kafka-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From nehanarkh...@apache.org
Subject git commit: KAFKA-830 partition replica assignment map in the controller should be a Set; reviewed by Jun Rao and Swapnil Ghike
Date Wed, 27 Mar 2013 20:29:34 GMT
Updated Branches:
  refs/heads/0.8 26c50fac4 -> c5e354d3a


KAFKA-830 partition replica assignment map in the controller should be a Set; reviewed by
Jun Rao and Swapnil Ghike


Project: http://git-wip-us.apache.org/repos/asf/kafka/repo
Commit: http://git-wip-us.apache.org/repos/asf/kafka/commit/c5e354d3
Tree: http://git-wip-us.apache.org/repos/asf/kafka/tree/c5e354d3
Diff: http://git-wip-us.apache.org/repos/asf/kafka/diff/c5e354d3

Branch: refs/heads/0.8
Commit: c5e354d3ab8ee4f9d18da6c084d4abfb00911b7c
Parents: 26c50fa
Author: Neha Narkhede <neha.narkhede@gmail.com>
Authored: Wed Mar 27 13:29:18 2013 -0700
Committer: Neha Narkhede <neha.narkhede@gmail.com>
Committed: Wed Mar 27 13:29:18 2013 -0700

----------------------------------------------------------------------
 .../kafka/controller/ReplicaStateMachine.scala     |    3 ++-
 1 files changed, 2 insertions(+), 1 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/kafka/blob/c5e354d3/core/src/main/scala/kafka/controller/ReplicaStateMachine.scala
----------------------------------------------------------------------
diff --git a/core/src/main/scala/kafka/controller/ReplicaStateMachine.scala b/core/src/main/scala/kafka/controller/ReplicaStateMachine.scala
index 5146f12..199640b 100644
--- a/core/src/main/scala/kafka/controller/ReplicaStateMachine.scala
+++ b/core/src/main/scala/kafka/controller/ReplicaStateMachine.scala
@@ -138,7 +138,8 @@ class ReplicaStateMachine(controller: KafkaController) extends Logging
{
             case NewReplica =>
               // add this replica to the assigned replicas list for its partition
               val currentAssignedReplicas = controllerContext.partitionReplicaAssignment(topicAndPartition)
-              controllerContext.partitionReplicaAssignment.put(topicAndPartition, currentAssignedReplicas
:+ replicaId)
+              if(!currentAssignedReplicas.contains(replicaId))
+                controllerContext.partitionReplicaAssignment.put(topicAndPartition, currentAssignedReplicas
:+ replicaId)
               stateChangeLogger.trace("Controller %d epoch %d changed state of replica %d
for partition %s to OnlineReplica"
                                         .format(controllerId, controller.epoch, replicaId,
topicAndPartition))
             case _ =>


Mime
View raw message