From 66deacec234fe2afb8121ae42bc6bc6df2b51c02 Mon Sep 17 00:00:00 2001 From: Tianli Feng Date: Sat, 19 Mar 2022 02:09:43 -0700 Subject: [PATCH 1/6] Replace internal usages of 'master' terminology in server/src/internalClusterTest directory Signed-off-by: Tianli Feng --- .../action/admin/ClientTimeoutIT.java | 10 +-- .../admin/cluster/node/tasks/TasksIT.java | 6 +- ...ansportClusterStateActionDisruptionIT.java | 8 +-- .../cluster/ClusterStateDiffIT.java | 8 ++- .../cluster/MinimumMasterNodesIT.java | 12 ++-- .../UnsafeBootstrapAndDetachCommandIT.java | 30 ++++----- .../cluster/coordination/ZenDiscoveryIT.java | 4 +- .../cluster/routing/AllocationIdIT.java | 2 +- .../discovery/ClusterDisruptionIT.java | 28 ++++----- .../discovery/DiscoveryDisruptionIT.java | 50 ++++++++------- .../discovery/MasterDisruptionIT.java | 29 +++++---- .../discovery/StableMasterDisruptionIT.java | 8 +-- .../env/NodeRepurposeCommandIT.java | 24 +++---- .../store/IndicesStoreIntegrationIT.java | 18 +++--- .../opensearch/snapshots/CloneSnapshotIT.java | 24 +++---- .../snapshots/ConcurrentSnapshotsIT.java | 62 +++++++++---------- .../DedicatedClusterSnapshotRestoreIT.java | 4 +- 17 files changed, 171 insertions(+), 156 deletions(-) diff --git a/server/src/internalClusterTest/java/org/opensearch/action/admin/ClientTimeoutIT.java b/server/src/internalClusterTest/java/org/opensearch/action/admin/ClientTimeoutIT.java index d83e8112569ee..e228626471b98 100644 --- a/server/src/internalClusterTest/java/org/opensearch/action/admin/ClientTimeoutIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/action/admin/ClientTimeoutIT.java @@ -47,7 +47,7 @@ protected Collection> nodePlugins() { } public void testNodesInfoTimeout() { - String masterNode = internalCluster().startMasterOnlyNode(); + String clusterManagerNode = internalCluster().startMasterOnlyNode(); String dataNode = internalCluster().startDataOnlyNode(); String anotherDataNode = internalCluster().startDataOnlyNode(); @@ -65,11 +65,11 @@ public void testNodesInfoTimeout() { nodes.add(node.getNode().getName()); } assertThat(response.getNodes().size(), equalTo(2)); - assertThat(nodes.contains(masterNode), is(true)); + assertThat(nodes.contains(clusterManagerNode), is(true)); } public void testNodesStatsTimeout() { - String masterNode = internalCluster().startMasterOnlyNode(); + String clusterManagerNode = internalCluster().startMasterOnlyNode(); String dataNode = internalCluster().startDataOnlyNode(); String anotherDataNode = internalCluster().startDataOnlyNode(); TimeValue timeout = TimeValue.timeValueMillis(1000); @@ -87,11 +87,11 @@ public void testNodesStatsTimeout() { nodes.add(node.getNode().getName()); } assertThat(response.getNodes().size(), equalTo(2)); - assertThat(nodes.contains(masterNode), is(true)); + assertThat(nodes.contains(clusterManagerNode), is(true)); } public void testListTasksTimeout() { - String masterNode = internalCluster().startMasterOnlyNode(); + String clusterManagerNode = internalCluster().startMasterOnlyNode(); String dataNode = internalCluster().startDataOnlyNode(); String anotherDataNode = internalCluster().startDataOnlyNode(); TimeValue timeout = TimeValue.timeValueMillis(1000); diff --git a/server/src/internalClusterTest/java/org/opensearch/action/admin/cluster/node/tasks/TasksIT.java b/server/src/internalClusterTest/java/org/opensearch/action/admin/cluster/node/tasks/TasksIT.java index fbac2f7dbff6e..495dfd2c264dd 100644 --- a/server/src/internalClusterTest/java/org/opensearch/action/admin/cluster/node/tasks/TasksIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/action/admin/cluster/node/tasks/TasksIT.java @@ -154,17 +154,17 @@ public void testTaskCounts() { assertThat(response.getTasks().size(), greaterThanOrEqualTo(cluster().numDataNodes())); } - public void testMasterNodeOperationTasks() { + public void testClusterManagerNodeOperationTasks() { registerTaskManagerListeners(ClusterHealthAction.NAME); - // First run the health on the master node - should produce only one task on the master node + // First run the health on the cluster-manager node - should produce only one task on the cluster-manager node internalCluster().masterClient().admin().cluster().prepareHealth().get(); assertEquals(1, numberOfEvents(ClusterHealthAction.NAME, Tuple::v1)); // counting only registration events assertEquals(1, numberOfEvents(ClusterHealthAction.NAME, event -> event.v1() == false)); // counting only unregistration events resetTaskManagerListeners(ClusterHealthAction.NAME); - // Now run the health on a non-master node - should produce one task on master and one task on another node + // Now run the health on a non-cluster-manager node - should produce one task on cluster-manager and one task on another node internalCluster().nonMasterClient().admin().cluster().prepareHealth().get(); assertEquals(2, numberOfEvents(ClusterHealthAction.NAME, Tuple::v1)); // counting only registration events assertEquals(2, numberOfEvents(ClusterHealthAction.NAME, event -> event.v1() == false)); // counting only unregistration events diff --git a/server/src/internalClusterTest/java/org/opensearch/action/admin/cluster/state/TransportClusterStateActionDisruptionIT.java b/server/src/internalClusterTest/java/org/opensearch/action/admin/cluster/state/TransportClusterStateActionDisruptionIT.java index c6f47a01ed2d2..f49a0c9a722a6 100644 --- a/server/src/internalClusterTest/java/org/opensearch/action/admin/cluster/state/TransportClusterStateActionDisruptionIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/action/admin/cluster/state/TransportClusterStateActionDisruptionIT.java @@ -204,9 +204,9 @@ public void runRepeatedlyWhileChangingMaster(Runnable runnable) throws Exception String value = "none"; while (shutdown.get() == false) { value = "none".equals(value) ? "all" : "none"; - final String nonMasterNode = randomValueOtherThan(masterName, () -> randomFrom(internalCluster().getNodeNames())); + final String nonClusterManagerNode = randomValueOtherThan(masterName, () -> randomFrom(internalCluster().getNodeNames())); assertAcked( - client(nonMasterNode).admin() + client(nonClusterManagerNode).admin() .cluster() .prepareUpdateSettings() .setPersistentSettings(Settings.builder().put(CLUSTER_ROUTING_REBALANCE_ENABLE_SETTING.getKey(), value)) @@ -235,8 +235,8 @@ public void runRepeatedlyWhileChangingMaster(Runnable runnable) throws Exception } assertBusy(() -> { - final String nonMasterNode = randomValueOtherThan(masterName, () -> randomFrom(internalCluster().getNodeNames())); - final String claimedMasterName = internalCluster().getMasterName(nonMasterNode); + final String nonClusterManagerNode = randomValueOtherThan(masterName, () -> randomFrom(internalCluster().getNodeNames())); + final String claimedMasterName = internalCluster().getMasterName(nonClusterManagerNode); assertThat(claimedMasterName, not(equalTo(masterName))); }); diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/ClusterStateDiffIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/ClusterStateDiffIT.java index ea1daffaf770d..7654a937c8dc0 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/ClusterStateDiffIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/ClusterStateDiffIT.java @@ -93,9 +93,13 @@ public class ClusterStateDiffIT extends OpenSearchIntegTestCase { public void testClusterStateDiffSerialization() throws Exception { NamedWriteableRegistry namedWriteableRegistry = new NamedWriteableRegistry(ClusterModule.getNamedWriteables()); - DiscoveryNode masterNode = randomNode("master"); + DiscoveryNode clusterManagerNode = randomNode("master"); DiscoveryNode otherNode = randomNode("other"); - DiscoveryNodes discoveryNodes = DiscoveryNodes.builder().add(masterNode).add(otherNode).localNodeId(masterNode.getId()).build(); + DiscoveryNodes discoveryNodes = DiscoveryNodes.builder() + .add(clusterManagerNode) + .add(otherNode) + .localNodeId(clusterManagerNode.getId()) + .build(); ClusterState clusterState = ClusterState.builder(new ClusterName("test")).nodes(discoveryNodes).build(); ClusterState clusterStateFromDiffs = ClusterState.Builder.fromBytes( ClusterState.Builder.toBytes(clusterState), diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/MinimumMasterNodesIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/MinimumMasterNodesIT.java index c3dc686921eb6..60b14cc32efa1 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/MinimumMasterNodesIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/MinimumMasterNodesIT.java @@ -309,11 +309,11 @@ public void testThreeNodesNoMasterBlock() throws Exception { assertHitCount(client().prepareSearch().setSize(0).setQuery(QueryBuilders.matchAllQuery()).execute().actionGet(), 100); } - List nonMasterNodes = new ArrayList<>( + List nonClusterManagerNodes = new ArrayList<>( Sets.difference(Sets.newHashSet(internalCluster().getNodeNames()), Collections.singleton(internalCluster().getMasterName())) ); - Settings nonMasterDataPathSettings1 = internalCluster().dataPathSettings(nonMasterNodes.get(0)); - Settings nonMasterDataPathSettings2 = internalCluster().dataPathSettings(nonMasterNodes.get(1)); + Settings nonMasterDataPathSettings1 = internalCluster().dataPathSettings(nonClusterManagerNodes.get(0)); + Settings nonMasterDataPathSettings2 = internalCluster().dataPathSettings(nonClusterManagerNodes.get(1)); internalCluster().stopRandomNonMasterNode(); internalCluster().stopRandomNonMasterNode(); @@ -393,7 +393,7 @@ public void onFailure(String source, Exception e) { // otherwise persistent setting (which is a part of accepted state on old master) will be propagated to other nodes logger.debug("--> wait for master to be elected in major partition"); assertBusy(() -> { - DiscoveryNode masterNode = internalCluster().client(randomFrom(otherNodes)) + DiscoveryNode clusterManagerNode = internalCluster().client(randomFrom(otherNodes)) .admin() .cluster() .prepareState() @@ -402,8 +402,8 @@ public void onFailure(String source, Exception e) { .getState() .nodes() .getMasterNode(); - assertThat(masterNode, notNullValue()); - assertThat(masterNode.getName(), not(equalTo(master))); + assertThat(clusterManagerNode, notNullValue()); + assertThat(clusterManagerNode.getName(), not(equalTo(master))); }); partition.stopDisrupting(); diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/UnsafeBootstrapAndDetachCommandIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/UnsafeBootstrapAndDetachCommandIT.java index 1447379b93ec8..8f574b4c60bd5 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/UnsafeBootstrapAndDetachCommandIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/UnsafeBootstrapAndDetachCommandIT.java @@ -479,12 +479,12 @@ public boolean clearData(String nodeName) { public void testNoInitialBootstrapAfterDetach() throws Exception { internalCluster().setBootstrapMasterNodeIndex(0); - String masterNode = internalCluster().startMasterOnlyNode(); - Settings masterNodeDataPathSettings = internalCluster().dataPathSettings(masterNode); + String clusterManagerNode = internalCluster().startMasterOnlyNode(); + Settings clusterManagerNodeDataPathSettings = internalCluster().dataPathSettings(clusterManagerNode); internalCluster().stopCurrentMasterNode(); final Environment environment = TestEnvironment.newEnvironment( - Settings.builder().put(internalCluster().getDefaultSettings()).put(masterNodeDataPathSettings).build() + Settings.builder().put(internalCluster().getDefaultSettings()).put(clusterManagerNodeDataPathSettings).build() ); detachCluster(environment); @@ -492,7 +492,7 @@ public void testNoInitialBootstrapAfterDetach() throws Exception { Settings.builder() // give the cluster 2 seconds to elect the master (it should not) .put(DiscoverySettings.INITIAL_STATE_TIMEOUT_SETTING.getKey(), "2s") - .put(masterNodeDataPathSettings) + .put(clusterManagerNodeDataPathSettings) .build() ); @@ -504,8 +504,8 @@ public void testNoInitialBootstrapAfterDetach() throws Exception { public void testCanRunUnsafeBootstrapAfterErroneousDetachWithoutLoosingMetadata() throws Exception { internalCluster().setBootstrapMasterNodeIndex(0); - String masterNode = internalCluster().startMasterOnlyNode(); - Settings masterNodeDataPathSettings = internalCluster().dataPathSettings(masterNode); + String clusterManagerNode = internalCluster().startMasterOnlyNode(); + Settings clusterManagerNodeDataPathSettings = internalCluster().dataPathSettings(clusterManagerNode); ClusterUpdateSettingsRequest req = new ClusterUpdateSettingsRequest().persistentSettings( Settings.builder().put(INDICES_RECOVERY_MAX_BYTES_PER_SEC_SETTING.getKey(), "1234kb") ); @@ -514,17 +514,17 @@ public void testCanRunUnsafeBootstrapAfterErroneousDetachWithoutLoosingMetadata( ClusterState state = internalCluster().client().admin().cluster().prepareState().execute().actionGet().getState(); assertThat(state.metadata().persistentSettings().get(INDICES_RECOVERY_MAX_BYTES_PER_SEC_SETTING.getKey()), equalTo("1234kb")); - ensureReadOnlyBlock(false, masterNode); + ensureReadOnlyBlock(false, clusterManagerNode); internalCluster().stopCurrentMasterNode(); final Environment environment = TestEnvironment.newEnvironment( - Settings.builder().put(internalCluster().getDefaultSettings()).put(masterNodeDataPathSettings).build() + Settings.builder().put(internalCluster().getDefaultSettings()).put(clusterManagerNodeDataPathSettings).build() ); detachCluster(environment); unsafeBootstrap(environment); // read-only block will remain same as one before bootstrap, in this case it is false - String masterNode2 = internalCluster().startMasterOnlyNode(masterNodeDataPathSettings); + String masterNode2 = internalCluster().startMasterOnlyNode(clusterManagerNodeDataPathSettings); ensureGreen(); ensureReadOnlyBlock(false, masterNode2); @@ -534,8 +534,8 @@ public void testCanRunUnsafeBootstrapAfterErroneousDetachWithoutLoosingMetadata( public void testUnsafeBootstrapWithApplyClusterReadOnlyBlockAsFalse() throws Exception { internalCluster().setBootstrapMasterNodeIndex(0); - String masterNode = internalCluster().startMasterOnlyNode(); - Settings masterNodeDataPathSettings = internalCluster().dataPathSettings(masterNode); + String clusterManagerNode = internalCluster().startMasterOnlyNode(); + Settings clusterManagerNodeDataPathSettings = internalCluster().dataPathSettings(clusterManagerNode); ClusterUpdateSettingsRequest req = new ClusterUpdateSettingsRequest().persistentSettings( Settings.builder().put(INDICES_RECOVERY_MAX_BYTES_PER_SEC_SETTING.getKey(), "1234kb") ); @@ -544,18 +544,18 @@ public void testUnsafeBootstrapWithApplyClusterReadOnlyBlockAsFalse() throws Exc ClusterState state = internalCluster().client().admin().cluster().prepareState().execute().actionGet().getState(); assertThat(state.metadata().persistentSettings().get(INDICES_RECOVERY_MAX_BYTES_PER_SEC_SETTING.getKey()), equalTo("1234kb")); - ensureReadOnlyBlock(false, masterNode); + ensureReadOnlyBlock(false, clusterManagerNode); internalCluster().stopCurrentMasterNode(); final Environment environment = TestEnvironment.newEnvironment( - Settings.builder().put(internalCluster().getDefaultSettings()).put(masterNodeDataPathSettings).build() + Settings.builder().put(internalCluster().getDefaultSettings()).put(clusterManagerNodeDataPathSettings).build() ); unsafeBootstrap(environment, false, false); - String masterNode2 = internalCluster().startMasterOnlyNode(masterNodeDataPathSettings); + String clusterManagerNode2 = internalCluster().startMasterOnlyNode(clusterManagerNodeDataPathSettings); ensureGreen(); - ensureReadOnlyBlock(false, masterNode2); + ensureReadOnlyBlock(false, clusterManagerNode2); state = internalCluster().client().admin().cluster().prepareState().execute().actionGet().getState(); assertThat(state.metadata().settings().get(INDICES_RECOVERY_MAX_BYTES_PER_SEC_SETTING.getKey()), equalTo("1234kb")); diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/ZenDiscoveryIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/ZenDiscoveryIT.java index 1baac9071110a..9df3a127899f2 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/ZenDiscoveryIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/ZenDiscoveryIT.java @@ -106,10 +106,10 @@ public void testNoShardRelocationsOccurWhenElectedMasterNodeFails() throws Excep } public void testHandleNodeJoin_incompatibleClusterState() throws InterruptedException, ExecutionException, TimeoutException { - String masterNode = internalCluster().startMasterOnlyNode(); + String clusterManagerNode = internalCluster().startMasterOnlyNode(); String node1 = internalCluster().startNode(); ClusterService clusterService = internalCluster().getInstance(ClusterService.class, node1); - Coordinator coordinator = (Coordinator) internalCluster().getInstance(Discovery.class, masterNode); + Coordinator coordinator = (Coordinator) internalCluster().getInstance(Discovery.class, clusterManagerNode); final ClusterState state = clusterService.state(); Metadata.Builder mdBuilder = Metadata.builder(state.metadata()); mdBuilder.putCustom(CustomMetadata.TYPE, new CustomMetadata("data")); diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/routing/AllocationIdIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/routing/AllocationIdIT.java index a20e944caebb2..a1b9be91c3f5f 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/routing/AllocationIdIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/routing/AllocationIdIT.java @@ -100,7 +100,7 @@ public void testFailedRecoveryOnAllocateStalePrimaryRequiresAnotherAllocateStale // initial set up final String indexName = "index42"; - final String master = internalCluster().startMasterOnlyNode(); + final String clusterManager = internalCluster().startMasterOnlyNode(); String node1 = internalCluster().startNode(); createIndex( indexName, diff --git a/server/src/internalClusterTest/java/org/opensearch/discovery/ClusterDisruptionIT.java b/server/src/internalClusterTest/java/org/opensearch/discovery/ClusterDisruptionIT.java index ceec1315a9d59..0bbd1ab9799f1 100644 --- a/server/src/internalClusterTest/java/org/opensearch/discovery/ClusterDisruptionIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/discovery/ClusterDisruptionIT.java @@ -338,26 +338,26 @@ public void testRejoinDocumentExistsInAllShardCopies() throws Exception { // simulate handling of sending shard failure during an isolation public void testSendingShardFailure() throws Exception { List nodes = startCluster(3); - String masterNode = internalCluster().getMasterName(); - List nonMasterNodes = nodes.stream().filter(node -> !node.equals(masterNode)).collect(Collectors.toList()); - String nonMasterNode = randomFrom(nonMasterNodes); + String clusterManagerNode = internalCluster().getMasterName(); + List nonClusterManagerNodes = nodes.stream().filter(node -> !node.equals(clusterManagerNode)).collect(Collectors.toList()); + String nonClusterManagerNode = randomFrom(nonClusterManagerNodes); assertAcked( prepareCreate("test").setSettings( Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 3).put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 2) ) ); ensureGreen(); - String nonMasterNodeId = internalCluster().clusterService(nonMasterNode).localNode().getId(); + String nonClusterManagerNodeId = internalCluster().clusterService(nonClusterManagerNode).localNode().getId(); // fail a random shard ShardRouting failedShard = randomFrom( - clusterService().state().getRoutingNodes().node(nonMasterNodeId).shardsWithState(ShardRoutingState.STARTED) + clusterService().state().getRoutingNodes().node(nonClusterManagerNodeId).shardsWithState(ShardRoutingState.STARTED) ); - ShardStateAction service = internalCluster().getInstance(ShardStateAction.class, nonMasterNode); + ShardStateAction service = internalCluster().getInstance(ShardStateAction.class, nonClusterManagerNode); CountDownLatch latch = new CountDownLatch(1); AtomicBoolean success = new AtomicBoolean(); - String isolatedNode = randomBoolean() ? masterNode : nonMasterNode; + String isolatedNode = randomBoolean() ? clusterManagerNode : nonClusterManagerNode; TwoPartitions partitions = isolateNode(isolatedNode); // we cannot use the NetworkUnresponsive disruption type here as it will swallow the "shard failed" request, calling neither // onSuccess nor onFailure on the provided listener. @@ -385,10 +385,10 @@ public void onFailure(Exception e) { } ); - if (isolatedNode.equals(nonMasterNode)) { - assertNoMaster(nonMasterNode); + if (isolatedNode.equals(nonClusterManagerNode)) { + assertNoMaster(nonClusterManagerNode); } else { - ensureStableCluster(2, nonMasterNode); + ensureStableCluster(2, nonClusterManagerNode); } // heal the partition @@ -410,10 +410,10 @@ public void onFailure(Exception e) { } public void testCannotJoinIfMasterLostDataFolder() throws Exception { - String masterNode = internalCluster().startMasterOnlyNode(); + String clusterManagerNode = internalCluster().startMasterOnlyNode(); String dataNode = internalCluster().startDataOnlyNode(); - internalCluster().restartNode(masterNode, new InternalTestCluster.RestartCallback() { + internalCluster().restartNode(clusterManagerNode, new InternalTestCluster.RestartCallback() { @Override public boolean clearData(String nodeName) { return true; @@ -442,9 +442,9 @@ public boolean validateClusterForming() { }); assertBusy(() -> { - assertFalse(internalCluster().client(masterNode).admin().cluster().prepareHealth().get().isTimedOut()); + assertFalse(internalCluster().client(clusterManagerNode).admin().cluster().prepareHealth().get().isTimedOut()); assertTrue( - internalCluster().client(masterNode) + internalCluster().client(clusterManagerNode) .admin() .cluster() .prepareHealth() diff --git a/server/src/internalClusterTest/java/org/opensearch/discovery/DiscoveryDisruptionIT.java b/server/src/internalClusterTest/java/org/opensearch/discovery/DiscoveryDisruptionIT.java index 079aaa714a15c..8ae128f19a945 100644 --- a/server/src/internalClusterTest/java/org/opensearch/discovery/DiscoveryDisruptionIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/discovery/DiscoveryDisruptionIT.java @@ -64,29 +64,29 @@ public class DiscoveryDisruptionIT extends AbstractDisruptionTestCase { * Test cluster join with issues in cluster state publishing * */ public void testClusterJoinDespiteOfPublishingIssues() throws Exception { - String masterNode = internalCluster().startMasterOnlyNode(); - String nonMasterNode = internalCluster().startDataOnlyNode(); + String clusterManagerNode = internalCluster().startMasterOnlyNode(); + String nonClusterManagerNode = internalCluster().startDataOnlyNode(); - DiscoveryNodes discoveryNodes = internalCluster().getInstance(ClusterService.class, nonMasterNode).state().nodes(); + DiscoveryNodes discoveryNodes = internalCluster().getInstance(ClusterService.class, nonClusterManagerNode).state().nodes(); TransportService masterTranspotService = internalCluster().getInstance( TransportService.class, discoveryNodes.getMasterNode().getName() ); - logger.info("blocking requests from non master [{}] to master [{}]", nonMasterNode, masterNode); + logger.info("blocking requests from non master [{}] to master [{}]", nonClusterManagerNode, clusterManagerNode); MockTransportService nonMasterTransportService = (MockTransportService) internalCluster().getInstance( TransportService.class, - nonMasterNode + nonClusterManagerNode ); nonMasterTransportService.addFailToSendNoConnectRule(masterTranspotService); - assertNoMaster(nonMasterNode); + assertNoMaster(nonClusterManagerNode); - logger.info("blocking cluster state publishing from master [{}] to non master [{}]", masterNode, nonMasterNode); + logger.info("blocking cluster state publishing from master [{}] to non master [{}]", clusterManagerNode, nonClusterManagerNode); MockTransportService masterTransportService = (MockTransportService) internalCluster().getInstance( TransportService.class, - masterNode + clusterManagerNode ); TransportService localTransportService = internalCluster().getInstance( TransportService.class, @@ -98,7 +98,11 @@ public void testClusterJoinDespiteOfPublishingIssues() throws Exception { masterTransportService.addFailToSendNoConnectRule(localTransportService, PublicationTransportHandler.COMMIT_STATE_ACTION_NAME); } - logger.info("allowing requests from non master [{}] to master [{}], waiting for two join request", nonMasterNode, masterNode); + logger.info( + "allowing requests from non master [{}] to master [{}], waiting for two join request", + nonClusterManagerNode, + clusterManagerNode + ); final CountDownLatch countDownLatch = new CountDownLatch(2); nonMasterTransportService.addSendBehavior(masterTransportService, (connection, requestId, action, request, options) -> { if (action.equals(JoinHelper.JOIN_ACTION_NAME)) { @@ -197,31 +201,31 @@ public void testElectMasterWithLatestVersion() throws Exception { public void testNodeNotReachableFromMaster() throws Exception { startCluster(3); - String masterNode = internalCluster().getMasterName(); - String nonMasterNode = null; - while (nonMasterNode == null) { - nonMasterNode = randomFrom(internalCluster().getNodeNames()); - if (nonMasterNode.equals(masterNode)) { - nonMasterNode = null; + String clusterManagerNode = internalCluster().getMasterName(); + String nonClusterManagerNode = null; + while (nonClusterManagerNode == null) { + nonClusterManagerNode = randomFrom(internalCluster().getNodeNames()); + if (nonClusterManagerNode.equals(clusterManagerNode)) { + nonClusterManagerNode = null; } } - logger.info("blocking request from master [{}] to [{}]", masterNode, nonMasterNode); + logger.info("blocking request from master [{}] to [{}]", clusterManagerNode, nonClusterManagerNode); MockTransportService masterTransportService = (MockTransportService) internalCluster().getInstance( TransportService.class, - masterNode + clusterManagerNode ); if (randomBoolean()) { - masterTransportService.addUnresponsiveRule(internalCluster().getInstance(TransportService.class, nonMasterNode)); + masterTransportService.addUnresponsiveRule(internalCluster().getInstance(TransportService.class, nonClusterManagerNode)); } else { - masterTransportService.addFailToSendNoConnectRule(internalCluster().getInstance(TransportService.class, nonMasterNode)); + masterTransportService.addFailToSendNoConnectRule(internalCluster().getInstance(TransportService.class, nonClusterManagerNode)); } - logger.info("waiting for [{}] to be removed from cluster", nonMasterNode); - ensureStableCluster(2, masterNode); + logger.info("waiting for [{}] to be removed from cluster", nonClusterManagerNode); + ensureStableCluster(2, clusterManagerNode); - logger.info("waiting for [{}] to have no master", nonMasterNode); - assertNoMaster(nonMasterNode); + logger.info("waiting for [{}] to have no master", nonClusterManagerNode); + assertNoMaster(nonClusterManagerNode); logger.info("healing partition and checking cluster reforms"); masterTransportService.clearAllRules(); diff --git a/server/src/internalClusterTest/java/org/opensearch/discovery/MasterDisruptionIT.java b/server/src/internalClusterTest/java/org/opensearch/discovery/MasterDisruptionIT.java index 14e7a26bb448e..041d665521e16 100644 --- a/server/src/internalClusterTest/java/org/opensearch/discovery/MasterDisruptionIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/discovery/MasterDisruptionIT.java @@ -71,33 +71,40 @@ public class MasterDisruptionIT extends AbstractDisruptionTestCase { public void testMasterNodeGCs() throws Exception { List nodes = startCluster(3); - String oldMasterNode = internalCluster().getMasterName(); + String oldClusterManagerNode = internalCluster().getMasterName(); // a very long GC, but it's OK as we remove the disruption when it has had an effect - SingleNodeDisruption masterNodeDisruption = new IntermittentLongGCDisruption(random(), oldMasterNode, 100, 200, 30000, 60000); + SingleNodeDisruption masterNodeDisruption = new IntermittentLongGCDisruption( + random(), + oldClusterManagerNode, + 100, + 200, + 30000, + 60000 + ); internalCluster().setDisruptionScheme(masterNodeDisruption); masterNodeDisruption.startDisrupting(); - Set oldNonMasterNodesSet = new HashSet<>(nodes); - oldNonMasterNodesSet.remove(oldMasterNode); + Set oldNonClusterManagerNodesSet = new HashSet<>(nodes); + oldNonClusterManagerNodesSet.remove(oldClusterManagerNode); - List oldNonMasterNodes = new ArrayList<>(oldNonMasterNodesSet); + List oldNonClusterManagerNodes = new ArrayList<>(oldNonClusterManagerNodesSet); - logger.info("waiting for nodes to de-elect master [{}]", oldMasterNode); - for (String node : oldNonMasterNodesSet) { - assertDifferentMaster(node, oldMasterNode); + logger.info("waiting for nodes to de-elect master [{}]", oldClusterManagerNode); + for (String node : oldNonClusterManagerNodesSet) { + assertDifferentMaster(node, oldClusterManagerNode); } logger.info("waiting for nodes to elect a new master"); - ensureStableCluster(2, oldNonMasterNodes.get(0)); + ensureStableCluster(2, oldNonClusterManagerNodes.get(0)); // restore GC masterNodeDisruption.stopDisrupting(); final TimeValue waitTime = new TimeValue(DISRUPTION_HEALING_OVERHEAD.millis() + masterNodeDisruption.expectedTimeToHeal().millis()); - ensureStableCluster(3, waitTime, false, oldNonMasterNodes.get(0)); + ensureStableCluster(3, waitTime, false, oldNonClusterManagerNodes.get(0)); // make sure all nodes agree on master String newMaster = internalCluster().getMasterName(); - assertThat(newMaster, not(equalTo(oldMasterNode))); + assertThat(newMaster, not(equalTo(oldClusterManagerNode))); assertMaster(newMaster, nodes); } diff --git a/server/src/internalClusterTest/java/org/opensearch/discovery/StableMasterDisruptionIT.java b/server/src/internalClusterTest/java/org/opensearch/discovery/StableMasterDisruptionIT.java index 77553ba713540..614c5a13c3253 100644 --- a/server/src/internalClusterTest/java/org/opensearch/discovery/StableMasterDisruptionIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/discovery/StableMasterDisruptionIT.java @@ -73,8 +73,8 @@ import static org.hamcrest.Matchers.equalTo; /** - * Tests relating to the loss of the master, but which work with the default fault detection settings which are rather lenient and will - * not detect a master failure too quickly. + * Tests relating to the loss of the cluster-manager, but which work with the default fault detection settings which are rather lenient and will + * not detect a cluster-manager failure too quickly. */ @OpenSearchIntegTestCase.ClusterScope(scope = OpenSearchIntegTestCase.Scope.TEST, numDataNodes = 0) public class StableMasterDisruptionIT extends OpenSearchIntegTestCase { @@ -228,9 +228,9 @@ public void testStaleMasterNotHijackingMajority() throws Exception { event.state(), event.previousState() ); - String previousMasterNodeName = previousMaster != null ? previousMaster.getName() : null; + String previousClusterManagerNodeName = previousMaster != null ? previousMaster.getName() : null; String currentMasterNodeName = currentMaster != null ? currentMaster.getName() : null; - masters.get(node).add(new Tuple<>(previousMasterNodeName, currentMasterNodeName)); + masters.get(node).add(new Tuple<>(previousClusterManagerNodeName, currentMasterNodeName)); } }); } diff --git a/server/src/internalClusterTest/java/org/opensearch/env/NodeRepurposeCommandIT.java b/server/src/internalClusterTest/java/org/opensearch/env/NodeRepurposeCommandIT.java index 2547333490f23..3803d9860e2d5 100644 --- a/server/src/internalClusterTest/java/org/opensearch/env/NodeRepurposeCommandIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/env/NodeRepurposeCommandIT.java @@ -56,7 +56,7 @@ public void testRepurpose() throws Exception { final String indexName = "test-repurpose"; logger.info("--> starting two nodes"); - final String masterNode = internalCluster().startMasterOnlyNode(); + final String clusterManagerNode = internalCluster().startMasterOnlyNode(); final String dataNode = internalCluster().startDataOnlyNode( Settings.builder().put(IndicesService.WRITE_DANGLING_INDICES_INFO_SETTING.getKey(), false).build() ); @@ -71,20 +71,20 @@ public void testRepurpose() throws Exception { assertTrue(client().prepareGet(indexName, "1").get().isExists()); - final Settings masterNodeDataPathSettings = internalCluster().dataPathSettings(masterNode); + final Settings clusterManagerNodeDataPathSettings = internalCluster().dataPathSettings(clusterManagerNode); final Settings dataNodeDataPathSettings = internalCluster().dataPathSettings(dataNode); - final Settings noMasterNoDataSettings = NodeRoles.removeRoles( + final Settings noClusterManagerNoDataSettings = NodeRoles.removeRoles( Collections.unmodifiableSet(new HashSet<>(Arrays.asList(DiscoveryNodeRole.DATA_ROLE, DiscoveryNodeRole.MASTER_ROLE))) ); - final Settings noMasterNoDataSettingsForMasterNode = Settings.builder() - .put(noMasterNoDataSettings) - .put(masterNodeDataPathSettings) + final Settings noClusterManagerNoDataSettingsForClusterManagerNode = Settings.builder() + .put(noClusterManagerNoDataSettings) + .put(clusterManagerNodeDataPathSettings) .build(); - final Settings noMasterNoDataSettingsForDataNode = Settings.builder() - .put(noMasterNoDataSettings) + final Settings noClusterManagerNoDataSettingsForDataNode = Settings.builder() + .put(noClusterManagerNoDataSettings) .put(dataNodeDataPathSettings) .build(); @@ -99,11 +99,11 @@ public void testRepurpose() throws Exception { ); logger.info("--> Repurposing node 1"); - executeRepurposeCommand(noMasterNoDataSettingsForDataNode, 1, 1); + executeRepurposeCommand(noClusterManagerNoDataSettingsForDataNode, 1, 1); OpenSearchException lockedException = expectThrows( OpenSearchException.class, - () -> executeRepurposeCommand(noMasterNoDataSettingsForMasterNode, 1, 1) + () -> executeRepurposeCommand(noClusterManagerNoDataSettingsForClusterManagerNode, 1, 1) ); assertThat(lockedException.getMessage(), containsString(NodeRepurposeCommand.FAILED_TO_OBTAIN_NODE_LOCK_MSG)); @@ -119,11 +119,11 @@ public void testRepurpose() throws Exception { internalCluster().stopRandomNode(s -> true); internalCluster().stopRandomNode(s -> true); - executeRepurposeCommand(noMasterNoDataSettingsForMasterNode, 1, 0); + executeRepurposeCommand(noClusterManagerNoDataSettingsForClusterManagerNode, 1, 0); // by restarting as master and data node, we can check that the index definition was really deleted and also that the tool // does not mess things up so much that the nodes cannot boot as master or data node any longer. - internalCluster().startMasterOnlyNode(masterNodeDataPathSettings); + internalCluster().startMasterOnlyNode(clusterManagerNodeDataPathSettings); internalCluster().startDataOnlyNode(dataNodeDataPathSettings); ensureGreen(); diff --git a/server/src/internalClusterTest/java/org/opensearch/indices/store/IndicesStoreIntegrationIT.java b/server/src/internalClusterTest/java/org/opensearch/indices/store/IndicesStoreIntegrationIT.java index b85afa80496d0..6ed9fab91a67d 100644 --- a/server/src/internalClusterTest/java/org/opensearch/indices/store/IndicesStoreIntegrationIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/indices/store/IndicesStoreIntegrationIT.java @@ -459,11 +459,11 @@ public void testShardActiveElsewhereDoesNotDeleteAnother() throws Exception { public void testShardActiveElseWhere() throws Exception { List nodes = internalCluster().startNodes(2); - final String masterNode = internalCluster().getMasterName(); - final String nonMasterNode = nodes.get(0).equals(masterNode) ? nodes.get(1) : nodes.get(0); + final String clusterManagerNode = internalCluster().getMasterName(); + final String nonClusterManagerNode = nodes.get(0).equals(clusterManagerNode) ? nodes.get(1) : nodes.get(0); - final String masterId = internalCluster().clusterService(masterNode).localNode().getId(); - final String nonMasterId = internalCluster().clusterService(nonMasterNode).localNode().getId(); + final String clusterManagerId = internalCluster().clusterService(clusterManagerNode).localNode().getId(); + final String nonClusterManagerId = internalCluster().clusterService(nonClusterManagerNode).localNode().getId(); final int numShards = scaledRandomIntBetween(2, 10); assertAcked( @@ -476,14 +476,14 @@ public void testShardActiveElseWhere() throws Exception { waitNoPendingTasksOnAll(); ClusterStateResponse stateResponse = client().admin().cluster().prepareState().get(); final Index index = stateResponse.getState().metadata().index("test").getIndex(); - RoutingNode routingNode = stateResponse.getState().getRoutingNodes().node(nonMasterId); + RoutingNode routingNode = stateResponse.getState().getRoutingNodes().node(nonClusterManagerId); final int[] node2Shards = new int[routingNode.numberOfOwningShards()]; int i = 0; for (ShardRouting shardRouting : routingNode) { node2Shards[i] = shardRouting.shardId().id(); i++; } - logger.info("Node [{}] has shards: {}", nonMasterNode, Arrays.toString(node2Shards)); + logger.info("Node [{}] has shards: {}", nonClusterManagerNode, Arrays.toString(node2Shards)); // disable relocations when we do this, to make sure the shards are not relocated from node2 // due to rebalancing, and delete its content @@ -496,14 +496,14 @@ public void testShardActiveElseWhere() throws Exception { ) .get(); - ClusterApplierService clusterApplierService = internalCluster().getInstance(ClusterService.class, nonMasterNode) + ClusterApplierService clusterApplierService = internalCluster().getInstance(ClusterService.class, nonClusterManagerNode) .getClusterApplierService(); ClusterState currentState = clusterApplierService.state(); IndexRoutingTable.Builder indexRoutingTableBuilder = IndexRoutingTable.builder(index); for (int j = 0; j < numShards; j++) { indexRoutingTableBuilder.addIndexShard( new IndexShardRoutingTable.Builder(new ShardId(index, j)).addShard( - TestShardRouting.newShardRouting("test", j, masterId, true, ShardRoutingState.STARTED) + TestShardRouting.newShardRouting("test", j, clusterManagerId, true, ShardRoutingState.STARTED) ).build() ); } @@ -528,7 +528,7 @@ public void onFailure(String source, Exception e) { waitNoPendingTasksOnAll(); logger.info("Checking if shards aren't removed"); for (int shard : node2Shards) { - assertShardExists(nonMasterNode, index, shard); + assertShardExists(nonClusterManagerNode, index, shard); } } diff --git a/server/src/internalClusterTest/java/org/opensearch/snapshots/CloneSnapshotIT.java b/server/src/internalClusterTest/java/org/opensearch/snapshots/CloneSnapshotIT.java index 137be2187fe57..6e93e416b532b 100644 --- a/server/src/internalClusterTest/java/org/opensearch/snapshots/CloneSnapshotIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/snapshots/CloneSnapshotIT.java @@ -172,7 +172,7 @@ public void testCloneSnapshotIndex() throws Exception { } public void testClonePreventsSnapshotDelete() throws Exception { - final String masterName = internalCluster().startMasterOnlyNode(); + final String clusterManagerName = internalCluster().startMasterOnlyNode(); internalCluster().startDataOnlyNode(); final String repoName = "repo-name"; createRepository(repoName, "mock"); @@ -185,9 +185,9 @@ public void testClonePreventsSnapshotDelete() throws Exception { indexRandomDocs(indexName, randomIntBetween(20, 100)); final String targetSnapshot = "target-snapshot"; - blockNodeOnAnyFiles(repoName, masterName); + blockNodeOnAnyFiles(repoName, clusterManagerName); final ActionFuture cloneFuture = startClone(repoName, sourceSnapshot, targetSnapshot, indexName); - waitForBlock(masterName, repoName, TimeValue.timeValueSeconds(30L)); + waitForBlock(clusterManagerName, repoName, TimeValue.timeValueSeconds(30L)); assertFalse(cloneFuture.isDone()); ConcurrentSnapshotExecutionException ex = expectThrows( @@ -196,7 +196,7 @@ public void testClonePreventsSnapshotDelete() throws Exception { ); assertThat(ex.getMessage(), containsString("cannot delete snapshot while it is being cloned")); - unblockNode(repoName, masterName); + unblockNode(repoName, clusterManagerName); assertAcked(cloneFuture.get()); final List status = clusterAdmin().prepareSnapshotStatus(repoName) .setSnapshots(sourceSnapshot, targetSnapshot) @@ -293,7 +293,7 @@ public void testLongRunningSnapshotAllowsConcurrentClone() throws Exception { } public void testDeletePreventsClone() throws Exception { - final String masterName = internalCluster().startMasterOnlyNode(); + final String clusterManagerName = internalCluster().startMasterOnlyNode(); internalCluster().startDataOnlyNode(); final String repoName = "repo-name"; createRepository(repoName, "mock"); @@ -306,9 +306,9 @@ public void testDeletePreventsClone() throws Exception { indexRandomDocs(indexName, randomIntBetween(20, 100)); final String targetSnapshot = "target-snapshot"; - blockNodeOnAnyFiles(repoName, masterName); + blockNodeOnAnyFiles(repoName, clusterManagerName); final ActionFuture deleteFuture = startDeleteSnapshot(repoName, sourceSnapshot); - waitForBlock(masterName, repoName, TimeValue.timeValueSeconds(30L)); + waitForBlock(clusterManagerName, repoName, TimeValue.timeValueSeconds(30L)); assertFalse(deleteFuture.isDone()); ConcurrentSnapshotExecutionException ex = expectThrows( @@ -317,7 +317,7 @@ public void testDeletePreventsClone() throws Exception { ); assertThat(ex.getMessage(), containsString("cannot clone from snapshot that is being deleted")); - unblockNode(repoName, masterName); + unblockNode(repoName, clusterManagerName); assertAcked(deleteFuture.get()); } @@ -546,7 +546,7 @@ public void testStartSnapshotWithSuccessfulShardClonePendingFinalization() throw } public void testStartCloneWithSuccessfulShardClonePendingFinalization() throws Exception { - final String masterName = internalCluster().startMasterOnlyNode(); + final String clusterManagerName = internalCluster().startMasterOnlyNode(); internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); @@ -560,14 +560,14 @@ public void testStartCloneWithSuccessfulShardClonePendingFinalization() throws E blockMasterOnWriteIndexFile(repoName); final String cloneName = "clone-blocked"; final ActionFuture blockedClone = startClone(repoName, sourceSnapshot, cloneName, indexName); - waitForBlock(masterName, repoName, TimeValue.timeValueSeconds(30L)); + waitForBlock(clusterManagerName, repoName, TimeValue.timeValueSeconds(30L)); awaitNumberOfSnapshotsInProgress(1); final String otherCloneName = "other-clone"; final ActionFuture otherClone = startClone(repoName, sourceSnapshot, otherCloneName, indexName); awaitNumberOfSnapshotsInProgress(2); assertFalse(blockedClone.isDone()); - unblockNode(repoName, masterName); - awaitNoMoreRunningOperations(masterName); + unblockNode(repoName, clusterManagerName); + awaitNoMoreRunningOperations(clusterManagerName); awaitMasterFinishRepoOperations(); assertAcked(blockedClone.get()); assertAcked(otherClone.get()); diff --git a/server/src/internalClusterTest/java/org/opensearch/snapshots/ConcurrentSnapshotsIT.java b/server/src/internalClusterTest/java/org/opensearch/snapshots/ConcurrentSnapshotsIT.java index 9adb0ff6260e8..f7b02e443d58b 100644 --- a/server/src/internalClusterTest/java/org/opensearch/snapshots/ConcurrentSnapshotsIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/snapshots/ConcurrentSnapshotsIT.java @@ -301,7 +301,7 @@ public void testMultipleReposAreIndependent3() throws Exception { } public void testSnapshotRunsAfterInProgressDelete() throws Exception { - final String masterNode = internalCluster().startMasterOnlyNode(); + final String clusterManagerNode = internalCluster().startMasterOnlyNode(); internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); @@ -314,11 +314,11 @@ public void testSnapshotRunsAfterInProgressDelete() throws Exception { blockMasterFromFinalizingSnapshotOnIndexFile(repoName); final ActionFuture deleteFuture = startDeleteSnapshot(repoName, firstSnapshot); - waitForBlock(masterNode, repoName, TimeValue.timeValueSeconds(30L)); + waitForBlock(clusterManagerNode, repoName, TimeValue.timeValueSeconds(30L)); final ActionFuture snapshotFuture = startFullSnapshot(repoName, "second-snapshot"); - unblockNode(repoName, masterNode); + unblockNode(repoName, clusterManagerNode); final UncategorizedExecutionException ex = expectThrows(UncategorizedExecutionException.class, deleteFuture::actionGet); assertThat(ex.getRootCause(), instanceOf(IOException.class)); @@ -571,7 +571,7 @@ public void testAssertMultipleSnapshotsAndPrimaryFailOver() throws Exception { } public void testQueuedDeletesWithFailures() throws Exception { - final String masterNode = internalCluster().startMasterOnlyNode(); + final String clusterManagerNode = internalCluster().startMasterOnlyNode(); internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); @@ -580,7 +580,7 @@ public void testQueuedDeletesWithFailures() throws Exception { blockMasterFromFinalizingSnapshotOnIndexFile(repoName); final ActionFuture firstDeleteFuture = startDeleteSnapshot(repoName, "*"); - waitForBlock(masterNode, repoName, TimeValue.timeValueSeconds(30L)); + waitForBlock(clusterManagerNode, repoName, TimeValue.timeValueSeconds(30L)); final ActionFuture snapshotFuture = startFullSnapshot(repoName, "snapshot-queued"); awaitNumberOfSnapshotsInProgress(1); @@ -588,7 +588,7 @@ public void testQueuedDeletesWithFailures() throws Exception { final ActionFuture secondDeleteFuture = startDeleteSnapshot(repoName, "*"); awaitNDeletionsInProgress(2); - unblockNode(repoName, masterNode); + unblockNode(repoName, clusterManagerNode); expectThrows(UncategorizedExecutionException.class, firstDeleteFuture::actionGet); // Second delete works out cleanly since the repo is unblocked now @@ -601,7 +601,7 @@ public void testQueuedDeletesWithFailures() throws Exception { } public void testQueuedDeletesWithOverlap() throws Exception { - final String masterNode = internalCluster().startMasterOnlyNode(); + final String clusterManagerNode = internalCluster().startMasterOnlyNode(); internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); @@ -615,7 +615,7 @@ public void testQueuedDeletesWithOverlap() throws Exception { final ActionFuture secondDeleteFuture = startDeleteSnapshot(repoName, "*"); awaitNDeletionsInProgress(2); - unblockNode(repoName, masterNode); + unblockNode(repoName, clusterManagerNode); assertThat(firstDeleteFuture.get().isAcknowledged(), is(true)); // Second delete works out cleanly since the repo is unblocked now @@ -878,7 +878,7 @@ public void testQueuedSnapshotOperationsAndBrokenRepoOnMasterFailOverMultipleRep } public void testMultipleSnapshotsQueuedAfterDelete() throws Exception { - final String masterNode = internalCluster().startMasterOnlyNode(); + final String clusterManagerNode = internalCluster().startMasterOnlyNode(); internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); @@ -889,7 +889,7 @@ public void testMultipleSnapshotsQueuedAfterDelete() throws Exception { final ActionFuture snapshotThree = startFullSnapshot(repoName, "snapshot-three"); final ActionFuture snapshotFour = startFullSnapshot(repoName, "snapshot-four"); - unblockNode(repoName, masterNode); + unblockNode(repoName, clusterManagerNode); assertSuccessful(snapshotThree); assertSuccessful(snapshotFour); @@ -897,7 +897,7 @@ public void testMultipleSnapshotsQueuedAfterDelete() throws Exception { } public void testMultiplePartialSnapshotsQueuedAfterDelete() throws Exception { - final String masterNode = internalCluster().startMasterOnlyNode(); + final String clusterManagerNode = internalCluster().startMasterOnlyNode(); internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); @@ -911,7 +911,7 @@ public void testMultiplePartialSnapshotsQueuedAfterDelete() throws Exception { awaitNumberOfSnapshotsInProgress(2); assertAcked(client().admin().indices().prepareDelete("index-two")); - unblockNode(repoName, masterNode); + unblockNode(repoName, clusterManagerNode); assertThat(snapshotThree.get().getSnapshotInfo().state(), is(SnapshotState.PARTIAL)); assertThat(snapshotFour.get().getSnapshotInfo().state(), is(SnapshotState.PARTIAL)); @@ -977,7 +977,7 @@ public void testQueuedSnapshotsWaitingForShardReady() throws Exception { } public void testBackToBackQueuedDeletes() throws Exception { - final String masterName = internalCluster().startMasterOnlyNode(); + final String clusterManagerName = internalCluster().startMasterOnlyNode(); internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); @@ -990,7 +990,7 @@ public void testBackToBackQueuedDeletes() throws Exception { final ActionFuture deleteSnapshotTwo = startDeleteSnapshot(repoName, snapshotTwo); awaitNDeletionsInProgress(2); - unblockNode(repoName, masterName); + unblockNode(repoName, clusterManagerName); assertAcked(deleteSnapshotOne.get()); assertAcked(deleteSnapshotTwo.get()); @@ -1024,7 +1024,7 @@ public void testQueuedOperationsAfterFinalizationFailure() throws Exception { } public void testStartDeleteDuringFinalizationCleanup() throws Exception { - final String masterName = internalCluster().startMasterOnlyNode(); + final String clusterManagerName = internalCluster().startMasterOnlyNode(); internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); @@ -1033,35 +1033,35 @@ public void testStartDeleteDuringFinalizationCleanup() throws Exception { final String snapshotName = "snap-name"; blockMasterFromDeletingIndexNFile(repoName); final ActionFuture snapshotFuture = startFullSnapshot(repoName, snapshotName); - waitForBlock(masterName, repoName, TimeValue.timeValueSeconds(30L)); + waitForBlock(clusterManagerName, repoName, TimeValue.timeValueSeconds(30L)); final ActionFuture deleteFuture = startDeleteSnapshot(repoName, snapshotName); awaitNDeletionsInProgress(1); - unblockNode(repoName, masterName); + unblockNode(repoName, clusterManagerName); assertSuccessful(snapshotFuture); assertAcked(deleteFuture.get(30L, TimeUnit.SECONDS)); } public void testEquivalentDeletesAreDeduplicated() throws Exception { - final String masterName = internalCluster().startMasterOnlyNode(); + final String clusterManagerName = internalCluster().startMasterOnlyNode(); internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); createIndexWithContent("index-test"); createNSnapshots(repoName, randomIntBetween(1, 5)); - blockNodeOnAnyFiles(repoName, masterName); + blockNodeOnAnyFiles(repoName, clusterManagerName); final int deletes = randomIntBetween(2, 10); final List> deleteResponses = new ArrayList<>(deletes); for (int i = 0; i < deletes; ++i) { deleteResponses.add(client().admin().cluster().prepareDeleteSnapshot(repoName, "*").execute()); } - waitForBlock(masterName, repoName, TimeValue.timeValueSeconds(30L)); + waitForBlock(clusterManagerName, repoName, TimeValue.timeValueSeconds(30L)); awaitNDeletionsInProgress(1); for (ActionFuture deleteResponse : deleteResponses) { assertFalse(deleteResponse.isDone()); } awaitNDeletionsInProgress(1); - unblockNode(repoName, masterName); + unblockNode(repoName, clusterManagerName); for (ActionFuture deleteResponse : deleteResponses) { assertAcked(deleteResponse.get()); } @@ -1219,7 +1219,7 @@ public void testMasterFailoverAndMultipleQueuedUpSnapshotsAcrossTwoRepos() throw } public void testConcurrentOperationsLimit() throws Exception { - final String masterName = internalCluster().startMasterOnlyNode(); + final String clusterManagerName = internalCluster().startMasterOnlyNode(); internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); @@ -1237,7 +1237,7 @@ public void testConcurrentOperationsLimit() throws Exception { ); final List snapshotNames = createNSnapshots(repoName, limitToTest + 1); - blockNodeOnAnyFiles(repoName, masterName); + blockNodeOnAnyFiles(repoName, clusterManagerName); int blockedSnapshots = 0; boolean blockedDelete = false; final List> snapshotFutures = new ArrayList<>(); @@ -1255,7 +1255,7 @@ public void testConcurrentOperationsLimit() throws Exception { if (blockedDelete) { awaitNDeletionsInProgress(1); } - waitForBlock(masterName, repoName, TimeValue.timeValueSeconds(30L)); + waitForBlock(clusterManagerName, repoName, TimeValue.timeValueSeconds(30L)); final String expectedFailureMessage = "Cannot start another operation, already running [" + limitToTest @@ -1275,7 +1275,7 @@ public void testConcurrentOperationsLimit() throws Exception { assertThat(csen2.getMessage(), containsString(expectedFailureMessage)); } - unblockNode(repoName, masterName); + unblockNode(repoName, clusterManagerName); if (deleteFuture != null) { assertAcked(deleteFuture.get()); } @@ -1322,16 +1322,16 @@ public void testConcurrentSnapshotWorksWithOldVersionRepo() throws Exception { } public void testQueuedDeleteAfterFinalizationFailure() throws Exception { - final String masterNode = internalCluster().startMasterOnlyNode(); + final String clusterManagerNode = internalCluster().startMasterOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); blockMasterFromFinalizingSnapshotOnIndexFile(repoName); final String snapshotName = "snap-1"; final ActionFuture snapshotFuture = startFullSnapshot(repoName, snapshotName); - waitForBlock(masterNode, repoName, TimeValue.timeValueSeconds(30L)); + waitForBlock(clusterManagerNode, repoName, TimeValue.timeValueSeconds(30L)); final ActionFuture deleteFuture = startDeleteSnapshot(repoName, snapshotName); awaitNDeletionsInProgress(1); - unblockNode(repoName, masterNode); + unblockNode(repoName, clusterManagerNode); assertAcked(deleteFuture.get()); final SnapshotException sne = expectThrows(SnapshotException.class, snapshotFuture::actionGet); assertThat(sne.getCause().getMessage(), containsString("exception after block")); @@ -1365,7 +1365,7 @@ public void testAbortNotStartedSnapshotWithoutIO() throws Exception { } public void testStartWithSuccessfulShardSnapshotPendingFinalization() throws Exception { - final String masterName = internalCluster().startMasterOnlyNode(); + final String clusterManagerName = internalCluster().startMasterOnlyNode(); final String dataNode = internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); @@ -1375,13 +1375,13 @@ public void testStartWithSuccessfulShardSnapshotPendingFinalization() throws Exc blockMasterOnWriteIndexFile(repoName); final ActionFuture blockedSnapshot = startFullSnapshot(repoName, "snap-blocked"); - waitForBlock(masterName, repoName, TimeValue.timeValueSeconds(30L)); + waitForBlock(clusterManagerName, repoName, TimeValue.timeValueSeconds(30L)); awaitNumberOfSnapshotsInProgress(1); blockNodeOnAnyFiles(repoName, dataNode); final ActionFuture otherSnapshot = startFullSnapshot(repoName, "other-snapshot"); awaitNumberOfSnapshotsInProgress(2); assertFalse(blockedSnapshot.isDone()); - unblockNode(repoName, masterName); + unblockNode(repoName, clusterManagerName); awaitNumberOfSnapshotsInProgress(1); awaitMasterFinishRepoOperations(); diff --git a/server/src/internalClusterTest/java/org/opensearch/snapshots/DedicatedClusterSnapshotRestoreIT.java b/server/src/internalClusterTest/java/org/opensearch/snapshots/DedicatedClusterSnapshotRestoreIT.java index 47d57e1260b5f..816cbfc1ac1b6 100644 --- a/server/src/internalClusterTest/java/org/opensearch/snapshots/DedicatedClusterSnapshotRestoreIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/snapshots/DedicatedClusterSnapshotRestoreIT.java @@ -1393,7 +1393,7 @@ public void testPartialSnapshotAllShardsMissing() throws Exception { * correctly by testing a snapshot name collision. */ public void testCreateSnapshotLegacyPath() throws Exception { - final String masterNode = internalCluster().startMasterOnlyNode(); + final String clusterManagerNode = internalCluster().startMasterOnlyNode(); internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "fs"); @@ -1403,7 +1403,7 @@ public void testCreateSnapshotLegacyPath() throws Exception { final Snapshot snapshot1 = PlainActionFuture.get( f -> snapshotsService.createSnapshotLegacy(new CreateSnapshotRequest(repoName, "snap-1"), f) ); - awaitNoMoreRunningOperations(masterNode); + awaitNoMoreRunningOperations(clusterManagerNode); final InvalidSnapshotNameException sne = expectThrows( InvalidSnapshotNameException.class, From c63b9284b00d47f9b2c6a810584189d5fad61fb6 Mon Sep 17 00:00:00 2001 From: Tianli Feng Date: Tue, 10 May 2022 17:05:55 -0700 Subject: [PATCH 2/6] Replace 'master' terminology with 'cluster manager' in test directory Signed-off-by: Tianli Feng --- .../ingest/common/IngestRestartIT.java | 2 +- .../discovery/gce/GceDiscoverTests.java | 2 +- .../action/admin/ClientTimeoutIT.java | 10 ++-- .../ClusterAllocationExplainIT.java | 6 +-- .../admin/cluster/node/tasks/TasksIT.java | 2 +- ...ansportClusterStateActionDisruptionIT.java | 38 +++++++------- .../admin/cluster/stats/ClusterStatsIT.java | 12 ++--- .../cluster/SpecificMasterNodesIT.java | 8 +-- .../coordination/RareClusterStateIT.java | 2 +- .../UnsafeBootstrapAndDetachCommandIT.java | 20 ++++---- .../cluster/coordination/ZenDiscoveryIT.java | 6 +-- .../cluster/routing/AllocationIdIT.java | 2 +- .../cluster/routing/PrimaryAllocationIT.java | 28 +++++------ .../decider/DiskThresholdDeciderIT.java | 4 +- .../ClusterDisruptionCleanSettingsIT.java | 2 +- .../discovery/ClusterDisruptionIT.java | 2 +- .../discovery/DiscoveryDisruptionIT.java | 2 +- .../env/NodeRepurposeCommandIT.java | 4 +- .../gateway/GatewayIndexStateIT.java | 2 +- .../opensearch/gateway/MetadataNodesIT.java | 6 +-- .../gateway/RecoverAfterNodesIT.java | 10 ++-- .../gateway/RecoveryFromGatewayIT.java | 2 +- .../gateway/ReplicaShardAllocatorIT.java | 6 +-- .../PeerRecoveryRetentionLeaseCreationIT.java | 2 +- .../RemoveCorruptedShardDataCommandIT.java | 2 +- .../DedicatedMasterGetFieldMappingIT.java | 2 +- .../indices/recovery/IndexRecoveryIT.java | 6 +-- .../store/IndicesStoreIntegrationIT.java | 2 +- .../org/opensearch/ingest/IngestClientIT.java | 6 +-- .../recovery/FullRollingRestartIT.java | 2 +- .../snapshots/AbortedRestoreIT.java | 2 +- .../snapshots/BlobStoreIncrementalityIT.java | 4 +- .../opensearch/snapshots/CloneSnapshotIT.java | 26 +++++----- .../snapshots/ConcurrentSnapshotsIT.java | 50 +++++++++---------- .../DedicatedClusterSnapshotRestoreIT.java | 14 +++--- .../snapshots/MultiClusterRepoAccessIT.java | 4 +- .../snapshots/SnapshotShardsServiceIT.java | 2 +- .../DelayedAllocationServiceTests.java | 2 +- .../allocation/AllocationCommandsTests.java | 4 +- .../NodeVersionAllocationDeciderTests.java | 12 ++--- .../allocation/SameShardRoutingTests.java | 6 +-- .../decider/DiskThresholdDeciderTests.java | 4 +- .../IncrementalClusterStateWriterTests.java | 4 +- .../transport/RemoteClusterServiceTests.java | 4 +- .../ClusterStateCreationUtils.java | 18 +++---- .../cluster/OpenSearchAllocationTestCase.java | 8 +-- .../AbstractCoordinatorTestCase.java | 24 ++++----- .../opensearch/test/InternalTestCluster.java | 48 +++++++++--------- .../java/org/opensearch/test/NodeRoles.java | 6 +-- .../test/test/InternalTestClusterIT.java | 2 +- .../test/test/InternalTestClusterTests.java | 44 ++++++++-------- 51 files changed, 244 insertions(+), 244 deletions(-) diff --git a/modules/ingest-common/src/internalClusterTest/java/org/opensearch/ingest/common/IngestRestartIT.java b/modules/ingest-common/src/internalClusterTest/java/org/opensearch/ingest/common/IngestRestartIT.java index aeaa7246f33b8..c662843b91ebb 100644 --- a/modules/ingest-common/src/internalClusterTest/java/org/opensearch/ingest/common/IngestRestartIT.java +++ b/modules/ingest-common/src/internalClusterTest/java/org/opensearch/ingest/common/IngestRestartIT.java @@ -86,7 +86,7 @@ protected Map, Object>> pluginScripts() { public void testFailureInConditionalProcessor() { internalCluster().ensureAtLeastNumDataNodes(1); - internalCluster().startMasterOnlyNode(); + internalCluster().startClusterManagerOnlyNode(); final String pipelineId = "foo"; client().admin() .cluster() diff --git a/plugins/discovery-gce/src/internalClusterTest/java/org/opensearch/discovery/gce/GceDiscoverTests.java b/plugins/discovery-gce/src/internalClusterTest/java/org/opensearch/discovery/gce/GceDiscoverTests.java index 815537b534586..60293614254c5 100644 --- a/plugins/discovery-gce/src/internalClusterTest/java/org/opensearch/discovery/gce/GceDiscoverTests.java +++ b/plugins/discovery-gce/src/internalClusterTest/java/org/opensearch/discovery/gce/GceDiscoverTests.java @@ -86,7 +86,7 @@ protected Settings nodeSettings(int nodeOrdinal) { public void testJoin() { // start master node - final String masterNode = internalCluster().startMasterOnlyNode(); + final String masterNode = internalCluster().startClusterManagerOnlyNode(); registerGceNode(masterNode); ClusterStateResponse clusterStateResponse = client(masterNode).admin() diff --git a/server/src/internalClusterTest/java/org/opensearch/action/admin/ClientTimeoutIT.java b/server/src/internalClusterTest/java/org/opensearch/action/admin/ClientTimeoutIT.java index e228626471b98..3b56c07cb10c8 100644 --- a/server/src/internalClusterTest/java/org/opensearch/action/admin/ClientTimeoutIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/action/admin/ClientTimeoutIT.java @@ -47,7 +47,7 @@ protected Collection> nodePlugins() { } public void testNodesInfoTimeout() { - String clusterManagerNode = internalCluster().startMasterOnlyNode(); + String clusterManagerNode = internalCluster().startClusterManagerOnlyNode(); String dataNode = internalCluster().startDataOnlyNode(); String anotherDataNode = internalCluster().startDataOnlyNode(); @@ -69,7 +69,7 @@ public void testNodesInfoTimeout() { } public void testNodesStatsTimeout() { - String clusterManagerNode = internalCluster().startMasterOnlyNode(); + String clusterManagerNode = internalCluster().startClusterManagerOnlyNode(); String dataNode = internalCluster().startDataOnlyNode(); String anotherDataNode = internalCluster().startDataOnlyNode(); TimeValue timeout = TimeValue.timeValueMillis(1000); @@ -91,7 +91,7 @@ public void testNodesStatsTimeout() { } public void testListTasksTimeout() { - String clusterManagerNode = internalCluster().startMasterOnlyNode(); + String clusterManagerNode = internalCluster().startClusterManagerOnlyNode(); String dataNode = internalCluster().startDataOnlyNode(); String anotherDataNode = internalCluster().startDataOnlyNode(); TimeValue timeout = TimeValue.timeValueMillis(1000); @@ -108,7 +108,7 @@ public void testListTasksTimeout() { } public void testRecoveriesWithTimeout() { - internalCluster().startMasterOnlyNode(); + internalCluster().startClusterManagerOnlyNode(); String dataNode = internalCluster().startDataOnlyNode(); String anotherDataNode = internalCluster().startDataOnlyNode(); @@ -148,7 +148,7 @@ public void testRecoveriesWithTimeout() { } public void testStatsWithTimeout() { - internalCluster().startMasterOnlyNode(); + internalCluster().startClusterManagerOnlyNode(); String dataNode = internalCluster().startDataOnlyNode(); String anotherDataNode = internalCluster().startDataOnlyNode(); diff --git a/server/src/internalClusterTest/java/org/opensearch/action/admin/cluster/allocation/ClusterAllocationExplainIT.java b/server/src/internalClusterTest/java/org/opensearch/action/admin/cluster/allocation/ClusterAllocationExplainIT.java index 8c7e5378516bf..542d2069a21ce 100644 --- a/server/src/internalClusterTest/java/org/opensearch/action/admin/cluster/allocation/ClusterAllocationExplainIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/action/admin/cluster/allocation/ClusterAllocationExplainIT.java @@ -1110,7 +1110,7 @@ public void testAssignedReplicaOnSpecificNode() throws Exception { public void testCannotAllocateStaleReplicaExplanation() throws Exception { logger.info("--> starting 3 nodes"); - final String masterNode = internalCluster().startNode(); + final String clusterManagerNode = internalCluster().startNode(); // start replica node first, so it's path will be used first when we start a node after // stopping all of them at end of test. final String replicaNode = internalCluster().startNode(); @@ -1123,7 +1123,7 @@ public void testCannotAllocateStaleReplicaExplanation() throws Exception { 1, Settings.builder() .put("index.routing.allocation.include._name", primaryNode) - .put("index.routing.allocation.exclude._name", masterNode) + .put("index.routing.allocation.exclude._name", clusterManagerNode) .build(), ActiveShardCount.ONE ); @@ -1165,7 +1165,7 @@ public void testCannotAllocateStaleReplicaExplanation() throws Exception { logger.info("--> restart the node with the stale replica"); String restartedNode = internalCluster().startDataOnlyNode(replicaDataPathSettings); - ensureClusterSizeConsistency(); // wait for the master to finish processing join. + ensureClusterSizeConsistency(); // wait for the cluster-manager to finish processing join. // wait until the system has fetched shard data and we know there is no valid shard copy assertBusy(() -> { diff --git a/server/src/internalClusterTest/java/org/opensearch/action/admin/cluster/node/tasks/TasksIT.java b/server/src/internalClusterTest/java/org/opensearch/action/admin/cluster/node/tasks/TasksIT.java index b08a7b098b613..9c6c67116ef8a 100644 --- a/server/src/internalClusterTest/java/org/opensearch/action/admin/cluster/node/tasks/TasksIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/action/admin/cluster/node/tasks/TasksIT.java @@ -117,7 +117,7 @@ /** * Integration tests for task management API *

- * We need at least 2 nodes so we have a master node a non-master node + * We need at least 2 nodes so we have a cluster-manager node a non-cluster-manager node */ @OpenSearchIntegTestCase.ClusterScope(scope = OpenSearchIntegTestCase.Scope.SUITE, minNumDataNodes = 2) public class TasksIT extends OpenSearchIntegTestCase { diff --git a/server/src/internalClusterTest/java/org/opensearch/action/admin/cluster/state/TransportClusterStateActionDisruptionIT.java b/server/src/internalClusterTest/java/org/opensearch/action/admin/cluster/state/TransportClusterStateActionDisruptionIT.java index f49a0c9a722a6..a94da40ba9e86 100644 --- a/server/src/internalClusterTest/java/org/opensearch/action/admin/cluster/state/TransportClusterStateActionDisruptionIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/action/admin/cluster/state/TransportClusterStateActionDisruptionIT.java @@ -68,8 +68,8 @@ protected Collection> nodePlugins() { return Collections.singletonList(MockTransportService.TestPlugin.class); } - public void testNonLocalRequestAlwaysFindsMaster() throws Exception { - runRepeatedlyWhileChangingMaster(() -> { + public void testNonLocalRequestAlwaysFindsClusterManager() throws Exception { + runRepeatedlyWhileChangingClusterManager(() -> { final ClusterStateRequestBuilder clusterStateRequestBuilder = client().admin() .cluster() .prepareState() @@ -82,12 +82,12 @@ public void testNonLocalRequestAlwaysFindsMaster() throws Exception { } catch (MasterNotDiscoveredException e) { return; // ok, we hit the disconnected node } - assertNotNull("should always contain a master node", clusterStateResponse.getState().nodes().getMasterNodeId()); + assertNotNull("should always contain a cluster-manager node", clusterStateResponse.getState().nodes().getMasterNodeId()); }); } public void testLocalRequestAlwaysSucceeds() throws Exception { - runRepeatedlyWhileChangingMaster(() -> { + runRepeatedlyWhileChangingClusterManager(() -> { final String node = randomFrom(internalCluster().getNodeNames()); final DiscoveryNodes discoveryNodes = client(node).admin() .cluster() @@ -108,8 +108,8 @@ public void testLocalRequestAlwaysSucceeds() throws Exception { }); } - public void testNonLocalRequestAlwaysFindsMasterAndWaitsForMetadata() throws Exception { - runRepeatedlyWhileChangingMaster(() -> { + public void testNonLocalRequestAlwaysFindsClusterManagerAndWaitsForMetadata() throws Exception { + runRepeatedlyWhileChangingClusterManager(() -> { final String node = randomFrom(internalCluster().getNodeNames()); final long metadataVersion = internalCluster().getInstance(ClusterService.class, node) .getClusterApplierService() @@ -134,14 +134,14 @@ public void testNonLocalRequestAlwaysFindsMasterAndWaitsForMetadata() throws Exc } if (clusterStateResponse.isWaitForTimedOut() == false) { final ClusterState state = clusterStateResponse.getState(); - assertNotNull("should always contain a master node", state.nodes().getMasterNodeId()); + assertNotNull("should always contain a cluster-manager node", state.nodes().getMasterNodeId()); assertThat("waited for metadata version", state.metadata().version(), greaterThanOrEqualTo(waitForMetadataVersion)); } }); } public void testLocalRequestWaitsForMetadata() throws Exception { - runRepeatedlyWhileChangingMaster(() -> { + runRepeatedlyWhileChangingClusterManager(() -> { final String node = randomFrom(internalCluster().getNodeNames()); final long metadataVersion = internalCluster().getInstance(ClusterService.class, node) .getClusterApplierService() @@ -170,7 +170,7 @@ public void testLocalRequestWaitsForMetadata() throws Exception { }); } - public void runRepeatedlyWhileChangingMaster(Runnable runnable) throws Exception { + public void runRepeatedlyWhileChangingClusterManager(Runnable runnable) throws Exception { internalCluster().startNodes(3); assertBusy( @@ -191,7 +191,7 @@ public void runRepeatedlyWhileChangingMaster(Runnable runnable) throws Exception ) ); - final String masterName = internalCluster().getMasterName(); + final String clusterManagerName = internalCluster().getMasterName(); final AtomicBoolean shutdown = new AtomicBoolean(); final Thread assertingThread = new Thread(() -> { @@ -204,7 +204,7 @@ public void runRepeatedlyWhileChangingMaster(Runnable runnable) throws Exception String value = "none"; while (shutdown.get() == false) { value = "none".equals(value) ? "all" : "none"; - final String nonClusterManagerNode = randomValueOtherThan(masterName, () -> randomFrom(internalCluster().getNodeNames())); + final String nonClusterManagerNode = randomValueOtherThan(clusterManagerName, () -> randomFrom(internalCluster().getNodeNames())); assertAcked( client(nonClusterManagerNode).admin() .cluster() @@ -222,22 +222,22 @@ public void runRepeatedlyWhileChangingMaster(Runnable runnable) throws Exception assertingThread.start(); updatingThread.start(); - final MockTransportService masterTransportService = (MockTransportService) internalCluster().getInstance( + final MockTransportService clusterManagerTransportService = (MockTransportService) internalCluster().getInstance( TransportService.class, - masterName + clusterManagerName ); for (MockTransportService mockTransportService : mockTransportServices) { - if (masterTransportService != mockTransportService) { - masterTransportService.addFailToSendNoConnectRule(mockTransportService); - mockTransportService.addFailToSendNoConnectRule(masterTransportService); + if (clusterManagerTransportService != mockTransportService) { + clusterManagerTransportService.addFailToSendNoConnectRule(mockTransportService); + mockTransportService.addFailToSendNoConnectRule(clusterManagerTransportService); } } assertBusy(() -> { - final String nonClusterManagerNode = randomValueOtherThan(masterName, () -> randomFrom(internalCluster().getNodeNames())); - final String claimedMasterName = internalCluster().getMasterName(nonClusterManagerNode); - assertThat(claimedMasterName, not(equalTo(masterName))); + final String nonClusterManagerNode = randomValueOtherThan(clusterManagerName, () -> randomFrom(internalCluster().getNodeNames())); + final String claimedClusterManagerName = internalCluster().getMasterName(nonClusterManagerNode); + assertThat(claimedClusterManagerName, not(equalTo(clusterManagerName))); }); shutdown.set(true); diff --git a/server/src/internalClusterTest/java/org/opensearch/action/admin/cluster/stats/ClusterStatsIT.java b/server/src/internalClusterTest/java/org/opensearch/action/admin/cluster/stats/ClusterStatsIT.java index 5b48268dfa89f..48e9f49ece629 100644 --- a/server/src/internalClusterTest/java/org/opensearch/action/admin/cluster/stats/ClusterStatsIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/action/admin/cluster/stats/ClusterStatsIT.java @@ -97,7 +97,7 @@ public void testNodeCounts() { for (int i = 0; i < numNodes; i++) { boolean isDataNode = randomBoolean(); boolean isIngestNode = randomBoolean(); - boolean isMasterNode = randomBoolean(); + boolean isClusterManagerNode = randomBoolean(); boolean isRemoteClusterClientNode = false; final Set roles = new HashSet<>(); if (isDataNode) { @@ -106,7 +106,7 @@ public void testNodeCounts() { if (isIngestNode) { roles.add(DiscoveryNodeRole.INGEST_ROLE); } - if (isMasterNode) { + if (isClusterManagerNode) { roles.add(DiscoveryNodeRole.CLUSTER_MANAGER_ROLE); } if (isRemoteClusterClientNode) { @@ -128,14 +128,14 @@ public void testNodeCounts() { if (isIngestNode) { incrementCountForRole(DiscoveryNodeRole.INGEST_ROLE.roleName(), expectedCounts); } - if (isMasterNode) { + if (isClusterManagerNode) { incrementCountForRole(DiscoveryNodeRole.MASTER_ROLE.roleName(), expectedCounts); incrementCountForRole(DiscoveryNodeRole.CLUSTER_MANAGER_ROLE.roleName(), expectedCounts); } if (isRemoteClusterClientNode) { incrementCountForRole(DiscoveryNodeRole.REMOTE_CLUSTER_CLIENT_ROLE.roleName(), expectedCounts); } - if (!isDataNode && !isMasterNode && !isIngestNode && !isRemoteClusterClientNode) { + if (!isDataNode && !isClusterManagerNode && !isIngestNode && !isRemoteClusterClientNode) { incrementCountForRole(ClusterStatsNodes.Counts.COORDINATING_ONLY, expectedCounts); } @@ -254,12 +254,12 @@ public void testAllocatedProcessors() throws Exception { } public void testClusterStatusWhenStateNotRecovered() throws Exception { - internalCluster().startMasterOnlyNode(Settings.builder().put("gateway.recover_after_nodes", 2).build()); + internalCluster().startClusterManagerOnlyNode(Settings.builder().put("gateway.recover_after_nodes", 2).build()); ClusterStatsResponse response = client().admin().cluster().prepareClusterStats().get(); assertThat(response.getStatus(), equalTo(ClusterHealthStatus.RED)); if (randomBoolean()) { - internalCluster().startMasterOnlyNode(); + internalCluster().startClusterManagerOnlyNode(); } else { internalCluster().startDataOnlyNode(); } diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/SpecificMasterNodesIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/SpecificMasterNodesIT.java index 5380b61c446d4..42ed9598694d6 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/SpecificMasterNodesIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/SpecificMasterNodesIT.java @@ -77,7 +77,7 @@ public void testSimpleOnlyMasterNodeElection() throws IOException { // all is well, no cluster-manager elected } logger.info("--> start master node"); - final String masterNodeName = internalCluster().startMasterOnlyNode(); + final String masterNodeName = internalCluster().startClusterManagerOnlyNode(); assertThat( internalCluster().nonMasterClient() .admin() @@ -181,7 +181,7 @@ public void testElectOnlyBetweenMasterNodes() throws Exception { // all is well, no cluster-manager elected } logger.info("--> start master node (1)"); - final String masterNodeName = internalCluster().startMasterOnlyNode(); + final String masterNodeName = internalCluster().startClusterManagerOnlyNode(); assertThat( internalCluster().nonMasterClient() .admin() @@ -210,7 +210,7 @@ public void testElectOnlyBetweenMasterNodes() throws Exception { ); logger.info("--> start master node (2)"); - final String nextMasterEligableNodeName = internalCluster().startMasterOnlyNode(); + final String nextMasterEligableNodeName = internalCluster().startClusterManagerOnlyNode(); assertThat( internalCluster().nonMasterClient() .admin() @@ -314,7 +314,7 @@ public void testElectOnlyBetweenMasterNodes() throws Exception { public void testAliasFilterValidation() { internalCluster().setBootstrapMasterNodeIndex(0); logger.info("--> start master node / non data"); - internalCluster().startMasterOnlyNode(); + internalCluster().startClusterManagerOnlyNode(); logger.info("--> start data node / non master node"); internalCluster().startDataOnlyNode(); diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/RareClusterStateIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/RareClusterStateIT.java index 6f4c6fca77196..2e0ff9aeb5956 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/RareClusterStateIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/RareClusterStateIT.java @@ -173,7 +173,7 @@ private ActionFuture start 1st cluster-manager-eligible node"); masterNodes.add( - internalCluster().startMasterOnlyNode( + internalCluster().startClusterManagerOnlyNode( Settings.builder().put(DiscoverySettings.INITIAL_STATE_TIMEOUT_SETTING.getKey(), "0s").build() ) ); // node ordinal 0 @@ -364,7 +364,7 @@ public void test3MasterNodes2Failed() throws Exception { ); logger.info("--> start 1st cluster-manager-eligible node"); - String masterNode2 = internalCluster().startMasterOnlyNode(master1DataPathSettings); + String masterNode2 = internalCluster().startClusterManagerOnlyNode(master1DataPathSettings); logger.info("--> detach-cluster on data-only node"); Environment environmentData = TestEnvironment.newEnvironment( @@ -410,8 +410,8 @@ public void test3MasterNodes2Failed() throws Exception { detachCluster(environmentMaster3, false); logger.info("--> start 2nd and 3rd cluster-manager-eligible nodes and ensure 4 nodes stable cluster"); - bootstrappedNodes.add(internalCluster().startMasterOnlyNode(master2DataPathSettings)); - bootstrappedNodes.add(internalCluster().startMasterOnlyNode(master3DataPathSettings)); + bootstrappedNodes.add(internalCluster().startClusterManagerOnlyNode(master2DataPathSettings)); + bootstrappedNodes.add(internalCluster().startClusterManagerOnlyNode(master3DataPathSettings)); ensureStableCluster(4); bootstrappedNodes.forEach(node -> ensureReadOnlyBlock(true, node)); removeBlock(); @@ -479,7 +479,7 @@ public boolean clearData(String nodeName) { public void testNoInitialBootstrapAfterDetach() throws Exception { internalCluster().setBootstrapMasterNodeIndex(0); - String clusterManagerNode = internalCluster().startMasterOnlyNode(); + String clusterManagerNode = internalCluster().startClusterManagerOnlyNode(); Settings clusterManagerNodeDataPathSettings = internalCluster().dataPathSettings(clusterManagerNode); internalCluster().stopCurrentMasterNode(); @@ -488,7 +488,7 @@ public void testNoInitialBootstrapAfterDetach() throws Exception { ); detachCluster(environment); - String node = internalCluster().startMasterOnlyNode( + String node = internalCluster().startClusterManagerOnlyNode( Settings.builder() // give the cluster 2 seconds to elect the master (it should not) .put(DiscoverySettings.INITIAL_STATE_TIMEOUT_SETTING.getKey(), "2s") @@ -504,7 +504,7 @@ public void testNoInitialBootstrapAfterDetach() throws Exception { public void testCanRunUnsafeBootstrapAfterErroneousDetachWithoutLoosingMetadata() throws Exception { internalCluster().setBootstrapMasterNodeIndex(0); - String clusterManagerNode = internalCluster().startMasterOnlyNode(); + String clusterManagerNode = internalCluster().startClusterManagerOnlyNode(); Settings clusterManagerNodeDataPathSettings = internalCluster().dataPathSettings(clusterManagerNode); ClusterUpdateSettingsRequest req = new ClusterUpdateSettingsRequest().persistentSettings( Settings.builder().put(INDICES_RECOVERY_MAX_BYTES_PER_SEC_SETTING.getKey(), "1234kb") @@ -524,7 +524,7 @@ public void testCanRunUnsafeBootstrapAfterErroneousDetachWithoutLoosingMetadata( detachCluster(environment); unsafeBootstrap(environment); // read-only block will remain same as one before bootstrap, in this case it is false - String masterNode2 = internalCluster().startMasterOnlyNode(clusterManagerNodeDataPathSettings); + String masterNode2 = internalCluster().startClusterManagerOnlyNode(clusterManagerNodeDataPathSettings); ensureGreen(); ensureReadOnlyBlock(false, masterNode2); @@ -534,7 +534,7 @@ public void testCanRunUnsafeBootstrapAfterErroneousDetachWithoutLoosingMetadata( public void testUnsafeBootstrapWithApplyClusterReadOnlyBlockAsFalse() throws Exception { internalCluster().setBootstrapMasterNodeIndex(0); - String clusterManagerNode = internalCluster().startMasterOnlyNode(); + String clusterManagerNode = internalCluster().startClusterManagerOnlyNode(); Settings clusterManagerNodeDataPathSettings = internalCluster().dataPathSettings(clusterManagerNode); ClusterUpdateSettingsRequest req = new ClusterUpdateSettingsRequest().persistentSettings( Settings.builder().put(INDICES_RECOVERY_MAX_BYTES_PER_SEC_SETTING.getKey(), "1234kb") @@ -553,7 +553,7 @@ public void testUnsafeBootstrapWithApplyClusterReadOnlyBlockAsFalse() throws Exc ); unsafeBootstrap(environment, false, false); - String clusterManagerNode2 = internalCluster().startMasterOnlyNode(clusterManagerNodeDataPathSettings); + String clusterManagerNode2 = internalCluster().startClusterManagerOnlyNode(clusterManagerNodeDataPathSettings); ensureGreen(); ensureReadOnlyBlock(false, clusterManagerNode2); diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/ZenDiscoveryIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/ZenDiscoveryIT.java index 9df3a127899f2..d70da69853f17 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/ZenDiscoveryIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/ZenDiscoveryIT.java @@ -60,7 +60,7 @@ import static org.opensearch.action.admin.cluster.node.stats.NodesStatsRequest.Metric.DISCOVERY; import static org.opensearch.test.NodeRoles.dataNode; -import static org.opensearch.test.NodeRoles.masterOnlyNode; +import static org.opensearch.test.NodeRoles.clusterManagerOnlyNode; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.greaterThanOrEqualTo; @@ -73,7 +73,7 @@ public class ZenDiscoveryIT extends OpenSearchIntegTestCase { public void testNoShardRelocationsOccurWhenElectedMasterNodeFails() throws Exception { - Settings masterNodeSettings = masterOnlyNode(); + Settings masterNodeSettings = clusterManagerOnlyNode(); internalCluster().startNodes(2, masterNodeSettings); Settings dateNodeSettings = dataNode(); internalCluster().startNodes(2, dateNodeSettings); @@ -106,7 +106,7 @@ public void testNoShardRelocationsOccurWhenElectedMasterNodeFails() throws Excep } public void testHandleNodeJoin_incompatibleClusterState() throws InterruptedException, ExecutionException, TimeoutException { - String clusterManagerNode = internalCluster().startMasterOnlyNode(); + String clusterManagerNode = internalCluster().startClusterManagerOnlyNode(); String node1 = internalCluster().startNode(); ClusterService clusterService = internalCluster().getInstance(ClusterService.class, node1); Coordinator coordinator = (Coordinator) internalCluster().getInstance(Discovery.class, clusterManagerNode); diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/routing/AllocationIdIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/routing/AllocationIdIT.java index a1b9be91c3f5f..7b0ffa0ceea32 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/routing/AllocationIdIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/routing/AllocationIdIT.java @@ -100,7 +100,7 @@ public void testFailedRecoveryOnAllocateStalePrimaryRequiresAnotherAllocateStale // initial set up final String indexName = "index42"; - final String clusterManager = internalCluster().startMasterOnlyNode(); + final String clusterManager = internalCluster().startClusterManagerOnlyNode(); String node1 = internalCluster().startNode(); createIndex( indexName, diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/routing/PrimaryAllocationIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/routing/PrimaryAllocationIT.java index 55bdc2a4ac3c4..00e603e196a0c 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/routing/PrimaryAllocationIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/routing/PrimaryAllocationIT.java @@ -110,7 +110,7 @@ protected boolean addMockInternalEngine() { } public void testBulkWeirdScenario() throws Exception { - String master = internalCluster().startMasterOnlyNode(Settings.EMPTY); + String master = internalCluster().startClusterManagerOnlyNode(Settings.EMPTY); internalCluster().startDataOnlyNodes(2); assertAcked( @@ -203,7 +203,7 @@ private Settings createStaleReplicaScenario(String master) throws Exception { public void testDoNotAllowStaleReplicasToBePromotedToPrimary() throws Exception { logger.info("--> starting 3 nodes, 1 master, 2 data"); - String master = internalCluster().startMasterOnlyNode(Settings.EMPTY); + String master = internalCluster().startClusterManagerOnlyNode(Settings.EMPTY); internalCluster().startDataOnlyNodes(2); assertAcked( client().admin() @@ -292,7 +292,7 @@ public void testFailedAllocationOfStalePrimaryToDataNodeWithNoData() throws Exce public void testForceStaleReplicaToBePromotedToPrimary() throws Exception { logger.info("--> starting 3 nodes, 1 master, 2 data"); - String master = internalCluster().startMasterOnlyNode(Settings.EMPTY); + String clusterManager = internalCluster().startClusterManagerOnlyNode(Settings.EMPTY); internalCluster().startDataOnlyNodes(2); assertAcked( client().admin() @@ -305,7 +305,7 @@ public void testForceStaleReplicaToBePromotedToPrimary() throws Exception { Set historyUUIDs = Arrays.stream(client().admin().indices().prepareStats("test").clear().get().getShards()) .map(shard -> shard.getCommitStats().getUserData().get(Engine.HISTORY_UUID_KEY)) .collect(Collectors.toSet()); - createStaleReplicaScenario(master); + createStaleReplicaScenario(clusterManager); if (randomBoolean()) { assertAcked(client().admin().indices().prepareClose("test").setWaitForActiveShards(0)); } @@ -343,7 +343,7 @@ public void testForceStaleReplicaToBePromotedToPrimary() throws Exception { } logger.info("expected allocation ids: {} actual allocation ids: {}", expectedAllocationIds, allocationIds); }; - final ClusterService clusterService = internalCluster().getInstance(ClusterService.class, master); + final ClusterService clusterService = internalCluster().getInstance(ClusterService.class, clusterManager); clusterService.addListener(clusterStateListener); rerouteBuilder.get(); @@ -390,7 +390,7 @@ public void testForceStaleReplicaToBePromotedToPrimary() throws Exception { } public void testForceStaleReplicaToBePromotedToPrimaryOnWrongNode() throws Exception { - String master = internalCluster().startMasterOnlyNode(Settings.EMPTY); + String clusterManager = internalCluster().startClusterManagerOnlyNode(Settings.EMPTY); internalCluster().startDataOnlyNodes(2); final String idxName = "test"; assertAcked( @@ -401,14 +401,14 @@ public void testForceStaleReplicaToBePromotedToPrimaryOnWrongNode() throws Excep .get() ); ensureGreen(); - createStaleReplicaScenario(master); + createStaleReplicaScenario(clusterManager); // Ensure the stopped primary's data is deleted so that it doesn't get picked up by the next datanode we start internalCluster().wipePendingDataDirectories(); internalCluster().startDataOnlyNodes(1); - ensureStableCluster(3, master); + ensureStableCluster(3, clusterManager); final int shardId = 0; final List nodeNames = new ArrayList<>(Arrays.asList(internalCluster().getNodeNames())); - nodeNames.remove(master); + nodeNames.remove(clusterManager); client().admin() .indices() .prepareShardStores(idxName) @@ -434,7 +434,7 @@ public void testForceStaleReplicaToBePromotedToPrimaryOnWrongNode() throws Excep } public void testForceStaleReplicaToBePromotedForGreenIndex() { - internalCluster().startMasterOnlyNode(Settings.EMPTY); + internalCluster().startClusterManagerOnlyNode(Settings.EMPTY); final List dataNodes = internalCluster().startDataOnlyNodes(2); final String idxName = "test"; assertAcked( @@ -459,7 +459,7 @@ public void testForceStaleReplicaToBePromotedForGreenIndex() { } public void testForceStaleReplicaToBePromotedForMissingIndex() { - internalCluster().startMasterOnlyNode(Settings.EMPTY); + internalCluster().startClusterManagerOnlyNode(Settings.EMPTY); final String dataNode = internalCluster().startDataOnlyNode(); final String idxName = "test"; IndexNotFoundException ex = expectThrows( @@ -497,7 +497,7 @@ public void testForcePrimaryShardIfAllocationDecidersSayNoAfterIndexCreation() t } public void testDoNotRemoveAllocationIdOnNodeLeave() throws Exception { - internalCluster().startMasterOnlyNode(Settings.EMPTY); + internalCluster().startClusterManagerOnlyNode(Settings.EMPTY); internalCluster().startDataOnlyNode(Settings.EMPTY); assertAcked( client().admin() @@ -537,7 +537,7 @@ public boolean clearData(String nodeName) { } public void testRemoveAllocationIdOnWriteAfterNodeLeave() throws Exception { - internalCluster().startMasterOnlyNode(Settings.EMPTY); + internalCluster().startClusterManagerOnlyNode(Settings.EMPTY); internalCluster().startDataOnlyNode(Settings.EMPTY); assertAcked( client().admin() @@ -657,7 +657,7 @@ public void testForceAllocatePrimaryOnNoDecision() throws Exception { * This test asserts that replicas failed to execute resync operations will be failed but not marked as stale. */ public void testPrimaryReplicaResyncFailed() throws Exception { - String master = internalCluster().startMasterOnlyNode(Settings.EMPTY); + String master = internalCluster().startClusterManagerOnlyNode(Settings.EMPTY); final int numberOfReplicas = between(2, 3); final String oldPrimary = internalCluster().startDataOnlyNode(); assertAcked( diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/routing/allocation/decider/DiskThresholdDeciderIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/routing/allocation/decider/DiskThresholdDeciderIT.java index eb3e61d83a948..2fe7efdf8fc3a 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/routing/allocation/decider/DiskThresholdDeciderIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/routing/allocation/decider/DiskThresholdDeciderIT.java @@ -154,7 +154,7 @@ protected Collection> nodePlugins() { } public void testHighWatermarkNotExceeded() throws Exception { - internalCluster().startMasterOnlyNode(); + internalCluster().startClusterManagerOnlyNode(); internalCluster().startDataOnlyNode(); final String dataNodeName = internalCluster().startDataOnlyNode(); ensureStableCluster(3); @@ -189,7 +189,7 @@ public void testHighWatermarkNotExceeded() throws Exception { } public void testRestoreSnapshotAllocationDoesNotExceedWatermark() throws Exception { - internalCluster().startMasterOnlyNode(); + internalCluster().startClusterManagerOnlyNode(); internalCluster().startDataOnlyNode(); final String dataNodeName = internalCluster().startDataOnlyNode(); ensureStableCluster(3); diff --git a/server/src/internalClusterTest/java/org/opensearch/discovery/ClusterDisruptionCleanSettingsIT.java b/server/src/internalClusterTest/java/org/opensearch/discovery/ClusterDisruptionCleanSettingsIT.java index 61a47d2bb0237..7040bfb950663 100644 --- a/server/src/internalClusterTest/java/org/opensearch/discovery/ClusterDisruptionCleanSettingsIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/discovery/ClusterDisruptionCleanSettingsIT.java @@ -63,7 +63,7 @@ protected Collection> nodePlugins() { public void testSearchWithRelocationAndSlowClusterStateProcessing() throws Exception { // Don't use AbstractDisruptionTestCase.DEFAULT_SETTINGS as settings // (which can cause node disconnects on a slow CI machine) - internalCluster().startMasterOnlyNode(); + internalCluster().startClusterManagerOnlyNode(); final String node_1 = internalCluster().startDataOnlyNode(); logger.info("--> creating index [test] with one shard and on replica"); diff --git a/server/src/internalClusterTest/java/org/opensearch/discovery/ClusterDisruptionIT.java b/server/src/internalClusterTest/java/org/opensearch/discovery/ClusterDisruptionIT.java index 0bbd1ab9799f1..c52918ee80fe0 100644 --- a/server/src/internalClusterTest/java/org/opensearch/discovery/ClusterDisruptionIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/discovery/ClusterDisruptionIT.java @@ -410,7 +410,7 @@ public void onFailure(Exception e) { } public void testCannotJoinIfMasterLostDataFolder() throws Exception { - String clusterManagerNode = internalCluster().startMasterOnlyNode(); + String clusterManagerNode = internalCluster().startClusterManagerOnlyNode(); String dataNode = internalCluster().startDataOnlyNode(); internalCluster().restartNode(clusterManagerNode, new InternalTestCluster.RestartCallback() { diff --git a/server/src/internalClusterTest/java/org/opensearch/discovery/DiscoveryDisruptionIT.java b/server/src/internalClusterTest/java/org/opensearch/discovery/DiscoveryDisruptionIT.java index 4600d802ab199..6fb311ba9a7b2 100644 --- a/server/src/internalClusterTest/java/org/opensearch/discovery/DiscoveryDisruptionIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/discovery/DiscoveryDisruptionIT.java @@ -64,7 +64,7 @@ public class DiscoveryDisruptionIT extends AbstractDisruptionTestCase { * Test cluster join with issues in cluster state publishing * */ public void testClusterJoinDespiteOfPublishingIssues() throws Exception { - String clusterManagerNode = internalCluster().startMasterOnlyNode(); + String clusterManagerNode = internalCluster().startClusterManagerOnlyNode(); String nonClusterManagerNode = internalCluster().startDataOnlyNode(); DiscoveryNodes discoveryNodes = internalCluster().getInstance(ClusterService.class, nonClusterManagerNode).state().nodes(); diff --git a/server/src/internalClusterTest/java/org/opensearch/env/NodeRepurposeCommandIT.java b/server/src/internalClusterTest/java/org/opensearch/env/NodeRepurposeCommandIT.java index f350de1960ed8..11ece43ea90d7 100644 --- a/server/src/internalClusterTest/java/org/opensearch/env/NodeRepurposeCommandIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/env/NodeRepurposeCommandIT.java @@ -56,7 +56,7 @@ public void testRepurpose() throws Exception { final String indexName = "test-repurpose"; logger.info("--> starting two nodes"); - final String clusterManagerNode = internalCluster().startMasterOnlyNode(); + final String clusterManagerNode = internalCluster().startClusterManagerOnlyNode(); final String dataNode = internalCluster().startDataOnlyNode( Settings.builder().put(IndicesService.WRITE_DANGLING_INDICES_INFO_SETTING.getKey(), false).build() ); @@ -123,7 +123,7 @@ public void testRepurpose() throws Exception { // by restarting as master and data node, we can check that the index definition was really deleted and also that the tool // does not mess things up so much that the nodes cannot boot as master or data node any longer. - internalCluster().startMasterOnlyNode(clusterManagerNodeDataPathSettings); + internalCluster().startClusterManagerOnlyNode(clusterManagerNodeDataPathSettings); internalCluster().startDataOnlyNode(dataNodeDataPathSettings); ensureGreen(); diff --git a/server/src/internalClusterTest/java/org/opensearch/gateway/GatewayIndexStateIT.java b/server/src/internalClusterTest/java/org/opensearch/gateway/GatewayIndexStateIT.java index a8828c7ad38b5..1542d6800eaa1 100644 --- a/server/src/internalClusterTest/java/org/opensearch/gateway/GatewayIndexStateIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/gateway/GatewayIndexStateIT.java @@ -277,7 +277,7 @@ public void testJustMasterNodeAndJustDataNode() { logger.info("--> cleaning nodes"); logger.info("--> starting 1 master node non data"); - internalCluster().startMasterOnlyNode(); + internalCluster().startClusterManagerOnlyNode(); internalCluster().startDataOnlyNode(); logger.info("--> create an index"); diff --git a/server/src/internalClusterTest/java/org/opensearch/gateway/MetadataNodesIT.java b/server/src/internalClusterTest/java/org/opensearch/gateway/MetadataNodesIT.java index c9807aa24e259..c96a71d5b2617 100644 --- a/server/src/internalClusterTest/java/org/opensearch/gateway/MetadataNodesIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/gateway/MetadataNodesIT.java @@ -60,7 +60,7 @@ public class MetadataNodesIT extends OpenSearchIntegTestCase { public void testMetaWrittenAlsoOnDataNode() throws Exception { // this test checks that index state is written on data only nodes if they have a shard allocated - String masterNode = internalCluster().startMasterOnlyNode(Settings.EMPTY); + String masterNode = internalCluster().startClusterManagerOnlyNode(Settings.EMPTY); String dataNode = internalCluster().startDataOnlyNode(Settings.EMPTY); assertAcked(prepareCreate("test").setSettings(Settings.builder().put("index.number_of_replicas", 0))); index("test", "_doc", "1", jsonBuilder().startObject().field("text", "some text").endObject()); @@ -71,7 +71,7 @@ public void testMetaWrittenAlsoOnDataNode() throws Exception { public void testIndexFilesAreRemovedIfAllShardsFromIndexRemoved() throws Exception { // this test checks that the index data is removed from a data only node once all shards have been allocated away from it - String masterNode = internalCluster().startMasterOnlyNode(Settings.EMPTY); + String masterNode = internalCluster().startClusterManagerOnlyNode(Settings.EMPTY); List nodeNames = internalCluster().startDataOnlyNodes(2); String node1 = nodeNames.get(0); String node2 = nodeNames.get(1); @@ -114,7 +114,7 @@ public void testIndexFilesAreRemovedIfAllShardsFromIndexRemoved() throws Excepti @SuppressWarnings("unchecked") public void testMetaWrittenWhenIndexIsClosedAndMetaUpdated() throws Exception { - String masterNode = internalCluster().startMasterOnlyNode(Settings.EMPTY); + String masterNode = internalCluster().startClusterManagerOnlyNode(Settings.EMPTY); final String dataNode = internalCluster().startDataOnlyNode(Settings.EMPTY); final String index = "index"; diff --git a/server/src/internalClusterTest/java/org/opensearch/gateway/RecoverAfterNodesIT.java b/server/src/internalClusterTest/java/org/opensearch/gateway/RecoverAfterNodesIT.java index 7365ef1c8847d..a3dc4de0329ff 100644 --- a/server/src/internalClusterTest/java/org/opensearch/gateway/RecoverAfterNodesIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/gateway/RecoverAfterNodesIT.java @@ -44,7 +44,7 @@ import java.util.Set; import static org.opensearch.test.NodeRoles.dataOnlyNode; -import static org.opensearch.test.NodeRoles.masterOnlyNode; +import static org.opensearch.test.NodeRoles.clusterManagerOnlyNode; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasItem; @@ -130,7 +130,7 @@ public void testRecoverAfterNodes() throws Exception { public void testRecoverAfterMasterNodes() throws Exception { internalCluster().setBootstrapMasterNodeIndex(0); logger.info("--> start master_node (1)"); - Client master1 = startNode(Settings.builder().put("gateway.recover_after_master_nodes", 2).put(masterOnlyNode())); + Client master1 = startNode(Settings.builder().put("gateway.recover_after_master_nodes", 2).put(clusterManagerOnlyNode())); assertThat( master1.admin() .cluster() @@ -211,7 +211,7 @@ public void testRecoverAfterMasterNodes() throws Exception { ); logger.info("--> start master_node (2)"); - Client master2 = startNode(Settings.builder().put("gateway.recover_after_master_nodes", 2).put(masterOnlyNode())); + Client master2 = startNode(Settings.builder().put("gateway.recover_after_master_nodes", 2).put(clusterManagerOnlyNode())); assertThat(waitForNoBlocksOnNode(BLOCK_WAIT_TIMEOUT, master1).isEmpty(), equalTo(true)); assertThat(waitForNoBlocksOnNode(BLOCK_WAIT_TIMEOUT, master2).isEmpty(), equalTo(true)); assertThat(waitForNoBlocksOnNode(BLOCK_WAIT_TIMEOUT, data1).isEmpty(), equalTo(true)); @@ -221,7 +221,7 @@ public void testRecoverAfterMasterNodes() throws Exception { public void testRecoverAfterDataNodes() throws Exception { internalCluster().setBootstrapMasterNodeIndex(0); logger.info("--> start master_node (1)"); - Client master1 = startNode(Settings.builder().put("gateway.recover_after_data_nodes", 2).put(masterOnlyNode())); + Client master1 = startNode(Settings.builder().put("gateway.recover_after_data_nodes", 2).put(clusterManagerOnlyNode())); assertThat( master1.admin() .cluster() @@ -263,7 +263,7 @@ public void testRecoverAfterDataNodes() throws Exception { ); logger.info("--> start master_node (2)"); - Client master2 = startNode(Settings.builder().put("gateway.recover_after_data_nodes", 2).put(masterOnlyNode())); + Client master2 = startNode(Settings.builder().put("gateway.recover_after_data_nodes", 2).put(clusterManagerOnlyNode())); assertThat( master2.admin() .cluster() diff --git a/server/src/internalClusterTest/java/org/opensearch/gateway/RecoveryFromGatewayIT.java b/server/src/internalClusterTest/java/org/opensearch/gateway/RecoveryFromGatewayIT.java index 19939a5a3cbc0..79ffe12d13129 100644 --- a/server/src/internalClusterTest/java/org/opensearch/gateway/RecoveryFromGatewayIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/gateway/RecoveryFromGatewayIT.java @@ -512,7 +512,7 @@ public void testLatestVersionLoaded() throws Exception { } public void testReuseInFileBasedPeerRecovery() throws Exception { - internalCluster().startMasterOnlyNode(); + internalCluster().startClusterManagerOnlyNode(); final String primaryNode = internalCluster().startDataOnlyNode(nodeSettings(0)); // create the index with our mapping diff --git a/server/src/internalClusterTest/java/org/opensearch/gateway/ReplicaShardAllocatorIT.java b/server/src/internalClusterTest/java/org/opensearch/gateway/ReplicaShardAllocatorIT.java index 345ed668a3bf4..db46fb4424848 100644 --- a/server/src/internalClusterTest/java/org/opensearch/gateway/ReplicaShardAllocatorIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/gateway/ReplicaShardAllocatorIT.java @@ -327,7 +327,7 @@ public void testFullClusterRestartPerformNoopRecovery() throws Exception { public void testPreferCopyWithHighestMatchingOperations() throws Exception { String indexName = "test"; - internalCluster().startMasterOnlyNode(); + internalCluster().startClusterManagerOnlyNode(); internalCluster().startDataOnlyNodes(3); assertAcked( client().admin() @@ -402,7 +402,7 @@ public void testPreferCopyWithHighestMatchingOperations() throws Exception { * Make sure that we do not repeatedly cancel an ongoing recovery for a noop copy on a broken node. */ public void testDoNotCancelRecoveryForBrokenNode() throws Exception { - internalCluster().startMasterOnlyNode(); + internalCluster().startClusterManagerOnlyNode(); String nodeWithPrimary = internalCluster().startDataOnlyNode(); String indexName = "test"; assertAcked( @@ -518,7 +518,7 @@ public void testPeerRecoveryForClosedIndices() throws Exception { * this behavior by changing the global checkpoint in phase1 to unassigned. */ public void testSimulateRecoverySourceOnOldNode() throws Exception { - internalCluster().startMasterOnlyNode(); + internalCluster().startClusterManagerOnlyNode(); String source = internalCluster().startDataOnlyNode(); String indexName = "test"; assertAcked( diff --git a/server/src/internalClusterTest/java/org/opensearch/index/seqno/PeerRecoveryRetentionLeaseCreationIT.java b/server/src/internalClusterTest/java/org/opensearch/index/seqno/PeerRecoveryRetentionLeaseCreationIT.java index e1e969345d5ed..686911f8d4741 100644 --- a/server/src/internalClusterTest/java/org/opensearch/index/seqno/PeerRecoveryRetentionLeaseCreationIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/index/seqno/PeerRecoveryRetentionLeaseCreationIT.java @@ -63,7 +63,7 @@ public void testCanRecoverFromStoreWithoutPeerRecoveryRetentionLease() throws Ex * primary that is recovering from store creates a lease for itself. */ - internalCluster().startMasterOnlyNode(); + internalCluster().startClusterManagerOnlyNode(); final String dataNode = internalCluster().startDataOnlyNode(); final Path[] nodeDataPaths = internalCluster().getInstance(NodeEnvironment.class, dataNode).nodeDataPaths(); diff --git a/server/src/internalClusterTest/java/org/opensearch/index/shard/RemoveCorruptedShardDataCommandIT.java b/server/src/internalClusterTest/java/org/opensearch/index/shard/RemoveCorruptedShardDataCommandIT.java index 2dc241e278768..7f7914b1ead87 100644 --- a/server/src/internalClusterTest/java/org/opensearch/index/shard/RemoveCorruptedShardDataCommandIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/index/shard/RemoveCorruptedShardDataCommandIT.java @@ -497,7 +497,7 @@ public Settings onNodeStopped(String nodeName) throws Exception { } public void testCorruptTranslogTruncationOfReplica() throws Exception { - internalCluster().startMasterOnlyNode(); + internalCluster().startClusterManagerOnlyNode(); final String node1 = internalCluster().startDataOnlyNode(); final String node2 = internalCluster().startDataOnlyNode(); diff --git a/server/src/internalClusterTest/java/org/opensearch/indices/mapping/DedicatedMasterGetFieldMappingIT.java b/server/src/internalClusterTest/java/org/opensearch/indices/mapping/DedicatedMasterGetFieldMappingIT.java index 98134531d4f31..a4123ccc46ab6 100644 --- a/server/src/internalClusterTest/java/org/opensearch/indices/mapping/DedicatedMasterGetFieldMappingIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/indices/mapping/DedicatedMasterGetFieldMappingIT.java @@ -42,7 +42,7 @@ public class DedicatedMasterGetFieldMappingIT extends SimpleGetFieldMappingsIT { @Before public void before1() throws Exception { - internalCluster().startMasterOnlyNode(); + internalCluster().startClusterManagerOnlyNode(); internalCluster().startNode(); } diff --git a/server/src/internalClusterTest/java/org/opensearch/indices/recovery/IndexRecoveryIT.java b/server/src/internalClusterTest/java/org/opensearch/indices/recovery/IndexRecoveryIT.java index 27f3b3c8a28f4..09caf8f1e4358 100644 --- a/server/src/internalClusterTest/java/org/opensearch/indices/recovery/IndexRecoveryIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/indices/recovery/IndexRecoveryIT.java @@ -1212,7 +1212,7 @@ public void testDisconnectsDuringRecovery() throws Exception { .build(); TimeValue disconnectAfterDelay = TimeValue.timeValueMillis(randomIntBetween(0, 100)); // start a master node - String masterNodeName = internalCluster().startMasterOnlyNode(nodeSettings); + String masterNodeName = internalCluster().startClusterManagerOnlyNode(nodeSettings); final String blueNodeName = internalCluster().startNode( Settings.builder().put("node.attr.color", "blue").put(nodeSettings).build() @@ -2085,7 +2085,7 @@ public void testRepeatedRecovery() throws Exception { } public void testAllocateEmptyPrimaryResetsGlobalCheckpoint() throws Exception { - internalCluster().startMasterOnlyNode(Settings.EMPTY); + internalCluster().startClusterManagerOnlyNode(Settings.EMPTY); final List dataNodes = internalCluster().startDataOnlyNodes(2); final Settings randomNodeDataPathSettings = internalCluster().dataPathSettings(randomFrom(dataNodes)); final String indexName = "test"; @@ -2185,7 +2185,7 @@ public void testPeerRecoveryTrimsLocalTranslog() throws Exception { } public void testCancelRecoveryWithAutoExpandReplicas() throws Exception { - internalCluster().startMasterOnlyNode(); + internalCluster().startClusterManagerOnlyNode(); assertAcked( client().admin() .indices() diff --git a/server/src/internalClusterTest/java/org/opensearch/indices/store/IndicesStoreIntegrationIT.java b/server/src/internalClusterTest/java/org/opensearch/indices/store/IndicesStoreIntegrationIT.java index 6ed9fab91a67d..2e35b7159b6aa 100644 --- a/server/src/internalClusterTest/java/org/opensearch/indices/store/IndicesStoreIntegrationIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/indices/store/IndicesStoreIntegrationIT.java @@ -345,7 +345,7 @@ public void testShardsCleanup() throws Exception { } public void testShardActiveElsewhereDoesNotDeleteAnother() throws Exception { - internalCluster().startMasterOnlyNode(); + internalCluster().startClusterManagerOnlyNode(); final List nodes = internalCluster().startDataOnlyNodes(4); final String node1 = nodes.get(0); diff --git a/server/src/internalClusterTest/java/org/opensearch/ingest/IngestClientIT.java b/server/src/internalClusterTest/java/org/opensearch/ingest/IngestClientIT.java index 2f666bbd65d4d..d577019590019 100644 --- a/server/src/internalClusterTest/java/org/opensearch/ingest/IngestClientIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/ingest/IngestClientIT.java @@ -302,8 +302,8 @@ public void testPutWithPipelineFactoryError() throws Exception { assertFalse(response.isFound()); } - public void testWithDedicatedMaster() throws Exception { - String masterOnlyNode = internalCluster().startMasterOnlyNode(); + public void testWithDedicatedClusterManager() throws Exception { + String clusterManagerOnlyNode = internalCluster().startClusterManagerOnlyNode(); BytesReference source = BytesReference.bytes( jsonBuilder().startObject() .field("description", "my_pipeline") @@ -318,7 +318,7 @@ public void testWithDedicatedMaster() throws Exception { PutPipelineRequest putPipelineRequest = new PutPipelineRequest("_id", source, XContentType.JSON); client().admin().cluster().putPipeline(putPipelineRequest).get(); - BulkItemResponse item = client(masterOnlyNode).prepareBulk() + BulkItemResponse item = client(clusterManagerOnlyNode).prepareBulk() .add(client().prepareIndex("test").setSource("field", "value2", "drop", true).setPipeline("_id")) .get() .getItems()[0]; diff --git a/server/src/internalClusterTest/java/org/opensearch/recovery/FullRollingRestartIT.java b/server/src/internalClusterTest/java/org/opensearch/recovery/FullRollingRestartIT.java index 15d1f3a0559a8..a8423312de271 100644 --- a/server/src/internalClusterTest/java/org/opensearch/recovery/FullRollingRestartIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/recovery/FullRollingRestartIT.java @@ -196,7 +196,7 @@ public void testFullRollingRestart() throws Exception { public void testNoRebalanceOnRollingRestart() throws Exception { // see https://github.com/elastic/elasticsearch/issues/14387 - internalCluster().startMasterOnlyNode(Settings.EMPTY); + internalCluster().startClusterManagerOnlyNode(Settings.EMPTY); internalCluster().startDataOnlyNodes(3); /** * We start 3 nodes and a dedicated master. Restart on of the data-nodes and ensure that we got no relocations. diff --git a/server/src/internalClusterTest/java/org/opensearch/snapshots/AbortedRestoreIT.java b/server/src/internalClusterTest/java/org/opensearch/snapshots/AbortedRestoreIT.java index 6a8e45920e806..97faacb38bc50 100644 --- a/server/src/internalClusterTest/java/org/opensearch/snapshots/AbortedRestoreIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/snapshots/AbortedRestoreIT.java @@ -59,7 +59,7 @@ public class AbortedRestoreIT extends AbstractSnapshotIntegTestCase { public void testAbortedRestoreAlsoAbortFileRestores() throws Exception { - internalCluster().startMasterOnlyNode(); + internalCluster().startClusterManagerOnlyNode(); final String dataNode = internalCluster().startDataOnlyNode(); final String indexName = "test-abort-restore"; diff --git a/server/src/internalClusterTest/java/org/opensearch/snapshots/BlobStoreIncrementalityIT.java b/server/src/internalClusterTest/java/org/opensearch/snapshots/BlobStoreIncrementalityIT.java index 5a3d2c6c4bafd..9a40ea2c95b28 100644 --- a/server/src/internalClusterTest/java/org/opensearch/snapshots/BlobStoreIncrementalityIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/snapshots/BlobStoreIncrementalityIT.java @@ -59,7 +59,7 @@ public class BlobStoreIncrementalityIT extends AbstractSnapshotIntegTestCase { public void testIncrementalBehaviorOnPrimaryFailover() throws InterruptedException, ExecutionException, IOException { - internalCluster().startMasterOnlyNode(); + internalCluster().startClusterManagerOnlyNode(); final String primaryNode = internalCluster().startDataOnlyNode(); final String indexName = "test-index"; createIndex( @@ -148,7 +148,7 @@ public void testIncrementalBehaviorOnPrimaryFailover() throws InterruptedExcepti } public void testForceMergeCausesFullSnapshot() throws Exception { - internalCluster().startMasterOnlyNode(); + internalCluster().startClusterManagerOnlyNode(); internalCluster().ensureAtLeastNumDataNodes(2); final String indexName = "test-index"; createIndex(indexName, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1).build()); diff --git a/server/src/internalClusterTest/java/org/opensearch/snapshots/CloneSnapshotIT.java b/server/src/internalClusterTest/java/org/opensearch/snapshots/CloneSnapshotIT.java index 6e93e416b532b..7dc33294ce783 100644 --- a/server/src/internalClusterTest/java/org/opensearch/snapshots/CloneSnapshotIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/snapshots/CloneSnapshotIT.java @@ -72,7 +72,7 @@ public class CloneSnapshotIT extends AbstractSnapshotIntegTestCase { public void testShardClone() throws Exception { - internalCluster().startMasterOnlyNode(); + internalCluster().startClusterManagerOnlyNode(); internalCluster().startDataOnlyNode(); final String repoName = "repo-name"; final Path repoPath = randomRepoPath(); @@ -143,7 +143,7 @@ public void testShardClone() throws Exception { } public void testCloneSnapshotIndex() throws Exception { - internalCluster().startMasterOnlyNode(); + internalCluster().startClusterManagerOnlyNode(); internalCluster().startDataOnlyNode(); final String repoName = "repo-name"; createRepository(repoName, "fs"); @@ -172,7 +172,7 @@ public void testCloneSnapshotIndex() throws Exception { } public void testClonePreventsSnapshotDelete() throws Exception { - final String clusterManagerName = internalCluster().startMasterOnlyNode(); + final String clusterManagerName = internalCluster().startClusterManagerOnlyNode(); internalCluster().startDataOnlyNode(); final String repoName = "repo-name"; createRepository(repoName, "mock"); @@ -210,7 +210,7 @@ public void testClonePreventsSnapshotDelete() throws Exception { } public void testConcurrentCloneAndSnapshot() throws Exception { - internalCluster().startMasterOnlyNode(); + internalCluster().startClusterManagerOnlyNode(); final String dataNode = internalCluster().startDataOnlyNode(); final String repoName = "repo-name"; createRepository(repoName, "mock"); @@ -234,7 +234,7 @@ public void testConcurrentCloneAndSnapshot() throws Exception { public void testLongRunningCloneAllowsConcurrentSnapshot() throws Exception { // large snapshot pool so blocked snapshot threads from cloning don't prevent concurrent snapshot finalizations - final String masterNode = internalCluster().startMasterOnlyNode(LARGE_SNAPSHOT_POOL_SETTINGS); + final String masterNode = internalCluster().startClusterManagerOnlyNode(LARGE_SNAPSHOT_POOL_SETTINGS); internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); @@ -263,7 +263,7 @@ public void testLongRunningCloneAllowsConcurrentSnapshot() throws Exception { } public void testLongRunningSnapshotAllowsConcurrentClone() throws Exception { - internalCluster().startMasterOnlyNode(); + internalCluster().startClusterManagerOnlyNode(); final String dataNode = internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); @@ -293,7 +293,7 @@ public void testLongRunningSnapshotAllowsConcurrentClone() throws Exception { } public void testDeletePreventsClone() throws Exception { - final String clusterManagerName = internalCluster().startMasterOnlyNode(); + final String clusterManagerName = internalCluster().startClusterManagerOnlyNode(); internalCluster().startDataOnlyNode(); final String repoName = "repo-name"; createRepository(repoName, "mock"); @@ -323,7 +323,7 @@ public void testDeletePreventsClone() throws Exception { public void testBackToBackClonesForIndexNotInCluster() throws Exception { // large snapshot pool so blocked snapshot threads from cloning don't prevent concurrent snapshot finalizations - final String masterNode = internalCluster().startMasterOnlyNode(LARGE_SNAPSHOT_POOL_SETTINGS); + final String masterNode = internalCluster().startClusterManagerOnlyNode(LARGE_SNAPSHOT_POOL_SETTINGS); internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); @@ -413,7 +413,7 @@ public void testMasterFailoverDuringCloneStep1() throws Exception { } public void testFailsOnCloneMissingIndices() { - internalCluster().startMasterOnlyNode(); + internalCluster().startClusterManagerOnlyNode(); internalCluster().startDataOnlyNode(); final String repoName = "repo-name"; final Path repoPath = randomRepoPath(); @@ -481,7 +481,7 @@ public void testExceptionDuringShardClone() throws Exception { } public void testDoesNotStartOnBrokenSourceSnapshot() throws Exception { - internalCluster().startMasterOnlyNode(); + internalCluster().startClusterManagerOnlyNode(); final String dataNode = internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); @@ -516,7 +516,7 @@ public void testDoesNotStartOnBrokenSourceSnapshot() throws Exception { } public void testStartSnapshotWithSuccessfulShardClonePendingFinalization() throws Exception { - final String masterName = internalCluster().startMasterOnlyNode(LARGE_SNAPSHOT_POOL_SETTINGS); + final String masterName = internalCluster().startClusterManagerOnlyNode(LARGE_SNAPSHOT_POOL_SETTINGS); final String dataNode = internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); @@ -546,7 +546,7 @@ public void testStartSnapshotWithSuccessfulShardClonePendingFinalization() throw } public void testStartCloneWithSuccessfulShardClonePendingFinalization() throws Exception { - final String clusterManagerName = internalCluster().startMasterOnlyNode(); + final String clusterManagerName = internalCluster().startClusterManagerOnlyNode(); internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); @@ -576,7 +576,7 @@ public void testStartCloneWithSuccessfulShardClonePendingFinalization() throws E } public void testStartCloneWithSuccessfulShardSnapshotPendingFinalization() throws Exception { - final String masterName = internalCluster().startMasterOnlyNode(LARGE_SNAPSHOT_POOL_SETTINGS); + final String masterName = internalCluster().startClusterManagerOnlyNode(LARGE_SNAPSHOT_POOL_SETTINGS); internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); diff --git a/server/src/internalClusterTest/java/org/opensearch/snapshots/ConcurrentSnapshotsIT.java b/server/src/internalClusterTest/java/org/opensearch/snapshots/ConcurrentSnapshotsIT.java index f7b02e443d58b..edae4fa4a6b5e 100644 --- a/server/src/internalClusterTest/java/org/opensearch/snapshots/ConcurrentSnapshotsIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/snapshots/ConcurrentSnapshotsIT.java @@ -106,7 +106,7 @@ protected Settings nodeSettings(int nodeOrdinal) { } public void testLongRunningSnapshotAllowsConcurrentSnapshot() throws Exception { - internalCluster().startMasterOnlyNode(); + internalCluster().startClusterManagerOnlyNode(); final String dataNode = internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); @@ -139,7 +139,7 @@ public void testLongRunningSnapshotAllowsConcurrentSnapshot() throws Exception { } public void testDeletesAreBatched() throws Exception { - internalCluster().startMasterOnlyNode(); + internalCluster().startClusterManagerOnlyNode(); final String dataNode = internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); @@ -205,7 +205,7 @@ public void testDeletesAreBatched() throws Exception { } public void testBlockedRepoDoesNotBlockOtherRepos() throws Exception { - internalCluster().startMasterOnlyNode(); + internalCluster().startClusterManagerOnlyNode(); internalCluster().startDataOnlyNode(); final String blockedRepoName = "test-repo-blocked"; final String otherRepoName = "test-repo"; @@ -231,7 +231,7 @@ public void testBlockedRepoDoesNotBlockOtherRepos() throws Exception { } public void testMultipleReposAreIndependent() throws Exception { - internalCluster().startMasterOnlyNode(); + internalCluster().startClusterManagerOnlyNode(); // We're blocking a some of the snapshot threads when we block the first repo below so we have to make sure we have enough threads // left for the second concurrent snapshot. final String dataNode = startDataNodeWithLargeSnapshotPool(); @@ -255,7 +255,7 @@ public void testMultipleReposAreIndependent() throws Exception { } public void testMultipleReposAreIndependent2() throws Exception { - internalCluster().startMasterOnlyNode(); + internalCluster().startClusterManagerOnlyNode(); // We're blocking a some of the snapshot threads when we block the first repo below so we have to make sure we have enough threads // left for the second repository's concurrent operations. final String dataNode = startDataNodeWithLargeSnapshotPool(); @@ -280,7 +280,7 @@ public void testMultipleReposAreIndependent2() throws Exception { } public void testMultipleReposAreIndependent3() throws Exception { - final String masterNode = internalCluster().startMasterOnlyNode(LARGE_SNAPSHOT_POOL_SETTINGS); + final String masterNode = internalCluster().startClusterManagerOnlyNode(LARGE_SNAPSHOT_POOL_SETTINGS); internalCluster().startDataOnlyNode(); final String blockedRepoName = "test-repo-blocked"; final String otherRepoName = "test-repo"; @@ -301,7 +301,7 @@ public void testMultipleReposAreIndependent3() throws Exception { } public void testSnapshotRunsAfterInProgressDelete() throws Exception { - final String clusterManagerNode = internalCluster().startMasterOnlyNode(); + final String clusterManagerNode = internalCluster().startClusterManagerOnlyNode(); internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); @@ -326,7 +326,7 @@ public void testSnapshotRunsAfterInProgressDelete() throws Exception { } public void testAbortOneOfMultipleSnapshots() throws Exception { - internalCluster().startMasterOnlyNode(); + internalCluster().startClusterManagerOnlyNode(); final String dataNode = internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); @@ -386,7 +386,7 @@ public void testAbortOneOfMultipleSnapshots() throws Exception { } public void testCascadedAborts() throws Exception { - internalCluster().startMasterOnlyNode(); + internalCluster().startClusterManagerOnlyNode(); final String dataNode = internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); @@ -540,7 +540,7 @@ public void testMasterFailOverWithQueuedDeletes() throws Exception { } public void testAssertMultipleSnapshotsAndPrimaryFailOver() throws Exception { - internalCluster().startMasterOnlyNode(); + internalCluster().startClusterManagerOnlyNode(); final String dataNode = internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); @@ -571,7 +571,7 @@ public void testAssertMultipleSnapshotsAndPrimaryFailOver() throws Exception { } public void testQueuedDeletesWithFailures() throws Exception { - final String clusterManagerNode = internalCluster().startMasterOnlyNode(); + final String clusterManagerNode = internalCluster().startClusterManagerOnlyNode(); internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); @@ -601,7 +601,7 @@ public void testQueuedDeletesWithFailures() throws Exception { } public void testQueuedDeletesWithOverlap() throws Exception { - final String clusterManagerNode = internalCluster().startMasterOnlyNode(); + final String clusterManagerNode = internalCluster().startClusterManagerOnlyNode(); internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); @@ -878,7 +878,7 @@ public void testQueuedSnapshotOperationsAndBrokenRepoOnMasterFailOverMultipleRep } public void testMultipleSnapshotsQueuedAfterDelete() throws Exception { - final String clusterManagerNode = internalCluster().startMasterOnlyNode(); + final String clusterManagerNode = internalCluster().startClusterManagerOnlyNode(); internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); @@ -897,7 +897,7 @@ public void testMultipleSnapshotsQueuedAfterDelete() throws Exception { } public void testMultiplePartialSnapshotsQueuedAfterDelete() throws Exception { - final String clusterManagerNode = internalCluster().startMasterOnlyNode(); + final String clusterManagerNode = internalCluster().startClusterManagerOnlyNode(); internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); @@ -919,7 +919,7 @@ public void testMultiplePartialSnapshotsQueuedAfterDelete() throws Exception { } public void testQueuedSnapshotsWaitingForShardReady() throws Exception { - internalCluster().startMasterOnlyNode(); + internalCluster().startClusterManagerOnlyNode(); internalCluster().startDataOnlyNodes(2); final String repoName = "test-repo"; createRepository(repoName, "fs"); @@ -977,7 +977,7 @@ public void testQueuedSnapshotsWaitingForShardReady() throws Exception { } public void testBackToBackQueuedDeletes() throws Exception { - final String clusterManagerName = internalCluster().startMasterOnlyNode(); + final String clusterManagerName = internalCluster().startClusterManagerOnlyNode(); internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); @@ -1024,7 +1024,7 @@ public void testQueuedOperationsAfterFinalizationFailure() throws Exception { } public void testStartDeleteDuringFinalizationCleanup() throws Exception { - final String clusterManagerName = internalCluster().startMasterOnlyNode(); + final String clusterManagerName = internalCluster().startClusterManagerOnlyNode(); internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); @@ -1042,7 +1042,7 @@ public void testStartDeleteDuringFinalizationCleanup() throws Exception { } public void testEquivalentDeletesAreDeduplicated() throws Exception { - final String clusterManagerName = internalCluster().startMasterOnlyNode(); + final String clusterManagerName = internalCluster().startClusterManagerOnlyNode(); internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); @@ -1102,7 +1102,7 @@ public void testMasterFailoverOnFinalizationLoop() throws Exception { } public void testStatusMultipleSnapshotsMultipleRepos() throws Exception { - internalCluster().startMasterOnlyNode(); + internalCluster().startClusterManagerOnlyNode(); // We're blocking a some of the snapshot threads when we block the first repo below so we have to make sure we have enough threads // left for the second concurrent snapshot. final String dataNode = startDataNodeWithLargeSnapshotPool(); @@ -1146,7 +1146,7 @@ public void testStatusMultipleSnapshotsMultipleRepos() throws Exception { } public void testInterleavedAcrossMultipleRepos() throws Exception { - internalCluster().startMasterOnlyNode(); + internalCluster().startClusterManagerOnlyNode(); // We're blocking a some of the snapshot threads when we block the first repo below so we have to make sure we have enough threads // left for the second concurrent snapshot. final String dataNode = startDataNodeWithLargeSnapshotPool(); @@ -1219,7 +1219,7 @@ public void testMasterFailoverAndMultipleQueuedUpSnapshotsAcrossTwoRepos() throw } public void testConcurrentOperationsLimit() throws Exception { - final String clusterManagerName = internalCluster().startMasterOnlyNode(); + final String clusterManagerName = internalCluster().startClusterManagerOnlyNode(); internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); @@ -1285,7 +1285,7 @@ public void testConcurrentOperationsLimit() throws Exception { } public void testConcurrentSnapshotWorksWithOldVersionRepo() throws Exception { - internalCluster().startMasterOnlyNode(); + internalCluster().startClusterManagerOnlyNode(); final String dataNode = internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; final Path repoPath = randomRepoPath(); @@ -1322,7 +1322,7 @@ public void testConcurrentSnapshotWorksWithOldVersionRepo() throws Exception { } public void testQueuedDeleteAfterFinalizationFailure() throws Exception { - final String clusterManagerNode = internalCluster().startMasterOnlyNode(); + final String clusterManagerNode = internalCluster().startClusterManagerOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); blockMasterFromFinalizingSnapshotOnIndexFile(repoName); @@ -1338,7 +1338,7 @@ public void testQueuedDeleteAfterFinalizationFailure() throws Exception { } public void testAbortNotStartedSnapshotWithoutIO() throws Exception { - internalCluster().startMasterOnlyNode(); + internalCluster().startClusterManagerOnlyNode(); final String dataNode = internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); @@ -1365,7 +1365,7 @@ public void testAbortNotStartedSnapshotWithoutIO() throws Exception { } public void testStartWithSuccessfulShardSnapshotPendingFinalization() throws Exception { - final String clusterManagerName = internalCluster().startMasterOnlyNode(); + final String clusterManagerName = internalCluster().startClusterManagerOnlyNode(); final String dataNode = internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); diff --git a/server/src/internalClusterTest/java/org/opensearch/snapshots/DedicatedClusterSnapshotRestoreIT.java b/server/src/internalClusterTest/java/org/opensearch/snapshots/DedicatedClusterSnapshotRestoreIT.java index 55fb0cec11c16..46638f31b6cca 100644 --- a/server/src/internalClusterTest/java/org/opensearch/snapshots/DedicatedClusterSnapshotRestoreIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/snapshots/DedicatedClusterSnapshotRestoreIT.java @@ -926,7 +926,7 @@ public void testMasterAndDataShutdownDuringSnapshot() throws Exception { */ public void testRestoreShrinkIndex() throws Exception { logger.info("--> starting a cluster-manager node and a data node"); - internalCluster().startMasterOnlyNode(); + internalCluster().startClusterManagerOnlyNode(); internalCluster().startDataOnlyNode(); final String repo = "test-repo"; @@ -1145,7 +1145,7 @@ public void testDeduplicateIndexMetadata() throws Exception { public void testDataNodeRestartWithBusyMasterDuringSnapshot() throws Exception { logger.info("--> starting a cluster-manager node and two data nodes"); - internalCluster().startMasterOnlyNode(); + internalCluster().startClusterManagerOnlyNode(); internalCluster().startDataOnlyNodes(2); final Path repoPath = randomRepoPath(); createRepository("test-repo", "mock", repoPath); @@ -1201,7 +1201,7 @@ public void testDataNodeRestartWithBusyMasterDuringSnapshot() throws Exception { public void testDataNodeRestartAfterShardSnapshotFailure() throws Exception { logger.info("--> starting a cluster-manager node and two data nodes"); - internalCluster().startMasterOnlyNode(); + internalCluster().startClusterManagerOnlyNode(); final List dataNodes = internalCluster().startDataOnlyNodes(2); final Path repoPath = randomRepoPath(); createRepository("test-repo", "mock", repoPath); @@ -1323,7 +1323,7 @@ public void testRetentionLeasesClearedOnRestore() throws Exception { } public void testAbortWaitsOnDataNode() throws Exception { - internalCluster().startMasterOnlyNode(); + internalCluster().startClusterManagerOnlyNode(); final String dataNodeName = internalCluster().startDataOnlyNode(); final String indexName = "test-index"; createIndex(indexName); @@ -1375,7 +1375,7 @@ public void onRequestSent( } public void testPartialSnapshotAllShardsMissing() throws Exception { - internalCluster().startMasterOnlyNode(); + internalCluster().startClusterManagerOnlyNode(); final String dataNode = internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "fs"); @@ -1393,7 +1393,7 @@ public void testPartialSnapshotAllShardsMissing() throws Exception { * correctly by testing a snapshot name collision. */ public void testCreateSnapshotLegacyPath() throws Exception { - final String clusterManagerNode = internalCluster().startMasterOnlyNode(); + final String clusterManagerNode = internalCluster().startClusterManagerOnlyNode(); internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "fs"); @@ -1425,7 +1425,7 @@ public void testCreateSnapshotLegacyPath() throws Exception { } public void testSnapshotDeleteRelocatingPrimaryIndex() throws Exception { - internalCluster().startMasterOnlyNode(); + internalCluster().startClusterManagerOnlyNode(); final List dataNodes = internalCluster().startDataOnlyNodes(2); final String repoName = "test-repo"; createRepository(repoName, "fs"); diff --git a/server/src/internalClusterTest/java/org/opensearch/snapshots/MultiClusterRepoAccessIT.java b/server/src/internalClusterTest/java/org/opensearch/snapshots/MultiClusterRepoAccessIT.java index 2b2b656d5dd0e..13aee8b8e18a6 100644 --- a/server/src/internalClusterTest/java/org/opensearch/snapshots/MultiClusterRepoAccessIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/snapshots/MultiClusterRepoAccessIT.java @@ -107,13 +107,13 @@ public void stopSecondCluster() throws IOException { } public void testConcurrentDeleteFromOtherCluster() throws InterruptedException { - internalCluster().startMasterOnlyNode(); + internalCluster().startClusterManagerOnlyNode(); internalCluster().startDataOnlyNode(); final String repoNameOnFirstCluster = "test-repo"; final String repoNameOnSecondCluster = randomBoolean() ? "test-repo" : "other-repo"; createRepository(repoNameOnFirstCluster, "fs", repoPath); - secondCluster.startMasterOnlyNode(); + secondCluster.startClusterManagerOnlyNode(); secondCluster.startDataOnlyNode(); secondCluster.client() .admin() diff --git a/server/src/internalClusterTest/java/org/opensearch/snapshots/SnapshotShardsServiceIT.java b/server/src/internalClusterTest/java/org/opensearch/snapshots/SnapshotShardsServiceIT.java index 762656e251659..4543a3e0a1b6d 100644 --- a/server/src/internalClusterTest/java/org/opensearch/snapshots/SnapshotShardsServiceIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/snapshots/SnapshotShardsServiceIT.java @@ -60,7 +60,7 @@ protected Collection> nodePlugins() { } public void testRetryPostingSnapshotStatusMessages() throws Exception { - internalCluster().startMasterOnlyNode(); + internalCluster().startClusterManagerOnlyNode(); internalCluster().startDataOnlyNode(); createRepository("test-repo", "mock"); diff --git a/server/src/test/java/org/opensearch/cluster/routing/DelayedAllocationServiceTests.java b/server/src/test/java/org/opensearch/cluster/routing/DelayedAllocationServiceTests.java index 1f45c5c1dfce4..635dfe409058a 100644 --- a/server/src/test/java/org/opensearch/cluster/routing/DelayedAllocationServiceTests.java +++ b/server/src/test/java/org/opensearch/cluster/routing/DelayedAllocationServiceTests.java @@ -83,7 +83,7 @@ public void createDelayedAllocationService() { threadPool = new TestThreadPool(getTestName()); clusterService = mock(ClusterService.class); allocationService = createAllocationService(Settings.EMPTY, new DelayedShardsMockGatewayAllocator()); - when(clusterService.getSettings()).thenReturn(NodeRoles.masterOnlyNode()); + when(clusterService.getSettings()).thenReturn(NodeRoles.clusterManagerOnlyNode()); delayedAllocationService = new TestDelayAllocationService(threadPool, clusterService, allocationService); verify(clusterService).addListener(delayedAllocationService); verify(clusterService).getSettings(); diff --git a/server/src/test/java/org/opensearch/cluster/routing/allocation/AllocationCommandsTests.java b/server/src/test/java/org/opensearch/cluster/routing/allocation/AllocationCommandsTests.java index cda0f1afaf62c..6fa91d9b2fa0f 100644 --- a/server/src/test/java/org/opensearch/cluster/routing/allocation/AllocationCommandsTests.java +++ b/server/src/test/java/org/opensearch/cluster/routing/allocation/AllocationCommandsTests.java @@ -737,7 +737,7 @@ public void testMoveShardToNonDataNode() { "test1", buildNewFakeTransportAddress(), emptyMap(), - MASTER_DATA_ROLES, + CLUSTER_MANAGER_DATA_ROLES, Version.CURRENT ); DiscoveryNode node2 = new DiscoveryNode( @@ -808,7 +808,7 @@ public void testMoveShardFromNonDataNode() { "test1", buildNewFakeTransportAddress(), emptyMap(), - MASTER_DATA_ROLES, + CLUSTER_MANAGER_DATA_ROLES, Version.CURRENT ); DiscoveryNode node2 = new DiscoveryNode( diff --git a/server/src/test/java/org/opensearch/cluster/routing/allocation/NodeVersionAllocationDeciderTests.java b/server/src/test/java/org/opensearch/cluster/routing/allocation/NodeVersionAllocationDeciderTests.java index 5972cc9981254..0ddc64f94d129 100644 --- a/server/src/test/java/org/opensearch/cluster/routing/allocation/NodeVersionAllocationDeciderTests.java +++ b/server/src/test/java/org/opensearch/cluster/routing/allocation/NodeVersionAllocationDeciderTests.java @@ -338,21 +338,21 @@ public void testRebalanceDoesNotAllocatePrimaryAndReplicasOnDifferentVersionNode "newNode", buildNewFakeTransportAddress(), emptyMap(), - MASTER_DATA_ROLES, + CLUSTER_MANAGER_DATA_ROLES, Version.CURRENT ); final DiscoveryNode oldNode1 = new DiscoveryNode( "oldNode1", buildNewFakeTransportAddress(), emptyMap(), - MASTER_DATA_ROLES, + CLUSTER_MANAGER_DATA_ROLES, VersionUtils.getPreviousVersion() ); final DiscoveryNode oldNode2 = new DiscoveryNode( "oldNode2", buildNewFakeTransportAddress(), emptyMap(), - MASTER_DATA_ROLES, + CLUSTER_MANAGER_DATA_ROLES, VersionUtils.getPreviousVersion() ); AllocationId allocationId1P = AllocationId.newInitializing(); @@ -457,21 +457,21 @@ public void testRestoreDoesNotAllocateSnapshotOnOlderNodes() { "newNode", buildNewFakeTransportAddress(), emptyMap(), - MASTER_DATA_ROLES, + CLUSTER_MANAGER_DATA_ROLES, Version.CURRENT ); final DiscoveryNode oldNode1 = new DiscoveryNode( "oldNode1", buildNewFakeTransportAddress(), emptyMap(), - MASTER_DATA_ROLES, + CLUSTER_MANAGER_DATA_ROLES, VersionUtils.getPreviousVersion() ); final DiscoveryNode oldNode2 = new DiscoveryNode( "oldNode2", buildNewFakeTransportAddress(), emptyMap(), - MASTER_DATA_ROLES, + CLUSTER_MANAGER_DATA_ROLES, VersionUtils.getPreviousVersion() ); diff --git a/server/src/test/java/org/opensearch/cluster/routing/allocation/SameShardRoutingTests.java b/server/src/test/java/org/opensearch/cluster/routing/allocation/SameShardRoutingTests.java index 36cb68e460418..5d3ed97afdd2d 100644 --- a/server/src/test/java/org/opensearch/cluster/routing/allocation/SameShardRoutingTests.java +++ b/server/src/test/java/org/opensearch/cluster/routing/allocation/SameShardRoutingTests.java @@ -96,7 +96,7 @@ public void testSameHost() { "test1", buildNewFakeTransportAddress(), emptyMap(), - MASTER_DATA_ROLES, + CLUSTER_MANAGER_DATA_ROLES, Version.CURRENT ) ) @@ -109,7 +109,7 @@ public void testSameHost() { "test1", buildNewFakeTransportAddress(), emptyMap(), - MASTER_DATA_ROLES, + CLUSTER_MANAGER_DATA_ROLES, Version.CURRENT ) ) @@ -138,7 +138,7 @@ public void testSameHost() { "test2", buildNewFakeTransportAddress(), emptyMap(), - MASTER_DATA_ROLES, + CLUSTER_MANAGER_DATA_ROLES, Version.CURRENT ) ) diff --git a/server/src/test/java/org/opensearch/cluster/routing/allocation/decider/DiskThresholdDeciderTests.java b/server/src/test/java/org/opensearch/cluster/routing/allocation/decider/DiskThresholdDeciderTests.java index a2fcf14638d45..79d6aa8e8d46b 100644 --- a/server/src/test/java/org/opensearch/cluster/routing/allocation/decider/DiskThresholdDeciderTests.java +++ b/server/src/test/java/org/opensearch/cluster/routing/allocation/decider/DiskThresholdDeciderTests.java @@ -921,14 +921,14 @@ public void testCanRemainWithShardRelocatingAway() { "node1", buildNewFakeTransportAddress(), emptyMap(), - MASTER_DATA_ROLES, + CLUSTER_MANAGER_DATA_ROLES, Version.CURRENT ); DiscoveryNode discoveryNode2 = new DiscoveryNode( "node2", buildNewFakeTransportAddress(), emptyMap(), - MASTER_DATA_ROLES, + CLUSTER_MANAGER_DATA_ROLES, Version.CURRENT ); DiscoveryNodes discoveryNodes = DiscoveryNodes.builder().add(discoveryNode1).add(discoveryNode2).build(); diff --git a/server/src/test/java/org/opensearch/gateway/IncrementalClusterStateWriterTests.java b/server/src/test/java/org/opensearch/gateway/IncrementalClusterStateWriterTests.java index 21d5c897c4a7d..1907abbfcaabd 100644 --- a/server/src/test/java/org/opensearch/gateway/IncrementalClusterStateWriterTests.java +++ b/server/src/test/java/org/opensearch/gateway/IncrementalClusterStateWriterTests.java @@ -181,8 +181,8 @@ private ClusterState clusterStateWithReplicatedClosedIndex(IndexMetadata indexMe private DiscoveryNodes.Builder generateDiscoveryNodes(boolean masterEligible) { Set dataOnlyRoles = Collections.singleton(DiscoveryNodeRole.DATA_ROLE); return DiscoveryNodes.builder() - .add(newNode("node1", masterEligible ? MASTER_DATA_ROLES : dataOnlyRoles)) - .add(newNode("master_node", MASTER_DATA_ROLES)) + .add(newNode("node1", masterEligible ? CLUSTER_MANAGER_DATA_ROLES : dataOnlyRoles)) + .add(newNode("master_node", CLUSTER_MANAGER_DATA_ROLES)) .localNodeId("node1") .masterNodeId(masterEligible ? "node1" : "master_node"); } diff --git a/server/src/test/java/org/opensearch/transport/RemoteClusterServiceTests.java b/server/src/test/java/org/opensearch/transport/RemoteClusterServiceTests.java index 75ba1fb56aa1d..0092763b4ba20 100644 --- a/server/src/test/java/org/opensearch/transport/RemoteClusterServiceTests.java +++ b/server/src/test/java/org/opensearch/transport/RemoteClusterServiceTests.java @@ -62,7 +62,7 @@ import java.util.concurrent.atomic.AtomicReference; import java.util.function.BiFunction; -import static org.opensearch.test.NodeRoles.masterOnlyNode; +import static org.opensearch.test.NodeRoles.clusterManagerOnlyNode; import static org.opensearch.test.NodeRoles.nonMasterNode; import static org.opensearch.test.NodeRoles.removeRoles; import static org.hamcrest.Matchers.either; @@ -553,7 +553,7 @@ public void testRemoteNodeRoles() throws IOException, InterruptedException { final Settings settings = Settings.EMPTY; final List knownNodes = new CopyOnWriteArrayList<>(); final Settings data = nonMasterNode(); - final Settings dedicatedMaster = masterOnlyNode(); + final Settings dedicatedMaster = clusterManagerOnlyNode(); try ( MockTransportService c1N1 = startTransport("cluster_1_node_1", knownNodes, Version.CURRENT, dedicatedMaster); MockTransportService c1N2 = startTransport("cluster_1_node_2", knownNodes, Version.CURRENT, data); diff --git a/test/framework/src/main/java/org/opensearch/action/support/replication/ClusterStateCreationUtils.java b/test/framework/src/main/java/org/opensearch/action/support/replication/ClusterStateCreationUtils.java index 72ca3617c40a3..18f8f4e584748 100644 --- a/test/framework/src/main/java/org/opensearch/action/support/replication/ClusterStateCreationUtils.java +++ b/test/framework/src/main/java/org/opensearch/action/support/replication/ClusterStateCreationUtils.java @@ -97,7 +97,7 @@ public static ClusterState state( numberOfNodes++; } } - numberOfNodes = Math.max(2, numberOfNodes); // we need a non-local master to test shard failures + numberOfNodes = Math.max(2, numberOfNodes); // we need a non-local cluster-manager to test shard failures final ShardId shardId = new ShardId(index, "_na_", 0); DiscoveryNodes.Builder discoBuilder = DiscoveryNodes.builder(); Set unassignedNodes = new HashSet<>(); @@ -107,7 +107,7 @@ public static ClusterState state( unassignedNodes.add(node.getId()); } discoBuilder.localNodeId(newNode(0).getId()); - discoBuilder.masterNodeId(newNode(1).getId()); // we need a non-local master to test shard failures + discoBuilder.masterNodeId(newNode(1).getId()); // we need a non-local cluster-manager to test shard failures final int primaryTerm = 1 + randomInt(200); IndexMetadata indexMetadata = IndexMetadata.builder(index) .settings( @@ -284,14 +284,14 @@ public static ClusterState state(final int numberOfNodes, final String[] indices */ public static ClusterState stateWithAssignedPrimariesAndOneReplica(String index, int numberOfShards) { - int numberOfNodes = 2; // we need a non-local master to test shard failures + int numberOfNodes = 2; // we need a non-local cluster-manager to test shard failures DiscoveryNodes.Builder discoBuilder = DiscoveryNodes.builder(); for (int i = 0; i < numberOfNodes + 1; i++) { final DiscoveryNode node = newNode(i); discoBuilder = discoBuilder.add(node); } discoBuilder.localNodeId(newNode(0).getId()); - discoBuilder.masterNodeId(newNode(1).getId()); // we need a non-local master to test shard failures + discoBuilder.masterNodeId(newNode(1).getId()); // we need a non-local cluster-manager to test shard failures IndexMetadata indexMetadata = IndexMetadata.builder(index) .settings( Settings.builder() @@ -426,20 +426,20 @@ public static ClusterState stateWithNoShard() { } /** - * Creates a cluster state where local node and master node can be specified + * Creates a cluster state where local node and cluster-manager node can be specified * * @param localNode node in allNodes that is the local node - * @param masterNode node in allNodes that is the master node. Can be null if no cluster-manager exists + * @param clusterManagerNode node in allNodes that is the cluster-manager node. Can be null if no cluster-manager exists * @param allNodes all nodes in the cluster * @return cluster state */ - public static ClusterState state(DiscoveryNode localNode, DiscoveryNode masterNode, DiscoveryNode... allNodes) { + public static ClusterState state(DiscoveryNode localNode, DiscoveryNode clusterManagerNode, DiscoveryNode... allNodes) { DiscoveryNodes.Builder discoBuilder = DiscoveryNodes.builder(); for (DiscoveryNode node : allNodes) { discoBuilder.add(node); } - if (masterNode != null) { - discoBuilder.masterNodeId(masterNode.getId()); + if (clusterManagerNode != null) { + discoBuilder.masterNodeId(clusterManagerNode.getId()); } discoBuilder.localNodeId(localNode.getId()); diff --git a/test/framework/src/main/java/org/opensearch/cluster/OpenSearchAllocationTestCase.java b/test/framework/src/main/java/org/opensearch/cluster/OpenSearchAllocationTestCase.java index e42dd42b18da5..a13d337fa4d26 100644 --- a/test/framework/src/main/java/org/opensearch/cluster/OpenSearchAllocationTestCase.java +++ b/test/framework/src/main/java/org/opensearch/cluster/OpenSearchAllocationTestCase.java @@ -148,7 +148,7 @@ public static AllocationDeciders randomAllocationDeciders(Settings settings, Clu return new AllocationDeciders(deciders); } - protected static Set MASTER_DATA_ROLES = Collections.unmodifiableSet( + protected static Set CLUSTER_MANAGER_DATA_ROLES = Collections.unmodifiableSet( new HashSet<>(Arrays.asList(DiscoveryNodeRole.CLUSTER_MANAGER_ROLE, DiscoveryNodeRole.DATA_ROLE)) ); @@ -157,11 +157,11 @@ protected static DiscoveryNode newNode(String nodeId) { } protected static DiscoveryNode newNode(String nodeName, String nodeId, Map attributes) { - return new DiscoveryNode(nodeName, nodeId, buildNewFakeTransportAddress(), attributes, MASTER_DATA_ROLES, Version.CURRENT); + return new DiscoveryNode(nodeName, nodeId, buildNewFakeTransportAddress(), attributes, CLUSTER_MANAGER_DATA_ROLES, Version.CURRENT); } protected static DiscoveryNode newNode(String nodeId, Map attributes) { - return new DiscoveryNode(nodeId, buildNewFakeTransportAddress(), attributes, MASTER_DATA_ROLES, Version.CURRENT); + return new DiscoveryNode(nodeId, buildNewFakeTransportAddress(), attributes, CLUSTER_MANAGER_DATA_ROLES, Version.CURRENT); } protected static DiscoveryNode newNode(String nodeId, Set roles) { @@ -169,7 +169,7 @@ protected static DiscoveryNode newNode(String nodeId, Set rol } protected static DiscoveryNode newNode(String nodeId, Version version) { - return new DiscoveryNode(nodeId, buildNewFakeTransportAddress(), emptyMap(), MASTER_DATA_ROLES, version); + return new DiscoveryNode(nodeId, buildNewFakeTransportAddress(), emptyMap(), CLUSTER_MANAGER_DATA_ROLES, version); } protected static ClusterState startRandomInitializingShard(ClusterState clusterState, AllocationService strategy) { diff --git a/test/framework/src/main/java/org/opensearch/cluster/coordination/AbstractCoordinatorTestCase.java b/test/framework/src/main/java/org/opensearch/cluster/coordination/AbstractCoordinatorTestCase.java index 6178ead662870..8b30d266dc74c 100644 --- a/test/framework/src/main/java/org/opensearch/cluster/coordination/AbstractCoordinatorTestCase.java +++ b/test/framework/src/main/java/org/opensearch/cluster/coordination/AbstractCoordinatorTestCase.java @@ -217,13 +217,13 @@ protected static int defaultInt(Setting setting) { } // Updating the cluster state involves up to 7 delays: - // 1. submit the task to the master service + // 1. submit the task to the cluster-manager service // 2. send PublishRequest // 3. receive PublishResponse // 4. send ApplyCommitRequest // 5. apply committed cluster state // 6. receive ApplyCommitResponse - // 7. apply committed state on master (last one to apply cluster state) + // 7. apply committed state on cluster-manager (last one to apply cluster state) public static final long DEFAULT_CLUSTER_STATE_UPDATE_DELAY = 7 * DEFAULT_DELAY_VARIABILITY; private static final int ELECTION_RETRIES = 10; @@ -288,11 +288,11 @@ class Cluster implements Releasable { this(initialNodeCount, true, Settings.EMPTY); } - Cluster(int initialNodeCount, boolean allNodesMasterEligible, Settings nodeSettings) { - this(initialNodeCount, allNodesMasterEligible, nodeSettings, () -> new StatusInfo(HEALTHY, "healthy-info")); + Cluster(int initialNodeCount, boolean allNodesclusterManagerEligible, Settings nodeSettings) { + this(initialNodeCount, allNodesclusterManagerEligible, nodeSettings, () -> new StatusInfo(HEALTHY, "healthy-info")); } - Cluster(int initialNodeCount, boolean allNodesMasterEligible, Settings nodeSettings, NodeHealthService nodeHealthService) { + Cluster(int initialNodeCount, boolean allNodesClusterManagerEligible, Settings nodeSettings, NodeHealthService nodeHealthService) { this.nodeHealthService = nodeHealthService; bigArrays = usually() ? BigArrays.NON_RECYCLING_INSTANCE @@ -301,29 +301,29 @@ class Cluster implements Releasable { assertThat(initialNodeCount, greaterThan(0)); - final Set masterEligibleNodeIds = new HashSet<>(initialNodeCount); + final Set clusterManagerEligibleNodeIds = new HashSet<>(initialNodeCount); clusterNodes = new ArrayList<>(initialNodeCount); for (int i = 0; i < initialNodeCount; i++) { final ClusterNode clusterNode = new ClusterNode( nextNodeIndex.getAndIncrement(), - allNodesMasterEligible || i == 0 || randomBoolean(), + allNodesClusterManagerEligible || i == 0 || randomBoolean(), nodeSettings, nodeHealthService ); clusterNodes.add(clusterNode); if (clusterNode.getLocalNode().isMasterNode()) { - masterEligibleNodeIds.add(clusterNode.getId()); + clusterManagerEligibleNodeIds.add(clusterNode.getId()); } } initialConfiguration = new VotingConfiguration( - new HashSet<>(randomSubsetOf(randomIntBetween(1, masterEligibleNodeIds.size()), masterEligibleNodeIds)) + new HashSet<>(randomSubsetOf(randomIntBetween(1, clusterManagerEligibleNodeIds.size()), clusterManagerEligibleNodeIds)) ); logger.info( "--> creating cluster of {} nodes (cluster-manager-eligible nodes: {}) with initial configuration {}", initialNodeCount, - masterEligibleNodeIds, + clusterManagerEligibleNodeIds, initialConfiguration ); } @@ -616,7 +616,7 @@ void stabilise(long stabilisationDurationMillis) { ); assertTrue(nodeId + " has been bootstrapped", clusterNode.coordinator.isInitialConfigurationSet()); assertThat( - nodeId + " has correct master", + nodeId + " has correct cluster-manager", clusterNode.getLastAppliedClusterState().nodes().getMasterNode(), equalTo(leader.getLocalNode()) ); @@ -930,7 +930,7 @@ && randomBoolean()) { final long newValue = randomLong(); logger.trace( - "rolling back persisted cluster state on master-ineligible node [{}]: " + "rolling back persisted cluster state on cluster-manager-ineligible node [{}]: " + "previously currentTerm={}, lastAcceptedTerm={}, lastAcceptedVersion={} " + "but now currentTerm={}, lastAcceptedTerm={}, lastAcceptedVersion={}", newLocalNode, diff --git a/test/framework/src/main/java/org/opensearch/test/InternalTestCluster.java b/test/framework/src/main/java/org/opensearch/test/InternalTestCluster.java index f37a1d68ec384..3e0dbac0843bb 100644 --- a/test/framework/src/main/java/org/opensearch/test/InternalTestCluster.java +++ b/test/framework/src/main/java/org/opensearch/test/InternalTestCluster.java @@ -166,7 +166,7 @@ import static org.opensearch.test.OpenSearchTestCase.assertBusy; import static org.opensearch.test.OpenSearchTestCase.randomFrom; import static org.opensearch.test.NodeRoles.dataOnlyNode; -import static org.opensearch.test.NodeRoles.masterOnlyNode; +import static org.opensearch.test.NodeRoles.clusterManagerOnlyNode; import static org.opensearch.test.NodeRoles.noRoles; import static org.opensearch.test.NodeRoles.onlyRole; import static org.opensearch.test.NodeRoles.removeRoles; @@ -249,7 +249,7 @@ public final class InternalTestCluster extends TestCluster { private final ExecutorService executor; - private final boolean autoManageMasterNodes; + private final boolean autoManageClusterManagerNodes; private final Collection> mockPlugins; @@ -272,7 +272,7 @@ public InternalTestCluster( final long clusterSeed, final Path baseDir, final boolean randomlyAddDedicatedMasters, - final boolean autoManageMasterNodes, + final boolean autoManageClusterManagerNodes, final int minNumDataNodes, final int maxNumDataNodes, final String clusterName, @@ -286,7 +286,7 @@ public InternalTestCluster( clusterSeed, baseDir, randomlyAddDedicatedMasters, - autoManageMasterNodes, + autoManageClusterManagerNodes, minNumDataNodes, maxNumDataNodes, clusterName, @@ -303,7 +303,7 @@ public InternalTestCluster( final long clusterSeed, final Path baseDir, final boolean randomlyAddDedicatedMasters, - final boolean autoManageMasterNodes, + final boolean autoManageClusterManagerNodes, final int minNumDataNodes, final int maxNumDataNodes, final String clusterName, @@ -315,7 +315,7 @@ public InternalTestCluster( final boolean forbidPrivateIndexSettings ) { super(clusterSeed); - this.autoManageMasterNodes = autoManageMasterNodes; + this.autoManageClusterManagerNodes = autoManageClusterManagerNodes; this.clientWrapper = clientWrapper; this.forbidPrivateIndexSettings = forbidPrivateIndexSettings; this.baseDir = baseDir; @@ -380,7 +380,7 @@ public InternalTestCluster( numSharedDedicatedMasterNodes, numSharedDataNodes, numSharedCoordOnlyNodes, - autoManageMasterNodes ? "auto-managed" : "manual" + autoManageClusterManagerNodes ? "auto-managed" : "manual" ); this.nodeConfigurationSource = nodeConfigurationSource; numDataPaths = random.nextInt(5) == 0 ? 2 + random.nextInt(3) : 1; @@ -454,7 +454,7 @@ public InternalTestCluster( * It's only possible to change {@link #bootstrapMasterNodeIndex} value if autoManageMasterNodes is false. */ public void setBootstrapMasterNodeIndex(int bootstrapMasterNodeIndex) { - assert autoManageMasterNodes == false || bootstrapMasterNodeIndex == -1 + assert autoManageClusterManagerNodes == false || bootstrapMasterNodeIndex == -1 : "bootstrapMasterNodeIndex should be -1 if autoManageMasterNodes is true, but was " + bootstrapMasterNodeIndex; this.bootstrapMasterNodeIndex = bootstrapMasterNodeIndex; } @@ -718,7 +718,7 @@ private Settings getNodeSettings(final int nodeId, final long seed, final Settin final String discoveryType = DISCOVERY_TYPE_SETTING.get(updatedSettings.build()); final boolean usingSingleNodeDiscovery = discoveryType.equals("single-node"); if (usingSingleNodeDiscovery == false) { - if (autoManageMasterNodes) { + if (autoManageClusterManagerNodes) { assertThat( "if master nodes are automatically managed then nodes must complete a join cycle when starting", updatedSettings.get(DiscoverySettings.INITIAL_STATE_TIMEOUT_SETTING.getKey()), @@ -1161,7 +1161,7 @@ private synchronized void reset(boolean wipeData) throws IOException { .map(Node.NODE_NAME_SETTING::get) .collect(Collectors.toList()); - if (prevNodeCount == 0 && autoManageMasterNodes) { + if (prevNodeCount == 0 && autoManageClusterManagerNodes) { if (numSharedDedicatedMasterNodes > 0) { autoBootstrapMasterNodeIndex = RandomNumbers.randomIntBetween(random, 0, numSharedDedicatedMasterNodes - 1); } else if (numSharedDataNodes > 0) { @@ -1187,7 +1187,7 @@ private synchronized void reset(boolean wipeData) throws IOException { nextNodeId.set(newSize); assert size() == newSize; - if (autoManageMasterNodes && newSize > 0) { + if (autoManageClusterManagerNodes && newSize > 0) { validateClusterFormed(); } logger.debug( @@ -1214,7 +1214,7 @@ public synchronized void validateClusterFormed() { .map(ClusterService::state) .collect(Collectors.toList()); final String debugString = ", expected nodes: " + expectedNodes + " and actual cluster states " + states; - // all nodes have a master + // all nodes have a cluster-manager assertTrue("Missing master" + debugString, states.stream().allMatch(cs -> cs.nodes().getMasterNodeId() != null)); // all nodes have the same master (in same term) assertEquals( @@ -1653,7 +1653,7 @@ public synchronized void stopRandomNode(final Predicate filter) throws if (nodePrefix.equals(OpenSearchIntegTestCase.SUITE_CLUSTER_NODE_PREFIX) && nodeAndClient.nodeAndClientId() < sharedNodesSeeds.length && nodeAndClient.isMasterEligible() - && autoManageMasterNodes + && autoManageClusterManagerNodes && nodes.values() .stream() .filter(NodeAndClient::isMasterEligible) @@ -1713,7 +1713,7 @@ private synchronized void startAndPublishNodesAndClients(List nod } nodeAndClients.forEach(this::publishNode); - if (autoManageMasterNodes + if (autoManageClusterManagerNodes && currentMasters > 0 && newMasters > 0 && getMinMasterNodes(currentMasters + newMasters) > currentMasters) { @@ -1838,7 +1838,7 @@ private void restartNode(NodeAndClient nodeAndClient, RestartCallback callback) final Settings newSettings = nodeAndClient.closeForRestart( callback, - autoManageMasterNodes ? getMinMasterNodes(getMasterNodesCount()) : -1 + autoManageClusterManagerNodes ? getMinMasterNodes(getMasterNodesCount()) : -1 ); removeExclusions(excludedNodeIds); @@ -1865,7 +1865,7 @@ private NodeAndClient removeNode(NodeAndClient nodeAndClient) { private Set excludeMasters(Collection nodeAndClients) { assert Thread.holdsLock(this); final Set excludedNodeNames = new HashSet<>(); - if (autoManageMasterNodes && nodeAndClients.size() > 0) { + if (autoManageClusterManagerNodes && nodeAndClients.size() > 0) { final long currentMasters = nodes.values().stream().filter(NodeAndClient::isMasterEligible).count(); final long stoppingMasters = nodeAndClients.stream().filter(NodeAndClient::isMasterEligible).count(); @@ -1912,7 +1912,7 @@ private void removeExclusions(Set excludedNodeIds) { public synchronized void fullRestart(RestartCallback callback) throws Exception { int numNodesRestarted = 0; final Settings[] newNodeSettings = new Settings[nextNodeId.get()]; - final int minMasterNodes = autoManageMasterNodes ? getMinMasterNodes(getMasterNodesCount()) : -1; + final int minMasterNodes = autoManageClusterManagerNodes ? getMinMasterNodes(getMasterNodesCount()) : -1; final List toStartAndPublish = new ArrayList<>(); // we want to start nodes in one go for (NodeAndClient nodeAndClient : nodes.values()) { callback.doAfterNodes(numNodesRestarted++, nodeAndClient.nodeClient()); @@ -2091,14 +2091,14 @@ public List startNodes(int numOfNodes, Settings settings) { public synchronized List startNodes(Settings... extraSettings) { final int newMasterCount = Math.toIntExact(Stream.of(extraSettings).filter(DiscoveryNode::isMasterNode).count()); final int defaultMinMasterNodes; - if (autoManageMasterNodes) { + if (autoManageClusterManagerNodes) { defaultMinMasterNodes = getMinMasterNodes(getMasterNodesCount() + newMasterCount); } else { defaultMinMasterNodes = -1; } final List nodes = new ArrayList<>(); final int prevMasterCount = getMasterNodesCount(); - int autoBootstrapMasterNodeIndex = autoManageMasterNodes + int autoBootstrapMasterNodeIndex = autoManageClusterManagerNodes && prevMasterCount == 0 && newMasterCount > 0 && Arrays.stream(extraSettings) @@ -2140,7 +2140,7 @@ public synchronized List startNodes(Settings... extraSettings) { nodes.add(nodeAndClient); } startAndPublishNodesAndClients(nodes); - if (autoManageMasterNodes) { + if (autoManageClusterManagerNodes) { validateClusterFormed(); } return nodes.stream().map(NodeAndClient::getName).collect(Collectors.toList()); @@ -2171,12 +2171,12 @@ private int getMasterNodesCount() { return (int) nodes.values().stream().filter(n -> DiscoveryNode.isMasterNode(n.node().settings())).count(); } - public String startMasterOnlyNode() { - return startMasterOnlyNode(Settings.EMPTY); + public String startClusterManagerOnlyNode() { + return startClusterManagerOnlyNode(Settings.EMPTY); } - public String startMasterOnlyNode(Settings settings) { - Settings settings1 = Settings.builder().put(settings).put(masterOnlyNode(settings)).build(); + public String startClusterManagerOnlyNode(Settings settings) { + Settings settings1 = Settings.builder().put(settings).put(NodeRoles.clusterManagerOnlyNode(settings)).build(); return startNode(settings1); } diff --git a/test/framework/src/main/java/org/opensearch/test/NodeRoles.java b/test/framework/src/main/java/org/opensearch/test/NodeRoles.java index 64fd6b22e9805..4f448e230a2b6 100644 --- a/test/framework/src/main/java/org/opensearch/test/NodeRoles.java +++ b/test/framework/src/main/java/org/opensearch/test/NodeRoles.java @@ -176,11 +176,11 @@ public static Settings masterNode(final Settings settings) { return addRoles(settings, Collections.singleton(DiscoveryNodeRole.CLUSTER_MANAGER_ROLE)); } - public static Settings masterOnlyNode() { - return masterOnlyNode(Settings.EMPTY); + public static Settings clusterManagerOnlyNode() { + return clusterManagerOnlyNode(Settings.EMPTY); } - public static Settings masterOnlyNode(final Settings settings) { + public static Settings clusterManagerOnlyNode(final Settings settings) { return onlyRole(settings, DiscoveryNodeRole.CLUSTER_MANAGER_ROLE); } diff --git a/test/framework/src/test/java/org/opensearch/test/test/InternalTestClusterIT.java b/test/framework/src/test/java/org/opensearch/test/test/InternalTestClusterIT.java index b650eb2c03022..0464343c2c6ee 100644 --- a/test/framework/src/test/java/org/opensearch/test/test/InternalTestClusterIT.java +++ b/test/framework/src/test/java/org/opensearch/test/test/InternalTestClusterIT.java @@ -79,7 +79,7 @@ public void testStoppingNodesOneByOne() throws IOException { } public void testOperationsDuringRestart() throws Exception { - internalCluster().startMasterOnlyNode(); + internalCluster().startClusterManagerOnlyNode(); internalCluster().startDataOnlyNodes(2); internalCluster().restartRandomDataNode(new InternalTestCluster.RestartCallback() { @Override diff --git a/test/framework/src/test/java/org/opensearch/test/test/InternalTestClusterTests.java b/test/framework/src/test/java/org/opensearch/test/test/InternalTestClusterTests.java index 87cd98a717be6..dc89d21a78506 100644 --- a/test/framework/src/test/java/org/opensearch/test/test/InternalTestClusterTests.java +++ b/test/framework/src/test/java/org/opensearch/test/test/InternalTestClusterTests.java @@ -165,23 +165,23 @@ public static void assertSettings(Settings left, Settings right, boolean checkCl } public void testBeforeTest() throws Exception { - final boolean autoManageMinMasterNodes = randomBoolean(); + final boolean autoManageMinClusterManagerNodes = randomBoolean(); long clusterSeed = randomLong(); - final boolean masterNodes; + final boolean clusterManagerNodes; final int minNumDataNodes; final int maxNumDataNodes; - final int bootstrapMasterNodeIndex; - if (autoManageMinMasterNodes) { - masterNodes = randomBoolean(); + final int bootstrapClusterManagerNodeIndex; + if (autoManageMinClusterManagerNodes) { + clusterManagerNodes = randomBoolean(); minNumDataNodes = randomIntBetween(0, 3); maxNumDataNodes = randomIntBetween(minNumDataNodes, 4); - bootstrapMasterNodeIndex = -1; + bootstrapClusterManagerNodeIndex = -1; } else { - // if we manage min master nodes, we need to lock down the number of nodes + // if we manage min cluster-manager nodes, we need to lock down the number of nodes minNumDataNodes = randomIntBetween(0, 4); maxNumDataNodes = minNumDataNodes; - masterNodes = false; - bootstrapMasterNodeIndex = maxNumDataNodes == 0 ? -1 : randomIntBetween(0, maxNumDataNodes - 1); + clusterManagerNodes = false; + bootstrapClusterManagerNodeIndex = maxNumDataNodes == 0 ? -1 : randomIntBetween(0, maxNumDataNodes - 1); } final int numClientNodes = randomIntBetween(0, 2); NodeConfigurationSource nodeConfigurationSource = new NodeConfigurationSource() { @@ -191,9 +191,9 @@ public Settings nodeSettings(int nodeOrdinal) { .put(DiscoveryModule.DISCOVERY_SEED_PROVIDERS_SETTING.getKey(), "file") .putList(SettingsBasedSeedHostsProvider.DISCOVERY_SEED_HOSTS_SETTING.getKey()) .put(NetworkModule.TRANSPORT_TYPE_KEY, getTestTransportType()); - if (autoManageMinMasterNodes == false) { + if (autoManageMinClusterManagerNodes == false) { assert minNumDataNodes == maxNumDataNodes; - assert masterNodes == false; + assert clusterManagerNodes == false; } return settings.build(); } @@ -209,8 +209,8 @@ public Path nodeConfigPath(int nodeOrdinal) { InternalTestCluster cluster0 = new InternalTestCluster( clusterSeed, createTempDir(), - masterNodes, - autoManageMinMasterNodes, + clusterManagerNodes, + autoManageMinClusterManagerNodes, minNumDataNodes, maxNumDataNodes, "clustername", @@ -220,13 +220,13 @@ public Path nodeConfigPath(int nodeOrdinal) { mockPlugins(), Function.identity() ); - cluster0.setBootstrapMasterNodeIndex(bootstrapMasterNodeIndex); + cluster0.setBootstrapMasterNodeIndex(bootstrapClusterManagerNodeIndex); InternalTestCluster cluster1 = new InternalTestCluster( clusterSeed, createTempDir(), - masterNodes, - autoManageMinMasterNodes, + clusterManagerNodes, + autoManageMinClusterManagerNodes, minNumDataNodes, maxNumDataNodes, "clustername", @@ -236,7 +236,7 @@ public Path nodeConfigPath(int nodeOrdinal) { mockPlugins(), Function.identity() ); - cluster1.setBootstrapMasterNodeIndex(bootstrapMasterNodeIndex); + cluster1.setBootstrapMasterNodeIndex(bootstrapClusterManagerNodeIndex); assertClusters(cluster0, cluster1, false); long seed = randomLong(); @@ -265,7 +265,7 @@ public Path nodeConfigPath(int nodeOrdinal) { public void testDataFolderAssignmentAndCleaning() throws IOException, InterruptedException { long clusterSeed = randomLong(); - boolean masterNodes = randomBoolean(); + boolean clusterManagerNodes = randomBoolean(); // we need one stable node final int minNumDataNodes = 2; final int maxNumDataNodes = 2; @@ -291,7 +291,7 @@ public Path nodeConfigPath(int nodeOrdinal) { InternalTestCluster cluster = new InternalTestCluster( clusterSeed, baseDir, - masterNodes, + clusterManagerNodes, true, minNumDataNodes, maxNumDataNodes, @@ -304,13 +304,13 @@ public Path nodeConfigPath(int nodeOrdinal) { ); try { cluster.beforeTest(random()); - final int originalMasterCount = cluster.numMasterNodes(); + final int originalClusterManagerCount = cluster.numMasterNodes(); final Map shardNodePaths = new HashMap<>(); for (String name : cluster.getNodeNames()) { shardNodePaths.put(name, getNodePaths(cluster, name)); } String poorNode = randomValueOtherThanMany( - n -> originalMasterCount == 1 && n.equals(cluster.getMasterName()), + n -> originalClusterManagerCount == 1 && n.equals(cluster.getMasterName()), () -> randomFrom(cluster.getNodeNames()) ); Path dataPath = getNodePaths(cluster, poorNode)[0]; @@ -419,7 +419,7 @@ public Path nodeConfigPath(int nodeOrdinal) { final DiscoveryNodeRole role = roles.get(i); final String node; if (role == clusterManagerRole) { - node = cluster.startMasterOnlyNode(); + node = cluster.startClusterManagerOnlyNode(); } else if (role == DiscoveryNodeRole.DATA_ROLE) { node = cluster.startDataOnlyNode(); } else if (role == DiscoveryNodeRole.INGEST_ROLE) { From 0b21a2d11dbff28d2c2ca8585d21f0fc5fbb34b4 Mon Sep 17 00:00:00 2001 From: Tianli Feng Date: Tue, 10 May 2022 17:40:59 -0700 Subject: [PATCH 3/6] Replace 'master' terminology with 'cluster manager' in server/src/internalClusterTest directory Signed-off-by: Tianli Feng --- .../rest/discovery/Zen2RestApiIT.java | 10 +- .../http/DanglingIndicesRestIT.java | 6 +- .../admin/indices/exists/IndicesExistsIT.java | 2 +- .../master/IndexingMasterFailoverIT.java | 2 +- .../cluster/MinimumMasterNodesIT.java | 6 +- .../cluster/SpecificMasterNodesIT.java | 6 +- .../coordination/RemoveCustomsCommandIT.java | 6 +- .../coordination/RemoveSettingsCommandIT.java | 6 +- .../UnsafeBootstrapAndDetachCommandIT.java | 18 +-- .../coordination/VotingConfigurationIT.java | 4 +- .../gateway/RecoverAfterNodesIT.java | 6 +- .../AbstractCoordinatorTestCase.java | 34 +++--- .../opensearch/common/util/MockBigArrays.java | 2 +- .../opensearch/test/InternalTestCluster.java | 104 +++++++++--------- .../test/OpenSearchIntegTestCase.java | 32 +++--- .../test/OpenSearchSingleNodeTestCase.java | 2 +- .../java/org/opensearch/test/TestCluster.java | 2 +- .../org/opensearch/test/VersionUtils.java | 4 +- .../BlockMasterServiceOnMaster.java | 2 +- .../BusyMasterServiceDisruption.java | 2 +- .../test/disruption/NetworkDisruption.java | 2 +- .../test/rest/yaml/ClientYamlTestClient.java | 10 +- .../yaml/ClientYamlTestExecutionContext.java | 2 +- .../OpenSearchClientYamlSuiteTestCase.java | 28 ++--- .../test/rest/yaml/section/DoSection.java | 2 +- .../FakeThreadPoolMasterServiceTests.java | 12 +- .../test/disruption/NetworkDisruptionIT.java | 6 +- .../test/test/InternalTestClusterTests.java | 12 +- 28 files changed, 165 insertions(+), 165 deletions(-) diff --git a/modules/transport-netty4/src/internalClusterTest/java/org/opensearch/rest/discovery/Zen2RestApiIT.java b/modules/transport-netty4/src/internalClusterTest/java/org/opensearch/rest/discovery/Zen2RestApiIT.java index f7899d91e0cb9..96e21e0e05ff7 100644 --- a/modules/transport-netty4/src/internalClusterTest/java/org/opensearch/rest/discovery/Zen2RestApiIT.java +++ b/modules/transport-netty4/src/internalClusterTest/java/org/opensearch/rest/discovery/Zen2RestApiIT.java @@ -69,7 +69,7 @@ protected boolean addMockHttpTransport() { } public void testRollingRestartOfTwoNodeCluster() throws Exception { - internalCluster().setBootstrapMasterNodeIndex(1); + internalCluster().setBootstrapClusterManagerNodeIndex(1); final List nodes = internalCluster().startNodes(2); createIndex( "test", @@ -135,7 +135,7 @@ public Settings onNodeStopped(String nodeName) throws IOException { } public void testClearVotingTombstonesNotWaitingForRemoval() throws Exception { - internalCluster().setBootstrapMasterNodeIndex(2); + internalCluster().setBootstrapClusterManagerNodeIndex(2); List nodes = internalCluster().startNodes(3); ensureStableCluster(3); RestClient restClient = getRestClient(); @@ -150,7 +150,7 @@ public void testClearVotingTombstonesNotWaitingForRemoval() throws Exception { } public void testClearVotingTombstonesWaitingForRemoval() throws Exception { - internalCluster().setBootstrapMasterNodeIndex(2); + internalCluster().setBootstrapClusterManagerNodeIndex(2); List nodes = internalCluster().startNodes(3); ensureStableCluster(3); RestClient restClient = getRestClient(); @@ -165,7 +165,7 @@ public void testClearVotingTombstonesWaitingForRemoval() throws Exception { } public void testFailsOnUnknownNode() throws Exception { - internalCluster().setBootstrapMasterNodeIndex(2); + internalCluster().setBootstrapClusterManagerNodeIndex(2); internalCluster().startNodes(3); ensureStableCluster(3); RestClient restClient = getRestClient(); @@ -182,7 +182,7 @@ public void testFailsOnUnknownNode() throws Exception { } public void testRemoveTwoNodesAtOnce() throws Exception { - internalCluster().setBootstrapMasterNodeIndex(2); + internalCluster().setBootstrapClusterManagerNodeIndex(2); List nodes = internalCluster().startNodes(3); ensureStableCluster(3); RestClient restClient = getRestClient(); diff --git a/qa/smoke-test-http/src/test/java/org/opensearch/http/DanglingIndicesRestIT.java b/qa/smoke-test-http/src/test/java/org/opensearch/http/DanglingIndicesRestIT.java index 3b32ac40917e4..8ce546e327c31 100644 --- a/qa/smoke-test-http/src/test/java/org/opensearch/http/DanglingIndicesRestIT.java +++ b/qa/smoke-test-http/src/test/java/org/opensearch/http/DanglingIndicesRestIT.java @@ -91,7 +91,7 @@ private Settings buildSettings(int maxTombstones) { * Check that when dangling indices are discovered, then they can be listed via the REST API. */ public void testDanglingIndicesCanBeListed() throws Exception { - internalCluster().setBootstrapMasterNodeIndex(1); + internalCluster().setBootstrapClusterManagerNodeIndex(1); internalCluster().startNodes(3, buildSettings(0)); final DanglingIndexDetails danglingIndexDetails = createDanglingIndices(INDEX_NAME); @@ -121,7 +121,7 @@ public void testDanglingIndicesCanBeListed() throws Exception { * Check that dangling indices can be imported. */ public void testDanglingIndicesCanBeImported() throws Exception { - internalCluster().setBootstrapMasterNodeIndex(1); + internalCluster().setBootstrapClusterManagerNodeIndex(1); internalCluster().startNodes(3, buildSettings(0)); createDanglingIndices(INDEX_NAME); @@ -157,7 +157,7 @@ public void testDanglingIndicesCanBeImported() throws Exception { * deleted through the API */ public void testDanglingIndicesCanBeDeleted() throws Exception { - internalCluster().setBootstrapMasterNodeIndex(1); + internalCluster().setBootstrapClusterManagerNodeIndex(1); internalCluster().startNodes(3, buildSettings(1)); createDanglingIndices(INDEX_NAME, OTHER_INDEX_NAME); diff --git a/server/src/internalClusterTest/java/org/opensearch/action/admin/indices/exists/IndicesExistsIT.java b/server/src/internalClusterTest/java/org/opensearch/action/admin/indices/exists/IndicesExistsIT.java index f8be80948f8cf..810d8b9f2d226 100644 --- a/server/src/internalClusterTest/java/org/opensearch/action/admin/indices/exists/IndicesExistsIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/action/admin/indices/exists/IndicesExistsIT.java @@ -48,7 +48,7 @@ public class IndicesExistsIT extends OpenSearchIntegTestCase { public void testIndexExistsWithBlocksInPlace() throws IOException { - internalCluster().setBootstrapMasterNodeIndex(0); + internalCluster().setBootstrapClusterManagerNodeIndex(0); Settings settings = Settings.builder().put(GatewayService.RECOVER_AFTER_NODES_SETTING.getKey(), 99).build(); String node = internalCluster().startNode(settings); diff --git a/server/src/internalClusterTest/java/org/opensearch/action/support/master/IndexingMasterFailoverIT.java b/server/src/internalClusterTest/java/org/opensearch/action/support/master/IndexingMasterFailoverIT.java index f8db63bc8b61d..b4e4c058be198 100644 --- a/server/src/internalClusterTest/java/org/opensearch/action/support/master/IndexingMasterFailoverIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/action/support/master/IndexingMasterFailoverIT.java @@ -65,7 +65,7 @@ protected Collection> nodePlugins() { public void testMasterFailoverDuringIndexingWithMappingChanges() throws Throwable { logger.info("--> start 4 nodes, 3 master, 1 data"); - internalCluster().setBootstrapMasterNodeIndex(2); + internalCluster().setBootstrapClusterManagerNodeIndex(2); internalCluster().startMasterOnlyNodes(3, Settings.EMPTY); diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/MinimumMasterNodesIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/MinimumMasterNodesIT.java index 79a47ab7eca0f..4981da39197c3 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/MinimumMasterNodesIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/MinimumMasterNodesIT.java @@ -84,7 +84,7 @@ protected Collection> nodePlugins() { } public void testTwoNodesNoMasterBlock() throws Exception { - internalCluster().setBootstrapMasterNodeIndex(1); + internalCluster().setBootstrapClusterManagerNodeIndex(1); Settings settings = Settings.builder().put("discovery.initial_state_timeout", "500ms").build(); @@ -250,7 +250,7 @@ public void testTwoNodesNoMasterBlock() throws Exception { } public void testThreeNodesNoMasterBlock() throws Exception { - internalCluster().setBootstrapMasterNodeIndex(2); + internalCluster().setBootstrapClusterManagerNodeIndex(2); Settings settings = Settings.builder().put("discovery.initial_state_timeout", "500ms").build(); @@ -340,7 +340,7 @@ public void testThreeNodesNoMasterBlock() throws Exception { } public void testCannotCommitStateThreeNodes() throws Exception { - internalCluster().setBootstrapMasterNodeIndex(2); + internalCluster().setBootstrapClusterManagerNodeIndex(2); Settings settings = Settings.builder().put("discovery.initial_state_timeout", "500ms").build(); diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/SpecificMasterNodesIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/SpecificMasterNodesIT.java index 42ed9598694d6..e72ce5d85303d 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/SpecificMasterNodesIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/SpecificMasterNodesIT.java @@ -56,7 +56,7 @@ public class SpecificMasterNodesIT extends OpenSearchIntegTestCase { public void testSimpleOnlyMasterNodeElection() throws IOException { - internalCluster().setBootstrapMasterNodeIndex(0); + internalCluster().setBootstrapClusterManagerNodeIndex(0); logger.info("--> start data node / non master node"); internalCluster().startNode(Settings.builder().put(dataOnlyNode()).put("discovery.initial_state_timeout", "1s")); try { @@ -160,7 +160,7 @@ public void testSimpleOnlyMasterNodeElection() throws IOException { } public void testElectOnlyBetweenMasterNodes() throws Exception { - internalCluster().setBootstrapMasterNodeIndex(0); + internalCluster().setBootstrapClusterManagerNodeIndex(0); logger.info("--> start data node / non master node"); internalCluster().startNode(Settings.builder().put(dataOnlyNode()).put("discovery.initial_state_timeout", "1s")); try { @@ -312,7 +312,7 @@ public void testElectOnlyBetweenMasterNodes() throws Exception { } public void testAliasFilterValidation() { - internalCluster().setBootstrapMasterNodeIndex(0); + internalCluster().setBootstrapClusterManagerNodeIndex(0); logger.info("--> start master node / non data"); internalCluster().startClusterManagerOnlyNode(); diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/RemoveCustomsCommandIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/RemoveCustomsCommandIT.java index 5037f51e2b3f0..05e8cd4e93d0e 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/RemoveCustomsCommandIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/RemoveCustomsCommandIT.java @@ -46,7 +46,7 @@ public class RemoveCustomsCommandIT extends OpenSearchIntegTestCase { public void testRemoveCustomsAbortedByUser() throws Exception { - internalCluster().setBootstrapMasterNodeIndex(0); + internalCluster().setBootstrapClusterManagerNodeIndex(0); String node = internalCluster().startNode(); Settings dataPathSettings = internalCluster().dataPathSettings(node); ensureStableCluster(1); @@ -59,7 +59,7 @@ public void testRemoveCustomsAbortedByUser() throws Exception { } public void testRemoveCustomsSuccessful() throws Exception { - internalCluster().setBootstrapMasterNodeIndex(0); + internalCluster().setBootstrapClusterManagerNodeIndex(0); String node = internalCluster().startNode(); createIndex("test"); client().admin().indices().prepareDelete("test").get(); @@ -85,7 +85,7 @@ public void testRemoveCustomsSuccessful() throws Exception { } public void testCustomDoesNotMatch() throws Exception { - internalCluster().setBootstrapMasterNodeIndex(0); + internalCluster().setBootstrapClusterManagerNodeIndex(0); String node = internalCluster().startNode(); createIndex("test"); client().admin().indices().prepareDelete("test").get(); diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/RemoveSettingsCommandIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/RemoveSettingsCommandIT.java index f908225e9ba91..fcefbd9fa1273 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/RemoveSettingsCommandIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/RemoveSettingsCommandIT.java @@ -49,7 +49,7 @@ public class RemoveSettingsCommandIT extends OpenSearchIntegTestCase { public void testRemoveSettingsAbortedByUser() throws Exception { - internalCluster().setBootstrapMasterNodeIndex(0); + internalCluster().setBootstrapClusterManagerNodeIndex(0); String node = internalCluster().startNode(); client().admin() .cluster() @@ -78,7 +78,7 @@ public void testRemoveSettingsAbortedByUser() throws Exception { } public void testRemoveSettingsSuccessful() throws Exception { - internalCluster().setBootstrapMasterNodeIndex(0); + internalCluster().setBootstrapClusterManagerNodeIndex(0); String node = internalCluster().startNode(); client().admin() .cluster() @@ -122,7 +122,7 @@ public void testRemoveSettingsSuccessful() throws Exception { } public void testSettingDoesNotMatch() throws Exception { - internalCluster().setBootstrapMasterNodeIndex(0); + internalCluster().setBootstrapClusterManagerNodeIndex(0); String node = internalCluster().startNode(); client().admin() .cluster() diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/UnsafeBootstrapAndDetachCommandIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/UnsafeBootstrapAndDetachCommandIT.java index 100ff2d944555..5fc0317ad8417 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/UnsafeBootstrapAndDetachCommandIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/UnsafeBootstrapAndDetachCommandIT.java @@ -228,7 +228,7 @@ public void testBootstrapNotBootstrappedCluster() throws Exception { } public void testBootstrapNoClusterState() throws IOException { - internalCluster().setBootstrapMasterNodeIndex(0); + internalCluster().setBootstrapClusterManagerNodeIndex(0); String node = internalCluster().startNode(); Settings dataPathSettings = internalCluster().dataPathSettings(node); ensureStableCluster(1); @@ -243,7 +243,7 @@ public void testBootstrapNoClusterState() throws IOException { } public void testDetachNoClusterState() throws IOException { - internalCluster().setBootstrapMasterNodeIndex(0); + internalCluster().setBootstrapClusterManagerNodeIndex(0); String node = internalCluster().startNode(); Settings dataPathSettings = internalCluster().dataPathSettings(node); ensureStableCluster(1); @@ -258,7 +258,7 @@ public void testDetachNoClusterState() throws IOException { } public void testBootstrapAbortedByUser() throws IOException { - internalCluster().setBootstrapMasterNodeIndex(0); + internalCluster().setBootstrapClusterManagerNodeIndex(0); String node = internalCluster().startNode(); Settings dataPathSettings = internalCluster().dataPathSettings(node); ensureStableCluster(1); @@ -271,7 +271,7 @@ public void testBootstrapAbortedByUser() throws IOException { } public void testDetachAbortedByUser() throws IOException { - internalCluster().setBootstrapMasterNodeIndex(0); + internalCluster().setBootstrapClusterManagerNodeIndex(0); String node = internalCluster().startNode(); Settings dataPathSettings = internalCluster().dataPathSettings(node); ensureStableCluster(1); @@ -284,7 +284,7 @@ public void testDetachAbortedByUser() throws IOException { } public void test3MasterNodes2Failed() throws Exception { - internalCluster().setBootstrapMasterNodeIndex(2); + internalCluster().setBootstrapClusterManagerNodeIndex(2); List masterNodes = new ArrayList<>(); logger.info("--> start 1st cluster-manager-eligible node"); @@ -418,7 +418,7 @@ public void test3MasterNodes2Failed() throws Exception { } public void testAllMasterEligibleNodesFailedDanglingIndexImport() throws Exception { - internalCluster().setBootstrapMasterNodeIndex(0); + internalCluster().setBootstrapClusterManagerNodeIndex(0); Settings settings = Settings.builder().put(AUTO_IMPORT_DANGLING_INDICES_SETTING.getKey(), true).build(); @@ -478,7 +478,7 @@ public boolean clearData(String nodeName) { } public void testNoInitialBootstrapAfterDetach() throws Exception { - internalCluster().setBootstrapMasterNodeIndex(0); + internalCluster().setBootstrapClusterManagerNodeIndex(0); String clusterManagerNode = internalCluster().startClusterManagerOnlyNode(); Settings clusterManagerNodeDataPathSettings = internalCluster().dataPathSettings(clusterManagerNode); internalCluster().stopCurrentMasterNode(); @@ -503,7 +503,7 @@ public void testNoInitialBootstrapAfterDetach() throws Exception { } public void testCanRunUnsafeBootstrapAfterErroneousDetachWithoutLoosingMetadata() throws Exception { - internalCluster().setBootstrapMasterNodeIndex(0); + internalCluster().setBootstrapClusterManagerNodeIndex(0); String clusterManagerNode = internalCluster().startClusterManagerOnlyNode(); Settings clusterManagerNodeDataPathSettings = internalCluster().dataPathSettings(clusterManagerNode); ClusterUpdateSettingsRequest req = new ClusterUpdateSettingsRequest().persistentSettings( @@ -533,7 +533,7 @@ public void testCanRunUnsafeBootstrapAfterErroneousDetachWithoutLoosingMetadata( } public void testUnsafeBootstrapWithApplyClusterReadOnlyBlockAsFalse() throws Exception { - internalCluster().setBootstrapMasterNodeIndex(0); + internalCluster().setBootstrapClusterManagerNodeIndex(0); String clusterManagerNode = internalCluster().startClusterManagerOnlyNode(); Settings clusterManagerNodeDataPathSettings = internalCluster().dataPathSettings(clusterManagerNode); ClusterUpdateSettingsRequest req = new ClusterUpdateSettingsRequest().persistentSettings( diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/VotingConfigurationIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/VotingConfigurationIT.java index f73ec8dc4bcd0..ef2d52e2de7b9 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/VotingConfigurationIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/VotingConfigurationIT.java @@ -62,7 +62,7 @@ protected Collection> nodePlugins() { } public void testAbdicateAfterVotingConfigExclusionAdded() throws ExecutionException, InterruptedException { - internalCluster().setBootstrapMasterNodeIndex(0); + internalCluster().setBootstrapClusterManagerNodeIndex(0); internalCluster().startNodes(2); final String originalMaster = internalCluster().getMasterName(); @@ -73,7 +73,7 @@ public void testAbdicateAfterVotingConfigExclusionAdded() throws ExecutionExcept } public void testElectsNodeNotInVotingConfiguration() throws Exception { - internalCluster().setBootstrapMasterNodeIndex(0); + internalCluster().setBootstrapClusterManagerNodeIndex(0); final List nodeNames = internalCluster().startNodes(4); // a 4-node cluster settles on a 3-node configuration; we then prevent the nodes in the configuration from winning an election diff --git a/server/src/internalClusterTest/java/org/opensearch/gateway/RecoverAfterNodesIT.java b/server/src/internalClusterTest/java/org/opensearch/gateway/RecoverAfterNodesIT.java index a3dc4de0329ff..77a9d37063c83 100644 --- a/server/src/internalClusterTest/java/org/opensearch/gateway/RecoverAfterNodesIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/gateway/RecoverAfterNodesIT.java @@ -75,7 +75,7 @@ public Client startNode(Settings.Builder settings) { } public void testRecoverAfterNodes() throws Exception { - internalCluster().setBootstrapMasterNodeIndex(0); + internalCluster().setBootstrapClusterManagerNodeIndex(0); logger.info("--> start node (1)"); Client clientNode1 = startNode(Settings.builder().put("gateway.recover_after_nodes", 3)); assertThat( @@ -128,7 +128,7 @@ public void testRecoverAfterNodes() throws Exception { } public void testRecoverAfterMasterNodes() throws Exception { - internalCluster().setBootstrapMasterNodeIndex(0); + internalCluster().setBootstrapClusterManagerNodeIndex(0); logger.info("--> start master_node (1)"); Client master1 = startNode(Settings.builder().put("gateway.recover_after_master_nodes", 2).put(clusterManagerOnlyNode())); assertThat( @@ -219,7 +219,7 @@ public void testRecoverAfterMasterNodes() throws Exception { } public void testRecoverAfterDataNodes() throws Exception { - internalCluster().setBootstrapMasterNodeIndex(0); + internalCluster().setBootstrapClusterManagerNodeIndex(0); logger.info("--> start master_node (1)"); Client master1 = startNode(Settings.builder().put("gateway.recover_after_data_nodes", 2).put(clusterManagerOnlyNode())); assertThat( diff --git a/test/framework/src/main/java/org/opensearch/cluster/coordination/AbstractCoordinatorTestCase.java b/test/framework/src/main/java/org/opensearch/cluster/coordination/AbstractCoordinatorTestCase.java index 8b30d266dc74c..add1ab144e3b6 100644 --- a/test/framework/src/main/java/org/opensearch/cluster/coordination/AbstractCoordinatorTestCase.java +++ b/test/framework/src/main/java/org/opensearch/cluster/coordination/AbstractCoordinatorTestCase.java @@ -336,7 +336,7 @@ void addNodesAndStabilise(int newNodesCount) { addNodes(newNodesCount); stabilise( - // The first pinging discovers the master + // The first pinging discovers the cluster-manager defaultMillis(DISCOVERY_FIND_PEERS_INTERVAL_SETTING) // One message delay to send a join + DEFAULT_DELAY_VARIABILITY @@ -557,7 +557,7 @@ void stabilise(long stabilisationDurationMillis) { final ClusterNode leader = getAnyLeader(); final long leaderTerm = leader.coordinator.getCurrentTerm(); - final int pendingTaskCount = leader.masterService.getFakeMasterServicePendingTaskCount(); + final int pendingTaskCount = leader.clusterManagerService.getFakeMasterServicePendingTaskCount(); runFor((pendingTaskCount + 1) * DEFAULT_CLUSTER_STATE_UPDATE_DELAY, "draining task queue"); final Matcher isEqualToLeaderVersion = equalTo(leader.coordinator.getLastAcceptedState().getVersion()); @@ -566,7 +566,7 @@ void stabilise(long stabilisationDurationMillis) { assertTrue(leaderId + " has been bootstrapped", leader.coordinator.isInitialConfigurationSet()); assertTrue(leaderId + " exists in its last-applied state", leader.getLastAppliedClusterState().getNodes().nodeExists(leaderId)); assertThat( - leaderId + " has no NO_MASTER_BLOCK", + leaderId + " has no NO_CLUSTER_MANAGER_BLOCK", leader.getLastAppliedClusterState().blocks().hasGlobalBlockWithId(NO_MASTER_BLOCK_ID), equalTo(false) ); @@ -621,7 +621,7 @@ void stabilise(long stabilisationDurationMillis) { equalTo(leader.getLocalNode()) ); assertThat( - nodeId + " has no NO_MASTER_BLOCK", + nodeId + " has no NO_CLUSTER_MANAGER_BLOCK", clusterNode.getLastAppliedClusterState().blocks().hasGlobalBlockWithId(NO_MASTER_BLOCK_ID), equalTo(false) ); @@ -638,7 +638,7 @@ void stabilise(long stabilisationDurationMillis) { nullValue() ); assertThat( - nodeId + " has NO_MASTER_BLOCK", + nodeId + " has NO_CLUSTER_MANAGER_BLOCK", clusterNode.getLastAppliedClusterState().blocks().hasGlobalBlockWithId(NO_MASTER_BLOCK_ID), equalTo(true) ); @@ -898,7 +898,7 @@ class MockPersistedState implements CoordinationState.PersistedState { final long persistedCurrentTerm; - if ( // node is master-ineligible either before or after the restart ... + if ( // node is cluster-manager-ineligible either before or after the restart ... (oldState.getLastAcceptedState().nodes().getLocalNode().isMasterNode() && newLocalNode.isMasterNode()) == false // ... and it's accepted some non-initial state so we can roll back ... && (oldState.getLastAcceptedState().term() > 0L || oldState.getLastAcceptedState().version() > 0L) @@ -1025,7 +1025,7 @@ class ClusterNode { private final DiscoveryNode localNode; final MockPersistedState persistedState; final Settings nodeSettings; - private AckedFakeThreadPoolMasterService masterService; + private AckedFakeThreadPoolClusterManagerService clusterManagerService; private DisruptableClusterApplierService clusterApplierService; private ClusterService clusterService; TransportService transportService; @@ -1033,10 +1033,10 @@ class ClusterNode { private NodeHealthService nodeHealthService; List> extraJoinValidators = new ArrayList<>(); - ClusterNode(int nodeIndex, boolean masterEligible, Settings nodeSettings, NodeHealthService nodeHealthService) { + ClusterNode(int nodeIndex, boolean clusterManagerEligible, Settings nodeSettings, NodeHealthService nodeHealthService) { this( nodeIndex, - createDiscoveryNode(nodeIndex, masterEligible), + createDiscoveryNode(nodeIndex, clusterManagerEligible), defaultPersistedStateSupplier, nodeSettings, nodeHealthService @@ -1105,7 +1105,7 @@ protected Optional getDisruptableMockTransport(Transpo null, emptySet() ); - masterService = new AckedFakeThreadPoolMasterService( + clusterManagerService = new AckedFakeThreadPoolClusterManagerService( localNode.getId(), "test", threadPool, @@ -1119,7 +1119,7 @@ protected Optional getDisruptableMockTransport(Transpo deterministicTaskQueue, threadPool ); - clusterService = new ClusterService(settings, clusterSettings, masterService, clusterApplierService); + clusterService = new ClusterService(settings, clusterSettings, clusterManagerService, clusterApplierService); clusterService.setNodeConnectionsService( new NodeConnectionsService(clusterService.getSettings(), threadPool, transportService) ); @@ -1134,7 +1134,7 @@ protected Optional getDisruptableMockTransport(Transpo transportService, writableRegistry(), allocationService, - masterService, + clusterManagerService, this::getPersistedState, Cluster.this::provideSeedHosts, clusterApplierService, @@ -1144,7 +1144,7 @@ protected Optional getDisruptableMockTransport(Transpo getElectionStrategy(), nodeHealthService ); - masterService.setClusterStatePublisher(coordinator); + clusterManagerService.setClusterStatePublisher(coordinator); final GatewayService gatewayService = new GatewayService( settings, allocationService, @@ -1331,11 +1331,11 @@ AckCollector submitUpdateTask( onNode(() -> { logger.trace("[{}] submitUpdateTask: enqueueing [{}]", localNode.getId(), source); final long submittedTerm = coordinator.getCurrentTerm(); - masterService.submitStateUpdateTask(source, new ClusterStateUpdateTask() { + clusterManagerService.submitStateUpdateTask(source, new ClusterStateUpdateTask() { @Override public ClusterState execute(ClusterState currentState) { assertThat(currentState.term(), greaterThanOrEqualTo(submittedTerm)); - masterService.nextAckCollector = ackCollector; + clusterManagerService.nextAckCollector = ackCollector; return clusterStateUpdate.apply(currentState); } @@ -1510,11 +1510,11 @@ int getSuccessfulAckIndex(ClusterNode clusterNode) { } } - static class AckedFakeThreadPoolMasterService extends FakeThreadPoolMasterService { + static class AckedFakeThreadPoolClusterManagerService extends FakeThreadPoolMasterService { AckCollector nextAckCollector = new AckCollector(); - AckedFakeThreadPoolMasterService( + AckedFakeThreadPoolClusterManagerService( String nodeName, String serviceName, ThreadPool threadPool, diff --git a/test/framework/src/main/java/org/opensearch/common/util/MockBigArrays.java b/test/framework/src/main/java/org/opensearch/common/util/MockBigArrays.java index fc628ca5228e6..94112b12e4810 100644 --- a/test/framework/src/main/java/org/opensearch/common/util/MockBigArrays.java +++ b/test/framework/src/main/java/org/opensearch/common/util/MockBigArrays.java @@ -69,7 +69,7 @@ public static void ensureAllArraysAreReleased() throws Exception { final Map masterCopy = new HashMap<>(ACQUIRED_ARRAYS); if (!masterCopy.isEmpty()) { // not empty, we might be executing on a shared cluster that keeps on obtaining - // and releasing arrays, lets make sure that after a reasonable timeout, all master + // and releasing arrays, lets make sure that after a reasonable timeout, all cluster-manager // copy (snapshot) have been released try { assertBusy(() -> assertTrue(Sets.haveEmptyIntersection(masterCopy.keySet(), ACQUIRED_ARRAYS.keySet()))); diff --git a/test/framework/src/main/java/org/opensearch/test/InternalTestCluster.java b/test/framework/src/main/java/org/opensearch/test/InternalTestCluster.java index 3e0dbac0843bb..b381cc6e86897 100644 --- a/test/framework/src/main/java/org/opensearch/test/InternalTestCluster.java +++ b/test/framework/src/main/java/org/opensearch/test/InternalTestCluster.java @@ -266,7 +266,7 @@ public final class InternalTestCluster extends TestCluster { private ServiceDisruptionScheme activeDisruptionScheme; private final Function clientWrapper; - private int bootstrapMasterNodeIndex = -1; + private int bootstrapClusterManagerNodeIndex = -1; public InternalTestCluster( final long clusterSeed, @@ -449,14 +449,14 @@ public InternalTestCluster( } /** - * Sets {@link #bootstrapMasterNodeIndex} to the given value, see {@link #bootstrapMasterNodeWithSpecifiedIndex(List)} + * Sets {@link #bootstrapClusterManagerNodeIndex} to the given value, see {@link #bootstrapClusterManagerNodeWithSpecifiedIndex(List)} * for the description of how this field is used. - * It's only possible to change {@link #bootstrapMasterNodeIndex} value if autoManageMasterNodes is false. + * It's only possible to change {@link #bootstrapClusterManagerNodeIndex} value if autoManageMasterNodes is false. */ - public void setBootstrapMasterNodeIndex(int bootstrapMasterNodeIndex) { - assert autoManageClusterManagerNodes == false || bootstrapMasterNodeIndex == -1 - : "bootstrapMasterNodeIndex should be -1 if autoManageMasterNodes is true, but was " + bootstrapMasterNodeIndex; - this.bootstrapMasterNodeIndex = bootstrapMasterNodeIndex; + public void setBootstrapClusterManagerNodeIndex(int bootstrapClusterManagerNodeIndex) { + assert autoManageClusterManagerNodes == false || bootstrapClusterManagerNodeIndex == -1 + : "bootstrapMasterNodeIndex should be -1 if autoManageMasterNodes is true, but was " + bootstrapClusterManagerNodeIndex; + this.bootstrapClusterManagerNodeIndex = bootstrapClusterManagerNodeIndex; } @Override @@ -823,20 +823,20 @@ public Client dataNodeClient() { public Client masterClient() { NodeAndClient randomNodeAndClient = getRandomNodeAndClient(new NodeNamePredicate(getMasterName())); if (randomNodeAndClient != null) { - return randomNodeAndClient.nodeClient(); // ensure node client master is requested + return randomNodeAndClient.nodeClient(); // ensure node client cluster-manager is requested } throw new AssertionError("No cluster-manager client found"); } /** - * Returns a node client to random node but not the master. This method will fail if no non-master client is available. + * Returns a node client to random node but not the cluster-manager. This method will fail if no non-cluster-manager client is available. */ public Client nonMasterClient() { NodeAndClient randomNodeAndClient = getRandomNodeAndClient(new NodeNamePredicate(getMasterName()).negate()); if (randomNodeAndClient != null) { - return randomNodeAndClient.nodeClient(); // ensure node client non-master is requested + return randomNodeAndClient.nodeClient(); // ensure node client non-cluster-manager is requested } - throw new AssertionError("No non-master client found"); + throw new AssertionError("No non-cluster-manager client found"); } /** @@ -1145,7 +1145,7 @@ private synchronized void reset(boolean wipeData) throws IOException { if (numSharedDedicatedMasterNodes > 0) { settings.add(removeRoles(nodeSettings, Collections.singleton(DiscoveryNodeRole.MASTER_ROLE))); } else { - // if we don't have dedicated master nodes, keep things default + // if we don't have dedicated cluster-manager nodes, keep things default settings.add(nodeSettings); } } @@ -1169,7 +1169,7 @@ private synchronized void reset(boolean wipeData) throws IOException { } } - final List updatedSettings = bootstrapMasterNodeWithSpecifiedIndex(settings); + final List updatedSettings = bootstrapClusterManagerNodeWithSpecifiedIndex(settings); for (int i = 0; i < numSharedDedicatedMasterNodes + numSharedDataNodes + numSharedCoordOnlyNodes; i++) { Settings nodeSettings = updatedSettings.get(i); @@ -1218,7 +1218,7 @@ public synchronized void validateClusterFormed() { assertTrue("Missing master" + debugString, states.stream().allMatch(cs -> cs.nodes().getMasterNodeId() != null)); // all nodes have the same master (in same term) assertEquals( - "Not all masters in same term" + debugString, + "Not all cluster-managers in same term" + debugString, 1, states.stream().mapToLong(ClusterState::term).distinct().count() ); @@ -1555,7 +1555,7 @@ public synchronized T getCurrentMasterNodeInstance(Class clazz) { } /** - * Returns an Iterable to all instances for the given class >T< across all data and master nodes + * Returns an Iterable to all instances for the given class >T< across all data and cluster-manager nodes * in the cluster. */ public Iterable getDataOrMasterNodeInstances(Class clazz) { @@ -1667,25 +1667,25 @@ public synchronized void stopRandomNode(final Predicate filter) throws } /** - * Stops the current master node forcefully + * Stops the current cluster-manager node forcefully */ public synchronized void stopCurrentMasterNode() throws IOException { ensureOpen(); assert size() > 0; - String masterNodeName = getMasterName(); - final NodeAndClient masterNode = nodes.get(masterNodeName); + String clusterManagerNodeName = getMasterName(); + final NodeAndClient masterNode = nodes.get(clusterManagerNodeName); assert masterNode != null; - logger.info("Closing master node [{}] ", masterNodeName); + logger.info("Closing cluster-manager node [{}] ", clusterManagerNodeName); stopNodesAndClient(masterNode); } /** - * Stops any of the current nodes but not the master node. + * Stops any of the current nodes but not the cluster-manager node. */ public synchronized void stopRandomNonMasterNode() throws IOException { NodeAndClient nodeAndClient = getRandomNodeAndClient(new NodeNamePredicate(getMasterName()).negate()); if (nodeAndClient != null) { - logger.info("Closing random non master node [{}] current master [{}] ", nodeAndClient.name, getMasterName()); + logger.info("Closing random non cluster-manager node [{}] current cluster-manager [{}] ", nodeAndClient.name, getMasterName()); stopNodesAndClient(nodeAndClient); } } @@ -1696,7 +1696,7 @@ private synchronized void startAndPublishNodesAndClients(List nod .filter(NodeAndClient::isMasterEligible) .filter(nac -> nodes.containsKey(nac.name) == false) // filter out old masters .count(); - final int currentMasters = getMasterNodesCount(); + final int currentMasters = getClusterManagerNodesCount(); rebuildUnicastHostFiles(nodeAndClients); // ensure that new nodes can find the existing nodes when they start List> futures = nodeAndClients.stream().map(node -> executor.submit(node::startNode)).collect(Collectors.toList()); @@ -1716,8 +1716,8 @@ private synchronized void startAndPublishNodesAndClients(List nod if (autoManageClusterManagerNodes && currentMasters > 0 && newMasters > 0 - && getMinMasterNodes(currentMasters + newMasters) > currentMasters) { - // update once masters have joined + && getMinClusterManagerNodes(currentMasters + newMasters) > currentMasters) { + // update once cluster-managers have joined validateClusterFormed(); } } @@ -1838,7 +1838,7 @@ private void restartNode(NodeAndClient nodeAndClient, RestartCallback callback) final Settings newSettings = nodeAndClient.closeForRestart( callback, - autoManageClusterManagerNodes ? getMinMasterNodes(getMasterNodesCount()) : -1 + autoManageClusterManagerNodes ? getMinClusterManagerNodes(getClusterManagerNodesCount()) : -1 ); removeExclusions(excludedNodeIds); @@ -1872,7 +1872,7 @@ private Set excludeMasters(Collection nodeAndClients) { assert stoppingMasters <= currentMasters : currentMasters + " < " + stoppingMasters; if (stoppingMasters != currentMasters && stoppingMasters > 0) { - // If stopping few enough master-nodes that there's still a majority left, there is no need to withdraw their votes first. + // If stopping few enough cluster-manager-nodes that there's still a majority left, there is no need to withdraw their votes first. // However, we do not yet have a way to be sure there's a majority left, because the voting configuration may not yet have // been updated when the previous nodes shut down, so we must always explicitly withdraw votes. // TODO add cluster health API to check that voting configuration is optimal so this isn't always needed @@ -1912,7 +1912,7 @@ private void removeExclusions(Set excludedNodeIds) { public synchronized void fullRestart(RestartCallback callback) throws Exception { int numNodesRestarted = 0; final Settings[] newNodeSettings = new Settings[nextNodeId.get()]; - final int minMasterNodes = autoManageClusterManagerNodes ? getMinMasterNodes(getMasterNodesCount()) : -1; + final int minMasterNodes = autoManageClusterManagerNodes ? getMinClusterManagerNodes(getClusterManagerNodesCount()) : -1; final List toStartAndPublish = new ArrayList<>(); // we want to start nodes in one go for (NodeAndClient nodeAndClient : nodes.values()) { callback.doAfterNodes(numNodesRestarted++, nodeAndClient.nodeClient()); @@ -1943,7 +1943,7 @@ public synchronized void fullRestart(RestartCallback callback) throws Exception } /** - * Returns the name of the current master node in the cluster. + * Returns the name of the current cluster-manager node in the cluster. */ public String getMasterName() { return getMasterName(null); @@ -1959,7 +1959,7 @@ public String getMasterName(@Nullable String viaNode) { return client.admin().cluster().prepareState().get().getState().nodes().getMasterNode().getName(); } catch (Exception e) { logger.warn("Can't fetch cluster state", e); - throw new RuntimeException("Can't get master node " + e.getMessage(), e); + throw new RuntimeException("Can't get cluster-manager node " + e.getMessage(), e); } } @@ -1999,14 +1999,14 @@ public synchronized Set nodesInclude(String index) { } /** - * Performs cluster bootstrap when node with index {@link #bootstrapMasterNodeIndex} is started + * Performs cluster bootstrap when node with index {@link #bootstrapClusterManagerNodeIndex} is started * with the names of all existing and new cluster-manager-eligible nodes. * Indexing starts from 0. - * If {@link #bootstrapMasterNodeIndex} is -1 (default), this method does nothing. + * If {@link #bootstrapClusterManagerNodeIndex} is -1 (default), this method does nothing. */ - private List bootstrapMasterNodeWithSpecifiedIndex(List allNodesSettings) { + private List bootstrapClusterManagerNodeWithSpecifiedIndex(List allNodesSettings) { assert Thread.holdsLock(this); - if (bootstrapMasterNodeIndex == -1) { // fast-path + if (bootstrapClusterManagerNodeIndex == -1) { // fast-path return allNodesSettings; } @@ -2018,7 +2018,7 @@ private List bootstrapMasterNodeWithSpecifiedIndex(List allN newSettings.add(settings); } else { currentNodeId++; - if (currentNodeId != bootstrapMasterNodeIndex) { + if (currentNodeId != bootstrapClusterManagerNodeIndex) { newSettings.add(settings); } else { List nodeNames = new ArrayList<>(); @@ -2042,7 +2042,7 @@ private List bootstrapMasterNodeWithSpecifiedIndex(List allN .build() ); - setBootstrapMasterNodeIndex(-1); + setBootstrapClusterManagerNodeIndex(-1); } } } @@ -2089,28 +2089,28 @@ public List startNodes(int numOfNodes, Settings settings) { * Starts multiple nodes with the given settings and returns their names */ public synchronized List startNodes(Settings... extraSettings) { - final int newMasterCount = Math.toIntExact(Stream.of(extraSettings).filter(DiscoveryNode::isMasterNode).count()); - final int defaultMinMasterNodes; + final int newClusterManagerCount = Math.toIntExact(Stream.of(extraSettings).filter(DiscoveryNode::isMasterNode).count()); + final int defaultMinClusterManagerNodes; if (autoManageClusterManagerNodes) { - defaultMinMasterNodes = getMinMasterNodes(getMasterNodesCount() + newMasterCount); + defaultMinClusterManagerNodes = getMinClusterManagerNodes(getClusterManagerNodesCount() + newClusterManagerCount); } else { - defaultMinMasterNodes = -1; + defaultMinClusterManagerNodes = -1; } final List nodes = new ArrayList<>(); - final int prevMasterCount = getMasterNodesCount(); - int autoBootstrapMasterNodeIndex = autoManageClusterManagerNodes - && prevMasterCount == 0 - && newMasterCount > 0 + final int prevClusterManagerCount = getClusterManagerNodesCount(); + int autoBootstrapClusterManagerNodeIndex = autoManageClusterManagerNodes + && prevClusterManagerCount == 0 + && newClusterManagerCount > 0 && Arrays.stream(extraSettings) .allMatch(s -> DiscoveryNode.isMasterNode(s) == false || ZEN2_DISCOVERY_TYPE.equals(DISCOVERY_TYPE_SETTING.get(s))) - ? RandomNumbers.randomIntBetween(random, 0, newMasterCount - 1) + ? RandomNumbers.randomIntBetween(random, 0, newClusterManagerCount - 1) : -1; final int numOfNodes = extraSettings.length; final int firstNodeId = nextNodeId.getAndIncrement(); final List settings = new ArrayList<>(); for (int i = 0; i < numOfNodes; i++) { - settings.add(getNodeSettings(firstNodeId + i, random.nextLong(), extraSettings[i], defaultMinMasterNodes)); + settings.add(getNodeSettings(firstNodeId + i, random.nextLong(), extraSettings[i], defaultMinClusterManagerNodes)); } nextNodeId.set(firstNodeId + numOfNodes); @@ -2119,16 +2119,16 @@ public synchronized List startNodes(Settings... extraSettings) { .map(Node.NODE_NAME_SETTING::get) .collect(Collectors.toList()); - final List updatedSettings = bootstrapMasterNodeWithSpecifiedIndex(settings); + final List updatedSettings = bootstrapClusterManagerNodeWithSpecifiedIndex(settings); for (int i = 0; i < numOfNodes; i++) { final Settings nodeSettings = updatedSettings.get(i); final Builder builder = Settings.builder(); if (DiscoveryNode.isMasterNode(nodeSettings)) { - if (autoBootstrapMasterNodeIndex == 0) { + if (autoBootstrapClusterManagerNodeIndex == 0) { builder.putList(INITIAL_CLUSTER_MANAGER_NODES_SETTING.getKey(), initialMasterNodes); } - autoBootstrapMasterNodeIndex -= 1; + autoBootstrapClusterManagerNodeIndex -= 1; } final NodeAndClient nodeAndClient = buildNode( @@ -2162,12 +2162,12 @@ public List startDataOnlyNodes(int numNodes, Settings settings) { return startNodes(numNodes, Settings.builder().put(onlyRole(settings, DiscoveryNodeRole.DATA_ROLE)).build()); } - /** calculates a min master nodes value based on the given number of master nodes */ - private static int getMinMasterNodes(int eligibleMasterNodes) { - return eligibleMasterNodes / 2 + 1; + /** calculates a min cluster-manager nodes value based on the given number of cluster-manager nodes */ + private static int getMinClusterManagerNodes(int eligibleClusterManagerNodes) { + return eligibleClusterManagerNodes / 2 + 1; } - private int getMasterNodesCount() { + private int getClusterManagerNodesCount() { return (int) nodes.values().stream().filter(n -> DiscoveryNode.isMasterNode(n.node().settings())).count(); } diff --git a/test/framework/src/main/java/org/opensearch/test/OpenSearchIntegTestCase.java b/test/framework/src/main/java/org/opensearch/test/OpenSearchIntegTestCase.java index 8a3a5bcb5bb50..5c4d44bc59bc6 100644 --- a/test/framework/src/main/java/org/opensearch/test/OpenSearchIntegTestCase.java +++ b/test/framework/src/main/java/org/opensearch/test/OpenSearchIntegTestCase.java @@ -707,7 +707,7 @@ public void setDisruptionScheme(ServiceDisruptionScheme scheme) { } /** - * Creates a disruption that isolates the current master node from all other nodes in the cluster. + * Creates a disruption that isolates the current cluster-manager node from all other nodes in the cluster. * * @param disruptionType type of disruption to create * @return disruption @@ -949,12 +949,12 @@ private ClusterHealthStatus ensureColor( .waitForNoRelocatingShards(true) .waitForNoInitializingShards(waitForNoInitializingShards) // We currently often use ensureGreen or ensureYellow to check whether the cluster is back in a good state after shutting down - // a node. If the node that is stopped is the master node, another node will become master and publish a cluster state where it - // is master but where the node that was stopped hasn't been removed yet from the cluster state. It will only subsequently - // publish a second state where the old master is removed. If the ensureGreen/ensureYellow is timed just right, it will get to - // execute before the second cluster state update removes the old master and the condition ensureGreen / ensureYellow will + // a node. If the node that is stopped is the cluster-manager node, another node will become cluster-manager and publish a cluster state where it + // is cluster-manager but where the node that was stopped hasn't been removed yet from the cluster state. It will only subsequently + // publish a second state where the old cluster-manager is removed. If the ensureGreen/ensureYellow is timed just right, it will get to + // execute before the second cluster state update removes the old cluster-manager and the condition ensureGreen / ensureYellow will // trivially hold if it held before the node was shut down. The following "waitForNodes" condition ensures that the node has - // been removed by the master so that the health check applies to the set of nodes we expect to be part of the cluster. + // been removed by the cluster-manager so that the health check applies to the set of nodes we expect to be part of the cluster. .waitForNodes(Integer.toString(cluster().size())); ClusterHealthResponse actionGet = client().admin().cluster().health(healthRequest).actionGet(); @@ -1085,13 +1085,13 @@ protected void ensureClusterSizeConsistency() { } /** - * Verifies that all nodes that have the same version of the cluster state as master have same cluster state + * Verifies that all nodes that have the same version of the cluster state as cluster-manager have same cluster state */ protected void ensureClusterStateConsistency() throws IOException { if (cluster() != null && cluster().size() > 0) { final NamedWriteableRegistry namedWriteableRegistry = cluster().getNamedWriteableRegistry(); - final Client masterClient = client(); - ClusterState masterClusterState = masterClient.admin().cluster().prepareState().all().get().getState(); + final Client clusterManagerClient = client(); + ClusterState masterClusterState = clusterManagerClient.admin().cluster().prepareState().all().get().getState(); byte[] masterClusterStateBytes = ClusterState.Builder.toBytes(masterClusterState); // remove local node reference masterClusterState = ClusterState.Builder.fromBytes(masterClusterStateBytes, null, namedWriteableRegistry); @@ -1105,8 +1105,8 @@ protected void ensureClusterStateConsistency() throws IOException { localClusterState = ClusterState.Builder.fromBytes(localClusterStateBytes, null, namedWriteableRegistry); final Map localStateMap = convertToMap(localClusterState); final int localClusterStateSize = localClusterState.toString().length(); - // Check that the non-master node has the same version of the cluster state as the master and - // that the master node matches the master (otherwise there is no requirement for the cluster state to match) + // Check that the non-cluster-manager node has the same version of the cluster state as the cluster-manager and + // that the cluster-manager node matches the cluster-manager (otherwise there is no requirement for the cluster state to match) if (masterClusterState.version() == localClusterState.version() && masterId.equals(localClusterState.nodes().getMasterNodeId())) { try { @@ -1320,7 +1320,7 @@ protected void ensureStableCluster(int nodeCount, TimeValue timeValue, boolean l /** * Ensures that all nodes in the cluster are connected to each other. * - * Some network disruptions may leave nodes that are not the master disconnected from each other. + * Some network disruptions may leave nodes that are not the cluster-manager disconnected from each other. * {@link org.opensearch.cluster.NodeConnectionsService} will eventually reconnect but it's * handy to be able to ensure this happens faster */ @@ -1738,9 +1738,9 @@ public enum Scope { int maxNumDataNodes() default -1; /** - * Indicates whether the cluster can have dedicated master nodes. If {@code false} means data nodes will serve as master nodes - * and there will be no dedicated master (and data) nodes. Default is {@code false} which means - * dedicated master nodes will be randomly used. + * Indicates whether the cluster can have dedicated cluster-manager nodes. If {@code false} means data nodes will serve as cluster-manager nodes + * and there will be no dedicated cluster-manager (and data) nodes. Default is {@code false} which means + * dedicated cluster-manager nodes will be randomly used. */ boolean supportsDedicatedMasters() default true; @@ -2227,7 +2227,7 @@ public final void cleanUpCluster() throws Exception { // need to check that there are no more in-flight search contexts before // we remove indices if (isInternalCluster()) { - internalCluster().setBootstrapMasterNodeIndex(-1); + internalCluster().setBootstrapClusterManagerNodeIndex(-1); } super.ensureAllSearchContextsReleased(); if (runTestScopeLifecycle()) { diff --git a/test/framework/src/main/java/org/opensearch/test/OpenSearchSingleNodeTestCase.java b/test/framework/src/main/java/org/opensearch/test/OpenSearchSingleNodeTestCase.java index e3f6e6019546b..04b3773c1d385 100644 --- a/test/framework/src/main/java/org/opensearch/test/OpenSearchSingleNodeTestCase.java +++ b/test/framework/src/main/java/org/opensearch/test/OpenSearchSingleNodeTestCase.java @@ -97,7 +97,7 @@ protected void startNode(long seed) throws Exception { assert NODE == null; NODE = RandomizedContext.current().runWithPrivateRandomness(seed, this::newNode); // we must wait for the node to actually be up and running. otherwise the node might have started, - // elected itself master but might not yet have removed the + // elected itself cluster-manager but might not yet have removed the // SERVICE_UNAVAILABLE/1/state not recovered / initialized block ClusterHealthResponse clusterHealthResponse = client().admin().cluster().prepareHealth().setWaitForGreenStatus().get(); assertFalse(clusterHealthResponse.isTimedOut()); diff --git a/test/framework/src/main/java/org/opensearch/test/TestCluster.java b/test/framework/src/main/java/org/opensearch/test/TestCluster.java index 2bc0ffd941502..26081d947431d 100644 --- a/test/framework/src/main/java/org/opensearch/test/TestCluster.java +++ b/test/framework/src/main/java/org/opensearch/test/TestCluster.java @@ -125,7 +125,7 @@ public void assertAfterTest() throws Exception { public abstract int numDataNodes(); /** - * Returns the number of data and master eligible nodes in the cluster. + * Returns the number of data and cluster-manager eligible nodes in the cluster. */ public abstract int numDataAndMasterNodes(); diff --git a/test/framework/src/main/java/org/opensearch/test/VersionUtils.java b/test/framework/src/main/java/org/opensearch/test/VersionUtils.java index 5989dfa7898fd..f763d749d70c1 100644 --- a/test/framework/src/main/java/org/opensearch/test/VersionUtils.java +++ b/test/framework/src/main/java/org/opensearch/test/VersionUtils.java @@ -65,7 +65,7 @@ static Tuple, List> resolveReleasedVersions(Version curre Map> majorVersions = Version.getDeclaredVersions(versionClass) .stream() .collect(Collectors.groupingBy(v -> (int) v.major)); - // this breaks b/c 5.x is still in version list but master doesn't care about it! + // this breaks b/c 5.x is still in version list but cluster-manager doesn't care about it! // assert majorVersions.size() == 2; List> oldVersions = new ArrayList<>(0); List> previousMajor = new ArrayList<>(0); @@ -85,7 +85,7 @@ static Tuple, List> resolveReleasedVersions(Version curre List unreleasedVersions = new ArrayList<>(); final List> stableVersions; if (currentMajor.size() == 1) { - // on master branch + // on main branch stableVersions = previousMajor; // remove current moveLastToUnreleased(currentMajor, unreleasedVersions); diff --git a/test/framework/src/main/java/org/opensearch/test/disruption/BlockMasterServiceOnMaster.java b/test/framework/src/main/java/org/opensearch/test/disruption/BlockMasterServiceOnMaster.java index 99397f0ffd953..85f8e5c250066 100644 --- a/test/framework/src/main/java/org/opensearch/test/disruption/BlockMasterServiceOnMaster.java +++ b/test/framework/src/main/java/org/opensearch/test/disruption/BlockMasterServiceOnMaster.java @@ -62,7 +62,7 @@ public void startDisrupting() { if (clusterService == null) { return; } - logger.info("blocking master service on node [{}]", disruptionNodeCopy); + logger.info("blocking cluster-manager service on node [{}]", disruptionNodeCopy); boolean success = disruptionLatch.compareAndSet(null, new CountDownLatch(1)); assert success : "startDisrupting called without waiting on stopDisrupting to complete"; final CountDownLatch started = new CountDownLatch(1); diff --git a/test/framework/src/main/java/org/opensearch/test/disruption/BusyMasterServiceDisruption.java b/test/framework/src/main/java/org/opensearch/test/disruption/BusyMasterServiceDisruption.java index 65cc0dac47a2b..4830f9b0359fb 100644 --- a/test/framework/src/main/java/org/opensearch/test/disruption/BusyMasterServiceDisruption.java +++ b/test/framework/src/main/java/org/opensearch/test/disruption/BusyMasterServiceDisruption.java @@ -61,7 +61,7 @@ public void startDisrupting() { if (clusterService == null) { return; } - logger.info("making master service busy on node [{}] at priority [{}]", disruptionNodeCopy, priority); + logger.info("making cluster-manager service busy on node [{}] at priority [{}]", disruptionNodeCopy, priority); active.set(true); submitTask(clusterService); } diff --git a/test/framework/src/main/java/org/opensearch/test/disruption/NetworkDisruption.java b/test/framework/src/main/java/org/opensearch/test/disruption/NetworkDisruption.java index b3877b202d36d..7f2644d8e857c 100644 --- a/test/framework/src/main/java/org/opensearch/test/disruption/NetworkDisruption.java +++ b/test/framework/src/main/java/org/opensearch/test/disruption/NetworkDisruption.java @@ -109,7 +109,7 @@ public void ensureHealthy(InternalTestCluster cluster) { /** * Ensures that all nodes in the cluster are connected to each other. * - * Some network disruptions may leave nodes that are not the master disconnected from each other. + * Some network disruptions may leave nodes that are not the cluster-manager disconnected from each other. * {@link org.opensearch.cluster.NodeConnectionsService} will eventually reconnect but it's * handy to be able to ensure this happens faster */ diff --git a/test/framework/src/main/java/org/opensearch/test/rest/yaml/ClientYamlTestClient.java b/test/framework/src/main/java/org/opensearch/test/rest/yaml/ClientYamlTestClient.java index 7a31c73d24305..6a87a89db4959 100644 --- a/test/framework/src/main/java/org/opensearch/test/rest/yaml/ClientYamlTestClient.java +++ b/test/framework/src/main/java/org/opensearch/test/rest/yaml/ClientYamlTestClient.java @@ -78,7 +78,7 @@ public class ClientYamlTestClient implements Closeable { private final ClientYamlSuiteRestSpec restSpec; private final Map restClients = new HashMap<>(); private final Version esVersion; - private final Version masterVersion; + private final Version clusterManagerVersion; private final CheckedSupplier clientBuilderWithSniffedNodes; ClientYamlTestClient( @@ -86,14 +86,14 @@ public class ClientYamlTestClient implements Closeable { final RestClient restClient, final List hosts, final Version esVersion, - final Version masterVersion, + final Version clusterManagerVersion, final CheckedSupplier clientBuilderWithSniffedNodes ) { assert hosts.size() > 0; this.restSpec = restSpec; this.restClients.put(NodeSelector.ANY, restClient); this.esVersion = esVersion; - this.masterVersion = masterVersion; + this.clusterManagerVersion = clusterManagerVersion; this.clientBuilderWithSniffedNodes = clientBuilderWithSniffedNodes; } @@ -101,8 +101,8 @@ public Version getEsVersion() { return esVersion; } - public Version getMasterVersion() { - return masterVersion; + public Version getClusterManagerVersion() { + return clusterManagerVersion; } /** diff --git a/test/framework/src/main/java/org/opensearch/test/rest/yaml/ClientYamlTestExecutionContext.java b/test/framework/src/main/java/org/opensearch/test/rest/yaml/ClientYamlTestExecutionContext.java index 4c3a1ec863d31..8e6bbd009dc2f 100644 --- a/test/framework/src/main/java/org/opensearch/test/rest/yaml/ClientYamlTestExecutionContext.java +++ b/test/framework/src/main/java/org/opensearch/test/rest/yaml/ClientYamlTestExecutionContext.java @@ -228,7 +228,7 @@ public Version esVersion() { } public Version masterVersion() { - return clientYamlTestClient.getMasterVersion(); + return clientYamlTestClient.getClusterManagerVersion(); } } diff --git a/test/framework/src/main/java/org/opensearch/test/rest/yaml/OpenSearchClientYamlSuiteTestCase.java b/test/framework/src/main/java/org/opensearch/test/rest/yaml/OpenSearchClientYamlSuiteTestCase.java index 1b19f03f46174..903b5667a21a3 100644 --- a/test/framework/src/main/java/org/opensearch/test/rest/yaml/OpenSearchClientYamlSuiteTestCase.java +++ b/test/framework/src/main/java/org/opensearch/test/rest/yaml/OpenSearchClientYamlSuiteTestCase.java @@ -144,14 +144,14 @@ public void initAndResetContext() throws Exception { final List hosts = getClusterHosts(); Tuple versionVersionTuple = readVersionsFromCatNodes(adminClient()); final Version minVersion = versionVersionTuple.v1(); - final Version masterVersion = versionVersionTuple.v2(); + final Version clusterManagerVersion = versionVersionTuple.v2(); logger.info( "initializing client, minimum OpenSearch version [{}], master version, [{}], hosts {}", minVersion, - masterVersion, + clusterManagerVersion, hosts ); - clientYamlTestClient = initClientYamlTestClient(restSpec, client(), hosts, minVersion, masterVersion); + clientYamlTestClient = initClientYamlTestClient(restSpec, client(), hosts, minVersion, clusterManagerVersion); restTestExecutionContext = new ClientYamlTestExecutionContext(clientYamlTestClient, randomizeContentType()); adminExecutionContext = new ClientYamlTestExecutionContext(clientYamlTestClient, false); final String[] denylist = resolvePathsProperty(REST_TESTS_DENYLIST, null); @@ -179,9 +179,9 @@ protected ClientYamlTestClient initClientYamlTestClient( final RestClient restClient, final List hosts, final Version esVersion, - final Version masterVersion + final Version clusterManagerVersion ) { - return new ClientYamlTestClient(restSpec, restClient, hosts, esVersion, masterVersion, this::getClientBuilderWithSniffedHosts); + return new ClientYamlTestClient(restSpec, restClient, hosts, esVersion, clusterManagerVersion, this::getClientBuilderWithSniffedHosts); } @AfterClass @@ -343,15 +343,15 @@ private Tuple readVersionsFromCatNodes(RestClient restClient) String nodesCatResponse = restTestResponse.getBodyAsString(); String[] split = nodesCatResponse.split("\n"); Version version = null; - Version masterVersion = null; + Version clusterManagerVersion = null; for (String perNode : split) { - final String[] versionAndMaster = perNode.split("\\s+"); - assert versionAndMaster.length == 2 : "invalid line: " + perNode + " length: " + versionAndMaster.length; - final Version currentVersion = Version.fromString(versionAndMaster[0]); - final boolean master = versionAndMaster[1].trim().equals("*"); - if (master) { - assert masterVersion == null; - masterVersion = currentVersion; + final String[] versionAndClusterManager = perNode.split("\\s+"); + assert versionAndClusterManager.length == 2 : "invalid line: " + perNode + " length: " + versionAndClusterManager.length; + final Version currentVersion = Version.fromString(versionAndClusterManager[0]); + final boolean clusterManager = versionAndClusterManager[1].trim().equals("*"); + if (clusterManager) { + assert clusterManagerVersion == null; + clusterManagerVersion = currentVersion; } if (version == null) { version = currentVersion; @@ -359,7 +359,7 @@ private Tuple readVersionsFromCatNodes(RestClient restClient) version = currentVersion; } } - return new Tuple<>(version, masterVersion); + return new Tuple<>(version, clusterManagerVersion); } protected RequestOptions getCatNodesVersionMasterRequestOptions() { diff --git a/test/framework/src/main/java/org/opensearch/test/rest/yaml/section/DoSection.java b/test/framework/src/main/java/org/opensearch/test/rest/yaml/section/DoSection.java index 6f29207e2a823..5d47c6619cc71 100644 --- a/test/framework/src/main/java/org/opensearch/test/rest/yaml/section/DoSection.java +++ b/test/framework/src/main/java/org/opensearch/test/rest/yaml/section/DoSection.java @@ -375,7 +375,7 @@ void checkWarningHeaders(final List warningHeaders, final Version master )) { /* * This warning header will come back in the vast majority of our tests that create an index when running against an - * older master. Rather than rewrite our tests to assert this warning header, we assume that it is expected. + * older cluster-manager. Rather than rewrite our tests to assert this warning header, we assume that it is expected. */ continue; } diff --git a/test/framework/src/test/java/org/opensearch/cluster/service/FakeThreadPoolMasterServiceTests.java b/test/framework/src/test/java/org/opensearch/cluster/service/FakeThreadPoolMasterServiceTests.java index 4f321019a37ac..dca822a01eed3 100644 --- a/test/framework/src/test/java/org/opensearch/cluster/service/FakeThreadPoolMasterServiceTests.java +++ b/test/framework/src/test/java/org/opensearch/cluster/service/FakeThreadPoolMasterServiceTests.java @@ -84,21 +84,21 @@ public void testFakeMasterService() { doAnswer(invocationOnMock -> runnableTasks.add((Runnable) invocationOnMock.getArguments()[0])).when(executorService).execute(any()); when(mockThreadPool.generic()).thenReturn(executorService); - FakeThreadPoolMasterService masterService = new FakeThreadPoolMasterService( + FakeThreadPoolMasterService clusterManagerService = new FakeThreadPoolMasterService( "test_node", "test", mockThreadPool, runnableTasks::add ); - masterService.setClusterStateSupplier(lastClusterStateRef::get); - masterService.setClusterStatePublisher((event, publishListener, ackListener) -> { + clusterManagerService.setClusterStateSupplier(lastClusterStateRef::get); + clusterManagerService.setClusterStatePublisher((event, publishListener, ackListener) -> { lastClusterStateRef.set(event.state()); publishingCallback.set(publishListener); }); - masterService.start(); + clusterManagerService.start(); AtomicBoolean firstTaskCompleted = new AtomicBoolean(); - masterService.submitStateUpdateTask("test1", new ClusterStateUpdateTask() { + clusterManagerService.submitStateUpdateTask("test1", new ClusterStateUpdateTask() { @Override public ClusterState execute(ClusterState currentState) { return ClusterState.builder(currentState) @@ -138,7 +138,7 @@ public void onFailure(String source, Exception e) { assertThat(runnableTasks.size(), equalTo(0)); AtomicBoolean secondTaskCompleted = new AtomicBoolean(); - masterService.submitStateUpdateTask("test2", new ClusterStateUpdateTask() { + clusterManagerService.submitStateUpdateTask("test2", new ClusterStateUpdateTask() { @Override public ClusterState execute(ClusterState currentState) { return ClusterState.builder(currentState) diff --git a/test/framework/src/test/java/org/opensearch/test/disruption/NetworkDisruptionIT.java b/test/framework/src/test/java/org/opensearch/test/disruption/NetworkDisruptionIT.java index b58d4fd45ff93..20ce592bbfd46 100644 --- a/test/framework/src/test/java/org/opensearch/test/disruption/NetworkDisruptionIT.java +++ b/test/framework/src/test/java/org/opensearch/test/disruption/NetworkDisruptionIT.java @@ -76,11 +76,11 @@ protected Collection> nodePlugins() { /** * Creates 3 to 5 mixed-node cluster and splits it into 2 parts. * The first part is guaranteed to have at least the majority of the nodes, - * so that master could be elected on this side. + * so that cluster-manager could be elected on this side. */ private Tuple, Set> prepareDisruptedCluster() { int numOfNodes = randomIntBetween(3, 5); - internalCluster().setBootstrapMasterNodeIndex(numOfNodes - 1); + internalCluster().setBootstrapClusterManagerNodeIndex(numOfNodes - 1); Set nodes = new HashSet<>(internalCluster().startNodes(numOfNodes, DISRUPTION_TUNED_SETTINGS)); ensureGreen(); assertThat(nodes.size(), greaterThanOrEqualTo(3)); @@ -127,7 +127,7 @@ public void testNetworkPartitionRemovalRestoresConnections() throws Exception { } public void testTransportRespondsEventually() throws InterruptedException { - internalCluster().setBootstrapMasterNodeIndex(0); + internalCluster().setBootstrapClusterManagerNodeIndex(0); internalCluster().ensureAtLeastNumDataNodes(randomIntBetween(3, 5)); final NetworkDisruption.DisruptedLinks disruptedLinks; if (randomBoolean()) { diff --git a/test/framework/src/test/java/org/opensearch/test/test/InternalTestClusterTests.java b/test/framework/src/test/java/org/opensearch/test/test/InternalTestClusterTests.java index dc89d21a78506..262008507753e 100644 --- a/test/framework/src/test/java/org/opensearch/test/test/InternalTestClusterTests.java +++ b/test/framework/src/test/java/org/opensearch/test/test/InternalTestClusterTests.java @@ -86,7 +86,7 @@ private static Collection> mockPlugins() { public void testInitializiationIsConsistent() { long clusterSeed = randomLong(); - boolean masterNodes = randomBoolean(); + boolean clusterManagerNodes = randomBoolean(); int minNumDataNodes = randomIntBetween(0, 9); int maxNumDataNodes = randomIntBetween(minNumDataNodes, 10); String clusterName = randomRealisticUnicodeOfCodepointLengthBetween(1, 10); @@ -98,7 +98,7 @@ public void testInitializiationIsConsistent() { InternalTestCluster cluster0 = new InternalTestCluster( clusterSeed, baseDir, - masterNodes, + clusterManagerNodes, randomBoolean(), minNumDataNodes, maxNumDataNodes, @@ -112,7 +112,7 @@ public void testInitializiationIsConsistent() { InternalTestCluster cluster1 = new InternalTestCluster( clusterSeed, baseDir, - masterNodes, + clusterManagerNodes, randomBoolean(), minNumDataNodes, maxNumDataNodes, @@ -220,7 +220,7 @@ public Path nodeConfigPath(int nodeOrdinal) { mockPlugins(), Function.identity() ); - cluster0.setBootstrapMasterNodeIndex(bootstrapClusterManagerNodeIndex); + cluster0.setBootstrapClusterManagerNodeIndex(bootstrapClusterManagerNodeIndex); InternalTestCluster cluster1 = new InternalTestCluster( clusterSeed, @@ -236,7 +236,7 @@ public Path nodeConfigPath(int nodeOrdinal) { mockPlugins(), Function.identity() ); - cluster1.setBootstrapMasterNodeIndex(bootstrapClusterManagerNodeIndex); + cluster1.setBootstrapClusterManagerNodeIndex(bootstrapClusterManagerNodeIndex); assertClusters(cluster0, cluster1, false); long seed = randomLong(); @@ -409,7 +409,7 @@ public Path nodeConfigPath(int nodeOrdinal) { roles.add(role); } - cluster.setBootstrapMasterNodeIndex( + cluster.setBootstrapClusterManagerNodeIndex( randomIntBetween(0, (int) roles.stream().filter(role -> role.equals(clusterManagerRole)).count() - 1) ); From b87c3432fe109d461c010830cc4d15658fc27fbe Mon Sep 17 00:00:00 2001 From: Tianli Feng Date: Tue, 10 May 2022 17:50:30 -0700 Subject: [PATCH 4/6] Adjust format by spotlessApply task Signed-off-by: Tianli Feng --- .../TransportClusterStateActionDisruptionIT.java | 10 ++++++++-- .../allocation/AllocationCommandsTests.java | 4 ++-- .../NodeVersionAllocationDeciderTests.java | 12 ++++++------ .../allocation/SameShardRoutingTests.java | 6 +++--- .../decider/DiskThresholdDeciderTests.java | 4 ++-- .../AbstractCoordinatorTestCase.java | 2 +- .../org/opensearch/test/InternalTestCluster.java | 6 +++--- .../opensearch/test/OpenSearchIntegTestCase.java | 16 +++++++++------- .../yaml/OpenSearchClientYamlSuiteTestCase.java | 9 ++++++++- 9 files changed, 42 insertions(+), 27 deletions(-) diff --git a/server/src/internalClusterTest/java/org/opensearch/action/admin/cluster/state/TransportClusterStateActionDisruptionIT.java b/server/src/internalClusterTest/java/org/opensearch/action/admin/cluster/state/TransportClusterStateActionDisruptionIT.java index a94da40ba9e86..b7538f6752ec4 100644 --- a/server/src/internalClusterTest/java/org/opensearch/action/admin/cluster/state/TransportClusterStateActionDisruptionIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/action/admin/cluster/state/TransportClusterStateActionDisruptionIT.java @@ -204,7 +204,10 @@ public void runRepeatedlyWhileChangingClusterManager(Runnable runnable) throws E String value = "none"; while (shutdown.get() == false) { value = "none".equals(value) ? "all" : "none"; - final String nonClusterManagerNode = randomValueOtherThan(clusterManagerName, () -> randomFrom(internalCluster().getNodeNames())); + final String nonClusterManagerNode = randomValueOtherThan( + clusterManagerName, + () -> randomFrom(internalCluster().getNodeNames()) + ); assertAcked( client(nonClusterManagerNode).admin() .cluster() @@ -235,7 +238,10 @@ public void runRepeatedlyWhileChangingClusterManager(Runnable runnable) throws E } assertBusy(() -> { - final String nonClusterManagerNode = randomValueOtherThan(clusterManagerName, () -> randomFrom(internalCluster().getNodeNames())); + final String nonClusterManagerNode = randomValueOtherThan( + clusterManagerName, + () -> randomFrom(internalCluster().getNodeNames()) + ); final String claimedClusterManagerName = internalCluster().getMasterName(nonClusterManagerNode); assertThat(claimedClusterManagerName, not(equalTo(clusterManagerName))); }); diff --git a/server/src/test/java/org/opensearch/cluster/routing/allocation/AllocationCommandsTests.java b/server/src/test/java/org/opensearch/cluster/routing/allocation/AllocationCommandsTests.java index 6fa91d9b2fa0f..4db9c0cf49b73 100644 --- a/server/src/test/java/org/opensearch/cluster/routing/allocation/AllocationCommandsTests.java +++ b/server/src/test/java/org/opensearch/cluster/routing/allocation/AllocationCommandsTests.java @@ -737,7 +737,7 @@ public void testMoveShardToNonDataNode() { "test1", buildNewFakeTransportAddress(), emptyMap(), - CLUSTER_MANAGER_DATA_ROLES, + CLUSTER_MANAGER_DATA_ROLES, Version.CURRENT ); DiscoveryNode node2 = new DiscoveryNode( @@ -808,7 +808,7 @@ public void testMoveShardFromNonDataNode() { "test1", buildNewFakeTransportAddress(), emptyMap(), - CLUSTER_MANAGER_DATA_ROLES, + CLUSTER_MANAGER_DATA_ROLES, Version.CURRENT ); DiscoveryNode node2 = new DiscoveryNode( diff --git a/server/src/test/java/org/opensearch/cluster/routing/allocation/NodeVersionAllocationDeciderTests.java b/server/src/test/java/org/opensearch/cluster/routing/allocation/NodeVersionAllocationDeciderTests.java index 0ddc64f94d129..38e24af421475 100644 --- a/server/src/test/java/org/opensearch/cluster/routing/allocation/NodeVersionAllocationDeciderTests.java +++ b/server/src/test/java/org/opensearch/cluster/routing/allocation/NodeVersionAllocationDeciderTests.java @@ -338,21 +338,21 @@ public void testRebalanceDoesNotAllocatePrimaryAndReplicasOnDifferentVersionNode "newNode", buildNewFakeTransportAddress(), emptyMap(), - CLUSTER_MANAGER_DATA_ROLES, + CLUSTER_MANAGER_DATA_ROLES, Version.CURRENT ); final DiscoveryNode oldNode1 = new DiscoveryNode( "oldNode1", buildNewFakeTransportAddress(), emptyMap(), - CLUSTER_MANAGER_DATA_ROLES, + CLUSTER_MANAGER_DATA_ROLES, VersionUtils.getPreviousVersion() ); final DiscoveryNode oldNode2 = new DiscoveryNode( "oldNode2", buildNewFakeTransportAddress(), emptyMap(), - CLUSTER_MANAGER_DATA_ROLES, + CLUSTER_MANAGER_DATA_ROLES, VersionUtils.getPreviousVersion() ); AllocationId allocationId1P = AllocationId.newInitializing(); @@ -457,21 +457,21 @@ public void testRestoreDoesNotAllocateSnapshotOnOlderNodes() { "newNode", buildNewFakeTransportAddress(), emptyMap(), - CLUSTER_MANAGER_DATA_ROLES, + CLUSTER_MANAGER_DATA_ROLES, Version.CURRENT ); final DiscoveryNode oldNode1 = new DiscoveryNode( "oldNode1", buildNewFakeTransportAddress(), emptyMap(), - CLUSTER_MANAGER_DATA_ROLES, + CLUSTER_MANAGER_DATA_ROLES, VersionUtils.getPreviousVersion() ); final DiscoveryNode oldNode2 = new DiscoveryNode( "oldNode2", buildNewFakeTransportAddress(), emptyMap(), - CLUSTER_MANAGER_DATA_ROLES, + CLUSTER_MANAGER_DATA_ROLES, VersionUtils.getPreviousVersion() ); diff --git a/server/src/test/java/org/opensearch/cluster/routing/allocation/SameShardRoutingTests.java b/server/src/test/java/org/opensearch/cluster/routing/allocation/SameShardRoutingTests.java index 5d3ed97afdd2d..cd19f78d54be5 100644 --- a/server/src/test/java/org/opensearch/cluster/routing/allocation/SameShardRoutingTests.java +++ b/server/src/test/java/org/opensearch/cluster/routing/allocation/SameShardRoutingTests.java @@ -96,7 +96,7 @@ public void testSameHost() { "test1", buildNewFakeTransportAddress(), emptyMap(), - CLUSTER_MANAGER_DATA_ROLES, + CLUSTER_MANAGER_DATA_ROLES, Version.CURRENT ) ) @@ -109,7 +109,7 @@ public void testSameHost() { "test1", buildNewFakeTransportAddress(), emptyMap(), - CLUSTER_MANAGER_DATA_ROLES, + CLUSTER_MANAGER_DATA_ROLES, Version.CURRENT ) ) @@ -138,7 +138,7 @@ public void testSameHost() { "test2", buildNewFakeTransportAddress(), emptyMap(), - CLUSTER_MANAGER_DATA_ROLES, + CLUSTER_MANAGER_DATA_ROLES, Version.CURRENT ) ) diff --git a/server/src/test/java/org/opensearch/cluster/routing/allocation/decider/DiskThresholdDeciderTests.java b/server/src/test/java/org/opensearch/cluster/routing/allocation/decider/DiskThresholdDeciderTests.java index 79d6aa8e8d46b..cbf624cdad2ca 100644 --- a/server/src/test/java/org/opensearch/cluster/routing/allocation/decider/DiskThresholdDeciderTests.java +++ b/server/src/test/java/org/opensearch/cluster/routing/allocation/decider/DiskThresholdDeciderTests.java @@ -921,14 +921,14 @@ public void testCanRemainWithShardRelocatingAway() { "node1", buildNewFakeTransportAddress(), emptyMap(), - CLUSTER_MANAGER_DATA_ROLES, + CLUSTER_MANAGER_DATA_ROLES, Version.CURRENT ); DiscoveryNode discoveryNode2 = new DiscoveryNode( "node2", buildNewFakeTransportAddress(), emptyMap(), - CLUSTER_MANAGER_DATA_ROLES, + CLUSTER_MANAGER_DATA_ROLES, Version.CURRENT ); DiscoveryNodes discoveryNodes = DiscoveryNodes.builder().add(discoveryNode1).add(discoveryNode2).build(); diff --git a/test/framework/src/main/java/org/opensearch/cluster/coordination/AbstractCoordinatorTestCase.java b/test/framework/src/main/java/org/opensearch/cluster/coordination/AbstractCoordinatorTestCase.java index add1ab144e3b6..5042d968176a4 100644 --- a/test/framework/src/main/java/org/opensearch/cluster/coordination/AbstractCoordinatorTestCase.java +++ b/test/framework/src/main/java/org/opensearch/cluster/coordination/AbstractCoordinatorTestCase.java @@ -1134,7 +1134,7 @@ protected Optional getDisruptableMockTransport(Transpo transportService, writableRegistry(), allocationService, - clusterManagerService, + clusterManagerService, this::getPersistedState, Cluster.this::provideSeedHosts, clusterApplierService, diff --git a/test/framework/src/main/java/org/opensearch/test/InternalTestCluster.java b/test/framework/src/main/java/org/opensearch/test/InternalTestCluster.java index b381cc6e86897..f9b38e186418c 100644 --- a/test/framework/src/main/java/org/opensearch/test/InternalTestCluster.java +++ b/test/framework/src/main/java/org/opensearch/test/InternalTestCluster.java @@ -166,7 +166,6 @@ import static org.opensearch.test.OpenSearchTestCase.assertBusy; import static org.opensearch.test.OpenSearchTestCase.randomFrom; import static org.opensearch.test.NodeRoles.dataOnlyNode; -import static org.opensearch.test.NodeRoles.clusterManagerOnlyNode; import static org.opensearch.test.NodeRoles.noRoles; import static org.opensearch.test.NodeRoles.onlyRole; import static org.opensearch.test.NodeRoles.removeRoles; @@ -286,7 +285,7 @@ public InternalTestCluster( clusterSeed, baseDir, randomlyAddDedicatedMasters, - autoManageClusterManagerNodes, + autoManageClusterManagerNodes, minNumDataNodes, maxNumDataNodes, clusterName, @@ -1872,7 +1871,8 @@ private Set excludeMasters(Collection nodeAndClients) { assert stoppingMasters <= currentMasters : currentMasters + " < " + stoppingMasters; if (stoppingMasters != currentMasters && stoppingMasters > 0) { - // If stopping few enough cluster-manager-nodes that there's still a majority left, there is no need to withdraw their votes first. + // If stopping few enough cluster-manager-nodes that there's still a majority left, there is no need to withdraw their votes + // first. // However, we do not yet have a way to be sure there's a majority left, because the voting configuration may not yet have // been updated when the previous nodes shut down, so we must always explicitly withdraw votes. // TODO add cluster health API to check that voting configuration is optimal so this isn't always needed diff --git a/test/framework/src/main/java/org/opensearch/test/OpenSearchIntegTestCase.java b/test/framework/src/main/java/org/opensearch/test/OpenSearchIntegTestCase.java index 5c4d44bc59bc6..163da4fced5f5 100644 --- a/test/framework/src/main/java/org/opensearch/test/OpenSearchIntegTestCase.java +++ b/test/framework/src/main/java/org/opensearch/test/OpenSearchIntegTestCase.java @@ -949,12 +949,13 @@ private ClusterHealthStatus ensureColor( .waitForNoRelocatingShards(true) .waitForNoInitializingShards(waitForNoInitializingShards) // We currently often use ensureGreen or ensureYellow to check whether the cluster is back in a good state after shutting down - // a node. If the node that is stopped is the cluster-manager node, another node will become cluster-manager and publish a cluster state where it - // is cluster-manager but where the node that was stopped hasn't been removed yet from the cluster state. It will only subsequently - // publish a second state where the old cluster-manager is removed. If the ensureGreen/ensureYellow is timed just right, it will get to - // execute before the second cluster state update removes the old cluster-manager and the condition ensureGreen / ensureYellow will - // trivially hold if it held before the node was shut down. The following "waitForNodes" condition ensures that the node has - // been removed by the cluster-manager so that the health check applies to the set of nodes we expect to be part of the cluster. + // a node. If the node that is stopped is the cluster-manager node, another node will become cluster-manager and publish a + // cluster state where it is cluster-manager but where the node that was stopped hasn't been removed yet from the cluster state. + // It will only subsequently publish a second state where the old cluster-manager is removed. + // If the ensureGreen/ensureYellow is timed just right, it will get to execute before the second cluster state update removes + // the old cluster-manager and the condition ensureGreen / ensureYellow will trivially hold if it held before the node was + // shut down. The following "waitForNodes" condition ensures that the node has been removed by the cluster-manager + // so that the health check applies to the set of nodes we expect to be part of the cluster. .waitForNodes(Integer.toString(cluster().size())); ClusterHealthResponse actionGet = client().admin().cluster().health(healthRequest).actionGet(); @@ -1106,7 +1107,8 @@ protected void ensureClusterStateConsistency() throws IOException { final Map localStateMap = convertToMap(localClusterState); final int localClusterStateSize = localClusterState.toString().length(); // Check that the non-cluster-manager node has the same version of the cluster state as the cluster-manager and - // that the cluster-manager node matches the cluster-manager (otherwise there is no requirement for the cluster state to match) + // that the cluster-manager node matches the cluster-manager (otherwise there is no requirement for the cluster state to + // match) if (masterClusterState.version() == localClusterState.version() && masterId.equals(localClusterState.nodes().getMasterNodeId())) { try { diff --git a/test/framework/src/main/java/org/opensearch/test/rest/yaml/OpenSearchClientYamlSuiteTestCase.java b/test/framework/src/main/java/org/opensearch/test/rest/yaml/OpenSearchClientYamlSuiteTestCase.java index 903b5667a21a3..1075acf751918 100644 --- a/test/framework/src/main/java/org/opensearch/test/rest/yaml/OpenSearchClientYamlSuiteTestCase.java +++ b/test/framework/src/main/java/org/opensearch/test/rest/yaml/OpenSearchClientYamlSuiteTestCase.java @@ -181,7 +181,14 @@ protected ClientYamlTestClient initClientYamlTestClient( final Version esVersion, final Version clusterManagerVersion ) { - return new ClientYamlTestClient(restSpec, restClient, hosts, esVersion, clusterManagerVersion, this::getClientBuilderWithSniffedHosts); + return new ClientYamlTestClient( + restSpec, + restClient, + hosts, + esVersion, + clusterManagerVersion, + this::getClientBuilderWithSniffedHosts + ); } @AfterClass From 8af315e648c1a50f6958befce780b06f87710dac Mon Sep 17 00:00:00 2001 From: Tianli Feng Date: Tue, 10 May 2022 21:09:57 -0700 Subject: [PATCH 5/6] Replace 'master' terminology with 'cluster manager' in test directory Signed-off-by: Tianli Feng --- .../AbstractCoordinatorTestCase.java | 8 +- .../CoordinationStateTestCluster.java | 12 +- .../service/FakeThreadPoolMasterService.java | 4 +- .../opensearch/common/util/MockBigArrays.java | 16 +- .../common/util/MockPageCacheRecycler.java | 18 +- .../blobstore/BlobStoreTestUtil.java | 2 +- .../AbstractSnapshotIntegTestCase.java | 26 +-- .../snapshots/mockstore/MockRepository.java | 4 +- .../test/AbstractBuilderTestCase.java | 6 +- .../opensearch/test/ClusterServiceUtils.java | 12 +- .../opensearch/test/ExternalTestCluster.java | 12 +- .../opensearch/test/InternalTestCluster.java | 154 +++++++++--------- .../test/OpenSearchIntegTestCase.java | 46 +++--- .../rest/yaml/ClientYamlDocsTestClient.java | 4 +- .../OpenSearchClientYamlSuiteTestCase.java | 8 +- .../test/rest/yaml/section/DoSection.java | 4 +- .../FakeThreadPoolMasterServiceTests.java | 4 +- 17 files changed, 170 insertions(+), 170 deletions(-) diff --git a/test/framework/src/main/java/org/opensearch/cluster/coordination/AbstractCoordinatorTestCase.java b/test/framework/src/main/java/org/opensearch/cluster/coordination/AbstractCoordinatorTestCase.java index 5042d968176a4..e341a330e2c4c 100644 --- a/test/framework/src/main/java/org/opensearch/cluster/coordination/AbstractCoordinatorTestCase.java +++ b/test/framework/src/main/java/org/opensearch/cluster/coordination/AbstractCoordinatorTestCase.java @@ -1261,7 +1261,7 @@ public String toString() { void submitSetAutoShrinkVotingConfiguration(final boolean autoShrinkVotingConfiguration) { submitUpdateTask( - "set master nodes failure tolerance [" + autoShrinkVotingConfiguration + "]", + "set cluster-manager nodes failure tolerance [" + autoShrinkVotingConfiguration + "]", cs -> ClusterState.builder(cs) .metadata( Metadata.builder(cs.metadata()) @@ -1347,7 +1347,7 @@ public void onFailure(String source, Exception e) { @Override public void onNoLongerMaster(String source) { - logger.trace("no longer master: [{}]", source); + logger.trace("no longer cluster-manager: [{}]", source); taskListener.onNoLongerMaster(source); } @@ -1610,7 +1610,7 @@ void allowClusterStateApplicationFailure() { } } - protected DiscoveryNode createDiscoveryNode(int nodeIndex, boolean masterEligible) { + protected DiscoveryNode createDiscoveryNode(int nodeIndex, boolean clusterManagerEligible) { final TransportAddress address = buildNewFakeTransportAddress(); return new DiscoveryNode( "", @@ -1620,7 +1620,7 @@ protected DiscoveryNode createDiscoveryNode(int nodeIndex, boolean masterEligibl address.getAddress(), address, Collections.emptyMap(), - masterEligible ? DiscoveryNodeRole.BUILT_IN_ROLES : emptySet(), + clusterManagerEligible ? DiscoveryNodeRole.BUILT_IN_ROLES : emptySet(), Version.CURRENT ); } 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 1e7456e03ce6f..b604c57bcf4bc 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 @@ -285,11 +285,11 @@ void runRandomly() { } else if (rarely() && rarely()) { randomFrom(clusterNodes).reboot(); } else if (rarely()) { - final List masterNodes = clusterNodes.stream() + final List clusterManangerNodes = clusterNodes.stream() .filter(cn -> cn.state.electionWon()) .collect(Collectors.toList()); - if (masterNodes.isEmpty() == false) { - final ClusterNode clusterNode = randomFrom(masterNodes); + if (clusterManangerNodes.isEmpty() == false) { + final ClusterNode clusterNode = randomFrom(clusterManangerNodes); final long term = rarely() ? randomLongBetween(0, maxTerm + 1) : clusterNode.state.getCurrentTerm(); final long version = rarely() ? randomIntBetween(0, 5) : clusterNode.state.getLastPublishedVersion() + 1; final CoordinationMetadata.VotingConfiguration acceptedConfig = rarely() @@ -323,13 +323,13 @@ void runRandomly() { } void invariant() { - // one master per term + // one cluster-manager per term messages.stream() .filter(m -> m.payload instanceof PublishRequest) .collect(Collectors.groupingBy(m -> ((PublishRequest) m.payload).getAcceptedState().term())) .forEach((term, publishMessages) -> { - Set mastersForTerm = publishMessages.stream().collect(Collectors.groupingBy(m -> m.sourceNode)).keySet(); - assertThat("Multiple masters " + mastersForTerm + " for term " + term, mastersForTerm, hasSize(1)); + Set clusterManagersForTerm = publishMessages.stream().collect(Collectors.groupingBy(m -> m.sourceNode)).keySet(); + assertThat("Multiple cluster-managers " + clusterManagersForTerm + " for term " + term, clusterManagersForTerm, hasSize(1)); }); // unique cluster state per (term, version) pair diff --git a/test/framework/src/main/java/org/opensearch/cluster/service/FakeThreadPoolMasterService.java b/test/framework/src/main/java/org/opensearch/cluster/service/FakeThreadPoolMasterService.java index 14d9f9554004f..c532a0cc36472 100644 --- a/test/framework/src/main/java/org/opensearch/cluster/service/FakeThreadPoolMasterService.java +++ b/test/framework/src/main/java/org/opensearch/cluster/service/FakeThreadPoolMasterService.java @@ -116,7 +116,7 @@ private void scheduleNextTaskIfNecessary() { onTaskAvailableToRun.accept(new Runnable() { @Override public String toString() { - return "master service scheduling next task"; + return "cluster-manager service scheduling next task"; } @Override @@ -125,7 +125,7 @@ public void run() { assert waitForPublish == false; assert scheduledNextTask; final int taskIndex = randomInt(pendingTasks.size() - 1); - logger.debug("next master service task: choosing task {} of {}", taskIndex, pendingTasks.size()); + logger.debug("next cluster-manager service task: choosing task {} of {}", taskIndex, pendingTasks.size()); final Runnable task = pendingTasks.remove(taskIndex); taskInProgress = true; scheduledNextTask = false; diff --git a/test/framework/src/main/java/org/opensearch/common/util/MockBigArrays.java b/test/framework/src/main/java/org/opensearch/common/util/MockBigArrays.java index 94112b12e4810..b0cf71cb4b54f 100644 --- a/test/framework/src/main/java/org/opensearch/common/util/MockBigArrays.java +++ b/test/framework/src/main/java/org/opensearch/common/util/MockBigArrays.java @@ -66,21 +66,21 @@ public class MockBigArrays extends BigArrays { private static final ConcurrentMap ACQUIRED_ARRAYS = new ConcurrentHashMap<>(); public static void ensureAllArraysAreReleased() throws Exception { - final Map masterCopy = new HashMap<>(ACQUIRED_ARRAYS); - if (!masterCopy.isEmpty()) { + final Map clusterManagerCopy = new HashMap<>(ACQUIRED_ARRAYS); + if (!clusterManagerCopy.isEmpty()) { // not empty, we might be executing on a shared cluster that keeps on obtaining // and releasing arrays, lets make sure that after a reasonable timeout, all cluster-manager // copy (snapshot) have been released try { - assertBusy(() -> assertTrue(Sets.haveEmptyIntersection(masterCopy.keySet(), ACQUIRED_ARRAYS.keySet()))); + assertBusy(() -> assertTrue(Sets.haveEmptyIntersection(clusterManagerCopy.keySet(), ACQUIRED_ARRAYS.keySet()))); } catch (AssertionError ex) { - masterCopy.keySet().retainAll(ACQUIRED_ARRAYS.keySet()); - ACQUIRED_ARRAYS.keySet().removeAll(masterCopy.keySet()); // remove all existing master copy we will report on - if (!masterCopy.isEmpty()) { - Iterator causes = masterCopy.values().iterator(); + clusterManagerCopy.keySet().retainAll(ACQUIRED_ARRAYS.keySet()); + ACQUIRED_ARRAYS.keySet().removeAll(clusterManagerCopy.keySet()); // remove all existing cluster-manager copy we will report on + if (!clusterManagerCopy.isEmpty()) { + Iterator causes = clusterManagerCopy.values().iterator(); Object firstCause = causes.next(); RuntimeException exception = new RuntimeException( - masterCopy.size() + " arrays have not been released", + clusterManagerCopy.size() + " arrays have not been released", firstCause instanceof Throwable ? (Throwable) firstCause : null ); while (causes.hasNext()) { diff --git a/test/framework/src/main/java/org/opensearch/common/util/MockPageCacheRecycler.java b/test/framework/src/main/java/org/opensearch/common/util/MockPageCacheRecycler.java index 471cf01a3f7d2..282536da33cca 100644 --- a/test/framework/src/main/java/org/opensearch/common/util/MockPageCacheRecycler.java +++ b/test/framework/src/main/java/org/opensearch/common/util/MockPageCacheRecycler.java @@ -53,19 +53,19 @@ public class MockPageCacheRecycler extends PageCacheRecycler { private static final ConcurrentMap ACQUIRED_PAGES = new ConcurrentHashMap<>(); public static void ensureAllPagesAreReleased() throws Exception { - final Map masterCopy = new HashMap<>(ACQUIRED_PAGES); - if (!masterCopy.isEmpty()) { + final Map clusterManagerCopy = new HashMap<>(ACQUIRED_PAGES); + if (!clusterManagerCopy.isEmpty()) { // not empty, we might be executing on a shared cluster that keeps on obtaining - // and releasing pages, lets make sure that after a reasonable timeout, all master + // and releasing pages, lets make sure that after a reasonable timeout, all cluster-manager // copy (snapshot) have been released - final boolean success = waitUntil(() -> Sets.haveEmptyIntersection(masterCopy.keySet(), ACQUIRED_PAGES.keySet())); + final boolean success = waitUntil(() -> Sets.haveEmptyIntersection(clusterManagerCopy.keySet(), ACQUIRED_PAGES.keySet())); if (!success) { - masterCopy.keySet().retainAll(ACQUIRED_PAGES.keySet()); - ACQUIRED_PAGES.keySet().removeAll(masterCopy.keySet()); // remove all existing master copy we will report on - if (!masterCopy.isEmpty()) { - Iterator causes = masterCopy.values().iterator(); + clusterManagerCopy.keySet().retainAll(ACQUIRED_PAGES.keySet()); + ACQUIRED_PAGES.keySet().removeAll(clusterManagerCopy.keySet()); // remove all existing cluster-manager copy we will report on + if (!clusterManagerCopy.isEmpty()) { + Iterator causes = clusterManagerCopy.values().iterator(); Throwable firstCause = causes.next(); - RuntimeException exception = new RuntimeException(masterCopy.size() + " pages have not been released", firstCause); + RuntimeException exception = new RuntimeException(clusterManagerCopy.size() + " pages have not been released", firstCause); while (causes.hasNext()) { exception.addSuppressed(causes.next()); } diff --git a/test/framework/src/main/java/org/opensearch/repositories/blobstore/BlobStoreTestUtil.java b/test/framework/src/main/java/org/opensearch/repositories/blobstore/BlobStoreTestUtil.java index ad61153b62a06..89d5f6f95bc5a 100644 --- a/test/framework/src/main/java/org/opensearch/repositories/blobstore/BlobStoreTestUtil.java +++ b/test/framework/src/main/java/org/opensearch/repositories/blobstore/BlobStoreTestUtil.java @@ -410,7 +410,7 @@ private static ClusterService mockClusterService(ClusterState initialState) { final ClusterService clusterService = mock(ClusterService.class); final ClusterApplierService clusterApplierService = mock(ClusterApplierService.class); when(clusterService.getClusterApplierService()).thenReturn(clusterApplierService); - // Setting local node as master so it may update the repository metadata in the cluster state + // Setting local node as cluster-manager so it may update the repository metadata in the cluster state final DiscoveryNode localNode = new DiscoveryNode("", buildNewFakeTransportAddress(), Version.CURRENT); final AtomicReference currentState = new AtomicReference<>( ClusterState.builder(initialState) diff --git a/test/framework/src/main/java/org/opensearch/snapshots/AbstractSnapshotIntegTestCase.java b/test/framework/src/main/java/org/opensearch/snapshots/AbstractSnapshotIntegTestCase.java index 3a55848c46150..70839be718e47 100644 --- a/test/framework/src/main/java/org/opensearch/snapshots/AbstractSnapshotIntegTestCase.java +++ b/test/framework/src/main/java/org/opensearch/snapshots/AbstractSnapshotIntegTestCase.java @@ -252,30 +252,30 @@ public SnapshotInfo waitForCompletion(String repository, String snapshotName, Ti } public static String blockMasterFromFinalizingSnapshotOnIndexFile(final String repositoryName) { - final String masterName = internalCluster().getMasterName(); - ((MockRepository) internalCluster().getInstance(RepositoriesService.class, masterName).repository(repositoryName)) + final String clusterManagerName = internalCluster().getMasterName(); + ((MockRepository) internalCluster().getInstance(RepositoriesService.class, clusterManagerName).repository(repositoryName)) .setBlockAndFailOnWriteIndexFile(); - return masterName; + return clusterManagerName; } public static String blockMasterOnWriteIndexFile(final String repositoryName) { - final String masterName = internalCluster().getMasterName(); + final String clusterManagerName = internalCluster().getMasterName(); ((MockRepository) internalCluster().getMasterNodeInstance(RepositoriesService.class).repository(repositoryName)) .setBlockOnWriteIndexFile(); - return masterName; + return clusterManagerName; } public static void blockMasterFromDeletingIndexNFile(String repositoryName) { - final String masterName = internalCluster().getMasterName(); - ((MockRepository) internalCluster().getInstance(RepositoriesService.class, masterName).repository(repositoryName)) + final String clusterManagerName = internalCluster().getMasterName(); + ((MockRepository) internalCluster().getInstance(RepositoriesService.class, clusterManagerName).repository(repositoryName)) .setBlockOnDeleteIndexFile(); } public static String blockMasterFromFinalizingSnapshotOnSnapFile(final String repositoryName) { - final String masterName = internalCluster().getMasterName(); - ((MockRepository) internalCluster().getInstance(RepositoriesService.class, masterName).repository(repositoryName)) + final String clusterManagerName = internalCluster().getMasterName(); + ((MockRepository) internalCluster().getInstance(RepositoriesService.class, clusterManagerName).repository(repositoryName)) .setBlockAndFailOnWriteSnapFiles(true); - return masterName; + return clusterManagerName; } public static String blockNodeWithIndex(final String repositoryName, final String indexName) { @@ -628,10 +628,10 @@ protected SnapshotInfo getSnapshot(String repository, String snapshot) { } protected void awaitMasterFinishRepoOperations() throws Exception { - logger.info("--> waiting for master to finish all repo operations on its SNAPSHOT pool"); - final ThreadPool masterThreadPool = internalCluster().getMasterNodeInstance(ThreadPool.class); + logger.info("--> waiting for cluster-manager to finish all repo operations on its SNAPSHOT pool"); + final ThreadPool clusterManagerThreadPool = internalCluster().getMasterNodeInstance(ThreadPool.class); assertBusy(() -> { - for (ThreadPoolStats.Stats stat : masterThreadPool.stats()) { + for (ThreadPoolStats.Stats stat : clusterManagerThreadPool.stats()) { if (ThreadPool.Names.SNAPSHOT.equals(stat.getName())) { assertEquals(stat.getActive(), 0); break; diff --git a/test/framework/src/main/java/org/opensearch/snapshots/mockstore/MockRepository.java b/test/framework/src/main/java/org/opensearch/snapshots/mockstore/MockRepository.java index b26ffc9bd69d9..4e641f9505e3e 100644 --- a/test/framework/src/main/java/org/opensearch/snapshots/mockstore/MockRepository.java +++ b/test/framework/src/main/java/org/opensearch/snapshots/mockstore/MockRepository.java @@ -143,7 +143,7 @@ public long getFailureCount() { */ private volatile boolean blockOnWriteIndexFile; - /** Allows blocking on writing the snapshot file at the end of snapshot creation to simulate a died master node */ + /** Allows blocking on writing the snapshot file at the end of snapshot creation to simulate a died cluster-manager node */ private volatile boolean blockAndFailOnWriteSnapFile; private volatile boolean blockOnWriteShardLevelMeta; @@ -191,7 +191,7 @@ public RepositoryMetadata getMetadata() { } private static RepositoryMetadata overrideSettings(RepositoryMetadata metadata, Environment environment) { - // TODO: use another method of testing not being able to read the test file written by the master... + // TODO: use another method of testing not being able to read the test file written by the cluster-manager... // this is super duper hacky if (metadata.settings().getAsBoolean("localize_location", false)) { Path location = PathUtils.get(metadata.settings().get("location")); diff --git a/test/framework/src/main/java/org/opensearch/test/AbstractBuilderTestCase.java b/test/framework/src/main/java/org/opensearch/test/AbstractBuilderTestCase.java index b29d6a26054ff..526ae1452f578 100644 --- a/test/framework/src/main/java/org/opensearch/test/AbstractBuilderTestCase.java +++ b/test/framework/src/main/java/org/opensearch/test/AbstractBuilderTestCase.java @@ -248,10 +248,10 @@ public void beforeTest() throws Exception { assert serviceHolderWithNoType == null; // we initialize the serviceHolder and serviceHolderWithNoType just once, but need some // calls to the randomness source during its setup. In order to not mix these calls with - // the randomness source that is later used in the test method, we use the master seed during + // the randomness source that is later used in the test method, we use the cluster-manager seed during // this setup - long masterSeed = SeedUtils.parseSeed(RandomizedTest.getContext().getRunnerSeedAsString()); - RandomizedTest.getContext().runWithPrivateRandomness(masterSeed, (Callable) () -> { + long clusterManagerSeed = SeedUtils.parseSeed(RandomizedTest.getContext().getRunnerSeedAsString()); + RandomizedTest.getContext().runWithPrivateRandomness(clusterManagerSeed, (Callable) () -> { serviceHolder = new ServiceHolder( nodeSettings, createTestIndexSettings(), diff --git a/test/framework/src/main/java/org/opensearch/test/ClusterServiceUtils.java b/test/framework/src/main/java/org/opensearch/test/ClusterServiceUtils.java index b97a35a3431b6..f709d8bcaff34 100644 --- a/test/framework/src/main/java/org/opensearch/test/ClusterServiceUtils.java +++ b/test/framework/src/main/java/org/opensearch/test/ClusterServiceUtils.java @@ -62,19 +62,19 @@ public class ClusterServiceUtils { public static MasterService createMasterService(ThreadPool threadPool, ClusterState initialClusterState) { - MasterService masterService = new MasterService( - Settings.builder().put(Node.NODE_NAME_SETTING.getKey(), "test_master_node").build(), + MasterService clusterManagerService = new MasterService( + Settings.builder().put(Node.NODE_NAME_SETTING.getKey(), "test_cluster_manager_node").build(), new ClusterSettings(Settings.EMPTY, ClusterSettings.BUILT_IN_CLUSTER_SETTINGS), threadPool ); AtomicReference clusterStateRef = new AtomicReference<>(initialClusterState); - masterService.setClusterStatePublisher((event, publishListener, ackListener) -> { + clusterManagerService.setClusterStatePublisher((event, publishListener, ackListener) -> { clusterStateRef.set(event.state()); publishListener.onResponse(null); }); - masterService.setClusterStateSupplier(clusterStateRef::get); - masterService.start(); - return masterService; + clusterManagerService.setClusterStateSupplier(clusterStateRef::get); + clusterManagerService.start(); + return clusterManagerService; } public static MasterService createMasterService(ThreadPool threadPool, DiscoveryNode localNode) { diff --git a/test/framework/src/main/java/org/opensearch/test/ExternalTestCluster.java b/test/framework/src/main/java/org/opensearch/test/ExternalTestCluster.java index 805e578a8e8db..6dec5858b398a 100644 --- a/test/framework/src/main/java/org/opensearch/test/ExternalTestCluster.java +++ b/test/framework/src/main/java/org/opensearch/test/ExternalTestCluster.java @@ -90,7 +90,7 @@ public final class ExternalTestCluster extends TestCluster { private final String clusterName; private final int numDataNodes; - private final int numMasterAndDataNodes; + private final int numClusterManagerAndDataNodes; public ExternalTestCluster( Path tempDir, @@ -141,19 +141,19 @@ public ExternalTestCluster( .get(); httpAddresses = new InetSocketAddress[nodeInfos.getNodes().size()]; int dataNodes = 0; - int masterAndDataNodes = 0; + int clusterManagerAndDataNodes = 0; for (int i = 0; i < nodeInfos.getNodes().size(); i++) { NodeInfo nodeInfo = nodeInfos.getNodes().get(i); httpAddresses[i] = nodeInfo.getInfo(HttpInfo.class).address().publishAddress().address(); if (DiscoveryNode.isDataNode(nodeInfo.getSettings())) { dataNodes++; - masterAndDataNodes++; + clusterManagerAndDataNodes++; } else if (DiscoveryNode.isMasterNode(nodeInfo.getSettings())) { - masterAndDataNodes++; + clusterManagerAndDataNodes++; } } this.numDataNodes = dataNodes; - this.numMasterAndDataNodes = masterAndDataNodes; + this.numClusterManagerAndDataNodes = clusterManagerAndDataNodes; this.client = client; this.node = node; @@ -191,7 +191,7 @@ public int numDataNodes() { @Override public int numDataAndMasterNodes() { - return numMasterAndDataNodes; + return numClusterManagerAndDataNodes; } @Override diff --git a/test/framework/src/main/java/org/opensearch/test/InternalTestCluster.java b/test/framework/src/main/java/org/opensearch/test/InternalTestCluster.java index f9b38e186418c..eb865192dd2e0 100644 --- a/test/framework/src/main/java/org/opensearch/test/InternalTestCluster.java +++ b/test/framework/src/main/java/org/opensearch/test/InternalTestCluster.java @@ -199,11 +199,11 @@ public final class InternalTestCluster extends TestCluster { nodeAndClient.node.settings() ); - private static final Predicate NO_DATA_NO_MASTER_PREDICATE = nodeAndClient -> DiscoveryNode.isMasterNode( + private static final Predicate NO_DATA_NO_CLUSTER_MANAGER_PREDICATE = nodeAndClient -> DiscoveryNode.isMasterNode( nodeAndClient.node.settings() ) == false && DiscoveryNode.isDataNode(nodeAndClient.node.settings()) == false; - private static final Predicate MASTER_NODE_PREDICATE = nodeAndClient -> DiscoveryNode.isMasterNode( + private static final Predicate CLUSTER_MANAGER_NODE_PREDICATE = nodeAndClient -> DiscoveryNode.isMasterNode( nodeAndClient.node.settings() ); @@ -237,8 +237,8 @@ public final class InternalTestCluster extends TestCluster { * fully shared cluster to be more reproducible */ private final long[] sharedNodesSeeds; - // if set to 0, data nodes will also assume the master role - private final int numSharedDedicatedMasterNodes; + // if set to 0, data nodes will also assume the cluster-manager role + private final int numSharedDedicatedClusterManagerNodes; private final int numSharedDataNodes; @@ -270,7 +270,7 @@ public final class InternalTestCluster extends TestCluster { public InternalTestCluster( final long clusterSeed, final Path baseDir, - final boolean randomlyAddDedicatedMasters, + final boolean randomlyAddDedicatedClusterManagers, final boolean autoManageClusterManagerNodes, final int minNumDataNodes, final int maxNumDataNodes, @@ -284,7 +284,7 @@ public InternalTestCluster( this( clusterSeed, baseDir, - randomlyAddDedicatedMasters, + randomlyAddDedicatedClusterManagers, autoManageClusterManagerNodes, minNumDataNodes, maxNumDataNodes, @@ -301,7 +301,7 @@ public InternalTestCluster( public InternalTestCluster( final long clusterSeed, final Path baseDir, - final boolean randomlyAddDedicatedMasters, + final boolean randomlyAddDedicatedClusterManagers, final boolean autoManageClusterManagerNodes, final int minNumDataNodes, final int maxNumDataNodes, @@ -329,24 +329,24 @@ public InternalTestCluster( Random random = new Random(clusterSeed); - boolean useDedicatedMasterNodes = randomlyAddDedicatedMasters ? random.nextBoolean() : false; + boolean useDedicatedClusterManagerNodes = randomlyAddDedicatedClusterManagers ? random.nextBoolean() : false; this.numSharedDataNodes = RandomNumbers.randomIntBetween(random, minNumDataNodes, maxNumDataNodes); assert this.numSharedDataNodes >= 0; if (numSharedDataNodes == 0) { this.numSharedCoordOnlyNodes = 0; - this.numSharedDedicatedMasterNodes = 0; + this.numSharedDedicatedClusterManagerNodes = 0; } else { - if (useDedicatedMasterNodes) { + if (useDedicatedClusterManagerNodes) { if (random.nextBoolean()) { - // use a dedicated master, but only low number to reduce overhead to tests - this.numSharedDedicatedMasterNodes = DEFAULT_LOW_NUM_MASTER_NODES; + // use a dedicated cluster-manager, but only low number to reduce overhead to tests + this.numSharedDedicatedClusterManagerNodes = DEFAULT_LOW_NUM_MASTER_NODES; } else { - this.numSharedDedicatedMasterNodes = DEFAULT_HIGH_NUM_MASTER_NODES; + this.numSharedDedicatedClusterManagerNodes = DEFAULT_HIGH_NUM_MASTER_NODES; } } else { - this.numSharedDedicatedMasterNodes = 0; + this.numSharedDedicatedClusterManagerNodes = 0; } if (numClientNodes < 0) { this.numSharedCoordOnlyNodes = RandomNumbers.randomIntBetween( @@ -366,17 +366,17 @@ public InternalTestCluster( this.mockPlugins = mockPlugins; - sharedNodesSeeds = new long[numSharedDedicatedMasterNodes + numSharedDataNodes + numSharedCoordOnlyNodes]; + sharedNodesSeeds = new long[numSharedDedicatedClusterManagerNodes + numSharedDataNodes + numSharedCoordOnlyNodes]; for (int i = 0; i < sharedNodesSeeds.length; i++) { sharedNodesSeeds[i] = random.nextLong(); } logger.info( - "Setup InternalTestCluster [{}] with seed [{}] using [{}] dedicated masters, " - + "[{}] (data) nodes and [{}] coord only nodes (min_master_nodes are [{}])", + "Setup InternalTestCluster [{}] with seed [{}] using [{}] dedicated cluster-managers, " + + "[{}] (data) nodes and [{}] coord only nodes (min_cluster_manager_nodes are [{}])", clusterName, SeedUtils.formatSeed(clusterSeed), - numSharedDedicatedMasterNodes, + numSharedDedicatedClusterManagerNodes, numSharedDataNodes, numSharedCoordOnlyNodes, autoManageClusterManagerNodes ? "auto-managed" : "manual" @@ -432,8 +432,8 @@ public InternalTestCluster( RecoverySettings.INDICES_RECOVERY_MAX_CONCURRENT_OPERATIONS_SETTING.getKey(), RandomNumbers.randomIntBetween(random, 1, 4) ); - // TODO: currently we only randomize "cluster.no_master_block" between "write" and "metadata_write", as "all" is fragile - // and fails shards when a master abdicates, which breaks many tests. + // TODO: currently we only randomize "cluster.no_cluster_manager_block" between "write" and "metadata_write", as "all" is fragile + // and fails shards when a cluster-manager abdicates, which breaks many tests. builder.put(NoMasterBlockService.NO_CLUSTER_MANAGER_BLOCK_SETTING.getKey(), randomFrom(random, "write", "metadata_write")); defaultSettings = builder.build(); executor = OpenSearchExecutors.newScaling( @@ -450,11 +450,11 @@ public InternalTestCluster( /** * Sets {@link #bootstrapClusterManagerNodeIndex} to the given value, see {@link #bootstrapClusterManagerNodeWithSpecifiedIndex(List)} * for the description of how this field is used. - * It's only possible to change {@link #bootstrapClusterManagerNodeIndex} value if autoManageMasterNodes is false. + * It's only possible to change {@link #bootstrapClusterManagerNodeIndex} value if autoManageClusterManagerNodes is false. */ public void setBootstrapClusterManagerNodeIndex(int bootstrapClusterManagerNodeIndex) { assert autoManageClusterManagerNodes == false || bootstrapClusterManagerNodeIndex == -1 - : "bootstrapMasterNodeIndex should be -1 if autoManageMasterNodes is true, but was " + bootstrapClusterManagerNodeIndex; + : "bootstrapClusterManagerNodeIndex should be -1 if autoManageClusterManagerNodes is true, but was " + bootstrapClusterManagerNodeIndex; this.bootstrapClusterManagerNodeIndex = bootstrapClusterManagerNodeIndex; } @@ -647,7 +647,7 @@ public synchronized void ensureAtLeastNumDataNodes(int n) { int size = numDataNodes(); if (size < n) { logger.info("increasing cluster size from {} to {}", size, n); - if (numSharedDedicatedMasterNodes > 0) { + if (numSharedDedicatedClusterManagerNodes > 0) { startDataOnlyNodes(n - size); } else { startNodes(n - size); @@ -666,7 +666,7 @@ public synchronized void ensureAtMostNumDataNodes(int n) throws IOException { if (size <= n) { return; } - // prevent killing the master if possible and client nodes + // prevent killing the cluster-manager if possible and client nodes final Stream collection = n == 0 ? nodes.values().stream() : nodes.values().stream().filter(DATA_NODE_PREDICATE.and(new NodeNamePredicate(getMasterName()).negate())); @@ -686,7 +686,7 @@ public synchronized void ensureAtMostNumDataNodes(int n) throws IOException { } } - private Settings getNodeSettings(final int nodeId, final long seed, final Settings extraSettings, final int defaultMinMasterNodes) { + private Settings getNodeSettings(final int nodeId, final long seed, final Settings extraSettings, final int defaultMinClusterManagerNodes) { final Settings settings = getSettings(nodeId, seed, extraSettings); final String name = buildNodeName(nodeId, settings); @@ -719,7 +719,7 @@ private Settings getNodeSettings(final int nodeId, final long seed, final Settin if (usingSingleNodeDiscovery == false) { if (autoManageClusterManagerNodes) { assertThat( - "if master nodes are automatically managed then nodes must complete a join cycle when starting", + "if cluster-manager nodes are automatically managed then nodes must complete a join cycle when starting", updatedSettings.get(DiscoverySettings.INITIAL_STATE_TIMEOUT_SETTING.getKey()), nullValue() ); @@ -816,7 +816,7 @@ public Client dataNodeClient() { } /** - * Returns a node client to the current master node. + * Returns a node client to the current cluster-manager node. * Note: use this with care tests should not rely on a certain nodes client. */ public Client masterClient() { @@ -843,14 +843,14 @@ public Client nonMasterClient() { */ public synchronized Client coordOnlyNodeClient() { ensureOpen(); - NodeAndClient randomNodeAndClient = getRandomNodeAndClient(NO_DATA_NO_MASTER_PREDICATE); + NodeAndClient randomNodeAndClient = getRandomNodeAndClient(NO_DATA_NO_CLUSTER_MANAGER_PREDICATE); if (randomNodeAndClient != null) { return randomNodeAndClient.client(); } int nodeId = nextNodeId.getAndIncrement(); Settings settings = getSettings(nodeId, random.nextLong(), Settings.EMPTY); startCoordinatingOnlyNode(settings); - return getRandomNodeAndClient(NO_DATA_NO_MASTER_PREDICATE).client(); + return getRandomNodeAndClient(NO_DATA_NO_CLUSTER_MANAGER_PREDICATE).client(); } public synchronized String startCoordinatingOnlyNode(Settings settings) { @@ -980,7 +980,7 @@ void startNode() { /** * closes the node and prepares it to be restarted */ - Settings closeForRestart(RestartCallback callback, int minMasterNodes) throws Exception { + Settings closeForRestart(RestartCallback callback, int minClusterManagerNodes) throws Exception { assert callback != null; close(); removeNode(this); @@ -988,7 +988,7 @@ Settings closeForRestart(RestartCallback callback, int minMasterNodes) throws Ex assert callbackSettings != null; Settings.Builder newSettings = Settings.builder(); newSettings.put(callbackSettings); - if (minMasterNodes >= 0) { + if (minClusterManagerNodes >= 0) { if (INITIAL_CLUSTER_MANAGER_NODES_SETTING.exists(callbackSettings) == false) { newSettings.putList(INITIAL_CLUSTER_MANAGER_NODES_SETTING.getKey()); } @@ -1127,54 +1127,54 @@ private synchronized void reset(boolean wipeData) throws IOException { final int prevNodeCount = nodes.size(); // start any missing node - assert newSize == numSharedDedicatedMasterNodes + numSharedDataNodes + numSharedCoordOnlyNodes; - final int numberOfMasterNodes = numSharedDedicatedMasterNodes > 0 ? numSharedDedicatedMasterNodes : numSharedDataNodes; - final int defaultMinMasterNodes = (numberOfMasterNodes / 2) + 1; + assert newSize == numSharedDedicatedClusterManagerNodes + numSharedDataNodes + numSharedCoordOnlyNodes; + final int numberOfClusterManagerNodes = numSharedDedicatedClusterManagerNodes > 0 ? numSharedDedicatedClusterManagerNodes : numSharedDataNodes; + final int defaultMinClusterManagerNodes = (numberOfClusterManagerNodes / 2) + 1; final List toStartAndPublish = new ArrayList<>(); // we want to start nodes in one go final Runnable onTransportServiceStarted = () -> rebuildUnicastHostFiles(toStartAndPublish); final List settings = new ArrayList<>(); - for (int i = 0; i < numSharedDedicatedMasterNodes; i++) { - final Settings nodeSettings = getNodeSettings(i, sharedNodesSeeds[i], Settings.EMPTY, defaultMinMasterNodes); + for (int i = 0; i < numSharedDedicatedClusterManagerNodes; i++) { + final Settings nodeSettings = getNodeSettings(i, sharedNodesSeeds[i], Settings.EMPTY, defaultMinClusterManagerNodes); settings.add(removeRoles(nodeSettings, Collections.singleton(DiscoveryNodeRole.DATA_ROLE))); } - for (int i = numSharedDedicatedMasterNodes; i < numSharedDedicatedMasterNodes + numSharedDataNodes; i++) { - final Settings nodeSettings = getNodeSettings(i, sharedNodesSeeds[i], Settings.EMPTY, defaultMinMasterNodes); - if (numSharedDedicatedMasterNodes > 0) { + for (int i = numSharedDedicatedClusterManagerNodes; i < numSharedDedicatedClusterManagerNodes + numSharedDataNodes; i++) { + final Settings nodeSettings = getNodeSettings(i, sharedNodesSeeds[i], Settings.EMPTY, defaultMinClusterManagerNodes); + if (numSharedDedicatedClusterManagerNodes > 0) { settings.add(removeRoles(nodeSettings, Collections.singleton(DiscoveryNodeRole.MASTER_ROLE))); } else { // if we don't have dedicated cluster-manager nodes, keep things default settings.add(nodeSettings); } } - for (int i = numSharedDedicatedMasterNodes + numSharedDataNodes; i < numSharedDedicatedMasterNodes + numSharedDataNodes + for (int i = numSharedDedicatedClusterManagerNodes + numSharedDataNodes; i < numSharedDedicatedClusterManagerNodes + numSharedDataNodes + numSharedCoordOnlyNodes; i++) { final Builder extraSettings = Settings.builder().put(noRoles()); - settings.add(getNodeSettings(i, sharedNodesSeeds[i], extraSettings.build(), defaultMinMasterNodes)); + settings.add(getNodeSettings(i, sharedNodesSeeds[i], extraSettings.build(), defaultMinClusterManagerNodes)); } - int autoBootstrapMasterNodeIndex = -1; - final List masterNodeNames = settings.stream() + int autoBootstrapClusterManagerNodeIndex = -1; + final List clusterManagerNodeNames = settings.stream() .filter(DiscoveryNode::isMasterNode) .map(Node.NODE_NAME_SETTING::get) .collect(Collectors.toList()); if (prevNodeCount == 0 && autoManageClusterManagerNodes) { - if (numSharedDedicatedMasterNodes > 0) { - autoBootstrapMasterNodeIndex = RandomNumbers.randomIntBetween(random, 0, numSharedDedicatedMasterNodes - 1); + if (numSharedDedicatedClusterManagerNodes > 0) { + autoBootstrapClusterManagerNodeIndex = RandomNumbers.randomIntBetween(random, 0, numSharedDedicatedClusterManagerNodes - 1); } else if (numSharedDataNodes > 0) { - autoBootstrapMasterNodeIndex = RandomNumbers.randomIntBetween(random, 0, numSharedDataNodes - 1); + autoBootstrapClusterManagerNodeIndex = RandomNumbers.randomIntBetween(random, 0, numSharedDataNodes - 1); } } final List updatedSettings = bootstrapClusterManagerNodeWithSpecifiedIndex(settings); - for (int i = 0; i < numSharedDedicatedMasterNodes + numSharedDataNodes + numSharedCoordOnlyNodes; i++) { + for (int i = 0; i < numSharedDedicatedClusterManagerNodes + numSharedDataNodes + numSharedCoordOnlyNodes; i++) { Settings nodeSettings = updatedSettings.get(i); - if (i == autoBootstrapMasterNodeIndex) { + if (i == autoBootstrapClusterManagerNodeIndex) { nodeSettings = Settings.builder() - .putList(INITIAL_CLUSTER_MANAGER_NODES_SETTING.getKey(), masterNodeNames) + .putList(INITIAL_CLUSTER_MANAGER_NODES_SETTING.getKey(), clusterManagerNodeNames) .put(nodeSettings) .build(); } @@ -1214,8 +1214,8 @@ public synchronized void validateClusterFormed() { .collect(Collectors.toList()); final String debugString = ", expected nodes: " + expectedNodes + " and actual cluster states " + states; // all nodes have a cluster-manager - assertTrue("Missing master" + debugString, states.stream().allMatch(cs -> cs.nodes().getMasterNodeId() != null)); - // all nodes have the same master (in same term) + assertTrue("Missing cluster-manager" + debugString, states.stream().allMatch(cs -> cs.nodes().getMasterNodeId() != null)); + // all nodes have the same cluster-manager (in same term) assertEquals( "Not all cluster-managers in same term" + debugString, 1, @@ -1558,7 +1558,7 @@ public synchronized T getCurrentMasterNodeInstance(Class clazz) { * in the cluster. */ public Iterable getDataOrMasterNodeInstances(Class clazz) { - return getInstances(clazz, DATA_NODE_PREDICATE.or(MASTER_NODE_PREDICATE)); + return getInstances(clazz, DATA_NODE_PREDICATE.or(CLUSTER_MANAGER_NODE_PREDICATE)); } private Iterable getInstances(Class clazz, Predicate predicate) { @@ -1582,7 +1582,7 @@ public T getDataNodeInstance(Class clazz) { } public T getMasterNodeInstance(Class clazz) { - return getInstance(clazz, MASTER_NODE_PREDICATE); + return getInstance(clazz, CLUSTER_MANAGER_NODE_PREDICATE); } private synchronized T getInstance(Class clazz, Predicate predicate) { @@ -1658,7 +1658,7 @@ public synchronized void stopRandomNode(final Predicate filter) throws .filter(NodeAndClient::isMasterEligible) .filter(n -> n.nodeAndClientId() < sharedNodesSeeds.length) .count() == 1) { - throw new AssertionError("Tried to stop the only master eligible shared node"); + throw new AssertionError("Tried to stop the only cluster-manager eligible shared node"); } logger.info("Closing filtered random node [{}] ", nodeAndClient.name); stopNodesAndClient(nodeAndClient); @@ -1672,10 +1672,10 @@ public synchronized void stopCurrentMasterNode() throws IOException { ensureOpen(); assert size() > 0; String clusterManagerNodeName = getMasterName(); - final NodeAndClient masterNode = nodes.get(clusterManagerNodeName); - assert masterNode != null; + final NodeAndClient clusterManagerNode = nodes.get(clusterManagerNodeName); + assert clusterManagerNode != null; logger.info("Closing cluster-manager node [{}] ", clusterManagerNodeName); - stopNodesAndClient(masterNode); + stopNodesAndClient(clusterManagerNode); } /** @@ -1691,11 +1691,11 @@ public synchronized void stopRandomNonMasterNode() throws IOException { private synchronized void startAndPublishNodesAndClients(List nodeAndClients) { if (nodeAndClients.size() > 0) { - final int newMasters = (int) nodeAndClients.stream() + final int newClusterManagers = (int) nodeAndClients.stream() .filter(NodeAndClient::isMasterEligible) - .filter(nac -> nodes.containsKey(nac.name) == false) // filter out old masters + .filter(nac -> nodes.containsKey(nac.name) == false) // filter out old cluster-managers .count(); - final int currentMasters = getClusterManagerNodesCount(); + final int currentClusterManagers = getClusterManagerNodesCount(); rebuildUnicastHostFiles(nodeAndClients); // ensure that new nodes can find the existing nodes when they start List> futures = nodeAndClients.stream().map(node -> executor.submit(node::startNode)).collect(Collectors.toList()); @@ -1713,9 +1713,9 @@ private synchronized void startAndPublishNodesAndClients(List nod nodeAndClients.forEach(this::publishNode); if (autoManageClusterManagerNodes - && currentMasters > 0 - && newMasters > 0 - && getMinClusterManagerNodes(currentMasters + newMasters) > currentMasters) { + && currentClusterManagers > 0 + && newClusterManagers > 0 + && getMinClusterManagerNodes(currentClusterManagers + newClusterManagers) > currentClusterManagers) { // update once cluster-managers have joined validateClusterFormed(); } @@ -1757,7 +1757,7 @@ private void stopNodesAndClient(NodeAndClient nodeAndClient) throws IOException } private synchronized void stopNodesAndClients(Collection nodeAndClients) throws IOException { - final Set excludedNodeIds = excludeMasters(nodeAndClients); + final Set excludedNodeIds = excludeClusterManagers(nodeAndClients); for (NodeAndClient nodeAndClient : nodeAndClients) { removeDisruptionSchemeFromNode(nodeAndClient); @@ -1833,7 +1833,7 @@ private void restartNode(NodeAndClient nodeAndClient, RestartCallback callback) activeDisruptionScheme.removeFromNode(nodeAndClient.name, this); } - Set excludedNodeIds = excludeMasters(Collections.singleton(nodeAndClient)); + Set excludedNodeIds = excludeClusterManagers(Collections.singleton(nodeAndClient)); final Settings newSettings = nodeAndClient.closeForRestart( callback, @@ -1861,23 +1861,23 @@ private NodeAndClient removeNode(NodeAndClient nodeAndClient) { return previous; } - private Set excludeMasters(Collection nodeAndClients) { + private Set excludeClusterManagers(Collection nodeAndClients) { assert Thread.holdsLock(this); final Set excludedNodeNames = new HashSet<>(); if (autoManageClusterManagerNodes && nodeAndClients.size() > 0) { - final long currentMasters = nodes.values().stream().filter(NodeAndClient::isMasterEligible).count(); - final long stoppingMasters = nodeAndClients.stream().filter(NodeAndClient::isMasterEligible).count(); + final long currentClusterManagers = nodes.values().stream().filter(NodeAndClient::isMasterEligible).count(); + final long stoppingClusterManagers = nodeAndClients.stream().filter(NodeAndClient::isMasterEligible).count(); - assert stoppingMasters <= currentMasters : currentMasters + " < " + stoppingMasters; - if (stoppingMasters != currentMasters && stoppingMasters > 0) { + assert stoppingClusterManagers <= currentClusterManagers : currentClusterManagers + " < " + stoppingClusterManagers; + if (stoppingClusterManagers != currentClusterManagers && stoppingClusterManagers > 0) { // If stopping few enough cluster-manager-nodes that there's still a majority left, there is no need to withdraw their votes // first. // However, we do not yet have a way to be sure there's a majority left, because the voting configuration may not yet have // been updated when the previous nodes shut down, so we must always explicitly withdraw votes. // TODO add cluster health API to check that voting configuration is optimal so this isn't always needed nodeAndClients.stream().filter(NodeAndClient::isMasterEligible).map(NodeAndClient::getName).forEach(excludedNodeNames::add); - assert excludedNodeNames.size() == stoppingMasters; + assert excludedNodeNames.size() == stoppingClusterManagers; logger.info("adding voting config exclusions {} prior to restart/shutdown", excludedNodeNames); try { @@ -1912,7 +1912,7 @@ private void removeExclusions(Set excludedNodeIds) { public synchronized void fullRestart(RestartCallback callback) throws Exception { int numNodesRestarted = 0; final Settings[] newNodeSettings = new Settings[nextNodeId.get()]; - final int minMasterNodes = autoManageClusterManagerNodes ? getMinClusterManagerNodes(getClusterManagerNodesCount()) : -1; + final int minClusterManagerNodes = autoManageClusterManagerNodes ? getMinClusterManagerNodes(getClusterManagerNodesCount()) : -1; final List toStartAndPublish = new ArrayList<>(); // we want to start nodes in one go for (NodeAndClient nodeAndClient : nodes.values()) { callback.doAfterNodes(numNodesRestarted++, nodeAndClient.nodeClient()); @@ -1920,7 +1920,7 @@ public synchronized void fullRestart(RestartCallback callback) throws Exception if (activeDisruptionScheme != null) { activeDisruptionScheme.removeFromNode(nodeAndClient.name, this); } - final Settings newSettings = nodeAndClient.closeForRestart(callback, minMasterNodes); + final Settings newSettings = nodeAndClient.closeForRestart(callback, minClusterManagerNodes); newNodeSettings[nodeAndClient.nodeAndClientId()] = newSettings; toStartAndPublish.add(nodeAndClient); } @@ -1950,7 +1950,7 @@ public String getMasterName() { } /** - * Returns the name of the current master node in the cluster and executes the request via the node specified + * Returns the name of the current cluster-manager node in the cluster and executes the request via the node specified * in the viaNode parameter. If viaNode isn't specified a random node will be picked to the send the request to. */ public String getMasterName(@Nullable String viaNode) { @@ -2114,7 +2114,7 @@ public synchronized List startNodes(Settings... extraSettings) { } nextNodeId.set(firstNodeId + numOfNodes); - final List initialMasterNodes = settings.stream() + final List initialClusterManagerNodes = settings.stream() .filter(DiscoveryNode::isMasterNode) .map(Node.NODE_NAME_SETTING::get) .collect(Collectors.toList()); @@ -2126,7 +2126,7 @@ public synchronized List startNodes(Settings... extraSettings) { final Builder builder = Settings.builder(); if (DiscoveryNode.isMasterNode(nodeSettings)) { if (autoBootstrapClusterManagerNodeIndex == 0) { - builder.putList(INITIAL_CLUSTER_MANAGER_NODES_SETTING.getKey(), initialMasterNodes); + builder.putList(INITIAL_CLUSTER_MANAGER_NODES_SETTING.getKey(), initialClusterManagerNodes); } autoBootstrapClusterManagerNodeIndex -= 1; } @@ -2208,7 +2208,7 @@ public int numDataNodes() { @Override public int numDataAndMasterNodes() { - return filterNodes(nodes, DATA_NODE_PREDICATE.or(MASTER_NODE_PREDICATE)).size(); + return filterNodes(nodes, DATA_NODE_PREDICATE.or(CLUSTER_MANAGER_NODE_PREDICATE)).size(); } public int numMasterNodes() { diff --git a/test/framework/src/main/java/org/opensearch/test/OpenSearchIntegTestCase.java b/test/framework/src/main/java/org/opensearch/test/OpenSearchIntegTestCase.java index 163da4fced5f5..2f0ec118e765c 100644 --- a/test/framework/src/main/java/org/opensearch/test/OpenSearchIntegTestCase.java +++ b/test/framework/src/main/java/org/opensearch/test/OpenSearchIntegTestCase.java @@ -713,11 +713,11 @@ public void setDisruptionScheme(ServiceDisruptionScheme scheme) { * @return disruption */ protected static NetworkDisruption isolateMasterDisruption(NetworkDisruption.NetworkLinkDisruptionType disruptionType) { - final String masterNode = internalCluster().getMasterName(); + final String clusterManagerNode = internalCluster().getMasterName(); return new NetworkDisruption( new NetworkDisruption.TwoPartitions( - Collections.singleton(masterNode), - Arrays.stream(internalCluster().getNodeNames()).filter(name -> name.equals(masterNode) == false).collect(Collectors.toSet()) + Collections.singleton(clusterManagerNode), + Arrays.stream(internalCluster().getNodeNames()).filter(name -> name.equals(clusterManagerNode) == false).collect(Collectors.toSet()) ), disruptionType ); @@ -1092,13 +1092,13 @@ protected void ensureClusterStateConsistency() throws IOException { if (cluster() != null && cluster().size() > 0) { final NamedWriteableRegistry namedWriteableRegistry = cluster().getNamedWriteableRegistry(); final Client clusterManagerClient = client(); - ClusterState masterClusterState = clusterManagerClient.admin().cluster().prepareState().all().get().getState(); - byte[] masterClusterStateBytes = ClusterState.Builder.toBytes(masterClusterState); + ClusterState clusterManagerClusterState = clusterManagerClient.admin().cluster().prepareState().all().get().getState(); + byte[] masterClusterStateBytes = ClusterState.Builder.toBytes(clusterManagerClusterState); // remove local node reference - masterClusterState = ClusterState.Builder.fromBytes(masterClusterStateBytes, null, namedWriteableRegistry); - Map masterStateMap = convertToMap(masterClusterState); - int masterClusterStateSize = masterClusterState.toString().length(); - String masterId = masterClusterState.nodes().getMasterNodeId(); + clusterManagerClusterState = ClusterState.Builder.fromBytes(masterClusterStateBytes, null, namedWriteableRegistry); + Map clusterManagerStateMap = convertToMap(clusterManagerClusterState); + int clusterManagerClusterStateSize = clusterManagerClusterState.toString().length(); + String clusterManagerId = clusterManagerClusterState.nodes().getMasterNodeId(); for (Client client : cluster().getClients()) { ClusterState localClusterState = client.admin().cluster().prepareState().all().setLocal(true).get().getState(); byte[] localClusterStateBytes = ClusterState.Builder.toBytes(localClusterState); @@ -1109,25 +1109,25 @@ protected void ensureClusterStateConsistency() throws IOException { // Check that the non-cluster-manager node has the same version of the cluster state as the cluster-manager and // that the cluster-manager node matches the cluster-manager (otherwise there is no requirement for the cluster state to // match) - if (masterClusterState.version() == localClusterState.version() - && masterId.equals(localClusterState.nodes().getMasterNodeId())) { + if (clusterManagerClusterState.version() == localClusterState.version() + && clusterManagerId.equals(localClusterState.nodes().getMasterNodeId())) { try { - assertEquals("cluster state UUID does not match", masterClusterState.stateUUID(), localClusterState.stateUUID()); + assertEquals("cluster state UUID does not match", clusterManagerClusterState.stateUUID(), localClusterState.stateUUID()); // We cannot compare serialization bytes since serialization order of maps is not guaranteed // We also cannot compare byte array size because CompressedXContent's DeflateCompressor uses // a synced flush that can affect the size of the compressed byte array // (see: DeflateCompressedXContentTests#testDifferentCompressedRepresentation for an example) // instead we compare the string length of cluster state - they should be the same - assertEquals("cluster state size does not match", masterClusterStateSize, localClusterStateSize); + assertEquals("cluster state size does not match", clusterManagerClusterStateSize, localClusterStateSize); // Compare JSON serialization assertNull( "cluster state JSON serialization does not match", - differenceBetweenMapsIgnoringArrayOrder(masterStateMap, localStateMap) + differenceBetweenMapsIgnoringArrayOrder(clusterManagerStateMap, localStateMap) ); } catch (final AssertionError error) { logger.error( - "Cluster state from master:\n{}\nLocal cluster state:\n{}", - masterClusterState.toString(), + "Cluster state from cluster-manager:\n{}\nLocal cluster state:\n{}", + clusterManagerClusterState.toString(), localClusterState.toString() ); throw error; @@ -1140,8 +1140,8 @@ protected void ensureClusterStateConsistency() throws IOException { protected void ensureClusterStateCanBeReadByNodeTool() throws IOException { if (cluster() != null && cluster().size() > 0) { - final Client masterClient = client(); - Metadata metadata = masterClient.admin().cluster().prepareState().all().get().getState().metadata(); + final Client clusterManagerClient = client(); + Metadata metadata = clusterManagerClient.admin().cluster().prepareState().all().get().getState().metadata(); final Map serializationParams = new HashMap<>(2); serializationParams.put("binary", "true"); serializationParams.put(Metadata.CONTEXT_MODE_PARAM, Metadata.CONTEXT_MODE_GATEWAY); @@ -1831,12 +1831,12 @@ private static Scope getCurrentClusterScope(Class clazz) { return annotation == null ? Scope.SUITE : annotation.scope(); } - private boolean getSupportsDedicatedMasters() { + private boolean getSupportsDedicatedClusterManagers() { ClusterScope annotation = getAnnotation(this.getClass(), ClusterScope.class); return annotation == null ? true : annotation.supportsDedicatedMasters(); } - private boolean getAutoManageMasterNodes() { + private boolean getAutoManageClusterManagerNodes() { ClusterScope annotation = getAnnotation(this.getClass(), ClusterScope.class); return annotation == null ? true : annotation.autoManageMasterNodes(); } @@ -1961,7 +1961,7 @@ protected TestCluster buildTestCluster(Scope scope, long seed) throws IOExceptio throw new OpenSearchException("Scope not supported: " + scope); } - boolean supportsDedicatedMasters = getSupportsDedicatedMasters(); + boolean supportsDedicatedClusterManagers = getSupportsDedicatedClusterManagers(); int numDataNodes = getNumDataNodes(); int minNumDataNodes; int maxNumDataNodes; @@ -1985,8 +1985,8 @@ protected TestCluster buildTestCluster(Scope scope, long seed) throws IOExceptio return new InternalTestCluster( seed, createTempDir(), - supportsDedicatedMasters, - getAutoManageMasterNodes(), + supportsDedicatedClusterManagers, + getAutoManageClusterManagerNodes(), minNumDataNodes, maxNumDataNodes, InternalTestCluster.clusterName(scope.name(), seed) + "-cluster", diff --git a/test/framework/src/main/java/org/opensearch/test/rest/yaml/ClientYamlDocsTestClient.java b/test/framework/src/main/java/org/opensearch/test/rest/yaml/ClientYamlDocsTestClient.java index d57fa7ff82f07..cd5f1fe168b12 100644 --- a/test/framework/src/main/java/org/opensearch/test/rest/yaml/ClientYamlDocsTestClient.java +++ b/test/framework/src/main/java/org/opensearch/test/rest/yaml/ClientYamlDocsTestClient.java @@ -62,10 +62,10 @@ public ClientYamlDocsTestClient( final RestClient restClient, final List hosts, final Version esVersion, - final Version masterVersion, + final Version clusterManagerVersion, final CheckedSupplier clientBuilderWithSniffedNodes ) { - super(restSpec, restClient, hosts, esVersion, masterVersion, clientBuilderWithSniffedNodes); + super(restSpec, restClient, hosts, esVersion, clusterManagerVersion, clientBuilderWithSniffedNodes); } @Override diff --git a/test/framework/src/main/java/org/opensearch/test/rest/yaml/OpenSearchClientYamlSuiteTestCase.java b/test/framework/src/main/java/org/opensearch/test/rest/yaml/OpenSearchClientYamlSuiteTestCase.java index 1075acf751918..f228c87186afd 100644 --- a/test/framework/src/main/java/org/opensearch/test/rest/yaml/OpenSearchClientYamlSuiteTestCase.java +++ b/test/framework/src/main/java/org/opensearch/test/rest/yaml/OpenSearchClientYamlSuiteTestCase.java @@ -146,7 +146,7 @@ public void initAndResetContext() throws Exception { final Version minVersion = versionVersionTuple.v1(); final Version clusterManagerVersion = versionVersionTuple.v2(); logger.info( - "initializing client, minimum OpenSearch version [{}], master version, [{}], hosts {}", + "initializing client, minimum OpenSearch version [{}], cluster-manager version, [{}], hosts {}", minVersion, clusterManagerVersion, hosts @@ -337,14 +337,14 @@ private static void validateSpec(ClientYamlSuiteRestSpec restSpec) { * Detect minimal node version and master node version of cluster using REST Client. * * @param restClient REST client used to discover cluster nodes - * @return {@link Tuple} of [minimal node version, master node version] + * @return {@link Tuple} of [minimal node version, cluster-manager node version] * @throws IOException When _cat API output parsing fails */ private Tuple readVersionsFromCatNodes(RestClient restClient) throws IOException { // we simply go to the _cat/nodes API and parse all versions in the cluster final Request request = new Request("GET", "/_cat/nodes"); request.addParameter("h", "version,master"); - request.setOptions(getCatNodesVersionMasterRequestOptions()); + request.setOptions(getCatNodesVersionClusterManagerRequestOptions()); Response response = restClient.performRequest(request); ClientYamlTestResponse restTestResponse = new ClientYamlTestResponse(response); String nodesCatResponse = restTestResponse.getBodyAsString(); @@ -369,7 +369,7 @@ private Tuple readVersionsFromCatNodes(RestClient restClient) return new Tuple<>(version, clusterManagerVersion); } - protected RequestOptions getCatNodesVersionMasterRequestOptions() { + protected RequestOptions getCatNodesVersionClusterManagerRequestOptions() { return RequestOptions.DEFAULT; } diff --git a/test/framework/src/main/java/org/opensearch/test/rest/yaml/section/DoSection.java b/test/framework/src/main/java/org/opensearch/test/rest/yaml/section/DoSection.java index 5d47c6619cc71..6fdc77984c339 100644 --- a/test/framework/src/main/java/org/opensearch/test/rest/yaml/section/DoSection.java +++ b/test/framework/src/main/java/org/opensearch/test/rest/yaml/section/DoSection.java @@ -353,7 +353,7 @@ public void execute(ClientYamlTestExecutionContext executionContext) throws IOEx /** * Check that the response contains only the warning headers that we expect. */ - void checkWarningHeaders(final List warningHeaders, final Version masterVersion) { + void checkWarningHeaders(final List warningHeaders, final Version clusterManagerVersion) { final List unexpected = new ArrayList<>(); final List unmatched = new ArrayList<>(); final List missing = new ArrayList<>(); @@ -367,7 +367,7 @@ void checkWarningHeaders(final List warningHeaders, final Version master final boolean matches = matcher.matches(); if (matches) { final String message = HeaderWarning.extractWarningValueFromWarningHeader(header, true); - if (masterVersion.before(LegacyESVersion.V_7_0_0) + if (clusterManagerVersion.before(LegacyESVersion.V_7_0_0) && message.equals( "the default number of shards will change from [5] to [1] in 7.0.0; " + "if you wish to continue using the default of [5] shards, " diff --git a/test/framework/src/test/java/org/opensearch/cluster/service/FakeThreadPoolMasterServiceTests.java b/test/framework/src/test/java/org/opensearch/cluster/service/FakeThreadPoolMasterServiceTests.java index dca822a01eed3..dabeeb6742ec4 100644 --- a/test/framework/src/test/java/org/opensearch/cluster/service/FakeThreadPoolMasterServiceTests.java +++ b/test/framework/src/test/java/org/opensearch/cluster/service/FakeThreadPoolMasterServiceTests.java @@ -63,7 +63,7 @@ public class FakeThreadPoolMasterServiceTests extends OpenSearchTestCase { - public void testFakeMasterService() { + public void testFakeClusterManagerService() { List runnableTasks = new ArrayList<>(); AtomicReference lastClusterStateRef = new AtomicReference<>(); DiscoveryNode discoveryNode = new DiscoveryNode( @@ -124,7 +124,7 @@ public void onFailure(String source, Exception e) { assertFalse(firstTaskCompleted.get()); final Runnable scheduleTask = runnableTasks.remove(0); - assertThat(scheduleTask, hasToString("master service scheduling next task")); + assertThat(scheduleTask, hasToString("cluster-manager service scheduling next task")); scheduleTask.run(); final Runnable publishTask = runnableTasks.remove(0); From 8d602f03627985d55d0863c82c6fb450ddef0290 Mon Sep 17 00:00:00 2001 From: Tianli Feng Date: Tue, 10 May 2022 21:11:27 -0700 Subject: [PATCH 6/6] Adjust format by spotlessApply task Signed-off-by: Tianli Feng --- .../CoordinationStateTestCluster.java | 4 +++- .../opensearch/common/util/MockBigArrays.java | 3 ++- .../common/util/MockPageCacheRecycler.java | 8 ++++++-- .../opensearch/test/InternalTestCluster.java | 20 +++++++++++++------ .../test/OpenSearchIntegTestCase.java | 14 +++++++++---- 5 files changed, 35 insertions(+), 14 deletions(-) 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 b604c57bcf4bc..ca4a33fa677c6 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 @@ -328,7 +328,9 @@ void invariant() { .filter(m -> m.payload instanceof PublishRequest) .collect(Collectors.groupingBy(m -> ((PublishRequest) m.payload).getAcceptedState().term())) .forEach((term, publishMessages) -> { - Set clusterManagersForTerm = publishMessages.stream().collect(Collectors.groupingBy(m -> m.sourceNode)).keySet(); + Set clusterManagersForTerm = publishMessages.stream() + .collect(Collectors.groupingBy(m -> m.sourceNode)) + .keySet(); assertThat("Multiple cluster-managers " + clusterManagersForTerm + " for term " + term, clusterManagersForTerm, hasSize(1)); }); diff --git a/test/framework/src/main/java/org/opensearch/common/util/MockBigArrays.java b/test/framework/src/main/java/org/opensearch/common/util/MockBigArrays.java index b0cf71cb4b54f..ed7a1643bf674 100644 --- a/test/framework/src/main/java/org/opensearch/common/util/MockBigArrays.java +++ b/test/framework/src/main/java/org/opensearch/common/util/MockBigArrays.java @@ -75,7 +75,8 @@ public static void ensureAllArraysAreReleased() throws Exception { assertBusy(() -> assertTrue(Sets.haveEmptyIntersection(clusterManagerCopy.keySet(), ACQUIRED_ARRAYS.keySet()))); } catch (AssertionError ex) { clusterManagerCopy.keySet().retainAll(ACQUIRED_ARRAYS.keySet()); - ACQUIRED_ARRAYS.keySet().removeAll(clusterManagerCopy.keySet()); // remove all existing cluster-manager copy we will report on + // remove all existing cluster-manager copy we will report on + ACQUIRED_ARRAYS.keySet().removeAll(clusterManagerCopy.keySet()); if (!clusterManagerCopy.isEmpty()) { Iterator causes = clusterManagerCopy.values().iterator(); Object firstCause = causes.next(); diff --git a/test/framework/src/main/java/org/opensearch/common/util/MockPageCacheRecycler.java b/test/framework/src/main/java/org/opensearch/common/util/MockPageCacheRecycler.java index 282536da33cca..431267c9dfb0d 100644 --- a/test/framework/src/main/java/org/opensearch/common/util/MockPageCacheRecycler.java +++ b/test/framework/src/main/java/org/opensearch/common/util/MockPageCacheRecycler.java @@ -61,11 +61,15 @@ public static void ensureAllPagesAreReleased() throws Exception { final boolean success = waitUntil(() -> Sets.haveEmptyIntersection(clusterManagerCopy.keySet(), ACQUIRED_PAGES.keySet())); if (!success) { clusterManagerCopy.keySet().retainAll(ACQUIRED_PAGES.keySet()); - ACQUIRED_PAGES.keySet().removeAll(clusterManagerCopy.keySet()); // remove all existing cluster-manager copy we will report on + // remove all existing cluster-manager copy we will report on + ACQUIRED_PAGES.keySet().removeAll(clusterManagerCopy.keySet()); if (!clusterManagerCopy.isEmpty()) { Iterator causes = clusterManagerCopy.values().iterator(); Throwable firstCause = causes.next(); - RuntimeException exception = new RuntimeException(clusterManagerCopy.size() + " pages have not been released", firstCause); + RuntimeException exception = new RuntimeException( + clusterManagerCopy.size() + " pages have not been released", + firstCause + ); while (causes.hasNext()) { exception.addSuppressed(causes.next()); } diff --git a/test/framework/src/main/java/org/opensearch/test/InternalTestCluster.java b/test/framework/src/main/java/org/opensearch/test/InternalTestCluster.java index eb865192dd2e0..637dff1d8169f 100644 --- a/test/framework/src/main/java/org/opensearch/test/InternalTestCluster.java +++ b/test/framework/src/main/java/org/opensearch/test/InternalTestCluster.java @@ -376,7 +376,7 @@ public InternalTestCluster( + "[{}] (data) nodes and [{}] coord only nodes (min_cluster_manager_nodes are [{}])", clusterName, SeedUtils.formatSeed(clusterSeed), - numSharedDedicatedClusterManagerNodes, + numSharedDedicatedClusterManagerNodes, numSharedDataNodes, numSharedCoordOnlyNodes, autoManageClusterManagerNodes ? "auto-managed" : "manual" @@ -454,7 +454,8 @@ public InternalTestCluster( */ public void setBootstrapClusterManagerNodeIndex(int bootstrapClusterManagerNodeIndex) { assert autoManageClusterManagerNodes == false || bootstrapClusterManagerNodeIndex == -1 - : "bootstrapClusterManagerNodeIndex should be -1 if autoManageClusterManagerNodes is true, but was " + bootstrapClusterManagerNodeIndex; + : "bootstrapClusterManagerNodeIndex should be -1 if autoManageClusterManagerNodes is true, but was " + + bootstrapClusterManagerNodeIndex; this.bootstrapClusterManagerNodeIndex = bootstrapClusterManagerNodeIndex; } @@ -686,7 +687,12 @@ public synchronized void ensureAtMostNumDataNodes(int n) throws IOException { } } - private Settings getNodeSettings(final int nodeId, final long seed, final Settings extraSettings, final int defaultMinClusterManagerNodes) { + private Settings getNodeSettings( + final int nodeId, + final long seed, + final Settings extraSettings, + final int defaultMinClusterManagerNodes + ) { final Settings settings = getSettings(nodeId, seed, extraSettings); final String name = buildNodeName(nodeId, settings); @@ -1128,7 +1134,9 @@ private synchronized void reset(boolean wipeData) throws IOException { // start any missing node assert newSize == numSharedDedicatedClusterManagerNodes + numSharedDataNodes + numSharedCoordOnlyNodes; - final int numberOfClusterManagerNodes = numSharedDedicatedClusterManagerNodes > 0 ? numSharedDedicatedClusterManagerNodes : numSharedDataNodes; + final int numberOfClusterManagerNodes = numSharedDedicatedClusterManagerNodes > 0 + ? numSharedDedicatedClusterManagerNodes + : numSharedDataNodes; final int defaultMinClusterManagerNodes = (numberOfClusterManagerNodes / 2) + 1; final List toStartAndPublish = new ArrayList<>(); // we want to start nodes in one go final Runnable onTransportServiceStarted = () -> rebuildUnicastHostFiles(toStartAndPublish); @@ -1148,8 +1156,8 @@ private synchronized void reset(boolean wipeData) throws IOException { settings.add(nodeSettings); } } - for (int i = numSharedDedicatedClusterManagerNodes + numSharedDataNodes; i < numSharedDedicatedClusterManagerNodes + numSharedDataNodes - + numSharedCoordOnlyNodes; i++) { + for (int i = numSharedDedicatedClusterManagerNodes + numSharedDataNodes; i < numSharedDedicatedClusterManagerNodes + + numSharedDataNodes + numSharedCoordOnlyNodes; i++) { final Builder extraSettings = Settings.builder().put(noRoles()); settings.add(getNodeSettings(i, sharedNodesSeeds[i], extraSettings.build(), defaultMinClusterManagerNodes)); } diff --git a/test/framework/src/main/java/org/opensearch/test/OpenSearchIntegTestCase.java b/test/framework/src/main/java/org/opensearch/test/OpenSearchIntegTestCase.java index 2f0ec118e765c..f36f4dedfdfaa 100644 --- a/test/framework/src/main/java/org/opensearch/test/OpenSearchIntegTestCase.java +++ b/test/framework/src/main/java/org/opensearch/test/OpenSearchIntegTestCase.java @@ -717,7 +717,9 @@ protected static NetworkDisruption isolateMasterDisruption(NetworkDisruption.Net return new NetworkDisruption( new NetworkDisruption.TwoPartitions( Collections.singleton(clusterManagerNode), - Arrays.stream(internalCluster().getNodeNames()).filter(name -> name.equals(clusterManagerNode) == false).collect(Collectors.toSet()) + Arrays.stream(internalCluster().getNodeNames()) + .filter(name -> name.equals(clusterManagerNode) == false) + .collect(Collectors.toSet()) ), disruptionType ); @@ -953,8 +955,8 @@ private ClusterHealthStatus ensureColor( // cluster state where it is cluster-manager but where the node that was stopped hasn't been removed yet from the cluster state. // It will only subsequently publish a second state where the old cluster-manager is removed. // If the ensureGreen/ensureYellow is timed just right, it will get to execute before the second cluster state update removes - // the old cluster-manager and the condition ensureGreen / ensureYellow will trivially hold if it held before the node was - // shut down. The following "waitForNodes" condition ensures that the node has been removed by the cluster-manager + // the old cluster-manager and the condition ensureGreen / ensureYellow will trivially hold if it held before the node was + // shut down. The following "waitForNodes" condition ensures that the node has been removed by the cluster-manager // so that the health check applies to the set of nodes we expect to be part of the cluster. .waitForNodes(Integer.toString(cluster().size())); @@ -1112,7 +1114,11 @@ protected void ensureClusterStateConsistency() throws IOException { if (clusterManagerClusterState.version() == localClusterState.version() && clusterManagerId.equals(localClusterState.nodes().getMasterNodeId())) { try { - assertEquals("cluster state UUID does not match", clusterManagerClusterState.stateUUID(), localClusterState.stateUUID()); + assertEquals( + "cluster state UUID does not match", + clusterManagerClusterState.stateUUID(), + localClusterState.stateUUID() + ); // We cannot compare serialization bytes since serialization order of maps is not guaranteed // We also cannot compare byte array size because CompressedXContent's DeflateCompressor uses // a synced flush that can affect the size of the compressed byte array