File tree Expand file tree Collapse file tree 3 files changed +13
-12
lines changed
buildSrc/src/main/groovy/org/elasticsearch/gradle/test Expand file tree Collapse file tree 3 files changed +13
-12
lines changed Original file line number Diff line number Diff line change @@ -63,13 +63,11 @@ class ClusterConfiguration {
6363 boolean debug = false
6464
6565 /**
66- * if <code >true</code> each node will be configured with <tt >discovery.zen.minimum_master_nodes</tt> set
67- * to the total number of nodes in the cluster. This will also cause that each node has `0s` state recovery
68- * timeout which can lead to issues if for instance an existing clusterstate is expected to be recovered
69- * before any tests start
66+ * Configuration of the setting <tt >discovery.zen.minimum_master_nodes</tt> on the nodes.
67+ * In case of more than one node, this defaults to (number of nodes / 2) + 1
7068 */
7169 @Input
72- boolean useMinimumMasterNodes = true
70+ Closure< Integer > minimumMasterNodes = { getNumNodes () > 1 ? getNumNodes() . intdiv( 2 ) + 1 : -1 }
7371
7472 @Input
7573 String jvmArgs = " -Xms" + System . getProperty(' tests.heap.size' , ' 512m' ) +
Original file line number Diff line number Diff line change @@ -311,13 +311,14 @@ class ClusterFormationTasks {
311311 // Define a node attribute so we can test that it exists
312312 ' node.attr.testattr' : ' test'
313313 ]
314- // we set min master nodes to the total number of nodes in the cluster and
315- // basically skip initial state recovery to allow the cluster to form using a realistic master election
316- // this means all nodes must be up, join the seed node and do a master election. This will also allow new and
317- // old nodes in the BWC case to become the master
318- if (node. config. useMinimumMasterNodes && node. config. numNodes > 1 ) {
319- esConfig[' discovery.zen.minimum_master_nodes' ] = node. config. numNodes
320- esConfig[' discovery.initial_state_timeout' ] = ' 0s' // don't wait for state.. just start up quickly
314+ int minimumMasterNodes = node. config. minimumMasterNodes. call()
315+ if (minimumMasterNodes > 0 ) {
316+ esConfig[' discovery.zen.minimum_master_nodes' ] = minimumMasterNodes
317+ }
318+ if (node. config. numNodes > 1 ) {
319+ // don't wait for state.. just start up quickly
320+ // this will also allow new and old nodes in the BWC case to become the master
321+ esConfig[' discovery.initial_state_timeout' ] = ' 0s'
321322 }
322323 esConfig[' node.max_local_storage_nodes' ] = node. config. numNodes
323324 esConfig[' http.port' ] = node. config. httpPort
Original file line number Diff line number Diff line change @@ -61,6 +61,7 @@ for (Version version : wireCompatVersions) {
6161 distribution = ' zip'
6262 clusterName = ' rolling-upgrade'
6363 unicastTransportUri = { seedNode , node , ant -> oldClusterTest. nodes. get(0 ). transportUri() }
64+ minimumMasterNodes = { 2 }
6465 /* Override the data directory so the new node always gets the node we
6566 * just stopped's data directory. */
6667 dataDir = { nodeNumber -> oldClusterTest. nodes[1 ]. dataDir }
@@ -81,6 +82,7 @@ for (Version version : wireCompatVersions) {
8182 distribution = ' zip'
8283 clusterName = ' rolling-upgrade'
8384 unicastTransportUri = { seedNode , node , ant -> mixedClusterTest. nodes. get(0 ). transportUri() }
85+ minimumMasterNodes = { 2 }
8486 /* Override the data directory so the new node always gets the node we
8587 * just stopped's data directory. */
8688 dataDir = { nodeNumber -> oldClusterTest. nodes[0 ]. dataDir}
You can’t perform that action at this time.
0 commit comments