Remove redundant success counter from AbstractSearchAsyncAction #124941
+13
−80
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
No need to count successes explicitly, the failure count and total count contain all the necessary information here (a fact we asserted also).
This removal also revealed some dead-code in the phase transition method that really only trigged in a test with invalid inputs (5 shards, but only a single shard iterator, not calling
start
on the action). I removed that test, at this point it was just testing itself.The beauty of this change is that it essentially only leaves the
outstandingShards
counter as shared state across all shards. A suggested follow-up would be to do away with that as well and move to a tree of futures for the per-shard results that scales more cleanly on larger boxes and makes reasoning about the concurrency easier to the point where we can do away with all the atomic array.