-
Notifications
You must be signed in to change notification settings - Fork 24.9k
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
Add setting to enforce a default TIER_PREFERENCE #79210
Add setting to enforce a default TIER_PREFERENCE #79210
Conversation
It's not wired up to anything yet, though
This precise implementation is really janky, but once we force the setting to always be true, we should be able to simplify it quite a bit.
Pinging @elastic/es-data-management (Team:Data Management) |
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.
server/src/main/java/org/elasticsearch/cluster/routing/allocation/DataTier.java
Show resolved
Hide resolved
server/src/test/java/org/elasticsearch/cluster/metadata/MetadataCreateIndexServiceTests.java
Show resolved
Hide resolved
...est/java/org/elasticsearch/xpack/cluster/routing/allocation/DataTierAllocationDeciderIT.java
Outdated
Show resolved
Hide resolved
enforceDefaultTierPreference(true); | ||
|
||
Template t = new Template(Settings.builder() | ||
.putNull(DataTier.TIER_PREFERENCE) |
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 randomly pick between this and setting:
.put(IndexMetadata.INDEX_ROUTING_REQUIRE_GROUP_PREFIX + ".box", "warm")
No problem if this is problematic, I do think we cover this somewhat with the unit tests.
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'm adding a reminder onto #76147 so that this isn't forgotten, but I want to unblock this PR and keep making progress for now.
My code here was mistaken -- there was a point where I didn't have the new logic conditional on whether it was a resize/shrink/clone/split, so I did need to change this test then, but indeed it's no longer necessary.
The test reuses the same 'request' object from stanza to stanza, so we have to carefully empty it out -- otherwise, if we're randomly using the template settings here the request settings from the previous stanza would leak through.
Part of #76147
Adds a new cluster setting (
cluster.routing.allocation.enforce_default_tier_preference
), defaulting tofalse
, that (if set totrue
) will inject aindex.routing.allocation.include._tier_preference
when indices are created. This is in addition to the other places where we have conditional logic that sometimes injects a default value, and it serves as a final backstop -- if nothing else sets the value, then this will. Minor caveat: it doesn't apply in the case of resizes (shrink/clone/split).In a subsequent PR, this will be set to
true
on 8.0, but the tests work regardless of what the default is (those that require a particular value control it explicitly).Still todo (but don't let that stop you from reviewing):- [ ] Add docs for this new setting.edit: I'm going to add the docs once this has settled better -- I've got four in flight PRs on this right now, and I don't want to do the the bigger aspects of the docs changes pitter patter across the lot of them.
/cc @dakrone FYI (and you're welcome to take a look!), but I'm explicitly asking for review from @henningandersen.