jsancio commented on a change in pull request #11893: URL: https://github.com/apache/kafka/pull/11893#discussion_r828542616
########## File path: metadata/src/main/java/org/apache/kafka/controller/ReplicationControlManager.java ########## @@ -341,22 +359,25 @@ public void replay(RemoveTopicRecord record) { // Delete the configurations associated with this topic. configurationControl.deleteTopicConfigs(topic.name); - // Remove the entries for this topic in brokersToIsrs. - for (PartitionRegistration partition : topic.parts.values()) { + for (Map.Entry<Integer, PartitionRegistration> entry : topic.parts.entrySet()) { + int partitionId = entry.getKey(); + PartitionRegistration partition = entry.getValue(); + + // Remove the entries for this topic in brokersToIsrs. for (int i = 0; i < partition.isr.length; i++) { brokersToIsrs.removeTopicEntryForBroker(topic.id, partition.isr[i]); } - if (partition.leader != partition.preferredReplica()) { - preferredReplicaImbalanceCount.decrement(); - } + + imbalancedPartitions.remove(new TopicIdPartition(record.topicId(), partitionId)); + Review comment: What do you mean? -- 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