-
Notifications
You must be signed in to change notification settings - Fork 25k
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
Snapshot/Restore: Ensure that shard failure reasons are correctly stored in CS #25941
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,6 +62,7 @@ public SnapshotShardFailure(@Nullable String nodeId, ShardId shardId, String rea | |
this.nodeId = nodeId; | ||
this.shardId = shardId; | ||
this.reason = reason; | ||
assert reason != null; | ||
status = RestStatus.INTERNAL_SERVER_ERROR; | ||
} | ||
|
||
|
@@ -215,6 +216,11 @@ public static SnapshotShardFailure fromXContent(XContentParser parser) throws IO | |
throw new ElasticsearchParseException("index shard was not set"); | ||
} | ||
snapshotShardFailure.shardId = new ShardId(index, index_uuid, shardId); | ||
// Workaround for https://github.com/elastic/elasticsearch/issues/25878 | ||
// Some old snapshot might still have null in shard failure reasons | ||
if (snapshotShardFailure.reason == null) { | ||
snapshotShardFailure.reason = ""; | ||
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. What I don't quite understand: Why will it happily parse the 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. You are right, it should be |
||
} | ||
return snapshotShardFailure; | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1128,7 +1128,7 @@ public ClusterState execute(ClusterState currentState) throws Exception { | |
for (ObjectObjectCursor<ShardId, ShardSnapshotStatus> shardEntry : snapshotEntry.shards()) { | ||
ShardSnapshotStatus status = shardEntry.value; | ||
if (!status.state().completed()) { | ||
shardsBuilder.put(shardEntry.key, new ShardSnapshotStatus(status.nodeId(), State.ABORTED)); | ||
shardsBuilder.put(shardEntry.key, new ShardSnapshotStatus(status.nodeId(), State.ABORTED, "aborted")); | ||
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. maybe extend the message to |
||
} else { | ||
shardsBuilder.put(shardEntry.key, status); | ||
} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -135,6 +135,13 @@ public static String blockMasterFromFinalizingSnapshot(final String repositoryNa | |
return masterName; | ||
} | ||
|
||
public static String blockMasterFromCreatingSnapshot(final String repositoryName) { | ||
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. The method name made me think that it would prevent the master from creating a snapshot at all. Maybe we can call it something along the lines of "blockMasterFromFinalizingSnapshot"? |
||
final String masterName = internalCluster().getMasterName(); | ||
((MockRepository)internalCluster().getInstance(RepositoriesService.class, masterName) | ||
.repository(repositoryName)).setBlockAndFailOnWriteSnapFiles(true); | ||
return masterName; | ||
} | ||
|
||
public static String blockNodeWithIndex(final String repositoryName, final String indexName) { | ||
for(String node : internalCluster().nodesInclude(indexName)) { | ||
((MockRepository)internalCluster().getInstance(RepositoriesService.class, node).repository(repositoryName)) | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can you add a comment here saying why we set
reason
to""
?