We make sure to filter shard generations for indices that are missing from the metadata when finalizing a partial snapshot (from concurrent index deletion) but we failed to account for the case where we manually build a fake metadata instance for snapshots without the global state. Fixed this by handling missing indices by skipping, same way we do it for filtering the shard generations. Relates #50234
This commit is contained in:
parent
1a3f9e5a07
commit
4403b69048
|
@ -494,7 +494,12 @@ public class SnapshotsService extends AbstractLifecycleComponent implements Clus
|
|||
// Remove global state from the cluster state
|
||||
Metadata.Builder builder = Metadata.builder();
|
||||
for (IndexId index : snapshot.indices()) {
|
||||
builder.put(metadata.index(index.getName()), false);
|
||||
final IndexMetadata indexMetadata = metadata.index(index.getName());
|
||||
if (indexMetadata == null) {
|
||||
assert snapshot.partial() : "Index [" + index + "] was deleted during a snapshot but snapshot was not partial.";
|
||||
} else {
|
||||
builder.put(indexMetadata, false);
|
||||
}
|
||||
}
|
||||
metadata = builder.build();
|
||||
}
|
||||
|
|
|
@ -693,7 +693,7 @@ public class SnapshotResiliencyTests extends ESTestCase {
|
|||
|
||||
continueOrDie(createIndicesListener, createIndexResponses ->
|
||||
client().admin().cluster().prepareCreateSnapshot(repoName, snapshotName).setWaitForCompletion(false)
|
||||
.setPartial(partialSnapshot).execute(createSnapshotResponseStepListener));
|
||||
.setPartial(partialSnapshot).setIncludeGlobalState(randomBoolean()).execute(createSnapshotResponseStepListener));
|
||||
|
||||
continueOrDie(createSnapshotResponseStepListener,
|
||||
createSnapshotResponse -> client().admin().indices().delete(new DeleteIndexRequest(index),
|
||||
|
|
Loading…
Reference in New Issue