-
Notifications
You must be signed in to change notification settings - Fork 25.6k
allocation: clarify RestoreInProgressAllocationDecider failure message #132307
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
schase-es
merged 13 commits into
elastic:main
from
schase-es:ES-11809_restore-in-progress-allocation-failure-message
Sep 27, 2025
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
e419a24
allocation: clarify RestoreInProgressAllocationDecider failure message
schase-es 2936779
Addressed review feedback:
schase-es a60a2a2
Merge branch 'main' into ES-11809_restore-in-progress-allocation-fail…
schase-es 9920308
Reverting commit re: David's feedback
schase-es 0a18d5a
Adding David's test for differentiating between allocation failure an…
schase-es 9ec98a1
Minor detail: fixing up a test error message
schase-es b2cf46c
Merge branch 'main' into ES-11809_restore-in-progress-allocation-fail…
schase-es b099f5d
Fixing up error message, and testing for it in RestoreSnapshotIT
schase-es 0bc74d5
[CI] Auto commit changes from spotless
f277ecb
Merge branch 'main' into ES-11809_restore-in-progress-allocation-fail…
schase-es 829304a
Merge branch 'main' into ES-11809_restore-in-progress-allocation-fail…
schase-es 168d94b
Style fixes
schase-es be39016
Merge branch 'main' into ES-11809_restore-in-progress-allocation-fail…
schase-es File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Some comments aren't visible on the classic Files Changed page.
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -13,7 +13,9 @@ | |
| import org.elasticsearch.cluster.routing.RecoverySource; | ||
| import org.elasticsearch.cluster.routing.RoutingNode; | ||
| import org.elasticsearch.cluster.routing.ShardRouting; | ||
| import org.elasticsearch.cluster.routing.UnassignedInfo; | ||
| import org.elasticsearch.cluster.routing.allocation.RoutingAllocation; | ||
| import org.elasticsearch.common.ReferenceDocs; | ||
|
|
||
| /** | ||
| * This {@link AllocationDecider} prevents shards that have failed to be | ||
|
|
@@ -49,15 +51,34 @@ public Decision canAllocate(final ShardRouting shardRouting, final RoutingAlloca | |
| return allocation.decision(Decision.YES, NAME, "shard is currently being restored"); | ||
| } | ||
| } | ||
| return allocation.decision( | ||
| Decision.NO, | ||
| NAME, | ||
| "shard has failed to be restored from the snapshot [%s] - manually close or delete the index [%s] in order to retry " | ||
| + "to restore the snapshot again or use the reroute API to force the allocation of an empty primary shard. Details: [%s]", | ||
| source.snapshot(), | ||
| shardRouting.getIndexName(), | ||
| shardRouting.unassignedInfo().details() | ||
| ); | ||
|
|
||
| /** | ||
| * POST: the RestoreInProgress.Entry is non-existent. This section differentiates between a restore that failed | ||
| * because of a indexing fault (see {@link AllocationService.applyFailedShards}) or because of an allocation | ||
| * failure. | ||
| */ | ||
| UnassignedInfo unassignedInfo = shardRouting.unassignedInfo(); | ||
| if (unassignedInfo.failedAllocations() > 0) { | ||
|
Comment on lines
+60
to
+61
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. looking good, matches with what David said in the #100233 |
||
| return allocation.decision( | ||
| Decision.NO, | ||
| NAME, | ||
| "shard has failed to be restored from the snapshot [%s] - manually close or delete the index [%s] in order to retry " | ||
| + "to restore the snapshot again or use the reroute API to force the allocation of an empty primary shard. Check the " | ||
| + "logs for more information about the failure. Details: [%s]", | ||
| source.snapshot(), | ||
| shardRouting.getIndexName(), | ||
| unassignedInfo.details() | ||
| ); | ||
| } else { | ||
| return allocation.decision( | ||
| Decision.NO, | ||
| NAME, | ||
| "Restore from snapshot failed because the configured constraints prevented allocation on any of the available nodes. " | ||
| + "Please check constraints applied in index and cluster settings, then retry the restore. " | ||
| + "See [%s] for more details on using the allocation explain API.", | ||
| ReferenceDocs.ALLOCATION_EXPLAIN_API | ||
| ); | ||
| } | ||
| } | ||
|
|
||
| @Override | ||
|
|
||
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
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.
Uh oh!
There was an error while loading. Please reload this page.