[Test] Fix race in BlockRefreshUponIndexCreationIT#154991
Open
szybia wants to merge 1 commit into
Open
Conversation
szybia
marked this pull request as ready for review
July 24, 2026 17:59
Collaborator
|
Pinging @elastic/es-distributed (Team:Distributed) |
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes an intermittent failure in the stateless internal cluster test BlockRefreshUponIndexCreationIT#testIndexWithZeroReplicasAndAutoExpandReplicasHasClusterBlocks by making the transport interception harness robust to legitimate retries of TransportRegisterCommitForRecoveryAction during recovery.
Changes:
- Replace the single-shot “release exactly one intercepted send” mechanism with a
SubscribableListenergate that forwards all held (and subsequent) registration sends once released. - Keep the test’s recovery-blocking synchronization via
CountDownLatch, but ensure recovery can’t remain stuck if the registration is retried. - Unmute the previously-flaky test in
muted-tests.ymlnow that the harness no longer deadlocks on retries.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| x-pack/plugin/stateless/src/internalClusterTest/java/org/elasticsearch/xpack/stateless/recovery/BlockRefreshUponIndexCreationIT.java | Updates the transport interception/release logic to forward all (and future) commit-registration sends, preventing recovery from getting stuck on retries. |
| muted-tests.yml | Removes the mute entry for the affected test now that the underlying race is addressed. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
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
testIndexWithZeroReplicasAndAutoExpandReplicasHasClusterBlocksfails intermittently in CI with:The test holds the search shard in recovery by intercepting the search node's
TransportRegisterCommitForRecoveryActionsends, releasing exactly one, then asserting theindex becomes green.
The search node can legitimately send that registration more than once during recovery: the
first attempt can fail transiently and be retried (indexing primary not yet active ->
ShardNotFoundException; or the indexing shard has not uploaded a commit yet ->NoShardAvailableActionException, which restarts recovery). The old test released only thefirst send and left any retry blocked forever, so the search replica never started,
create-index never became shards-acknowledged, and
assertAckedfailed.Fix
Replace the "release exactly one" queue with a
SubscribableListenergate: every interceptedregistration subscribes to it, and releasing it forwards all held sends. Because a completed
SubscribableListenerruns later subscribers inline, any subsequent retry / re-allocation sendis forwarded immediately too. The harness is now correct regardless of how many registration
sends recovery performs. Also unmutes the test.
Why I believe it is fixed
(forcing the retry the old harness dropped): failed exactly as in CI, and passed with the fix.
retry trigger.
Closes #154605