Repository navigation
fix(raft): pin openraft fork that resamples election timeout per campaign - #1845
Merged
Merged
Conversation
…aign openraft 0.9 draws the election timeout once, when the Raft is built. Two surviving voters of a three-voter group whose draws round to the same election tick start every campaign together after a leader loss, each rejects the other's same-term vote request, and the split repeats term after term with no leader elected. Upstream fixed this on 0.10 only (databendlabs/openraft#1838). Pin fluree/openraft release-0.9-fluree: v0.9.25 plus a port of that change. The lockfile diff is limited to the openraft and openraft-macros entries. surviving_voters_elect_after_leader_loss runs 48 three-voter failovers in small concurrent batches with a 250-500 ms election window. Against stock openraft at least one failover stalls with both survivors candidates in the same term; against the pinned fork every failover elects a leader.
Base automatically changed from
fix/join-cancelled-reported-as-panic
to
main
September 16, 2026 01:36
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.
Problem
After a three-voter group loses its leader, the two survivors can fail to elect a new one indefinitely. Each becomes a candidate at the same moment, votes for itself, and rejects the other's request as a competing vote in the same term. Both time out together and repeat, term after term. The two remaining voters are a healthy quorum, yet the group accepts no writes until something external changes the timing.
Solo's CI hit this in
flow-raft'smulti_nodefailover test, and reproduced it locally in about 8% of failovers. It applies to every group built onfluree-raft-core, including the data group.Root cause
openraft 0.9 draws each node's random election timeout once, in
EngineConfig::newwhen theRaftis constructed, and reuses it for every later campaign. Elections fire on a 75 ms tick. After a split round, each survivor's next deadline is its own fire time plus its own fixed timeout, so if both draws round to the same tick the gap between them never changes. The tie is a fixed point, not bad luck that eventually clears.Upstream fixed this in databendlabs/openraft#1838, which resamples the timeout at the start of each campaign. It landed on the 0.10 line only. 0.9.25 does not include it.
Fix
fluree/openraftrelease-0.9-flureeis thev0.9.25tag plus a port of fix: @json opacity, var-length edge identity, commit-id spelling, reserved-graph contract #1838.EngineConfigkeeps the configured min and max, andEngine::electdraws a fresh timeout before each campaign. 0.9 has no Pre-Vote, soelectis the only campaign entry point. Leader lease and smaller-log timeouts are unchanged. The port adds engine tests, including one that fails without the resample.Cargo.tomlgets a[patch.crates-io]entry pinning openraft to that fork commit byrev. TheCargo.lockdiff is limited to theopenraftandopenraft-macrosentries.The pin should be removed once a crates.io 0.9 release carries the resample fix. Solo's workspace needs the same patch entry to pick it up.
Tests
surviving_voters_elect_after_leader_lossinfluree-raft-core/tests/multi_node_group.rsruns 48 three-voter failovers over the HTTP transport, in six sequential batches of eight concurrent clusters. It shortens the election window to 250–500 ms so a shared tick is likely, then asserts that a survivor leads within 15 s.The batches are kept small on purpose. With 48 clusters at once in a debug build, the runtime starves and vote responses miss the election window. Survivors then stall at diverging terms, which is a separate failure that also affects the fork, so the test must not produce it.
The raft-core integration suites only compile with
--features testing,kv; run them with those features or they report zero tests.