Skip to content

Hold two election tests to the real vote round - #126

Merged
matrixarkai merged 1 commit into
mainfrom
fix/raft-election-vote-state
Aug 22, 2026
Merged

Hold two election tests to the real vote round#126
matrixarkai merged 1 commit into
mainfrom
fix/raft-election-vote-state

Conversation

@bjmeetsfo

Copy link
Copy Markdown
Collaborator

Both tests still described the promotion path as it behaved before elections became a real vote round, so they have been failing on main.

One asserted that promoting a stale replica reports it as lagging. That answer came from a local precheck which read cached peer state; promotion now runs the vote round, and an out-of-date candidate is refused because no up-to-date voter will grant it. The outcome that matters is unchanged and still asserted: it does not become leader.

The other asserted that a follower carries no recorded vote after an election promoted someone else. It does carry one — that is the per-term vote bookkeeping the algorithm relies on, and wiping it was the old behaviour.

Test-only change. The raft suite goes from 2 failing to 194 passed, 0 failed (--test-threads=1; the suite's own fixed ports make parallel runs flaky).

Both tests still described the promotion path as it behaved before elections became a
real vote round, so they have been failing on main.

One asserted that promoting a stale replica reports it as lagging. That answer came from
a local precheck which read cached peer state; promotion now runs the vote round, and an
out-of-date candidate is refused because no up-to-date voter will grant it. The outcome
that matters is unchanged and still asserted: it does not become leader.

The other asserted that a follower carries no recorded vote after an election promoted
someone else. It does carry one -- that is the per-term vote bookkeeping the algorithm
relies on, and wiping it was the old behaviour.
@bjmeetsfo
bjmeetsfo requested a review from superhaiou as a code owner August 22, 2026 07:47
@matrixarkai
matrixarkai merged commit ff73285 into main Aug 22, 2026
6 checks passed
@matrixarkai
matrixarkai deleted the fix/raft-election-vote-state branch August 22, 2026 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants