浏览代码

Log a debug level message for deleting non-existing snapshot (#100479)

The new message helps pairing with the "deleting snapshots" log message
at info level.
Yang Wang 2 年之前
父节点
当前提交
2cfdb7a92d
共有 1 个文件被更改,包括 4 次插入1 次删除
  1. 4 1
      server/src/main/java/org/elasticsearch/snapshots/SnapshotsService.java

+ 4 - 1
server/src/main/java/org/elasticsearch/snapshots/SnapshotsService.java

@@ -1931,7 +1931,9 @@ public class SnapshotsService extends AbstractLifecycleComponent implements Clus
                         final SnapshotId foundId = snapshotsIdsInRepository.get(snapshotOrPattern);
                         final SnapshotId foundId = snapshotsIdsInRepository.get(snapshotOrPattern);
                         if (foundId == null) {
                         if (foundId == null) {
                             if (snapshotIds.stream().noneMatch(snapshotId -> snapshotId.getName().equals(snapshotOrPattern))) {
                             if (snapshotIds.stream().noneMatch(snapshotId -> snapshotId.getName().equals(snapshotOrPattern))) {
-                                throw new SnapshotMissingException(repositoryName, snapshotOrPattern);
+                                final var snapshotMissingException = new SnapshotMissingException(repositoryName, snapshotOrPattern);
+                                logger.debug(snapshotMissingException.getMessage());
+                                throw snapshotMissingException;
                             }
                             }
                         } else {
                         } else {
                             snapshotIds.add(foundId);
                             snapshotIds.add(foundId);
@@ -2353,6 +2355,7 @@ public class SnapshotsService extends AbstractLifecycleComponent implements Clus
 
 
                         @Override
                         @Override
                         public void onFailure(Exception e) {
                         public void onFailure(Exception e) {
+                            logger.debug(() -> "failed to complete snapshot deletion [" + deleteEntry + "]", e);
                             submitUnbatchedTask(
                             submitUnbatchedTask(
                                 "remove snapshot deletion metadata after failed delete",
                                 "remove snapshot deletion metadata after failed delete",
                                 new RemoveSnapshotDeletionAndContinueTask(deleteEntry, repositoryData) {
                                 new RemoveSnapshotDeletionAndContinueTask(deleteEntry, repositoryData) {