Skip to content

Commit

Permalink
Add link to warning re. single-node clusters (elastic#112114)
Browse files Browse the repository at this point in the history
Expands the message added in elastic#88013 to include a link to the relevant
docs.
  • Loading branch information
DaveCTurner authored and cbuescher committed Sep 4, 2024
1 parent 30c4bef commit 7f80d17
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@
import org.elasticsearch.cluster.service.MasterServiceTaskQueue;
import org.elasticsearch.cluster.version.CompatibilityVersions;
import org.elasticsearch.common.Priority;
import org.elasticsearch.common.ReferenceDocs;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.component.AbstractLifecycleComponent;
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
Expand Down Expand Up @@ -831,10 +832,12 @@ public void run() {
discover other nodes and form a multi-node cluster via the [{}={}] setting. Fully-formed clusters do \
not attempt to discover other nodes, and nodes with different cluster UUIDs cannot belong to the same \
cluster. The cluster UUID persists across restarts and can only be changed by deleting the contents of \
the node's data path(s). Remove the discovery configuration to suppress this message.""",
the node's data path(s). Remove the discovery configuration to suppress this message. See [{}] for \
more information.""",
applierState.metadata().clusterUUID(),
DISCOVERY_SEED_HOSTS_SETTING.getKey(),
DISCOVERY_SEED_HOSTS_SETTING.get(settings)
DISCOVERY_SEED_HOSTS_SETTING.get(settings),
ReferenceDocs.FORMING_SINGLE_NODE_CLUSTERS
);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ public enum ReferenceDocs {
MAX_SHARDS_PER_NODE,
FLOOD_STAGE_WATERMARK,
X_OPAQUE_ID,
FORMING_SINGLE_NODE_CLUSTERS,
// this comment keeps the ';' on the next line so every entry above has a trailing ',' which makes the diff for adding new links cleaner
;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,6 @@
"LUCENE_MAX_DOCS_LIMIT": "size-your-shards.html#troubleshooting-max-docs-limit",
"MAX_SHARDS_PER_NODE": "size-your-shards.html#troubleshooting-max-shards-open",
"FLOOD_STAGE_WATERMARK": "fix-watermark-errors.html",
"X_OPAQUE_ID": "api-conventions.html#x-opaque-id"
"X_OPAQUE_ID": "api-conventions.html#x-opaque-id",
"FORMING_SINGLE_NODE_CLUSTERS": "modules-discovery-bootstrap-cluster.html#modules-discovery-bootstrap-cluster-joining"
}
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
import org.elasticsearch.cluster.node.DiscoveryNodeUtils;
import org.elasticsearch.cluster.node.DiscoveryNodes;
import org.elasticsearch.cluster.service.ClusterStateUpdateStats;
import org.elasticsearch.common.ReferenceDocs;
import org.elasticsearch.common.Strings;
import org.elasticsearch.common.io.stream.NamedWriteableRegistry;
import org.elasticsearch.common.io.stream.StreamOutput;
Expand Down Expand Up @@ -79,6 +80,8 @@
import static org.elasticsearch.discovery.SettingsBasedSeedHostsProvider.DISCOVERY_SEED_HOSTS_SETTING;
import static org.elasticsearch.monitor.StatusInfo.Status.HEALTHY;
import static org.elasticsearch.monitor.StatusInfo.Status.UNHEALTHY;
import static org.hamcrest.Matchers.allOf;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.equalTo;
import static org.hamcrest.Matchers.greaterThan;
import static org.hamcrest.Matchers.greaterThanOrEqualTo;
Expand Down Expand Up @@ -1762,7 +1765,13 @@ public void testLogsWarningPeriodicallyIfSingleNodeClusterHasSeedHosts() {
@Override
public void match(LogEvent event) {
final String message = event.getMessage().getFormattedMessage();
assertThat(message, startsWith("This node is a fully-formed single-node cluster with cluster UUID"));
assertThat(
message,
allOf(
startsWith("This node is a fully-formed single-node cluster with cluster UUID"),
containsString(ReferenceDocs.FORMING_SINGLE_NODE_CLUSTERS.toString())
)
);
loggedClusterUuid = (String) event.getMessage().getParameters()[0];
}

Expand Down

0 comments on commit 7f80d17

Please sign in to comment.