chia7712 commented on a change in pull request #10319:
URL: https://github.com/apache/kafka/pull/10319#discussion_r595191354



##########
File path: core/src/main/scala/kafka/admin/ReassignPartitionsCommand.scala
##########
@@ -515,15 +512,14 @@ object ReassignPartitionsCommand extends Logging {
                                       : (Map[TopicPartition, 
PartitionReassignmentState], Boolean) = {
     val partitionsBeingReassigned = zkClient.getPartitionReassignment
     val results = new mutable.HashMap[TopicPartition, 
PartitionReassignmentState]()
-    targetReassignments.groupBy(_._1.topic).foreach {
-      case (topic, partitions) =>
-        val replicasForTopic = 
zkClient.getReplicaAssignmentForTopics(Set(topic))
-        partitions.foreach {
-          case (partition, targetReplicas) =>
-            val currentReplicas = replicasForTopic.getOrElse(partition, Seq())
-            results.put(partition, new PartitionReassignmentState(
-              currentReplicas, targetReplicas, 
!partitionsBeingReassigned.contains(partition)))
-        }
+    targetReassignments.groupBy(_._1.topic).forKeyValue { (topic, partitions) 
=>
+      val replicasForTopic = zkClient.getReplicaAssignmentForTopics(Set(topic))
+      partitions.foreach {

Review comment:
       `forKeyValue`




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

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


Reply via email to