Repository navigation
test: fix flaky test_consensus_snapshot_create_collection voter race - #8951
Merged
generall merged 1 commit intoMay 7, 2026
Merged
Conversation
The test killed the last peer immediately after start_cluster, but start_cluster only waits for cluster size and a known leader — not for all peers to be promoted from learner to voter. If the last peer caught up first, it became the only other voter alongside the leader; killing it left a 2-of-2 quorum with one voter dead, and the subsequent CreateCollection commit timed out after 10s. Wait for all peers to be voters before killing one, so the survivors form a 2-of-3 voter quorum. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
generall
deleted the
fix/consensus-snapshot-create-collection-flaky-voter-race
branch
May 7, 2026 21:35
timvisee
pushed a commit
that referenced
this pull request
May 8, 2026
…8951) The test killed the last peer immediately after start_cluster, but start_cluster only waits for cluster size and a known leader — not for all peers to be promoted from learner to voter. If the last peer caught up first, it became the only other voter alongside the leader; killing it left a 2-of-2 quorum with one voter dead, and the subsequent CreateCollection commit timed out after 10s. Wait for all peers to be voters before killing one, so the survivors form a 2-of-3 voter quorum. Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
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.
Summary
test_consensus_snapshot_create_collectionkilled the last peer right afterstart_cluster.start_clusteronly waits for a uniform leader/peer-count, not for learner→voter promotion.[leader, dead], learners[alive]— quorum 2/2 with 1 alive, so the subsequentCreateCollectioncouldn't commit and timed out after 10s.all_peers_are_votersafterstart_clusterso killing one peer leaves a 2-of-3 voter quorum. Promoted the existing local helper intest_learners_promoted_to_voters.pyintoutils.pyfor reuse.Captured failure:
tests/consensus_tests/test_consensus_compaction.py::test_consensus_snapshot_create_collection[2]returned 500Waiting for consensus operation commit failed. Timeout set at: 10 seconds. The same race applies to[1](lower probability, same fix).Test plan
pytest tests/consensus_tests/test_consensus_compaction.py::test_consensus_snapshot_create_collection -k 2 --count=20locally to confirm the race is gonetest_learners_promoted_to_votersstill passes after the helper move🤖 Generated with Claude Code