Fix getSnapshotIndexMetaData Exception Behavior (#47488) (#47496)

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
This commit is contained in:
Armin Braun 2019-10-03 12:47:50 +02:00 committed by GitHub
parent 7549be4489
commit bac119f672
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions

View File

@ -786,7 +786,11 @@ public abstract class BlobStoreRepository extends AbstractLifecycleComponent imp
@Override
public IndexMetaData getSnapshotIndexMetaData(final SnapshotId snapshotId, final IndexId index) throws IOException {
return indexMetaDataFormat.read(indexContainer(index), snapshotId.getUUID());
try {
return indexMetaDataFormat.read(indexContainer(index), snapshotId.getUUID());
} catch (NoSuchFileException e) {
throw new SnapshotMissingException(metadata.name(), snapshotId, e);
}
}
private BlobPath indicesPath() {