Skip to content

Conversation

@cjen1-msft
Copy link
Contributor

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

This PR follows up on the previous pre-vote PRs to enable it by default.
This closes #7361

Todos

  • flip bit
  • fix broken trace validation
    • flip bit in driver
  • fix broken tests
    • partitions test
    • force_become_primary

@cjen1-msft cjen1-msft added the run-long-test Run Long Test job label Nov 20, 2025
@cjen1-msft cjen1-msft marked this pull request as ready for review November 21, 2025 18:59
@cjen1-msft cjen1-msft requested a review from a team as a code owner November 21, 2025 18:59
Copilot AI review requested due to automatic review settings November 21, 2025 18:59
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 enables pre-vote by default in the Raft consensus implementation. Pre-vote is a Raft optimization that prevents unnecessary term increases by requiring candidates to win a "pre-vote" before calling a real election. This improves cluster stability and reduces disruption from partitioned or out-of-date nodes attempting to become leaders.

Key changes:

  • Flipped the default value for pre_vote_enabled from false to true in core state and test driver files
  • Updated numerous test scenarios to handle the new pre-vote phase in elections
  • Refactored partition tests to accommodate the more stable election behavior with pre-vote
  • Moved and improved the force_become_primary utility function from e2e_operations.py to partitions_test.py

Reviewed changes

Copilot reviewed 24 out of 24 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/consensus/aft/impl/state.h Changed default value of pre_vote_enabled from false to true
src/consensus/aft/test/driver.h Updated test driver to enable pre-vote by default
src/consensus/aft/test/main.cpp Added test assertions for pre-vote message exchanges
src/consensus/aft/test/committable_suffix.cpp Updated tests to dispatch pre-vote messages before election messages
tests/raft_scenarios/* Updated test scenarios to assert PreVoteCandidate state and add explicit pre-vote enable/disable flags
tests/partitions_test.py Refactored partition tests; added force_become_primary function; updated expectations for pre-vote behavior; contains leftover debug literals
tests/infra/network.py Enhanced wait_for_node_commit_sync to accept optional nodes parameter; changed view comparison from > to >=
tests/e2e_operations.py Removed force_become_primary and run_ledger_chunk_bytes_check functions (moved to partitions_test.py)

@achamayou achamayou merged commit f3a6b34 into microsoft:main Dec 8, 2025
23 checks passed
@cjen1-msft cjen1-msft deleted the enable_pre_vote branch December 8, 2025 11:35
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.

Implement PreVote optimisation for Raft

3 participants