-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Fix to load indices status in batches so that the URL used to call OpenSearch does not exceed maximum length #21208
base: master
Are you sure you want to change the base?
Conversation
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 for this! Some suggestions for improvement:
- We should try to use an endpoint where we can get results in a single response to avoid multiple round-trips. We could use
/_settings/index.blocks.read,index.blocks.write,index.blocks.metadata
for example. - We could do this, when
indices.stream().collect(joining(",")).length > threshold
- Should we also implement this for the ES7 module?
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.
Some inline questions.
final GetSettingsResponse settingsResponse = c.indices().getSettings(getSettingsRequest, requestOptions); | ||
return BlockSettingsParser.parseBlockSettings(settingsResponse); | ||
}); | ||
if(String.join(",", indices).length() > MAX_INDICES_URL_LENGTH) { |
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 think we should safe some buffer here, as there will also be the path + additional query parameters (+ potential url encoding overhead?). Let's play it safe and reduce MAX_INDICES_URL_LENGTH
to 2500?
}); | ||
if(String.join(",", indices).length() > MAX_INDICES_URL_LENGTH) { | ||
final GetSettingsRequest getSettingsRequest = new GetSettingsRequest() | ||
.indicesOptions(IndicesOptions.fromOptions(false, true, true, true)) |
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.
Can we use .names("index.blocks.read", ...)
to get only the blocks here?
Description
Prior to this PR, a call to
getIndicesBlocksStatus()
would exceed to URL maximum of 4096 bytes if the number of indices would be large. This PR mitigates the problem by getting the status in batches and merges the result. IMotivation and Context
How Has This Been Tested?
Screenshots (if appropriate):
Types of changes
Checklist: