stanislavkozlovski commented on a change in pull request #9065:
URL: https://github.com/apache/kafka/pull/9065#discussion_r459596274



##########
File path: core/src/main/scala/kafka/cluster/Partition.scala
##########
@@ -678,11 +678,13 @@ class Partition(val topicPartition: TopicPartition,
                              isr: Set[Int],
                              addingReplicas: Seq[Int],
                              removingReplicas: Seq[Int]): Unit = {
-    remoteReplicasMap.clear()
+    val replicaSet = assignment.toSet
+    val removedReplicas = remoteReplicasMap.keys -- replicaSet
+
     assignment
       .filter(_ != localBrokerId)
       .foreach(id => remoteReplicasMap.getAndMaybePut(id, new Replica(id, 
topicPartition)))
-
+    removedReplicas.foreach(remoteReplicasMap.remove)

Review comment:
       `remoteReplicasMap --= removedReplicas` doesn't compile - the 
`remoteReplicasMap` is using a Kafka `Pool` class which itself is using a Java 
Map and I don't think they support the `--=` notation
   




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