Skip to content

Commit c74ca28

Browse files
Fix getSnapshotIndexMetaData Exception Behavior (#47488)
If we fail to read the global metadata in a snapshot we would throw `SnapshotMissingException` but wouldn't do so for the index metadata. This is breaking SLM tests at a low rate because they use `SnapshotMissingException` thrown from snapshot status APIs to wait for a snapshot being gone. Also, we should be consistent here in general and not leak the `NoSuchFileException` to the transport layer for index meta. Closes #46508
1 parent ea1c22c commit c74ca28

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

server/src/main/java/org/elasticsearch/repositories/blobstore/BlobStoreRepository.java

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -744,7 +744,11 @@ public MetaData getSnapshotGlobalMetaData(final SnapshotId snapshotId) {
744744

745745
@Override
746746
public IndexMetaData getSnapshotIndexMetaData(final SnapshotId snapshotId, final IndexId index) throws IOException {
747-
return indexMetaDataFormat.read(indexContainer(index), snapshotId.getUUID());
747+
try {
748+
return indexMetaDataFormat.read(indexContainer(index), snapshotId.getUUID());
749+
} catch (NoSuchFileException e) {
750+
throw new SnapshotMissingException(metadata.name(), snapshotId, e);
751+
}
748752
}
749753

750754
private BlobPath indicesPath() {

0 commit comments

Comments
 (0)