Skip to content

Commit f5b07e4

Browse files
author
Ali Beyad
committed
Fixes getting snapshot status checks for preventing duplicate entries
from both current snapshots (cluster state) and repository snapshots (on storage).
1 parent 37c8c0f commit f5b07e4

File tree

1 file changed

+6
-7
lines changed

1 file changed

+6
-7
lines changed

core/src/main/java/org/elasticsearch/action/admin/cluster/snapshots/status/TransportSnapshotsStatusAction.java

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -207,15 +207,14 @@ private SnapshotsStatusResponse buildResponse(SnapshotsStatusRequest request, Li
207207
.filter(s -> requestedSnapshotNames.contains(s.getName()))
208208
.collect(Collectors.toMap(SnapshotId::getName, Function.identity()));
209209
for (final String snapshotName : request.snapshots()) {
210+
if (currentSnapshotNames.contains(snapshotName)) {
211+
// we've already found this snapshot in the current snapshot entries, so skip over
212+
continue;
213+
}
210214
SnapshotId snapshotId = matchedSnapshotIds.get(snapshotName);
211215
if (snapshotId == null) {
212-
if (currentSnapshotNames.contains(snapshotName)) {
213-
// we've already found this snapshot in the current snapshot entries, so skip over
214-
continue;
215-
} else {
216-
// neither in the current snapshot entries nor found in the repository
217-
throw new SnapshotMissingException(repositoryName, snapshotName);
218-
}
216+
// neither in the current snapshot entries nor found in the repository
217+
throw new SnapshotMissingException(repositoryName, snapshotName);
219218
}
220219
SnapshotInfo snapshotInfo = snapshotsService.snapshot(repositoryName, snapshotId);
221220
List<SnapshotIndexShardStatus> shardStatusBuilder = new ArrayList<>();

0 commit comments

Comments
 (0)