-
Notifications
You must be signed in to change notification settings - Fork 25.6k
Make sure _tier field handles missing setting #71439
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
Conversation
When `_tier_preference` isn't set, getting it returns an empty string "". This PR updates the _tier metadata field to detect this case correctly.
|
Pinging @elastic/es-search (Team:Search) |
| } | ||
| String tierPreference = DataTierAllocationDecider.INDEX_ROUTING_PREFER_SETTING.get(context.getIndexSettings().getSettings()); | ||
| if (tierPreference == null) { | ||
| if (Strings.hasText(tierPreference) == false) { |
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 check is a little unusual, but it matches how we test for the setting in other places like DataTierAllocationDecider.
cbuescher
left a comment
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.
LGTM, I left a minor suggestion around reusing the existing test helper but leave it to you if you want to change that or not.
| ); | ||
| } | ||
|
|
||
| private SearchExecutionContext createContextWithoutSetting() { |
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.
nit: maybe we could re-use the other createContext() method by adding an argument (e.g. a bool flag) to either return a context with- or without the setting?
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 the suggestion, I'll stick with this approach as I find it clearest right now. We can always refactor if these methods grow larger and there's more duplication!
When `_tier_preference` isn't set, getting it returns an empty string "". This PR updates the _tier metadata field to detect this case correctly.
When
_tier_preferenceisn't set, getting it returns an empty string "". ThisPR updates the _tier metadata field to detect this case correctly.
Relates to #68135.