From 0605e73f812cae84c3dea03b65afaa93a6c68656 Mon Sep 17 00:00:00 2001 From: Lakshya Taragi Date: Mon, 21 Oct 2024 14:42:32 +0530 Subject: [PATCH] Use clusterState entry of shallow v2 snapshot Signed-off-by: Lakshya Taragi --- .../snapshots/status/TransportSnapshotsStatusAction.java | 8 +++++--- 1 file changed, 5 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 d0df56b0c71ed..04e7978adf9dd 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 @@ -236,9 +236,9 @@ private Set getNodeIdsOfCurrentSnapshots(final SnapshotsStatusRequest re ); } // the actual no. of shards contributed by this current snapshot will now be calculated - } else { + } else if (currentSnapshotEntry.remoteStoreIndexShallowCopyV2() == false) { // all shards of this current snapshot are required in response - totalShardsAcrossCurrentSnapshots = currentSnapshotEntry.shards().size(); + totalShardsAcrossCurrentSnapshots += currentSnapshotEntry.shards().size(); } for (final Map.Entry shardStatusEntry : currentSnapshotEntry.shards() @@ -246,9 +246,11 @@ private Set getNodeIdsOfCurrentSnapshots(final SnapshotsStatusRequest re SnapshotsInProgress.ShardSnapshotStatus shardStatus = shardStatusEntry.getValue(); boolean indexPresentInFilter = requestedIndexNames.contains(shardStatusEntry.getKey().getIndexName()); - if (indexPresentInFilter) { + if (requestUsesIndexFilter && indexPresentInFilter && currentSnapshotEntry.remoteStoreIndexShallowCopyV2() == false) { // count only those shards whose index belongs to the index-filter totalShardsAcrossCurrentSnapshots++; + + // for non-index filter case, we already counted all the shards of this current snapshot (non-shallow v2) } if (shardStatus.nodeId() != null) {