Browse Source

Cleaner Exception Handling on Shard Delete (#44384)

* Follow up to #44165
* We should just catch all exceptions here and not return errors after the index-N update went through since a subsequent delete attempt by the user would fail with SnapshotMissingException since the snapshot now appears deleted. Also, `SnapshotException` isn't even thrown in the changed spot it seems in the first place and certainly not the only exception possible.
Armin Braun 6 years ago
parent
commit
8d9d05b87c

+ 1 - 1
server/src/main/java/org/elasticsearch/repositories/blobstore/BlobStoreRepository.java

@@ -527,7 +527,7 @@ public abstract class BlobStoreRepository extends AbstractLifecycleComponent imp
                         for (int shardId = 0; shardId < indexMetaData.getNumberOfShards(); shardId++) {
                         for (int shardId = 0; shardId < indexMetaData.getNumberOfShards(); shardId++) {
                             try {
                             try {
                                 deleteShardSnapshot(repositoryData, indexId, new ShardId(indexMetaData.getIndex(), shardId), snapshotId);
                                 deleteShardSnapshot(repositoryData, indexId, new ShardId(indexMetaData.getIndex(), shardId), snapshotId);
-                            } catch (SnapshotException ex) {
+                            } catch (Exception ex) {
                                 final int finalShardId = shardId;
                                 final int finalShardId = shardId;
                                 logger.warn(() -> new ParameterizedMessage("[{}] failed to delete shard data for shard [{}][{}]",
                                 logger.warn(() -> new ParameterizedMessage("[{}] failed to delete shard data for shard [{}][{}]",
                                     snapshotId, indexId.getName(), finalShardId), ex);
                                     snapshotId, indexId.getName(), finalShardId), ex);