-
Notifications
You must be signed in to change notification settings - Fork 246
Enable pre-vote by default #7462
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
Conversation
Co-authored-by: Eddy Ashton <ashton.eddy@gmail.com>
…rimary will not accidentally be deposed!
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 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_enabledfromfalsetotruein 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_primaryutility function frome2e_operations.pytopartitions_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) |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
This PR follows up on the previous pre-vote PRs to enable it by default.
This closes #7361
Todos