- Notifications
You must be signed in to change notification settings - Fork 25.5k
Defer unpromotable shard refreshes until index refresh blocks are cleared #120642
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
fcofdez merged 18 commits into elastic:main from fcofdez:wait-for-refresh-block-clearing Jan 28, 2025
Merged
Changes from all commits
Commits
Show all changes
18 commits Select commit Hold shift + click to select a range
52b14be
Defer unpromotable shard refreshes until index refresh blocks are cle…
fcofdez 3fb0599
Update docs/changelog/120642.yaml
fcofdez 1604afd
Use unpromotable shard list
fcofdez c0dde3a
Merge branch 'wait-for-refresh-block-clearing' of github.com:fcofdez/…
fcofdez 9a22ad6
Review comments
fcofdez a922b75
Merge remote-tracking branch 'origin/main' into wait-for-refresh-bloc…
fcofdez 179074d
Check for blocks first
fcofdez 76d842a
Fix test
fcofdez a22a69e
Merge remote-tracking branch 'origin/main' into wait-for-refresh-bloc…
fcofdez 3470214
Merge remote-tracking branch 'origin/main' into wait-for-refresh-bloc…
fcofdez 7d31f27
Review comments
fcofdez 1fdfb44
Merge remote-tracking branch 'origin/main' into wait-for-refresh-bloc…
fcofdez 1b2a2b8
Merge branch 'main' into wait-for-refresh-block-clearing
elasticmachine 3c7b1ca
Revert renaming
fcofdez 39431e1
Merge branch 'wait-for-refresh-block-clearing' of github.com:fcofdez/…
fcofdez cda1dfa
Merge remote-tracking branch 'origin/main' into wait-for-refresh-bloc…
fcofdez bf1ed0d
Merge remote-tracking branch 'origin/main' into wait-for-refresh-bloc…
fcofdez a3b09a0
Merge branch 'main' into wait-for-refresh-block-clearing
elasticmachine 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
pr: 120642 | ||
summary: Defer unpromotable shard refreshes until index refresh blocks are cleared | ||
area: Engine | ||
type: enhancement | ||
issues: [] |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
| @@ -65,7 +65,7 @@ public void onFailure(Exception e) { | |
} | ||
}); | ||
case IMMEDIATE -> immediate(indexShard, listener.delegateFailureAndWrap((l, r) -> { | ||
if (indexShard.getReplicationGroup().getRoutingTable().unpromotableShards().size() > 0) { | ||
if (indexShard.getReplicationGroup().getRoutingTable().allUnpromotableShards().size() > 0) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 | ||
sendUnpromotableRequests(indexShard, r.generation(), true, l, postWriteRefreshTimeout); | ||
} else { | ||
l.onResponse(true); | ||
| @@ -136,7 +136,8 @@ private void sendUnpromotableRequests( | |
indexShard.getReplicationGroup().getRoutingTable(), | ||
indexShard.getOperationPrimaryTerm(), | ||
generation, | ||
true | ||
true, | ||
postWriteRefreshTimeout | ||
); | ||
transportService.sendRequest( | ||
transportService.getLocalNode(), | ||
|
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
Oops, something went wrong.
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.
It is slightly annoying that the observer does not support it but we need to have something like:
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.
That's right and why I prefer slightly more the Runnable approach. Fixed in 179074d
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 still find this simpler than the runnable way which takes over more reponsibility from the observer. One can trick the observer by passing in initial version -1, but it is a bit ugly. We should probably add a method to it to simplify this very common case.
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.
Yes, I was planning on doing that. I'll open a PR shortly