Skip to content

Commit a19087b

Browse files
Log Warning on Failed Blob Deletes in BlobStoreRepository (#40188)
* Log Warning on Failed Blob Deletes in BlobStoreRepository * We should not just debug log these spots, they all can and will lead to leaked files when snapshot deletion fails
1 parent 6aadcd9 commit a19087b

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -472,17 +472,17 @@ public void deleteSnapshot(SnapshotId snapshotId, long repositoryStateId) {
472472
final BlobContainer indicesBlobContainer = blobStore().blobContainer(basePath().add("indices"));
473473
for (final IndexId indexId : indicesToCleanUp) {
474474
try {
475-
indicesBlobContainer.deleteBlob(indexId.getId());
475+
indicesBlobContainer.deleteBlobIgnoringIfNotExists(indexId.getId());
476476
} catch (DirectoryNotEmptyException dnee) {
477477
// if the directory isn't empty for some reason, it will fail to clean up;
478478
// we'll ignore that and accept that cleanup didn't fully succeed.
479479
// since we are using UUIDs for path names, this won't be an issue for
480480
// snapshotting indices of the same name
481-
logger.debug(() -> new ParameterizedMessage("[{}] index [{}] no longer part of any snapshots in the repository, " +
481+
logger.warn(() -> new ParameterizedMessage("[{}] index [{}] no longer part of any snapshots in the repository, " +
482482
"but failed to clean up its index folder due to the directory not being empty.", metadata.name(), indexId), dnee);
483483
} catch (IOException ioe) {
484484
// a different IOException occurred while trying to delete - will just log the issue for now
485-
logger.debug(() -> new ParameterizedMessage("[{}] index [{}] no longer part of any snapshots in the repository, " +
485+
logger.warn(() -> new ParameterizedMessage("[{}] index [{}] no longer part of any snapshots in the repository, " +
486486
"but failed to clean up its index folder.", metadata.name(), indexId), ioe);
487487
}
488488
}
@@ -832,7 +832,7 @@ private long listBlobsToGetLatestIndexId() throws IOException {
832832
} catch (NumberFormatException nfe) {
833833
// the index- blob wasn't of the format index-N where N is a number,
834834
// no idea what this blob is but it doesn't belong in the repository!
835-
logger.debug("[{}] Unknown blob in the repository: {}", metadata.name(), blobName);
835+
logger.warn("[{}] Unknown blob in the repository: {}", metadata.name(), blobName);
836836
}
837837
}
838838
return latest;
@@ -975,7 +975,7 @@ public void delete() {
975975
try {
976976
indexShardSnapshotFormat.delete(blobContainer, snapshotId.getUUID());
977977
} catch (IOException e) {
978-
logger.debug("[{}] [{}] failed to delete shard snapshot file", shardId, snapshotId);
978+
logger.warn(new ParameterizedMessage("[{}] [{}] failed to delete shard snapshot file", shardId, snapshotId), e);
979979
}
980980

981981
// Build a list of snapshots that should be preserved
@@ -1135,7 +1135,7 @@ protected Tuple<BlobStoreIndexShardSnapshots, Integer> buildBlobStoreIndexShardS
11351135
logger.warn(() -> new ParameterizedMessage("failed to read index file [{}]", file), e);
11361136
}
11371137
} else if (blobKeys.isEmpty() == false) {
1138-
logger.debug("Could not find a readable index-N file in a non-empty shard snapshot directory [{}]", blobContainer.path());
1138+
logger.warn("Could not find a readable index-N file in a non-empty shard snapshot directory [{}]", blobContainer.path());
11391139
}
11401140

11411141
// We couldn't load the index file - falling back to loading individual snapshots

0 commit comments

Comments
 (0)