-
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
Force execution of finish shard bulk request #51957
Merged
Merged
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
5a02d1a
Force execution of finish shard bulk request
Tim-Brooks 4b0b0eb
Dispatch everything
Tim-Brooks ae403e7
Comment
Tim-Brooks 07135b2
Merge remote-tracking branch 'upstream/master' into force_shard_finish
Tim-Brooks 722236d
Merge remote-tracking branch 'upstream/master' into force_shard_finish
Tim-Brooks File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
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 was thinking that rather than scheduling only
finishRequest
on the write thread pool, we should execute the entirety ofonRejection
on the write thread pool (and still forcing execution, since rejecting execution here would be very bad):elasticsearch/server/src/main/java/org/elasticsearch/action/bulk/TransportShardBulkAction.java
Line 160 in 3ad8aa6
The reason I think this is because we're still doing work in
onRejection
that is linear in the number of documents in the bulk request. It seems we'd want to get that off of the networking/cluster state applier thread too given that we're going to fork anyway.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 wonder if we should instead let
onRejection
force-push theonRejection
handling onto the queue of the requested executor. The current "direct" handling kind of prioritizes theonRejection
handling over everything else in the queue, which I think there is really no good reason for.Looking at various
onRejection
handlers, some calllistener.onFailure
and verifying that none of those do bad things is tricky.Also notice that
onAfter
is also called in the caller thread when requests are rejected, this poses similar issues (not that I found a smoking gun there).Finally, notice that
AbstractRunnable.onRejection
by default callsonFailure
.I doubt that we careful consider that
onAfter
andonFailure
might run in the current thread when usingAbstractRunnable
and executing theonRejection
handling on the target thread-pool would fix this, making it easier to reason about.That said, I think this PR is good and I am not objecting to it going in. Following my suggestion is likely to surface a few additional things to resolve.
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 made @jasontedor change.
I think maybe Henning's comment about maybe
onRejection
should be executed on the thread pool anyway is beyond the scope of this PR? Or at least a larger discussion.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.
@tbrooks8, yes, that is fine, I just found it most natural to put it here. I will open a PR with that change so we can discuss based on that PR instead.