test: fix race in test_corrupted_snapshot_recovery#9013
Open
generall wants to merge 1 commit into
Open
Conversation
When the restarted peer's dummy shard is auto-recovered by the cluster's recovery loop before the test issues its manual `replicate_shard` call, the manual call returns 400 "already involved in transfer". Skip the manual call when a transfer is already in flight — the existing wait_for / transfer-count / replica assertions still verify the shard recovers. Co-Authored-By: Claude Opus 4.7 (1M context) <[email protected]>
timvisee
requested changes
May 12, 2026
Comment on lines
+204
to
+208
| # Initiate transfer from another peer to recover the shard. | ||
| # This part checks that dummy shard can be recovered with shard transfer. | ||
| # If a transfer was already auto-initiated by the cluster recovery loop, | ||
| # skip the manual call — it would fail with 400 "already involved in transfer". | ||
| recover_shard(peer_api_uris[-1], collection_name=COLLECTION_NAME) |
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.
Fix for https://github.com/qdrant/qdrant/actions/runs/25706195257/job/75476715323?pr=8999
Summary
tests/consensus_tests/test_failed_snapshot_recovery.py::test_corrupted_snapshot_recoverywhere the manualrecover_shard()call returns 400 "Shard 0 is already involved in transfer" if the cluster's auto-recovery loop initiates the transfer first.Collection::recover_dirty_shards(seelib/collection/src/collection/mod.rs:826) auto-proposes aShardTransferfrom another replica. The test was then unconditionally callingrecover_shard(), racing with that proposal.flag_existsassertion when a transfer is in flight; now it also skips the manualrecover_shard()call in the same branch. The subsequentwait_for(flag removed),wait_for_collection_shard_transfers_count, and replica/scroll assertions still verify recovery completes either way.Timeline from failing run
From
peer_3_restarted.log:01:01:13.735peer 3 auto-proposes recovery transfer (WalDelta, 7575… → 2573…)01:01:13.880transfer applied; shardDead→Recovery01:01:14.832test polls/cluster(transfer visible)01:01:14.949test's manualPOST /cluster→ 400 "Shard 0 is already involved in transfer"Test plan
test_corrupted_snapshot_recovery(consensus tests)🤖 Generated with Claude Code