-
Notifications
You must be signed in to change notification settings - Fork 25.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
Allow ClusterState.Custom
to be created on initial cluster states
#26144
Conversation
Today we have a `null` invariant on all `ClusterState.Custom`. This makes several code paths complicated and requires complex state handling in some cases. This change allows to register a custom supplier that is used to initialize the initial clusterstate with these transient customs.
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 just left a few naming suggestions.
/** | ||
* Creates a new cluster state builder that is initialized with the cluster name and all initial cluster state customs. | ||
*/ | ||
ClusterState.Builder newClusterStateBuilder(); |
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.
Maybe initalClusterStateBuilder
? It's a bit confusing since this "new" is very different from the "new" in the previous method.
} | ||
|
||
public static Map<String, Supplier<ClusterState.Custom>> getCustomSuppliers(List<ClusterPlugin> clusterPlugins) { |
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.
We might want to do the same for MetaData.Custom, so it might be a good idea to reflect that this is ClusterStateCustom and not MetaDataCustom in the name.
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.
... and I agree the supplier approach here makes more sense because it will make rolling cluster restart handling later easier.
* This allows custom clusterstate extensions to be always present and prevents invariants where clusterstates are published | ||
* but customs are not initialized. | ||
*/ | ||
default Map<String, Supplier<ClusterState.Custom>> getInitialCustomSupplier() { return Collections.emptyMap(); } |
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.
Again, we might want to add ClusterState to the name so we can have MetaData custom later.
Most of other things that deal with customs are in the Plugin
itself: getNamedWriteables
, getNamedWriteables
, getCustomMetaDataUpgrader
, etc. So, the Plugin
interface might be a better place for it... or maybe we should move upgraders here.
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 this plugin is the right place for it. I agree we should move others here.
…26144) Today we have a `null` invariant on all `ClusterState.Custom`. This makes several code paths complicated and requires complex state handling in some cases. This change allows to register a custom supplier that is used to initialize the initial clusterstate with these transient customs.
…26144) Today we have a `null` invariant on all `ClusterState.Custom`. This makes several code paths complicated and requires complex state handling in some cases. This change allows to register a custom supplier that is used to initialize the initial clusterstate with these transient customs.
@imotov I looked into backporting to 5.6 and it's not as straight forward as I wanted it to be. I think we just go with 6.0 upwards. followups can then happen on 7.0 |
@s1monw sounds good. |
* master: (30 commits) Rewrite range queries with open bounds to exists query (elastic#26160) Fix eclipse compilation problem (elastic#26170) Epoch millis and second formats parse float implicitly (Closes elastic#14641) (elastic#26119) fix SplitProcessor targetField test (elastic#26178) Fixed typo in README.textile (elastic#26168) Fix incorrect class name in deleteByQuery docs (elastic#26151) Move more token filters to analysis-common module reindex: automatically choose the number of slices (elastic#26030) Fix serialization of the `_all` field. (elastic#26143) percolator: Hint what clauses are important in a conjunction query based on fields Remove unused Netty-related settings (elastic#26161) Remove SimpleQueryStringIT#testPhraseQueryOnFieldWithNoPositions. Tests: reenable ShardReduceIT#testIpRange. Allow `ClusterState.Custom` to be created on initial cluster states (elastic#26144) Teach the build about betas and rcs (elastic#26066) Fix wrong header level inner hits: Unfiltered nested source should keep its full path Document how to import Lucene Snapshot libs when elasticsearch clients (elastic#26113) Use `global_ordinals_hash` execution mode when sorting by sub aggregations. (elastic#26014) Make the README use a single type in examples. (elastic#26098) ...
Pinging @elastic/es-distributed |
Today we have a
null
invariant on allClusterState.Custom
. This makesseveral code paths complicated and requires complex state handling in some cases.
This change allows to register a custom supplier that is used to initialize the
initial clusterstate with these transient customs.