Skip to content

v0.9.22

Choose a tag to compare

@drmingdrmer drmingdrmer released this 08 Apr 14:39
· 670 commits to main since this release

Summary:

  • Fixed:
    • 6ff217da prevent redundant election when single voter is already electing.

Detail:

Fixed:

  • Fixed: 6ff217da prevent redundant election when single voter is already electing; by Zhang Yanpo; 2026-04-08

    When a single-voter node calls elect() during initialize(), it
    becomes a Candidate with an uncommitted vote. Before the vote flush
    completes, an election tick can fire and trigger a second elect(),
    bumping the term unnecessarily (e.g., T1 → T2). This caused flaky
    test failures in single-term-leader mode where new_cluster()
    expected vote == <T1-N0:Q> but observed <T2-N0:Q>.

    The fix checks candidate_ref().is_some() to detect an in-progress
    election. This is precise because the Candidate struct only exists
    between an elect() call and becoming Leader — it is never present
    after a node restart, unlike vote-based checks (is_leading()) which
    would incorrectly match persisted votes from a previous run.