Skip to content

Commit 160e8ed

Browse files
committed
Use clusterState entry of shallow v2 snapshot
Signed-off-by: Lakshya Taragi <lakshya.taragi@gmail.com>
1 parent eb39c25 commit 160e8ed

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

server/src/main/java/org/opensearch/action/admin/cluster/snapshots/status/TransportSnapshotsStatusAction.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -236,19 +236,21 @@ private Set<String> getNodeIdsOfCurrentSnapshots(final SnapshotsStatusRequest re
236236
);
237237
}
238238
// the actual no. of shards contributed by this current snapshot will now be calculated
239-
} else {
239+
} else if (currentSnapshotEntry.remoteStoreIndexShallowCopyV2() == false) {
240240
// all shards of this current snapshot are required in response
241-
totalShardsAcrossCurrentSnapshots = currentSnapshotEntry.shards().size();
241+
totalShardsAcrossCurrentSnapshots += currentSnapshotEntry.shards().size();
242242
}
243243

244244
for (final Map.Entry<ShardId, SnapshotsInProgress.ShardSnapshotStatus> shardStatusEntry : currentSnapshotEntry.shards()
245245
.entrySet()) {
246246
SnapshotsInProgress.ShardSnapshotStatus shardStatus = shardStatusEntry.getValue();
247247
boolean indexPresentInFilter = requestedIndexNames.contains(shardStatusEntry.getKey().getIndexName());
248248

249-
if (indexPresentInFilter) {
249+
if (requestUsesIndexFilter && indexPresentInFilter) {
250250
// count only those shards whose index belongs to the index-filter
251251
totalShardsAcrossCurrentSnapshots++;
252+
253+
// for non-index filter case, we already counted all the shards of this current snapshot (non-shallow v2)
252254
}
253255

254256
if (shardStatus.nodeId() != null) {

0 commit comments

Comments
 (0)