forked from apache/kafka
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
KAFKA-16952: Do not bump broker epoch when re-registering the same in…
…carnation (apache#16333) * KAFKA-16952: Do not bump broker epoch when re-registering the same incarnation As part of KIP-858 (Handle JBOD broker disk failure in KRaft), we added some code that caused the broker to re-register itself when transitioning from a MetadataVersion that did not support broker directory IDs, to one that did. This code was necessary because otherwise the controller would not be aware of what directories the broker held. However, prior to this PR, the re-registration process acted exactly like a full registration. That is, it bumped the broker epoch (which is meant to only be bumped on broker restart). This PR fixes the code to keep the broker epoch the same if the incarnation ID is the same. There are some other minor improvements here: - The previous logic relied on a complicated combination of request version and previous broker epoch to understand if the request came from the same broker or not. This is not needed: either the incarnation ID is the same and it's the same process, or it is not and it isn't. - We now log whether we're amending a registration, registering a previously unknown broker, or replacing a previous registration. - Move changes to the HeartbeatManager to the end of the function, so that we will not do them if any validation step fails. Log4j messages are also generated at the end, for the same reason. Reviewers: Ron Dagostino <[email protected]>
- Loading branch information
Showing
3 changed files
with
91 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters