-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Fix request processing scheduling #127464
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
Merged
idegtiarenko
merged 10 commits into
elastic:main
from
idegtiarenko:debug_DataNodeRequestSenderIT
May 7, 2025
Merged
Changes from 6 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
de2f695
Fix request processing scheduling
idegtiarenko a5fde53
Merge branch 'main' into debug_DataNodeRequestSenderIT
idegtiarenko 7780ed7
fix retry limit
idegtiarenko 3425c26
Merge branch 'main' into debug_DataNodeRequestSenderIT
idegtiarenko b2dd3da
replace `isHeldByCurrentThread`check
idegtiarenko 90d297c
Merge branch 'main' into debug_DataNodeRequestSenderIT
idegtiarenko 733e5c8
Merge branch 'main' into debug_DataNodeRequestSenderIT
idegtiarenko 8a0dcc6
Move retry scheduling to trySendingRequestsForPendingShards
idegtiarenko b193ec8
handle all shards unassigned
idegtiarenko 95ed34f
Merge branch 'main' into debug_DataNodeRequestSenderIT
idegtiarenko 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 hidden or 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 hidden or 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 am concerned that we are scattering sendingLock#lock and sendingLock#unlock in two different places. Can we keep them close?
Uh oh!
There was an error while loading. Please reload this page.
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.
They are in the same inner listener, guarding the same structure at the moment.
They were previously in the same method before but that was not enough and caused a bug.
I suspect we could do this by creating a releasable inner wrapper class on top of
pendingRetries = new HashSet<>()but that sounds like an overkill not really helping with readability.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.
@idegtiarenko Sorry, I should have provided more detail. My concern is that we acquire the sending lock in
maybeScheduleRetryand release it inonAfter, which is linked to the status ofpendingRetries. While the implementation is technically correct, I think we should stick to the simplest lock pattern unless there is a strong reason to do otherwise:I think we can follow this lock pattern in the DataNodeRequestSender class.
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 sounds a lot like the original implementation (within
onAfter) that was not correct.Do you see a way how to implement this suggestion while still locking conditionally (only if shard movement is detected) and blocking concurrent requests while it is detected that new shard location resolution is required?
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.
As discussed yesterday, I moved retry scheduling to
trySendingRequestsForPendingShardsin 8a0dcc6