Enable prevote in some raft scenarios#7498
Merged
achamayou merged 6 commits intomicrosoft:mainfrom Dec 1, 2025
Merged
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR enables pre-vote in Raft consensus test scenarios where it can be trivially integrated, improving test coverage for the pre-vote election safety mechanism. The changes primarily add pre-vote configuration and adjust test flows to account for the additional PreVoteCandidate state in the election process.
Key changes:
- Enables
pre_vote_enabled,truein 14 existing test scenarios where elections are either not tested or require minimal adjustments - Adds a new
retire_backup_pre_votetest that demonstrates pre-vote prevents leadership disruption when a removed node reconnects - Updates election-related tests with PreVoteCandidate state assertions and corresponding message dispatch sequences
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| tests/raft_scenarios/suffix_collision.{1,2,3} | Enables pre-vote configuration |
| tests/raft_scenarios/soft_rollback | Explicitly disables pre-vote as test relies on specific rollback behavior; also corrects assertion from "Primary" to "Leader" |
| tests/raft_scenarios/rollback_safety | Enables pre-vote and adds PreVoteCandidate state transitions at three election points |
| tests/raft_scenarios/retire_one | Enables pre-vote configuration |
| tests/raft_scenarios/retire_backup_pre_vote | New test demonstrating that pre-vote prevents removed nodes from disrupting leadership |
| tests/raft_scenarios/replicate | Enables pre-vote configuration |
| tests/raft_scenarios/reelection | Enables pre-vote and updates election flow to check for PreVoteCandidate state |
| tests/raft_scenarios/reconnect | Enables pre-vote configuration |
| tests/raft_scenarios/reconfiguration | Enables pre-vote configuration |
| tests/raft_scenarios/multi_election | Enables pre-vote configuration |
| tests/raft_scenarios/liveness_through_conflict | Enables pre-vote and adds PreVoteCandidate state transition during election |
| tests/raft_scenarios/fancy_election.{1,2} | Enables pre-vote and updates election sequence with PreVoteCandidate checks |
| tests/raft_scenarios/election_while_reconfiguration | Enables pre-vote and comprehensively updates election flow during reconfiguration with PreVoteCandidate state transitions |
| tests/raft_scenarios/check_quorum | Enables pre-vote configuration |
| tests/raft_scenarios/append | Enables pre-vote configuration |
| tests/raft_scenarios/ackuracy | Enables pre-vote and adds PreVoteCandidate state transitions at three election points |
achamayou
reviewed
Dec 1, 2025
achamayou
approved these changes
Dec 1, 2025
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 enabled pre-vote in all the scenarios where it is trivial to do so - the scenario does not rely on elections, or it just requires an additional round of communication to pass the pre-vote step.
Additionally I've added a replacement for retire_backup (retire_backup_pre_vote) which mirrors the original until the test is blocked by pre-vote round.
I've also cleaned up the retire_backup scenario as there were a couple of places where using finer grained messaging made the flow easier to understand.