-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Fix missing removal of query cancellation callback in QueryPhase #130279
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
Changes from 8 commits
f5a5daa
cf1d49f
6e4edce
5fc5f49
103a1c1
7314f4d
57da03a
15c3582
0014df9
9bc2874
ae84b60
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
pr: 130279 | ||
summary: Fix missing removal of query cancellation callback in QueryPhase | ||
area: Search | ||
type: bug | ||
issues: [130071] |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -907,7 +907,9 @@ private SearchPhaseResult executeQueryPhase(ShardSearchRequest request, Cancella | |
tracer.stopTrace(task); | ||
} | ||
if (request.numberOfShards() == 1 && (request.source() == null || request.source().rankBuilder() == null)) { | ||
// we already have query results, but we can run fetch at the same time | ||
// in this case, we reuse search context across search and fetch phases. | ||
// so we need to remove all cancelation callbacks from query phase before starting fetch. | ||
context.searcher().removeQueryCancellations(); | ||
|
||
context.addFetchResult(); | ||
return executeFetchPhase(readerContext, context, afterQueryTime); | ||
} else { | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -187,6 +187,11 @@ public void close() { | |
this.cancellable.clear(); | ||
} | ||
|
||
// remove all registered cancellation callbacks to prevent them from leaking into other phases | ||
public void removeQueryCancellations() { | ||
|
||
this.cancellable.clear(); | ||
} | ||
|
||
public boolean hasCancellations() { | ||
return this.cancellable.isEnabled(); | ||
} | ||
|
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.
could you leave the initial comment, and perhaps rewrite the new part to something like
in this case we reuse the search context across search and fetch phase, hence we need to clear the cancellation checks that were applied by the query phase before running fetch. Note that the timeout checks are not applied to the fetch phase, while the cancellation checks are.