Skip to content

Commit

Permalink
Remove shallow v2 snapshots from current snapshots altogether
Browse files Browse the repository at this point in the history
Signed-off-by: Lakshya Taragi <lakshya.taragi@gmail.com>
  • Loading branch information
ltaragi committed Oct 21, 2024
1 parent 0605e73 commit 57cfd5f
Showing 1 changed file with 7 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,7 @@ protected void clusterManagerOperation(
request.repository(),
Arrays.asList(request.snapshots())
);

if (currentSnapshots.isEmpty()) {
buildResponse(snapshotsInProgress, request, currentSnapshots, null, listener);
return;
Expand Down Expand Up @@ -212,7 +213,10 @@ private Set<String> getNodeIdsOfCurrentSnapshots(final SnapshotsStatusRequest re
int totalShardsAcrossCurrentSnapshots = 0;

Check warning on line 213 in server/src/main/java/org/opensearch/action/admin/cluster/snapshots/status/TransportSnapshotsStatusAction.java

View check run for this annotation

Codecov / codecov/patch

server/src/main/java/org/opensearch/action/admin/cluster/snapshots/status/TransportSnapshotsStatusAction.java#L212-L213

Added lines #L212 - L213 were not covered by tests

for (SnapshotsInProgress.Entry currentSnapshotEntry : currentSnapshots) {

if (currentSnapshotEntry.remoteStoreIndexShallowCopyV2()) {
// skip current shallow v2 snapshots
continue;

Check warning on line 218 in server/src/main/java/org/opensearch/action/admin/cluster/snapshots/status/TransportSnapshotsStatusAction.java

View check run for this annotation

Codecov / codecov/patch

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

Added line #L218 was not covered by tests
}
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
Expand All @@ -236,7 +240,7 @@ private Set<String> getNodeIdsOfCurrentSnapshots(final SnapshotsStatusRequest re
);
}
// the actual no. of shards contributed by this current snapshot will now be calculated
} else if (currentSnapshotEntry.remoteStoreIndexShallowCopyV2() == false) {
} else {

Check warning on line 243 in server/src/main/java/org/opensearch/action/admin/cluster/snapshots/status/TransportSnapshotsStatusAction.java

View check run for this annotation

Codecov / codecov/patch

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

Added line #L243 was not covered by tests
// all shards of this current snapshot are required in response
totalShardsAcrossCurrentSnapshots += currentSnapshotEntry.shards().size();

Check warning on line 245 in server/src/main/java/org/opensearch/action/admin/cluster/snapshots/status/TransportSnapshotsStatusAction.java

View check run for this annotation

Codecov / codecov/patch

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

Added line #L245 was not covered by tests
}
Expand All @@ -246,7 +250,7 @@ private Set<String> getNodeIdsOfCurrentSnapshots(final SnapshotsStatusRequest re
SnapshotsInProgress.ShardSnapshotStatus shardStatus = shardStatusEntry.getValue();
boolean indexPresentInFilter = requestedIndexNames.contains(shardStatusEntry.getKey().getIndexName());

Check warning on line 251 in server/src/main/java/org/opensearch/action/admin/cluster/snapshots/status/TransportSnapshotsStatusAction.java

View check run for this annotation

Codecov / codecov/patch

server/src/main/java/org/opensearch/action/admin/cluster/snapshots/status/TransportSnapshotsStatusAction.java#L249-L251

Added lines #L249 - L251 were not covered by tests

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

Check warning on line 255 in server/src/main/java/org/opensearch/action/admin/cluster/snapshots/status/TransportSnapshotsStatusAction.java

View check run for this annotation

Codecov / codecov/patch

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

Added line #L255 was not covered by tests

Expand Down

0 comments on commit 57cfd5f

Please sign in to comment.