From bac119f672da79c8aad27c01e36082646e740c6a Mon Sep 17 00:00:00 2001 From: Armin Braun Date: Thu, 3 Oct 2019 12:47:50 +0200 Subject: [PATCH] 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 --- .../repositories/blobstore/BlobStoreRepository.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/src/main/java/org/elasticsearch/repositories/blobstore/BlobStoreRepository.java b/server/src/main/java/org/elasticsearch/repositories/blobstore/BlobStoreRepository.java index 2cd8fca47df..520b4d7a5be 100644 --- a/server/src/main/java/org/elasticsearch/repositories/blobstore/BlobStoreRepository.java +++ b/server/src/main/java/org/elasticsearch/repositories/blobstore/BlobStoreRepository.java @@ -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() {