-
Notifications
You must be signed in to change notification settings - Fork 25k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Return partial failures if search was cancelled. #64382
Conversation
Pinging @elastic/es-search (:Search/Search) |
@elasticmachine run elasticsearch-ci/1 |
* search phase as "all shards failed". Note that if we cancelled the rest of the search request because of a | ||
* partial failure, we don't count this as if "all shards failed". | ||
*/ | ||
if (successfulOps.get() == 0 && requestCancelled.get() == false) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Drive by comment:
I wonder if we need to check if (shardFailures.size() == total) and if so, still report all shards failed? At least it will be a little bit confusing to get the partial shards failure exception if you only search one shard.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a good point, that's a more robust check! I had assumed we wouldn't set requestCancelled
unless there were multiple shards.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I pushed an update to only check shardSearchFailures.length == getNumShards()
. But I think this only makes sense with #64337 -- I'll pull that in once it's merged and check if there are still test failures.
@elasticmachine run elasticsearch-ci/1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
In elastic#63520, we started cancelling searches that encounter shard failures and don't allow partial results. In this case we return an 'all shards failed' response, since there are no successful responses. This PR proposes to return a 'partial shards failure' instead. The reasoning: it's misleading to claim that 'all shards failed' when we only know at least one shard failed (and preemptively cancelled the rest).
In #63520, we started cancelling searches that encounter shard failures and
don't allow partial results. In this case we return an 'all shards failed'
response, since there are no successful responses.
This PR proposes to return a 'partial shards failure' instead. The reasoning:
it's misleading to claim that 'all shards failed' when we only know at least
one shard failed (and preemptively cancelled the rest).
Addresses #64367.