Skip to content

Commit 8a728c4

Browse files
Include the snapshot ID when logging shard snapshot statuses
1 parent 79c388a commit 8a728c4

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

server/src/main/java/org/elasticsearch/snapshots/SnapshotShardsService.java

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,7 @@ public final class SnapshotShardsService extends AbstractLifecycleComponent impl
8787

8888
private final SnapshotShutdownProgressTracker snapshotShutdownProgressTracker;
8989

90+
/** Maps each snapshot to its collection of individual shard snapshots */
9091
private final Map<Snapshot, Map<ShardId, IndexShardSnapshotStatus>> shardSnapshots = new HashMap<>();
9192

9293
// A map of snapshots to the shardIds that we already reported to the master as failed
@@ -237,9 +238,16 @@ public void beforeIndexShardClosed(ShardId shardId, @Nullable IndexShard indexSh
237238
}
238239

239240
private void logIndexShardSnapshotStatuses(Logger callerLogger) {
240-
for (var snapshotStatuses : shardSnapshots.values()) {
241-
for (var shardSnapshot : snapshotStatuses.entrySet()) {
242-
callerLogger.info(Strings.format("ShardId %s, %s", shardSnapshot.getKey(), shardSnapshot.getValue()));
241+
for (var snapshot : shardSnapshots.entrySet()) { // iterate the snapshots
242+
for (var shardSnapshot : snapshot.getValue().entrySet()) { // iterate the individual shard snapshots
243+
callerLogger.info(
244+
Strings.format(
245+
"SnapshotId %s, ShardId %s, shard snapshot status: %s",
246+
snapshot.getKey().getSnapshotId(),
247+
shardSnapshot.getKey(),
248+
shardSnapshot.getValue()
249+
)
250+
);
243251
}
244252
}
245253
}

0 commit comments

Comments
 (0)