cmccabe commented on code in PR #15876:
URL: https://github.com/apache/kafka/pull/15876#discussion_r1599223381


##########
metadata/src/main/java/org/apache/kafka/controller/ReplicationControlManager.java:
##########
@@ -1475,8 +1475,13 @@ ControllerResult<ElectLeadersResponseData> 
electLeaders(ElectLeadersRequestData
                 ReplicaElectionResult topicResults =
                     new ReplicaElectionResult().setTopic(topic.topic());
                 response.replicaElectionResults().add(topicResults);
-                for (int partitionId : topic.partitions()) {
-                    ApiError error = electLeader(topic.topic(), partitionId, 
electionType, records);
+                for (int i = 0; i < topic.partitions().size(); i++) {
+                    int partitionId = topic.partitions().get(i);
+                    int desiredLeader = -1;
+                    if(!topic.desiredLeaders().isEmpty()) {
+                        desiredLeader = topic.desiredLeaders().get(i);

Review Comment:
   We need to handle the case where the array is the wrong size, or has 
negative numbers in it, or whatever.
   
   Just having an UnknownServerException happen in these cases is not good.



-- 
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