junrao commented on code in PR #13947: URL: https://github.com/apache/kafka/pull/13947#discussion_r1291773207
########## core/src/main/scala/kafka/server/ReplicaManager.scala: ########## @@ -2418,7 +2449,15 @@ class ReplicaManager(val config: KafkaConfig, // Handle deleted partitions. We need to do this first because we might subsequently // create new partitions with the same names as the ones we are deleting here. if (!localChanges.deletes.isEmpty) { - val deletes = localChanges.deletes.asScala.map(tp => (tp, true)).toMap + val deletes = localChanges.deletes.asScala + .map(tp => { + def isCurrentLeader = Option(delta.image().getTopic(tp.topic())) Review Comment: Could `isCurrentLeader` just be a val? ########## core/src/main/scala/kafka/server/ReplicaManager.scala: ########## @@ -2418,7 +2449,15 @@ class ReplicaManager(val config: KafkaConfig, // Handle deleted partitions. We need to do this first because we might subsequently // create new partitions with the same names as the ones we are deleting here. if (!localChanges.deletes.isEmpty) { - val deletes = localChanges.deletes.asScala.map(tp => (tp, true)).toMap + val deletes = localChanges.deletes.asScala + .map(tp => { Review Comment: It's simpler to do `.map{ tp => ...}` instead. -- 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