From 43e63892a01940ffb6c61ca406569eab777b71ee Mon Sep 17 00:00:00 2001 From: Tianli Feng Date: Fri, 29 Apr 2022 12:46:57 -0700 Subject: [PATCH] Rename reserved node id '_must_join_elected_master_' to '_must_join_elected_cluster_manager_' that used by in DetachClusterCommand Signed-off-by: Tianli Feng --- .../cluster/coordination/ClusterFormationFailureHelper.java | 2 +- .../opensearch/cluster/coordination/CoordinationMetadata.java | 4 ++-- .../opensearch/cluster/coordination/DetachClusterCommand.java | 4 ++-- .../coordination/ClusterFormationFailureHelperTests.java | 2 +- .../cluster/coordination/CoordinationStateTestCluster.java | 2 +- 5 files changed, 7 insertions(+), 7 deletions(-) diff --git a/server/src/main/java/org/opensearch/cluster/coordination/ClusterFormationFailureHelper.java b/server/src/main/java/org/opensearch/cluster/coordination/ClusterFormationFailureHelper.java index 0f419aa7a0937..9cfd3a6fc3697 100644 --- a/server/src/main/java/org/opensearch/cluster/coordination/ClusterFormationFailureHelper.java +++ b/server/src/main/java/org/opensearch/cluster/coordination/ClusterFormationFailureHelper.java @@ -218,7 +218,7 @@ String getDescription() { assert clusterState.getLastCommittedConfiguration().isEmpty() == false; - if (clusterState.getLastCommittedConfiguration().equals(VotingConfiguration.MUST_JOIN_ELECTED_MASTER)) { + if (clusterState.getLastCommittedConfiguration().equals(VotingConfiguration.MUST_JOIN_ELECTED_CLUSTER_MANAGER)) { return String.format( Locale.ROOT, "cluster-manager not discovered yet and this node was detached from its previous cluster, have discovered %s; %s", diff --git a/server/src/main/java/org/opensearch/cluster/coordination/CoordinationMetadata.java b/server/src/main/java/org/opensearch/cluster/coordination/CoordinationMetadata.java index c7671cb9e9b2b..56f8d24b6a5c0 100644 --- a/server/src/main/java/org/opensearch/cluster/coordination/CoordinationMetadata.java +++ b/server/src/main/java/org/opensearch/cluster/coordination/CoordinationMetadata.java @@ -350,8 +350,8 @@ public String toString() { public static class VotingConfiguration implements Writeable, ToXContentFragment { public static final VotingConfiguration EMPTY_CONFIG = new VotingConfiguration(Collections.emptySet()); - public static final VotingConfiguration MUST_JOIN_ELECTED_MASTER = new VotingConfiguration( - Collections.singleton("_must_join_elected_master_") + public static final VotingConfiguration MUST_JOIN_ELECTED_CLUSTER_MANAGER = new VotingConfiguration( + Collections.singleton("_must_join_elected_cluster_manager_") ); private final Set nodeIds; diff --git a/server/src/main/java/org/opensearch/cluster/coordination/DetachClusterCommand.java b/server/src/main/java/org/opensearch/cluster/coordination/DetachClusterCommand.java index efa5a5ee600ab..afc8a68a74e9c 100644 --- a/server/src/main/java/org/opensearch/cluster/coordination/DetachClusterCommand.java +++ b/server/src/main/java/org/opensearch/cluster/coordination/DetachClusterCommand.java @@ -86,8 +86,8 @@ protected void processNodePaths(Terminal terminal, Path[] dataPaths, int nodeLoc // package-private for tests static Metadata updateMetadata(Metadata oldMetadata) { final CoordinationMetadata coordinationMetadata = CoordinationMetadata.builder() - .lastAcceptedConfiguration(CoordinationMetadata.VotingConfiguration.MUST_JOIN_ELECTED_MASTER) - .lastCommittedConfiguration(CoordinationMetadata.VotingConfiguration.MUST_JOIN_ELECTED_MASTER) + .lastAcceptedConfiguration(CoordinationMetadata.VotingConfiguration.MUST_JOIN_ELECTED_CLUSTER_MANAGER) + .lastCommittedConfiguration(CoordinationMetadata.VotingConfiguration.MUST_JOIN_ELECTED_CLUSTER_MANAGER) .term(0) .build(); return Metadata.builder(oldMetadata).coordinationMetadata(coordinationMetadata).clusterUUIDCommitted(false).build(); diff --git a/server/src/test/java/org/opensearch/cluster/coordination/ClusterFormationFailureHelperTests.java b/server/src/test/java/org/opensearch/cluster/coordination/ClusterFormationFailureHelperTests.java index 391d7b0e56332..c3be1a726d949 100644 --- a/server/src/test/java/org/opensearch/cluster/coordination/ClusterFormationFailureHelperTests.java +++ b/server/src/test/java/org/opensearch/cluster/coordination/ClusterFormationFailureHelperTests.java @@ -428,7 +428,7 @@ public void testDescriptionAfterDetachCluster() { final ClusterState clusterState = state( localNode, - VotingConfiguration.MUST_JOIN_ELECTED_MASTER.getNodeIds().toArray(new String[0]) + VotingConfiguration.MUST_JOIN_ELECTED_CLUSTER_MANAGER.getNodeIds().toArray(new String[0]) ); assertThat( diff --git a/test/framework/src/main/java/org/opensearch/cluster/coordination/CoordinationStateTestCluster.java b/test/framework/src/main/java/org/opensearch/cluster/coordination/CoordinationStateTestCluster.java index 2f1e18058d544..1e7456e03ce6f 100644 --- a/test/framework/src/main/java/org/opensearch/cluster/coordination/CoordinationStateTestCluster.java +++ b/test/framework/src/main/java/org/opensearch/cluster/coordination/CoordinationStateTestCluster.java @@ -155,7 +155,7 @@ void reboot() { .getLastAcceptedConfiguration() .isEmpty() ? CoordinationMetadata.VotingConfiguration.EMPTY_CONFIG - : CoordinationMetadata.VotingConfiguration.MUST_JOIN_ELECTED_MASTER; + : CoordinationMetadata.VotingConfiguration.MUST_JOIN_ELECTED_CLUSTER_MANAGER; persistedState = new InMemoryPersistedState( 0L, clusterState(0L, 0L, localNode, votingConfiguration, votingConfiguration, 0L)