-
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
Wait for cluster to recover before resolving index template #99797
Merged
Merged
Changes from 4 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
3302980
Wait for cluster to recover before resolving index template
ywangd fd4e882
Update docs/changelog/99797.yaml
ywangd 1c13309
Apply suggestions from code review
ywangd 421f543
address feedback
ywangd 812154a
Account for index pressure before waiting for cluster state recovery
ywangd 1cb5b35
restructure a bit
ywangd 49077a1
tweak
ywangd e07a5a8
Merge remote-tracking branch 'origin/main' into es-49499
ywangd 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
pr: 99797 | ||
summary: Wait for cluster to recover before resolving index template | ||
area: CRUD | ||
type: bug | ||
issues: [] |
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
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.
Ah wait, sorry, we need to do this check first, on the transport worker, before we start waiting for cluster states. Otherwise we might just pile up far too much work in memory waiting for the cluster recovery.
But that is a little tricky because we need to compute
isOnlySystem
to call this, and that needs the cluster to be recovered. I suggest we conservatively assumeisOnlySystem == false
if the cluster is not yet recovered.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.
Sorry I don't quite follow. It seems to me that when the code reaches here, the cluster state is either recovered successfully or we had no need to wait for recover at all. So there is no more waiting after this line?
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 that's right, but it's the waiting before this line that's a problem. Before we run this line we have the bulk request in memory but we aren't tracking it in the indexing pressure subsystem. If we receive lots of indexing requests while the cluster is recovering then we will try to hold them all in memory, rejecting none of them and will eventually just OOM.
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.
Makes sense. Thanks a lot for the explanation! Updated in 812154a
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.
Btw, I didn't change how
isOnlySystem
is computed since the method is written with the assumption that the index may not be available yet (see here).Also, if the metadata is not available, the ultimate default is to return
false
(when theSystemIndices
also does not know the index).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 had some concerns about whether
clusterState.metadata()
could be null, orclusterState.metadata().getIndicesLookup()
, but I did some checking and I think this is ok.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.
Thanks checking! I didn't think that was possible.