Skip to content

Commit 57cfd5f

Browse files
committed
Remove shallow v2 snapshots from current snapshots altogether
Signed-off-by: Lakshya Taragi <lakshya.taragi@gmail.com>
1 parent 0605e73 commit 57cfd5f

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

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

+7-3
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ protected void clusterManagerOperation(
159159
request.repository(),
160160
Arrays.asList(request.snapshots())
161161
);
162+
162163
if (currentSnapshots.isEmpty()) {
163164
buildResponse(snapshotsInProgress, request, currentSnapshots, null, listener);
164165
return;
@@ -212,7 +213,10 @@ private Set<String> getNodeIdsOfCurrentSnapshots(final SnapshotsStatusRequest re
212213
int totalShardsAcrossCurrentSnapshots = 0;
213214

214215
for (SnapshotsInProgress.Entry currentSnapshotEntry : currentSnapshots) {
215-
216+
if (currentSnapshotEntry.remoteStoreIndexShallowCopyV2()) {
217+
// skip current shallow v2 snapshots
218+
continue;
219+
}
216220
if (requestUsesIndexFilter) {
217221
// index-filter is allowed only for a single snapshot, which has to be this one
218222
// first check if any requested indices are missing from this current snapshot
@@ -236,7 +240,7 @@ private Set<String> getNodeIdsOfCurrentSnapshots(final SnapshotsStatusRequest re
236240
);
237241
}
238242
// the actual no. of shards contributed by this current snapshot will now be calculated
239-
} else if (currentSnapshotEntry.remoteStoreIndexShallowCopyV2() == false) {
243+
} else {
240244
// all shards of this current snapshot are required in response
241245
totalShardsAcrossCurrentSnapshots += currentSnapshotEntry.shards().size();
242246
}
@@ -246,7 +250,7 @@ private Set<String> getNodeIdsOfCurrentSnapshots(final SnapshotsStatusRequest re
246250
SnapshotsInProgress.ShardSnapshotStatus shardStatus = shardStatusEntry.getValue();
247251
boolean indexPresentInFilter = requestedIndexNames.contains(shardStatusEntry.getKey().getIndexName());
248252

249-
if (requestUsesIndexFilter && indexPresentInFilter && currentSnapshotEntry.remoteStoreIndexShallowCopyV2() == false) {
253+
if (requestUsesIndexFilter && indexPresentInFilter) {
250254
// count only those shards whose index belongs to the index-filter
251255
totalShardsAcrossCurrentSnapshots++;
252256

0 commit comments

Comments
 (0)