ZOOKEEPER-2789: Reassign ZXID for solving 32bit overflow problem(base master and fix conflict)#2382
Open
rooookkie wants to merge 3 commits intoapache:masterfrom
Open
ZOOKEEPER-2789: Reassign ZXID for solving 32bit overflow problem(base master and fix conflict)#2382rooookkie wants to merge 3 commits intoapache:masterfrom
rooookkie wants to merge 3 commits intoapache:masterfrom
Conversation
…se master and fix conflict)
…ver and ObserverMaster
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR addresses ZOOKEEPER-2789, which resolves the ZXID 32-bit counter overflow problem.
In ZooKeeper, the ZXID is a 64-bit number composed of a 32-bit epoch and a 32-bit counter. When the 32-bit counter overflows, it forces a leader re-election and can cause serious issues in the cluster. This change:
ZxidUtilsto support configurable epoch/counter bit positions, enabling a 40-bit counter (from the original 32-bit), which significantly delays the overflow threshold.QuorumPeerandLearner, allowing the cluster to transition from 32-bit to 40-bit counter mode without restart via rolling upgrade.& 0xffffffffL,>> 32,<< 32) withZxidUtilsutility methods across the codebase, making the code more maintainable and consistent.Brief changelog
ZxidUtilswith configurable epoch high position (32-bit / 40-bit),clearEpoch(),clearCounter(), andgetCounterLowPosition()methodsQuorumPeerandLearnerfor transitioning from 32-bit to 40-bit counterZxidUtilsmethods acrossLeader,LearnerHandler,FollowerZooKeeperServer, andObserverMasterLeader.propose()to useZxidUtils.getCounterLowPosition()for rollover detectionLearnerHandlerTestfor ZXID reassignment scenariosZab1_0Test,ZxidRolloverTest,FollowerResyncConcurrencyTest, andReconfigTestto useZxidUtilsmethodsHow does this change relate to the original PR?
This is a re-submission of #2164. The original authors (@asdf2014 and @ganzichen) have been inactive for a long time and the PR has gone stale, so I'm picking it up and rebasing it on the latest master branch.
Conflict resolution:
buildRequestToProcessmethod inFollowerZooKeeperServerwas removed upstream by ZOOKEEPER-4925, so the conflict was resolved by dropping that method and applying the bit-operation replacement directly to the currentlogRequest()method.ObserverMaster.processAck()which was not covered by the original PR.Testing done
LearnerHandlerTestfor ZXID reassignmentZxidRolloverTest,Zab1_0Test,FollowerResyncConcurrencyTest, andReconfigTestupdatedOriginal Authors
Credit to the original authors of #2164: