In GET _cat/snapshots we report the shard counts for IN_PROGRESS snapshots as all zeroes, even though we actually know how many of these shards there are and how many of them have succeeded or failed at the point we construct the SnapshotInfo:
diff --git a/server/src/main/java/org/elasticsearch/snapshots/SnapshotInfo.java b/server/src/main/java/org/elasticsearch/snapshots/SnapshotInfo.java
index c6c00451b82..42c8566f98e 100644
--- a/server/src/main/java/org/elasticsearch/snapshots/SnapshotInfo.java
+++ b/server/src/main/java/org/elasticsearch/snapshots/SnapshotInfo.java
@@ -364,8 +365,10 @@ public final class SnapshotInfo implements Comparable<SnapshotInfo>, ToXContent,
Version.CURRENT,
entry.startTime(),
0L,
- 0,
- 0,
+ entry.shards().size(),
+ Math.toIntExact(StreamSupport.stream(entry.shards().spliterator(), false)
+ .filter(c -> c.value.state() == SnapshotsInProgress.ShardState.SUCCESS)
+ .count()),
Collections.emptyList(),
entry.includeGlobalState(),
entry.userMetadata(),
This doesn't actually work, it doesn't distinguish in-progress shards from failed shards, but it's close.
In
GET _cat/snapshotswe report the shard counts forIN_PROGRESSsnapshots as all zeroes, even though we actually know how many of these shards there are and how many of them have succeeded or failed at the point we construct theSnapshotInfo:This doesn't actually work, it doesn't distinguish in-progress shards from failed shards, but it's close.