From 57cfd5fffe38161f5f11f51b773b6f999f215b1a Mon Sep 17 00:00:00 2001 From: Lakshya Taragi Date: Mon, 21 Oct 2024 15:46:48 +0530 Subject: [PATCH] Remove shallow v2 snapshots from current snapshots altogether Signed-off-by: Lakshya Taragi --- .../status/TransportSnapshotsStatusAction.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/server/src/main/java/org/opensearch/action/admin/cluster/snapshots/status/TransportSnapshotsStatusAction.java b/server/src/main/java/org/opensearch/action/admin/cluster/snapshots/status/TransportSnapshotsStatusAction.java index 04e7978adf9dd..2c8b06bb5e8fe 100644 --- a/server/src/main/java/org/opensearch/action/admin/cluster/snapshots/status/TransportSnapshotsStatusAction.java +++ b/server/src/main/java/org/opensearch/action/admin/cluster/snapshots/status/TransportSnapshotsStatusAction.java @@ -159,6 +159,7 @@ protected void clusterManagerOperation( request.repository(), Arrays.asList(request.snapshots()) ); + if (currentSnapshots.isEmpty()) { buildResponse(snapshotsInProgress, request, currentSnapshots, null, listener); return; @@ -212,7 +213,10 @@ private Set getNodeIdsOfCurrentSnapshots(final SnapshotsStatusRequest re int totalShardsAcrossCurrentSnapshots = 0; for (SnapshotsInProgress.Entry currentSnapshotEntry : currentSnapshots) { - + if (currentSnapshotEntry.remoteStoreIndexShallowCopyV2()) { + // skip current shallow v2 snapshots + continue; + } if (requestUsesIndexFilter) { // index-filter is allowed only for a single snapshot, which has to be this one // first check if any requested indices are missing from this current snapshot @@ -236,7 +240,7 @@ private Set getNodeIdsOfCurrentSnapshots(final SnapshotsStatusRequest re ); } // the actual no. of shards contributed by this current snapshot will now be calculated - } else if (currentSnapshotEntry.remoteStoreIndexShallowCopyV2() == false) { + } else { // all shards of this current snapshot are required in response totalShardsAcrossCurrentSnapshots += currentSnapshotEntry.shards().size(); } @@ -246,7 +250,7 @@ private Set getNodeIdsOfCurrentSnapshots(final SnapshotsStatusRequest re SnapshotsInProgress.ShardSnapshotStatus shardStatus = shardStatusEntry.getValue(); boolean indexPresentInFilter = requestedIndexNames.contains(shardStatusEntry.getKey().getIndexName()); - if (requestUsesIndexFilter && indexPresentInFilter && currentSnapshotEntry.remoteStoreIndexShallowCopyV2() == false) { + if (requestUsesIndexFilter && indexPresentInFilter) { // count only those shards whose index belongs to the index-filter totalShardsAcrossCurrentSnapshots++;