cmccabe commented on code in PR #15810: URL: https://github.com/apache/kafka/pull/15810#discussion_r1586861400
########## metadata/src/main/java/org/apache/kafka/controller/PartitionChangeBuilder.java: ########## @@ -365,45 +369,62 @@ private void tryElection(PartitionChangeRecord record) { } /** - * Trigger a leader epoch bump if one is needed. - * - * We need to bump the leader epoch if: - * 1. The leader changed, or - * 2. The new replica list does not contain all the nodes that the old replica list did. - * - * Changes that do NOT fall in any of these categories will increase the partition epoch, but - * not the leader epoch. Note that if the leader epoch increases, the partition epoch will - * always increase as well; there is no case where the partition epoch increases more slowly - * than the leader epoch. + * Trigger a leader epoch bump if one is needed because of replica reassignment. * - * If the PartitionChangeRecord sets the leader field to something other than - * NO_LEADER_CHANGE, a leader epoch bump will automatically occur. That takes care of - * case 1. In this function, we check for cases 2 and 3, and handle them by manually - * setting record.leader to the current leader. - * - * In MV before 3.6 there was a bug (KAFKA-15021) in the brokers' replica manager - * that required that the leader epoch be bump whenever the ISR shrank. In MV 3.6 this leader - * bump is not required when the ISR shrinks. Note, that the leader epoch is never increased if - * the ISR expanded. + * Note that if the leader epoch increases, the partition epoch will always increase as well; there is no + * case where the partition epoch increases more slowly than the leader epoch. + */ + void triggerLeaderEpochBumpForReplicaReassignmentIfNeeded(PartitionChangeRecord record) { Review Comment: I agree that the name should be revisited. Better to do that in a follow-on PR, though, to avoid making this one too big. -- 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