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
This commit is contained in:
Armin Braun 2019-02-04 09:06:39 +01:00 committed by GitHub
parent d58e899d45
commit 4561f425db
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 6 deletions

View File

@ -284,12 +284,10 @@ public class SnapshotShardsService extends AbstractLifecycleComponent implements
notifyFailedSnapshotShard(snapshot, shard.key, lastSnapshotStatus.getFailure());
}
} else {
for (ObjectObjectCursor<ShardId, ShardSnapshotStatus> curr : entry.shards()) {
// due to CS batching we might have missed the INIT state and straight went into ABORTED
// notify master that abort has completed by moving to FAILED
if (curr.value.state() == State.ABORTED) {
notifyFailedSnapshotShard(snapshot, curr.key, curr.value.reason());
}
if (shard.value.state() == State.ABORTED) {
notifyFailedSnapshotShard(snapshot, shard.key, shard.value.reason());
}
}
}