junrao commented on code in PR #13451:
URL: https://github.com/apache/kafka/pull/13451#discussion_r1369359298


##########
core/src/main/scala/kafka/controller/KafkaController.scala:
##########
@@ -1894,10 +1894,16 @@ class KafkaController(val config: KafkaConfig,
       val currentAssignment = 
controllerContext.partitionFullReplicaAssignment(topicPartition)
       val newAssignment = currentAssignment.reassignTo(replicas)
       val areNewReplicasAlive = 
newAssignment.addingReplicas.toSet.subsetOf(controllerContext.liveBrokerIds)
+      val currentLeader = 
controllerContext.partitionLeadershipInfo(topicPartition).get.leaderAndIsr.leader
+      val unneededAddingReplicas = 
currentAssignment.replicas.diff(newAssignment.replicas)
       if (!areNewReplicasAlive)
         Some(new ApiError(Errors.INVALID_REPLICA_ASSIGNMENT,
           s"Replica assignment has brokers that are not alive. Replica list: " 
+
             s"${newAssignment.addingReplicas}, live broker list: 
${controllerContext.liveBrokerIds}"))
+      else if (unneededAddingReplicas.contains(currentLeader))

Review Comment:
   Hmm, by doing this, it seems that if we start with replicas as (0, 1) and 0 
as the leader, we can't re-assign this partition to (1, 2)?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to