Skip to content

Commit c8f1258

Browse files
gfyoungAli Beyad
authored andcommitted
Caught exceptions during compromised snapshot deletion
1 parent 1589792 commit c8f1258

File tree

1 file changed

+34
-6
lines changed

1 file changed

+34
-6
lines changed

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

Lines changed: 34 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -355,14 +355,42 @@ public void deleteSnapshot(SnapshotId snapshotId) {
355355
final String snapshotName = snapshotId.getName();
356356
// Delete snapshot file first so we wouldn't end up with partially deleted snapshot that looks OK
357357
if (snapshot != null) {
358-
snapshotFormat(snapshot.version()).delete(snapshotsBlobContainer, blobId(snapshotId));
359-
globalMetaDataFormat(snapshot.version()).delete(snapshotsBlobContainer, snapshotName);
358+
try {
359+
snapshotFormat(snapshot.version()).delete(snapshotsBlobContainer, blobId(snapshotId));
360+
} catch (IOException e) {
361+
logger.debug("snapshotFormat failed to delete snapshot [{}]", snapshotId);
362+
}
363+
364+
try {
365+
globalMetaDataFormat(snapshot.version()).delete(snapshotsBlobContainer, snapshotName);
366+
} catch (IOException e) {
367+
logger.debug("gloalMetaDataFormat failed to delete snapshot [{}]");
368+
}
360369
} else {
361370
// We don't know which version was the snapshot created with - try deleting both current and legacy formats
362-
snapshotFormat.delete(snapshotsBlobContainer, blobId(snapshotId));
363-
snapshotLegacyFormat.delete(snapshotsBlobContainer, snapshotName);
364-
globalMetaDataLegacyFormat.delete(snapshotsBlobContainer, snapshotName);
365-
globalMetaDataFormat.delete(snapshotsBlobContainer, snapshotName);
371+
try {
372+
snapshotFormat.delete(snapshotsBlobContainer, blobId(snapshotId));
373+
} catch (IOException e) {
374+
logger.debug("snapshotFormat failed to delete snapshot [{}]");
375+
}
376+
377+
try {
378+
snapshotLegacyFormat.delete(snapshotsBlobContainer, snapshotName);
379+
} catch (IOException e) {
380+
logger.debug("snapshotLegacyFormat failed to delete snapshot [{}]");
381+
}
382+
383+
try {
384+
globalMetaDataLegacyFormat.delete(snapshotsBlobContainer, snapshotName);
385+
} catch (IOException e) {
386+
logger.debug("globalMetaDataLegacyFormat failed to delete snapshot [{}]");
387+
}
388+
389+
try {
390+
globalMetaDataFormat.delete(snapshotsBlobContainer, snapshotName);
391+
} catch (IOException e) {
392+
logger.debug("globalMetaDataFormat failed to delete snapshot [{}]");
393+
}
366394
}
367395
// Delete snapshot from the snapshot list
368396
List<SnapshotId> snapshotIds = getSnapshots().stream().filter(id -> snapshotId.equals(id) == false).collect(Collectors.toList());

0 commit comments

Comments
 (0)