-
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
Introduce universal bootstrap method for tests with autoMinMasterNodes=false #38038
Conversation
Pinging @elastic/es-distributed |
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.
Great, the duplication irked me too.
I think it can be further simplified, moving this whole mechanism within InternalTestCluster
. I also wonder if we should reset bootstrapMasterNodeId
to -1
after use, and should assert that it is -1
if autoManageMinMasterNodes
is set.
Also there's a few places where you org.elasticsearch.use org.elasticsearch.fully-qualified org.elasticsearch.names, mirroring existing usage. I think we can tidy that up, at least in the places they occur here. There's only one NODE_NAME_SETTING
worth talking about.
* See {@link #addExtraClusterBootstrapSettings(List)}. | ||
* Please note that this value is being reset to -1 after each test. See {@link #resetBootstrapMasterNodeId()}. | ||
*/ | ||
protected int bootstrapMasterNodeId = -1; |
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 move this entirely within InternalTestCluster
?
@@ -1986,17 +1998,63 @@ public Settings transportClientSettings() { | |||
}; | |||
} | |||
|
|||
/** | |||
* Performs cluster bootstrap when {@link #bootstrapMasterNodeId} is started with the names of all | |||
* previously started master-eligible nodes. |
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.
s/previously started/existing and new/
?
/** | ||
* This method is called before starting a collection of nodes. | ||
* At this point the test has a holistic view on all nodes settings and might perform settings adjustments as needed. | ||
* For instance, the test could retrieve master node names and fill in | ||
* {@link org.elasticsearch.cluster.coordination.ClusterBootstrapService#INITIAL_MASTER_NODES_SETTING} setting. | ||
* By default, this method delegates to {@link #bootstrapMasterNodeWithSpecifiedId(List)} method. | ||
* | ||
* @param allNodesSettings list of node settings before update | ||
* @return list of node settings after update | ||
*/ | ||
protected List<Settings> addExtraClusterBootstrapSettings(List<Settings> allNodesSettings) { |
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 is never overridden, so can be inlined.
reset bootstrapMasterNodeId after bootstrap
# Conflicts: # server/src/test/java/org/elasticsearch/cluster/MinimumMasterNodesIT.java # server/src/test/java/org/elasticsearch/cluster/SpecificMasterNodesIT.java # server/src/test/java/org/elasticsearch/cluster/coordination/UnsafeBootstrapMasterIT.java
66982b5
to
738cf9f
Compare
@DaveCTurner thanks for your review! |
I've missed that |
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, nice work
* master: (36 commits) Ensure joda compatibility in custom date formats (elastic#38171) Do not compute cardinality if the `terms` execution mode does not use `global_ordinals` (elastic#38169) Do not set timeout for IndexRequests in GatewayIndexStateIT (elastic#38147) Zen2ify testMasterFailoverDuringIndexingWithMappingChanges (elastic#38178) SQL: [Docs] Add limitation for aggregate functions on scalars (elastic#38186) Add elasticsearch-node detach-cluster command (elastic#37979) Add tests for fractional epoch parsing (elastic#38162) Enable bw tests for elastic#37871 and elastic#38032. (elastic#38167) Clear send behavior rule in CloseWhileRelocatingShardsIT (elastic#38159) Fix testCorruptedIndex (elastic#38161) Add finalReduce flag to SearchRequest (elastic#38104) Forbid negative field boosts in analyzed queries (elastic#37930) Remove AtomiFieldData#getLegacyFieldValues (elastic#38087) Universal cluster bootstrap method for tests with autoMinMasterNodes=false (elastic#38038) Fix FullClusterRestartIT.testHistoryUUIDIsAdded (elastic#38098) Replace joda time in ingest-common module (elastic#38088) Fix eclipse config for ssl-config (elastic#38096) Don't load global ordinals with the `map` execution_hint (elastic#37833) Relax fault detector in some disruption tests (elastic#38101) Fix java time epoch date formatters (elastic#37829) ...
Currently, there are a few tests that use autoMinMasterNodes=false and
hence override
addExtraClusterBootstrapSettings
, mostly this is 10-30lines of codes that are copy-pasted from class to class.
This PR introduces
bootstrapMasterNodeWithSpecifiedId
which issuitable for all classes and copy-paste could be removed.
Removing code is always a good thing!