From 00bbd7ee59c7b02ff113d2308b0fed8bc4fe8fbf Mon Sep 17 00:00:00 2001 From: Gaurav Bafna Date: Wed, 23 Oct 2024 11:24:36 +0530 Subject: [PATCH] Consider snapshots only for the given repo Signed-off-by: Gaurav Bafna --- .../java/org/opensearch/snapshots/SnapshotsService.java | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/server/src/main/java/org/opensearch/snapshots/SnapshotsService.java b/server/src/main/java/org/opensearch/snapshots/SnapshotsService.java index e16f42583d466..0972f5dad0fa2 100644 --- a/server/src/main/java/org/opensearch/snapshots/SnapshotsService.java +++ b/server/src/main/java/org/opensearch/snapshots/SnapshotsService.java @@ -2562,7 +2562,11 @@ public ClusterState execute(ClusterState currentState) throws Exception { final List snapshotEntries = findInProgressSnapshots(snapshots, snapshotNames, repoName); boolean isSnapshotV2 = SHALLOW_SNAPSHOT_V2.get(repository.getMetadata().settings()); boolean remoteStoreIndexShallowCopy = remoteStoreShallowCopyEnabled(repository); - if (isSnapshotV2 && remoteStoreIndexShallowCopy && snapshots.entries().size() > 0) { + List entriesForThisRepo = snapshots.entries() + .stream() + .filter(entry -> Objects.equals(entry.repository(), repoName)) + .collect(Collectors.toList()); + if (isSnapshotV2 && remoteStoreIndexShallowCopy && entriesForThisRepo.isEmpty() == false) { throw new ConcurrentSnapshotExecutionException( repoName, String.join(",", snapshotNames),