wenbingshen commented on a change in pull request #10346:
URL: https://github.com/apache/kafka/pull/10346#discussion_r598088312



##########
File path: core/src/main/scala/kafka/controller/KafkaController.scala
##########
@@ -1680,45 +1680,61 @@ class KafkaController(val config: KafkaConfig,
   private def processPartitionModifications(topic: String): Unit = {
     def restorePartitionReplicaAssignment(
       topic: String,
-      newPartitionReplicaAssignment: Map[TopicPartition, ReplicaAssignment]
+      restorePartitionReplicaAssignment: Map[TopicPartition, ReplicaAssignment]
     ): Unit = {
       info("Restoring the partition replica assignment for topic 
%s".format(topic))
 
-      val existingPartitions = 
zkClient.getChildren(TopicPartitionsZNode.path(topic))
-      val existingPartitionReplicaAssignment = newPartitionReplicaAssignment
-        .filter(p => existingPartitions.contains(p._1.partition.toString))
-        .map { case (tp, _) =>
-          tp -> controllerContext.partitionFullReplicaAssignment(tp)
-      }.toMap
-
       zkClient.setTopicAssignment(topic,
         controllerContext.topicIds.get(topic),
-        existingPartitionReplicaAssignment,
+        restorePartitionReplicaAssignment,
         controllerContext.epochZkVersion)
     }
 
     if (!isActive) return
     val partitionReplicaAssignment = 
zkClient.getFullReplicaAssignmentForTopics(immutable.Set(topic))
-    val partitionsToBeAdded = partitionReplicaAssignment.filter { case 
(topicPartition, _) =>
+    val newPartitionsToBeAdded = partitionReplicaAssignment.filter { case 
(topicPartition, _) =>

Review comment:
       > newPartitionsToBeAdded seems verbose since new and added are 
describing the same thing. So, it could just be partitionsToBeAdded. Similarly, 
oldPartitionsToBeModified could just be partitionsToBeModified.
   
   You said is correct, I have revised it




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