showuon commented on code in PR #12405: URL: https://github.com/apache/kafka/pull/12405#discussion_r922931217
########## core/src/main/scala/kafka/controller/ControllerContext.scala: ########## @@ -328,8 +328,9 @@ class ControllerContext { } def queueTopicDeletion(topics: Set[String]): Unit = { + val newlyDeletedTopics = topics.diff(topicsToBeDeleted) Review Comment: @ocadaruma , thanks for the explanation. So, do you mean: 1. Before the PR, topic-A partition 0 is in preferred Leader, so after 1st time entering `cleanPreferredReplicaImbalanceMetric`, it won't do anything, which is expected, because ithe `preferredReplicaImbalanceCount` is not incremented before. But after 1st `topic-A` deletion, the leader will be changed to NoLeader (or other replica), and now, if we have 2nd chance entering `cleanPreferredReplicaImbalanceMetric`, it'll decrement it, which is unexpected. Is my understanding correct? ########## core/src/main/scala/kafka/controller/ControllerContext.scala: ########## @@ -328,8 +328,9 @@ class ControllerContext { } def queueTopicDeletion(topics: Set[String]): Unit = { + val newlyDeletedTopics = topics.diff(topicsToBeDeleted) Review Comment: @ocadaruma , thanks for the explanation. So, do you mean: Before the PR, topic-A partition 0 is in preferred Leader, so after 1st time entering `cleanPreferredReplicaImbalanceMetric`, it won't do anything, which is expected, because ithe `preferredReplicaImbalanceCount` is not incremented before. But after 1st `topic-A` deletion, the leader will be changed to NoLeader (or other replica), and now, if we have 2nd chance entering `cleanPreferredReplicaImbalanceMetric`, it'll decrement it, which is unexpected. Is my understanding correct? -- 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