Skip to content

Commit c3a6d19

Browse files
authored
Log [initial_master_nodes] on formation failure (#36466)
Today we log a slightly cryptic "cluster bootstrapping is disabled on this node" message if bootstrapping hasn't been configured. Since there is today only one way to bootstrap the cluster it seems preferable to spell out exactly which setting is missing.
1 parent 00eadd9 commit c3a6d19

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

server/src/main/java/org/elasticsearch/cluster/coordination/ClusterFormationFailureHelper.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -150,7 +150,7 @@ String getDescription() {
150150

151151
if (INITIAL_MASTER_NODE_COUNT_SETTING.get(Settings.EMPTY).equals(INITIAL_MASTER_NODE_COUNT_SETTING.get(settings))
152152
&& INITIAL_MASTER_NODES_SETTING.get(Settings.EMPTY).equals(INITIAL_MASTER_NODES_SETTING.get(settings))) {
153-
bootstrappingDescription = "cluster bootstrapping is disabled on this node";
153+
bootstrappingDescription = "[" + INITIAL_MASTER_NODES_SETTING.getKey() + "] is empty on this node";
154154
} else if (INITIAL_MASTER_NODES_SETTING.get(Settings.EMPTY).equals(INITIAL_MASTER_NODES_SETTING.get(settings))) {
155155
bootstrappingDescription = String.format(Locale.ROOT,
156156
"this node must discover at least [%d] master-eligible nodes to bootstrap a cluster",

server/src/test/java/org/elasticsearch/cluster/coordination/ClusterFormationFailureHelperTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -156,20 +156,20 @@ public void testDescriptionBeforeBootstrapping() {
156156

157157
assertThat(new ClusterFormationState(Settings.EMPTY, clusterState, emptyList(), emptyList()).getDescription(),
158158
is("master not discovered yet, this node has not previously joined a bootstrapped (v7+) cluster, and " +
159-
"cluster bootstrapping is disabled on this node: have discovered []; " +
159+
"[cluster.initial_master_nodes] is empty on this node: have discovered []; " +
160160
"discovery will continue using [] from hosts providers and [" + localNode + "] from last-known cluster state"));
161161

162162
final TransportAddress otherAddress = buildNewFakeTransportAddress();
163163
assertThat(new ClusterFormationState(Settings.EMPTY, clusterState, singletonList(otherAddress), emptyList()).getDescription(),
164164
is("master not discovered yet, this node has not previously joined a bootstrapped (v7+) cluster, and " +
165-
"cluster bootstrapping is disabled on this node: have discovered []; " +
165+
"[cluster.initial_master_nodes] is empty on this node: have discovered []; " +
166166
"discovery will continue using [" + otherAddress + "] from hosts providers and [" + localNode +
167167
"] from last-known cluster state"));
168168

169169
final DiscoveryNode otherNode = new DiscoveryNode("other", buildNewFakeTransportAddress(), Version.CURRENT);
170170
assertThat(new ClusterFormationState(Settings.EMPTY, clusterState, emptyList(), singletonList(otherNode)).getDescription(),
171171
is("master not discovered yet, this node has not previously joined a bootstrapped (v7+) cluster, and " +
172-
"cluster bootstrapping is disabled on this node: have discovered [" + otherNode + "]; " +
172+
"[cluster.initial_master_nodes] is empty on this node: have discovered [" + otherNode + "]; " +
173173
"discovery will continue using [] from hosts providers and [" + localNode + "] from last-known cluster state"));
174174

175175
assertThat(new ClusterFormationState(Settings.builder().put(INITIAL_MASTER_NODE_COUNT_SETTING.getKey(), 2).build(),

0 commit comments

Comments
 (0)