Skip to content

Conversation

@cjen1-msft
Copy link
Contributor

@cjen1-msft cjen1-msft commented Nov 5, 2025

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.

cjen1-msft and others added 4 commits November 5, 2025 13:29
@cjen1-msft cjen1-msft marked this pull request as ready for review November 5, 2025 15:01
@cjen1-msft cjen1-msft requested a review from a team as a code owner November 5, 2025 15:01
@cjen1-msft cjen1-msft requested a review from Copilot November 5, 2025 17:07
Copy link
Contributor

Copilot AI left a 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 PreVoteCandidate leadership 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 isPreVote field in IsRequestVoteResponse. This predicate should validate msg.isPreVote against the logline packet's election_type field, similar to how IsRequestVoteRequest handles 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

@cjen1-msft cjen1-msft marked this pull request as draft November 5, 2025 18:21
cjen1-msft and others added 2 commits November 5, 2025 18:22
Co-authored-by: Copilot <[email protected]>
Co-authored-by: Amaury Chamayou <[email protected]>
Co-authored-by: Eddy Ashton <[email protected]>
@cjen1-msft cjen1-msft changed the title [release/6.x] Backport pre-vote capability (#7374, #7375, #7404, #7409) [release/6.x] Backport pre-vote capability (#7374, #7375, #7404, #7409, #7438) Nov 6, 2025
@cjen1-msft cjen1-msft marked this pull request as ready for review November 6, 2025 19:06
@cjen1-msft cjen1-msft added the run-long-test Run Long Test job label Nov 7, 2025
@eddyashton eddyashton marked this pull request as draft November 7, 2025 14:24
@eddyashton
Copy link
Member

Converting this to draft - it shouldn't be merged to 6.x without #7445 being included as well.

@cjen1-msft cjen1-msft changed the title [release/6.x] Backport pre-vote capability (#7374, #7375, #7404, #7409, #7438) [release/6.x] Backport pre-vote capability (#7374, #7375, #7404, #7409, #7438, #7445) Nov 12, 2025
@cjen1-msft cjen1-msft marked this pull request as ready for review November 13, 2025 14:11
@cjen1-msft cjen1-msft marked this pull request as draft November 13, 2025 14:11
@cjen1-msft cjen1-msft changed the title [release/6.x] Backport pre-vote capability (#7374, #7375, #7404, #7409, #7438, #7445) [release/6.x] Backport pre-vote capability (#7374, #7375, #7404, #7409, #7438, #7445, #7458) Nov 13, 2025
Co-authored-by: Amaury Chamayou <[email protected]>
Co-authored-by: Amaury Chamayou <[email protected]>
@cjen1-msft cjen1-msft marked this pull request as ready for review November 14, 2025 09:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

run-long-test Run Long Test job

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants