fix(controller,lib): decide each PreVote round once and promote only with this election's votes (bug-1915)

A late PreVote grant after WON re-ran the WON path and started a second
real election that replaced elect_ctx, so the term-2 leader promoted no
vote endpoints. Rounds now carry an id and endpoints a round/kind; stale
or wrong-kind replies, timeouts and errors are dropped; raft ignores
replies with no round in progress. raft_cb_become_leader promotes only
with its own stamped election record (own term, majority), else steps
down and re-arms. raft_on_leader_lost keeps voted_for (one vote per
term) and the delayed election starts only as a follower in the lost
term. The failover stagger hands the PreVote start to a vtask so the
delaymgr stays trigger-only.

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
Rongsong Shen 2026-10-04 09:14:38 +00:00
parent acf78f9a94
commit 88a8bf8a47
Signed by untrusted user: rshen
GPG key ID: 80533536B0EB651C
7 changed files with 2463 additions and 201 deletions

File diff suppressed because it is too large Load diff