Skip to content

Commit 4561f42

Browse files
Remove Redundandant Loop in SnapshotShardsService (#38283)
* This was a merge mistake on my end I think, obviously we only need to loop over the shards once not twice here to find those that we missed in INIT state
1 parent d58e899 commit 4561f42

File tree

1 file changed

+4
-6
lines changed

1 file changed

+4
-6
lines changed

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

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -284,12 +284,10 @@ private void startNewSnapshots(SnapshotsInProgress snapshotsInProgress) {
284284
notifyFailedSnapshotShard(snapshot, shard.key, lastSnapshotStatus.getFailure());
285285
}
286286
} else {
287-
for (ObjectObjectCursor<ShardId, ShardSnapshotStatus> curr : entry.shards()) {
288-
// due to CS batching we might have missed the INIT state and straight went into ABORTED
289-
// notify master that abort has completed by moving to FAILED
290-
if (curr.value.state() == State.ABORTED) {
291-
notifyFailedSnapshotShard(snapshot, curr.key, curr.value.reason());
292-
}
287+
// due to CS batching we might have missed the INIT state and straight went into ABORTED
288+
// notify master that abort has completed by moving to FAILED
289+
if (shard.value.state() == State.ABORTED) {
290+
notifyFailedSnapshotShard(snapshot, shard.key, shard.value.reason());
293291
}
294292
}
295293
}

0 commit comments

Comments
 (0)