jolshan commented on code in PR #13107: URL: https://github.com/apache/kafka/pull/13107#discussion_r1068766335
########## core/src/main/scala/kafka/controller/ControllerChannelManager.scala: ########## @@ -436,17 +436,22 @@ abstract class AbstractControllerBrokerRequestBatch(config: KafkaConfig, def addStopReplicaRequestForBrokers(brokerIds: Seq[Int], topicPartition: TopicPartition, deletePartition: Boolean): Unit = { - // A sentinel (-2) is used as an epoch if the topic is queued for deletion. It overrides - // any existing epoch. - val leaderEpoch = metadataInstance.leaderEpoch(topicPartition) - brokerIds.filter(_ >= 0).foreach { brokerId => val result = stopReplicaRequestMap.getOrElseUpdate(brokerId, mutable.Map.empty) - val alreadyDelete = result.get(topicPartition).exists(_.deletePartition) + val updatedDeletePartition = deletePartition || result.get(topicPartition).exists(_.deletePartition) + + // A sentinel (-2) is used as an epoch if the replica is to be deleted. + // It overrides any existing epoch. + val leaderEpoch = if (updatedDeletePartition) { Review Comment: Just to clarify this change is now including `result.get(topicPartition).exists(_.deletePartition)` as a condition to mark the epoch as -2? The rest is just cleaning up/simplifying. -- 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