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


##########
core/src/main/scala/kafka/controller/KafkaController.scala:
##########
@@ -802,8 +802,11 @@ class KafkaController(val config: KafkaConfig,
       // If there is a reassignment already in progress, then some of the 
currently adding replicas
       // may be eligible for immediate removal, in which case we need to stop 
the replicas.
       val unneededReplicas = 
currentAssignment.replicas.diff(reassignment.replicas)
-      if (unneededReplicas.nonEmpty)
+      if (unneededReplicas.nonEmpty) {
+        // Elect a new leader if the current leader is the inside the unneeded 
replicas.
+        moveReassignedPartitionLeaderIfRequired(topicPartition, reassignment)

Review Comment:
   Good points. Indeed, we won't be able to move the leader if other replicas 
are not in ISR. Rejecting the new reassignment might be a better option. I'll 
take a look.



-- 
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: jira-unsubscr...@kafka.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to