-
Notifications
You must be signed in to change notification settings - Fork 243
[release/6.x] Backport pre-vote capability (#7374, #7375, #7404, #7409, #7438, #7445, #7458) #7436
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: release/6.x
Are you sure you want to change the base?
Conversation
) Co-authored-by: Amaury Chamayou <[email protected]> Co-authored-by: Eddy Ashton <[email protected]>
Co-authored-by: Amaury Chamayou <[email protected]>
Co-authored-by: Copilot <[email protected]> Co-authored-by: Amaury Chamayou <[email protected]> Co-authored-by: Amaury Chamayou <[email protected]>
…very active config (microsoft#7375) Co-authored-by: Copilot <[email protected]> Co-authored-by: Amaury Chamayou <[email protected]>
b83a9b3 to
16705c7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds support for the PreVote optimization in the Raft consensus protocol. PreVote prevents isolated followers from disrupting the cluster by requiring them to first become PreVoteCandidates and receive a quorum of speculative pre-votes before becoming actual Candidates and incrementing the term.
Key changes:
- Introduces a new
PreVoteCandidateleadership state and three PreVote status levels (Disabled, Capable, Enabled) - Updates the CheckQuorum logic to require quorum in every active configuration (not just any configuration)
- Adds TLA+ trace validation support for PreVote scenarios and CLI integration for scenario-based testing
Reviewed Changes
Copilot reviewed 26 out of 26 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| tla/tlc.py | Adds --scenario CLI option for generating and validating traces from scenario files |
| tla/consensus/ccfraft.tla | Implements PreVote state machine, adds PreVoteCandidate state and related actions |
| tla/consensus/Traceccfraft.tla | Updates trace validation to support PreVote messages and state transitions |
| src/consensus/aft/raft.h | Implements PreVote logic in C++, refactors CheckQuorum, handles PreVote messages |
| src/consensus/aft/raft_types.h | Adds ElectionType enum (PreVote/RegularVote) to request vote messages |
| src/consensus/aft/impl/state.h | Adds pre_vote_enabled field to State struct |
| tests/raft_scenarios/. | New test scenarios for PreVote and CheckQuorum behavior |
| doc/architecture/consensus/index.rst | Documents PreVote extension and migration strategy |
| CHANGELOG.md | Documents PreVote support and CheckQuorum fix |
Comments suppressed due to low confidence (1)
tla/consensus/Traceccfraft.tla:65
- Missing validation of the
isPreVotefield inIsRequestVoteResponse. This predicate should validatemsg.isPreVoteagainst the logline packet'selection_typefield, similar to howIsRequestVoteRequesthandles it. This omission could lead to incorrect trace validation when PreVote responses are processed.
IsRequestVoteResponse(msg, dst, src, logline) ==
/\ IsHeader(msg, dst, src, logline, RequestVoteResponse)
/\ msg.voteGranted = logline.msg.packet.vote_granted
Co-authored-by: Copilot <[email protected]> Co-authored-by: Amaury Chamayou <[email protected]> Co-authored-by: Eddy Ashton <[email protected]>
|
Converting this to draft - it shouldn't be merged to |
Co-authored-by: Amaury Chamayou <[email protected]> Co-authored-by: Amaury Chamayou <[email protected]>
Primarily (#7404, #7409, #7438, #7445, #7458), but also (#7374, #7375).
Per the migration plan for enabling pre-vote, we should first make 6.X capable of receiving and responding to pre-vote messages, and then we will enable pre-vote by default in 7.x.
This includes the backport of the CheckQuorum changes (#7374, #7375), as otherwise the CI for tracing will likely fail.
A slightly safer version of this backport, is to separate out the CheckQuorum changes, and then backport just the changes to the recv_request_vote without the changes for if a replica is a pre-vote candidate.
However the current PR should be a no-op for existing services.