From a330fac2ead4c2d51deb94b1248f34cb3157d67c Mon Sep 17 00:00:00 2001 From: David Turner Date: Tue, 11 Dec 2018 08:40:25 +0000 Subject: [PATCH] Log [initial_master_nodes] on formation failure 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. --- .../cluster/coordination/ClusterFormationFailureHelper.java | 2 +- .../coordination/ClusterFormationFailureHelperTests.java | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/server/src/main/java/org/elasticsearch/cluster/coordination/ClusterFormationFailureHelper.java b/server/src/main/java/org/elasticsearch/cluster/coordination/ClusterFormationFailureHelper.java index 79142ec07c1d1..dc6de08f74c6b 100644 --- a/server/src/main/java/org/elasticsearch/cluster/coordination/ClusterFormationFailureHelper.java +++ b/server/src/main/java/org/elasticsearch/cluster/coordination/ClusterFormationFailureHelper.java @@ -150,7 +150,7 @@ String getDescription() { if (INITIAL_MASTER_NODE_COUNT_SETTING.get(Settings.EMPTY).equals(INITIAL_MASTER_NODE_COUNT_SETTING.get(settings)) && INITIAL_MASTER_NODES_SETTING.get(Settings.EMPTY).equals(INITIAL_MASTER_NODES_SETTING.get(settings))) { - bootstrappingDescription = "cluster bootstrapping is disabled on this node"; + bootstrappingDescription = "[" + INITIAL_MASTER_NODES_SETTING.getKey() + "] is empty on this node"; } else if (INITIAL_MASTER_NODES_SETTING.get(Settings.EMPTY).equals(INITIAL_MASTER_NODES_SETTING.get(settings))) { bootstrappingDescription = String.format(Locale.ROOT, "this node must discover at least [%d] master-eligible nodes to bootstrap a cluster", diff --git a/server/src/test/java/org/elasticsearch/cluster/coordination/ClusterFormationFailureHelperTests.java b/server/src/test/java/org/elasticsearch/cluster/coordination/ClusterFormationFailureHelperTests.java index 40b15709fb730..f17e80c2a16aa 100644 --- a/server/src/test/java/org/elasticsearch/cluster/coordination/ClusterFormationFailureHelperTests.java +++ b/server/src/test/java/org/elasticsearch/cluster/coordination/ClusterFormationFailureHelperTests.java @@ -156,20 +156,20 @@ public void testDescriptionBeforeBootstrapping() { assertThat(new ClusterFormationState(Settings.EMPTY, clusterState, emptyList(), emptyList()).getDescription(), is("master not discovered yet, this node has not previously joined a bootstrapped (v7+) cluster, and " + - "cluster bootstrapping is disabled on this node: have discovered []; " + + "[cluster.initial_master_nodes] is empty on this node: have discovered []; " + "discovery will continue using [] from hosts providers and [" + localNode + "] from last-known cluster state")); final TransportAddress otherAddress = buildNewFakeTransportAddress(); assertThat(new ClusterFormationState(Settings.EMPTY, clusterState, singletonList(otherAddress), emptyList()).getDescription(), is("master not discovered yet, this node has not previously joined a bootstrapped (v7+) cluster, and " + - "cluster bootstrapping is disabled on this node: have discovered []; " + + "[cluster.initial_master_nodes] is empty on this node: have discovered []; " + "discovery will continue using [" + otherAddress + "] from hosts providers and [" + localNode + "] from last-known cluster state")); final DiscoveryNode otherNode = new DiscoveryNode("other", buildNewFakeTransportAddress(), Version.CURRENT); assertThat(new ClusterFormationState(Settings.EMPTY, clusterState, emptyList(), singletonList(otherNode)).getDescription(), is("master not discovered yet, this node has not previously joined a bootstrapped (v7+) cluster, and " + - "cluster bootstrapping is disabled on this node: have discovered [" + otherNode + "]; " + + "[cluster.initial_master_nodes] is empty on this node: have discovered [" + otherNode + "]; " + "discovery will continue using [] from hosts providers and [" + localNode + "] from last-known cluster state")); assertThat(new ClusterFormationState(Settings.builder().put(INITIAL_MASTER_NODE_COUNT_SETTING.getKey(), 2).build(),