From 66deacec234fe2afb8121ae42bc6bc6df2b51c02 Mon Sep 17 00:00:00 2001 From: Tianli Feng Date: Sat, 19 Mar 2022 02:09:43 -0700 Subject: [PATCH 01/11] 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 8cb690cd3875e975f0d3b50d737a79227ee6984d Mon Sep 17 00:00:00 2001 From: Tianli Feng Date: Fri, 13 May 2022 16:29:42 -0700 Subject: [PATCH 02/11] Replace 'master' terminology with 'cluster manager' in server/src/internalClusterTest directory Signed-off-by: Tianli Feng --- .../master/IndexingMasterFailoverIT.java | 6 +-- .../opensearch/cluster/ClusterHealthIT.java | 11 +++--- .../cluster/ClusterInfoServiceIT.java | 2 +- .../cluster/MinimumMasterNodesIT.java | 26 ++++++------- .../opensearch/cluster/NoMasterNodeIT.java | 2 +- .../cluster/SpecificMasterNodesIT.java | 22 +++++------ .../action/shard/ShardStateActionIT.java | 5 ++- .../coordination/RareClusterStateIT.java | 38 +++++++++---------- .../cluster/routing/AllocationIdIT.java | 2 +- .../cluster/routing/PrimaryAllocationIT.java | 21 +++++----- .../decider/DiskThresholdDeciderIT.java | 2 +- .../org/opensearch/env/NodeEnvironmentIT.java | 4 +- .../env/NodeRepurposeCommandIT.java | 4 +- .../gateway/GatewayIndexStateIT.java | 10 ++--- .../gateway/RecoverAfterNodesIT.java | 8 ++-- .../gateway/RecoveryFromGatewayIT.java | 4 +- .../index/mapper/DynamicMappingIT.java | 2 +- .../mapping/UpdateMappingIntegrationIT.java | 2 +- .../state/CloseWhileRelocatingShardsIT.java | 2 +- .../store/IndicesStoreIntegrationIT.java | 2 +- .../recovery/FullRollingRestartIT.java | 2 +- 21 files changed, 91 insertions(+), 86 deletions(-) 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 b4e4c058be198..2a124d9e23607 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 @@ -74,7 +74,7 @@ public void testMasterFailoverDuringIndexingWithMappingChanges() throws Throwabl logger.info("--> wait for all nodes to join the cluster"); ensureStableCluster(4); - // We index data with mapping changes into cluster and have master failover at same time + // We index data with mapping changes into cluster and have cluster-manager failover at same time client().admin() .indices() .prepareCreate("myindex") @@ -108,14 +108,14 @@ public void run() { barrier.await(); - // interrupt communication between master and other nodes in cluster + // interrupt communication between cluster-manager and other nodes in cluster NetworkDisruption partition = isolateMasterDisruption(NetworkDisruption.DISCONNECT); internalCluster().setDisruptionScheme(partition); logger.info("--> disrupting network"); partition.startDisrupting(); - logger.info("--> waiting for new master to be elected"); + logger.info("--> waiting for new cluster-manager to be elected"); ensureStableCluster(3, dataNode); partition.stopDisrupting(); diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/ClusterHealthIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/ClusterHealthIT.java index 393ab8e5a7544..8aea483c54e3b 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/ClusterHealthIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/ClusterHealthIT.java @@ -60,7 +60,7 @@ public class ClusterHealthIT extends OpenSearchIntegTestCase { public void testSimpleLocalHealth() { createIndex("test"); - ensureGreen(); // master should think it's green now. + ensureGreen(); // cluster-manager should think it's green now. for (final String node : internalCluster().getNodeNames()) { // a very high time out, which should never fire due to the local flag @@ -350,10 +350,10 @@ public void testHealthOnMasterFailover() throws Exception { final String node = internalCluster().startDataOnlyNode(); final boolean withIndex = randomBoolean(); if (withIndex) { - // Create index with many shards to provoke the health request to wait (for green) while master is being shut down. - // Notice that this is set to 0 after the test completed starting a number of health requests and master restarts. + // Create index with many shards to provoke the health request to wait (for green) while cluster-manager is being shut down. + // Notice that this is set to 0 after the test completed starting a number of health requests and cluster-manager restarts. // This ensures that the cluster is yellow when the health request is made, making the health request wait on the observer, - // triggering a call to observer.onClusterServiceClose when master is shutdown. + // triggering a call to observer.onClusterServiceClose when cluster-manager is shutdown. createIndex( "test", Settings.builder() @@ -364,7 +364,8 @@ public void testHealthOnMasterFailover() throws Exception { ); } final List> responseFutures = new ArrayList<>(); - // Run a few health requests concurrent to master fail-overs against a data-node to make sure master failover is handled + // Run a few health requests concurrent to cluster-manager fail-overs against a data-node to make sure cluster-manager failover is + // handled // without exceptions final int iterations = withIndex ? 10 : 20; for (int i = 0; i < iterations; ++i) { diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/ClusterInfoServiceIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/ClusterInfoServiceIT.java index e8ea0bb933a3e..dae9505fe67bf 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/ClusterInfoServiceIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/ClusterInfoServiceIT.java @@ -166,7 +166,7 @@ public void testClusterInfoServiceCollectsInformation() { } ensureGreen(indexName); InternalTestCluster internalTestCluster = internalCluster(); - // Get the cluster info service on the master node + // Get the cluster info service on the cluster-manager node final InternalClusterInfoService infoService = (InternalClusterInfoService) internalTestCluster.getInstance( ClusterInfoService.class, internalTestCluster.getMasterName() diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/MinimumMasterNodesIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/MinimumMasterNodesIT.java index 4981da39197c3..0e442334abca7 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/MinimumMasterNodesIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/MinimumMasterNodesIT.java @@ -151,13 +151,13 @@ public void testTwoNodesNoMasterBlock() throws Exception { ); } - String masterNode = internalCluster().getMasterName(); - String otherNode = node1Name.equals(masterNode) ? node2Name : node1Name; - logger.info("--> add voting config exclusion for non-master node, to be sure it's not elected"); + String clusterManagerNode = internalCluster().getMasterName(); + String otherNode = node1Name.equals(clusterManagerNode) ? node2Name : node1Name; + logger.info("--> add voting config exclusion for non-cluster-manager node, to be sure it's not elected"); client().execute(AddVotingConfigExclusionsAction.INSTANCE, new AddVotingConfigExclusionsRequest(otherNode)).get(); - logger.info("--> stop master node, no cluster-manager block should appear"); - Settings masterDataPathSettings = internalCluster().dataPathSettings(masterNode); - internalCluster().stopRandomNode(InternalTestCluster.nameFilter(masterNode)); + logger.info("--> stop cluster-manager node, no cluster-manager block should appear"); + Settings masterDataPathSettings = internalCluster().dataPathSettings(clusterManagerNode); + internalCluster().stopRandomNode(InternalTestCluster.nameFilter(clusterManagerNode)); assertBusy(() -> { ClusterState clusterState = client().admin().cluster().prepareState().setLocal(true).execute().actionGet().getState(); @@ -170,7 +170,7 @@ public void testTwoNodesNoMasterBlock() throws Exception { assertThat(state.nodes().getSize(), equalTo(2)); assertThat(state.nodes().getMasterNode(), equalTo(null)); - logger.info("--> starting the previous master node again..."); + logger.info("--> starting the previous cluster-manager node again..."); node2Name = internalCluster().startNode(Settings.builder().put(settings).put(masterDataPathSettings).build()); clusterHealthResponse = client().admin() @@ -204,11 +204,11 @@ public void testTwoNodesNoMasterBlock() throws Exception { clearRequest.setWaitForRemoval(false); client().execute(ClearVotingConfigExclusionsAction.INSTANCE, clearRequest).get(); - masterNode = internalCluster().getMasterName(); - otherNode = node1Name.equals(masterNode) ? node2Name : node1Name; - logger.info("--> add voting config exclusion for master node, to be sure it's not elected"); - client().execute(AddVotingConfigExclusionsAction.INSTANCE, new AddVotingConfigExclusionsRequest(masterNode)).get(); - logger.info("--> stop non-master node, no cluster-manager block should appear"); + clusterManagerNode = internalCluster().getMasterName(); + otherNode = node1Name.equals(clusterManagerNode) ? node2Name : node1Name; + logger.info("--> add voting config exclusion for cluster-manager node, to be sure it's not elected"); + client().execute(AddVotingConfigExclusionsAction.INSTANCE, new AddVotingConfigExclusionsRequest(clusterManagerNode)).get(); + logger.info("--> stop non-cluster-manager node, no cluster-manager block should appear"); Settings otherNodeDataPathSettings = internalCluster().dataPathSettings(otherNode); internalCluster().stopRandomNode(InternalTestCluster.nameFilter(otherNode)); @@ -217,7 +217,7 @@ public void testTwoNodesNoMasterBlock() throws Exception { assertThat(state1.blocks().hasGlobalBlockWithId(NoMasterBlockService.NO_MASTER_BLOCK_ID), equalTo(true)); }); - logger.info("--> starting the previous master node again..."); + logger.info("--> starting the previous cluster-manager node again..."); internalCluster().startNode(Settings.builder().put(settings).put(otherNodeDataPathSettings).build()); ensureGreen(); diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/NoMasterNodeIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/NoMasterNodeIT.java index 5226eed2b6610..2c50c2051b34a 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/NoMasterNodeIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/NoMasterNodeIT.java @@ -216,7 +216,7 @@ public void testNoMasterActions() throws Exception { } void checkUpdateAction(boolean autoCreateIndex, TimeValue timeout, ActionRequestBuilder builder) { - // we clean the metadata when loosing a master, therefore all operations on indices will auto create it, if allowed + // we clean the metadata when loosing a cluster-manager, therefore all operations on indices will auto create it, if allowed try { builder.get(); fail("expected ClusterBlockException or MasterNotDiscoveredException"); diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/SpecificMasterNodesIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/SpecificMasterNodesIT.java index e72ce5d85303d..1bc94de1b51e1 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/SpecificMasterNodesIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/SpecificMasterNodesIT.java @@ -72,11 +72,11 @@ public void testSimpleOnlyMasterNodeElection() throws IOException { .getMasterNodeId(), nullValue() ); - fail("should not be able to find master"); + fail("should not be able to find cluster-manager"); } catch (MasterNotDiscoveredException e) { // all is well, no cluster-manager elected } - logger.info("--> start master node"); + logger.info("--> start cluster-manager node"); final String masterNodeName = internalCluster().startClusterManagerOnlyNode(); assertThat( internalCluster().nonMasterClient() @@ -122,12 +122,12 @@ public void testSimpleOnlyMasterNodeElection() throws IOException { .getMasterNodeId(), nullValue() ); - fail("should not be able to find master"); + fail("should not be able to find cluster-manager"); } catch (MasterNotDiscoveredException e) { // all is well, no cluster-manager elected } - logger.info("--> start previous master node again"); + logger.info("--> start previous cluster-manager node again"); final String nextMasterEligibleNodeName = internalCluster().startNode( Settings.builder().put(nonDataNode(masterNode())).put(masterDataPathSettings) ); @@ -161,7 +161,7 @@ public void testSimpleOnlyMasterNodeElection() throws IOException { public void testElectOnlyBetweenMasterNodes() throws Exception { internalCluster().setBootstrapClusterManagerNodeIndex(0); - logger.info("--> start data node / non master node"); + logger.info("--> start data node / non cluster-manager node"); internalCluster().startNode(Settings.builder().put(dataOnlyNode()).put("discovery.initial_state_timeout", "1s")); try { assertThat( @@ -176,11 +176,11 @@ public void testElectOnlyBetweenMasterNodes() throws Exception { .getMasterNodeId(), nullValue() ); - fail("should not be able to find master"); + fail("should not be able to find cluster-manager"); } catch (MasterNotDiscoveredException e) { // all is well, no cluster-manager elected } - logger.info("--> start master node (1)"); + logger.info("--> start cluster-manager node (1)"); final String masterNodeName = internalCluster().startClusterManagerOnlyNode(); assertThat( internalCluster().nonMasterClient() @@ -209,7 +209,7 @@ public void testElectOnlyBetweenMasterNodes() throws Exception { equalTo(masterNodeName) ); - logger.info("--> start master node (2)"); + logger.info("--> start cluster-manager node (2)"); final String nextMasterEligableNodeName = internalCluster().startClusterManagerOnlyNode(); assertThat( internalCluster().nonMasterClient() @@ -253,7 +253,7 @@ public void testElectOnlyBetweenMasterNodes() throws Exception { logger.info("--> closing master node (1)"); client().execute(AddVotingConfigExclusionsAction.INSTANCE, new AddVotingConfigExclusionsRequest(masterNodeName)).get(); - // removing the master from the voting configuration immediately triggers the master to step down + // removing the cluster-manager from the voting configuration immediately triggers the cluster-manager to step down assertBusy(() -> { assertThat( internalCluster().nonMasterClient() @@ -313,10 +313,10 @@ public void testElectOnlyBetweenMasterNodes() throws Exception { public void testAliasFilterValidation() { internalCluster().setBootstrapClusterManagerNodeIndex(0); - logger.info("--> start master node / non data"); + logger.info("--> start cluster-manager node / non data"); internalCluster().startClusterManagerOnlyNode(); - logger.info("--> start data node / non master node"); + logger.info("--> start data node / non cluster-manager node"); internalCluster().startDataOnlyNode(); assertAcked( diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/action/shard/ShardStateActionIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/action/shard/ShardStateActionIT.java index dc1814c132d96..a5c35f3e25f09 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/action/shard/ShardStateActionIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/action/shard/ShardStateActionIT.java @@ -119,7 +119,7 @@ public void testFollowupRerouteCanBeSetToHigherPriority() { .setPersistentSettings(Settings.builder().put(ShardStateAction.FOLLOW_UP_REROUTE_PRIORITY_SETTING.getKey(), "urgent")) ); - // ensure that the master always has a HIGH priority pending task + // ensure that the cluster-manager always has a HIGH priority pending task final AtomicBoolean stopSpammingMaster = new AtomicBoolean(); final ClusterService masterClusterService = internalCluster().getInstance(ClusterService.class, internalCluster().getMasterName()); masterClusterService.submitStateUpdateTask("spam", new ClusterStateUpdateTask(Priority.HIGH) { @@ -141,7 +141,8 @@ public void clusterStateProcessed(String source, ClusterState oldState, ClusterS } }); - // even with the master under such pressure, all shards of the index can be assigned; in particular, after the primaries have + // even with the cluster-manager under such pressure, all shards of the index can be assigned; in particular, after the primaries + // have // started there's a follow-up reroute at a higher priority than the spam createIndex("test"); assertFalse(client().admin().cluster().prepareHealth().setWaitForGreenStatus().get().isTimedOut()); 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 2e0ff9aeb5956..1b361b8051416 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/RareClusterStateIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/RareClusterStateIT.java @@ -105,9 +105,9 @@ public void testAssignmentWithJustAddedNodes() { // close to have some unassigned started shards shards.. client().admin().indices().prepareClose(index).get(); - final String masterName = internalCluster().getMasterName(); - final ClusterService clusterService = internalCluster().clusterService(masterName); - final AllocationService allocationService = internalCluster().getInstance(AllocationService.class, masterName); + final String clusterManagerName = internalCluster().getMasterName(); + final ClusterService clusterService = internalCluster().clusterService(clusterManagerName); + final AllocationService allocationService = internalCluster().getInstance(AllocationService.class, clusterManagerName); clusterService.submitStateUpdateTask("test-inject-node-and-reroute", new ClusterStateUpdateTask() { @Override public ClusterState execute(ClusterState currentState) { @@ -220,36 +220,36 @@ public void testDelayedMappingPropagationOnPrimary() throws Exception { final List nodeNames = internalCluster().startNodes(2); assertFalse(client().admin().cluster().prepareHealth().setWaitForNodes("2").get().isTimedOut()); - final String master = internalCluster().getMasterName(); - assertThat(nodeNames, hasItem(master)); + final String clusterManager = internalCluster().getMasterName(); + assertThat(nodeNames, hasItem(clusterManager)); String otherNode = null; for (String node : nodeNames) { - if (node.equals(master) == false) { + if (node.equals(clusterManager) == false) { otherNode = node; break; } } assertNotNull(otherNode); - // Don't allocate the shard on the master node + // Don't allocate the shard on the cluster-manager node assertAcked( prepareCreate("index").setSettings( Settings.builder() .put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0) - .put("index.routing.allocation.exclude._name", master) + .put("index.routing.allocation.exclude._name", clusterManager) ).get() ); ensureGreen(); // Check routing tables ClusterState state = client().admin().cluster().prepareState().get().getState(); - assertEquals(master, state.nodes().getMasterNode().getName()); + assertEquals(clusterManager, state.nodes().getMasterNode().getName()); List shards = state.routingTable().allShards("index"); assertThat(shards, hasSize(1)); for (ShardRouting shard : shards) { if (shard.primary()) { - // primary must not be on the master node + // primary must not be on the cluster-manager node assertFalse(state.nodes().getMasterNodeId().equals(shard.currentNodeId())); } else { fail(); // only primaries @@ -266,7 +266,7 @@ public void testDelayedMappingPropagationOnPrimary() throws Exception { client().admin().indices().preparePutMapping("index").setSource("field", "type=long") ); - // ...and wait for mappings to be available on master + // ...and wait for mappings to be available on cluster-manager assertBusy(() -> { MappingMetadata typeMappings = client().admin().indices().prepareGetMappings("index").get().getMappings().get("index"); assertNotNull(typeMappings); @@ -308,24 +308,24 @@ public void testDelayedMappingPropagationOnReplica() throws Exception { final List nodeNames = internalCluster().startNodes(2); assertFalse(client().admin().cluster().prepareHealth().setWaitForNodes("2").get().isTimedOut()); - final String master = internalCluster().getMasterName(); - assertThat(nodeNames, hasItem(master)); + final String clusterManager = internalCluster().getMasterName(); + assertThat(nodeNames, hasItem(clusterManager)); String otherNode = null; for (String node : nodeNames) { - if (node.equals(master) == false) { + if (node.equals(clusterManager) == false) { otherNode = node; break; } } assertNotNull(otherNode); - // Force allocation of the primary on the master node by first only allocating on the master + // Force allocation of the primary on the cluster-manager node by first only allocating on the cluster-manager // and then allowing all nodes so that the replica gets allocated on the other node prepareCreate("index").setSettings( Settings.builder() .put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 1) - .put("index.routing.allocation.include._name", master) + .put("index.routing.allocation.include._name", clusterManager) ).get(); client().admin() .indices() @@ -336,7 +336,7 @@ public void testDelayedMappingPropagationOnReplica() throws Exception { // Check routing tables ClusterState state = client().admin().cluster().prepareState().get().getState(); - assertEquals(master, state.nodes().getMasterNode().getName()); + assertEquals(clusterManager, state.nodes().getMasterNode().getName()); List shards = state.routingTable().allShards("index"); assertThat(shards, hasSize(2)); for (ShardRouting shard : shards) { @@ -359,7 +359,7 @@ public void testDelayedMappingPropagationOnReplica() throws Exception { final Index index = resolveIndex("index"); // Wait for mappings to be available on master assertBusy(() -> { - final IndicesService indicesService = internalCluster().getInstance(IndicesService.class, master); + final IndicesService indicesService = internalCluster().getInstance(IndicesService.class, clusterManager); final IndexService indexService = indicesService.indexServiceSafe(index); assertNotNull(indexService); final MapperService mapperService = indexService.mapperService(); @@ -383,7 +383,7 @@ public void testDelayedMappingPropagationOnReplica() throws Exception { // ...and wait for second mapping to be available on master assertBusy(() -> { - final IndicesService indicesService = internalCluster().getInstance(IndicesService.class, master); + final IndicesService indicesService = internalCluster().getInstance(IndicesService.class, clusterManager); final IndexService indexService = indicesService.indexServiceSafe(index); assertNotNull(indexService); final MapperService mapperService = indexService.mapperService(); 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 7b0ffa0ceea32..a57ea705f4f88 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/routing/AllocationIdIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/routing/AllocationIdIT.java @@ -135,7 +135,7 @@ public void testFailedRecoveryOnAllocateStalePrimaryRequiresAnotherAllocateStale // create fake corrupted marker on node1 putFakeCorruptionMarker(indexSettings, shardId, indexPath); - // thanks to master node1 is out of sync + // thanks to cluster-manager node1 is out of sync node1 = internalCluster().startNode(node1DataPathSettings); // there is only _stale_ primary 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 00e603e196a0c..29b18825c4fce 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/routing/PrimaryAllocationIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/routing/PrimaryAllocationIT.java @@ -149,7 +149,7 @@ public void testBulkWeirdScenario() throws Exception { } // returns data paths settings of in-sync shard copy - private Settings createStaleReplicaScenario(String master) throws Exception { + private Settings createStaleReplicaScenario(String clusterManager) throws Exception { client().prepareIndex("test").setSource(jsonBuilder().startObject().field("field", "value1").endObject()).get(); refresh(); ClusterState state = client().admin().cluster().prepareState().all().get().getState(); @@ -167,14 +167,14 @@ private Settings createStaleReplicaScenario(String master) throws Exception { } NetworkDisruption partition = new NetworkDisruption( - new TwoPartitions(Sets.newHashSet(master, replicaNode), Collections.singleton(primaryNode)), + new TwoPartitions(Sets.newHashSet(clusterManager, replicaNode), Collections.singleton(primaryNode)), NetworkDisruption.DISCONNECT ); internalCluster().setDisruptionScheme(partition); logger.info("--> partitioning node with primary shard from rest of cluster"); partition.startDisrupting(); - ensureStableCluster(2, master); + ensureStableCluster(2, clusterManager); logger.info("--> index a document into previous replica shard (that is now primary)"); client(replicaNode).prepareIndex("test").setSource(jsonBuilder().startObject().field("field", "value1").endObject()).get(); @@ -183,26 +183,29 @@ private Settings createStaleReplicaScenario(String master) throws Exception { final Settings inSyncDataPathSettings = internalCluster().dataPathSettings(replicaNode); internalCluster().stopRandomNode(InternalTestCluster.nameFilter(replicaNode)); - ensureStableCluster(1, master); + ensureStableCluster(1, clusterManager); partition.stopDisrupting(); logger.info("--> waiting for node with old primary shard to rejoin the cluster"); - ensureStableCluster(2, master); + ensureStableCluster(2, clusterManager); logger.info("--> check that old primary shard does not get promoted to primary again"); // kick reroute and wait for all shard states to be fetched - client(master).admin().cluster().prepareReroute().get(); + client(clusterManager).admin().cluster().prepareReroute().get(); assertBusy( - () -> assertThat(internalCluster().getInstance(GatewayAllocator.class, master).getNumberOfInFlightFetches(), equalTo(0)) + () -> assertThat(internalCluster().getInstance(GatewayAllocator.class, clusterManager).getNumberOfInFlightFetches(), equalTo(0)) ); // kick reroute a second time and check that all shards are unassigned - assertThat(client(master).admin().cluster().prepareReroute().get().getState().getRoutingNodes().unassigned().size(), equalTo(2)); + assertThat( + client(clusterManager).admin().cluster().prepareReroute().get().getState().getRoutingNodes().unassigned().size(), + equalTo(2) + ); return inSyncDataPathSettings; } public void testDoNotAllowStaleReplicasToBePromotedToPrimary() throws Exception { - logger.info("--> starting 3 nodes, 1 master, 2 data"); + logger.info("--> starting 3 nodes, 1 cluster-manager, 2 data"); String master = internalCluster().startClusterManagerOnlyNode(Settings.EMPTY); internalCluster().startDataOnlyNodes(2); 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 2fe7efdf8fc3a..b5d260f5c3314 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 @@ -353,7 +353,7 @@ private void refreshDiskUsage() { private void assertBusyWithDiskUsageRefresh(String nodeName, String indexName, Matcher> matcher) throws Exception { assertBusy(() -> { - // refresh the master's ClusterInfoService before checking the assigned shards because DiskThresholdMonitor might still + // refresh the cluster-manager's ClusterInfoService before checking the assigned shards because DiskThresholdMonitor might still // be processing a previous ClusterInfo update and will skip the new one (see DiskThresholdMonitor#onNewInfo(ClusterInfo) // and its internal checkInProgress flag) refreshDiskUsage(); diff --git a/server/src/internalClusterTest/java/org/opensearch/env/NodeEnvironmentIT.java b/server/src/internalClusterTest/java/org/opensearch/env/NodeEnvironmentIT.java index 83c103bd82738..8eecf001da103 100644 --- a/server/src/internalClusterTest/java/org/opensearch/env/NodeEnvironmentIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/env/NodeEnvironmentIT.java @@ -79,10 +79,10 @@ public void testStartFailureOnDataForNonDataNode() throws Exception { ); } - logger.info("--> restarting the node without the data and master roles"); + logger.info("--> restarting the node without the data and cluster-manager roles"); IllegalStateException ex = expectThrows( IllegalStateException.class, - "node not having the data and master roles while having existing index metadata must fail", + "node not having the data and cluster-manager roles while having existing index metadata must fail", () -> internalCluster().restartRandomDataNode(new InternalTestCluster.RestartCallback() { @Override public Settings onNodeStopped(String nodeName) { diff --git a/server/src/internalClusterTest/java/org/opensearch/env/NodeRepurposeCommandIT.java b/server/src/internalClusterTest/java/org/opensearch/env/NodeRepurposeCommandIT.java index 11ece43ea90d7..7a5c7ac653ab4 100644 --- a/server/src/internalClusterTest/java/org/opensearch/env/NodeRepurposeCommandIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/env/NodeRepurposeCommandIT.java @@ -121,8 +121,8 @@ public void testRepurpose() throws Exception { 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. + // by restarting as cluster-manager 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 cluster-manager or data node any longer. internalCluster().startClusterManagerOnlyNode(clusterManagerNodeDataPathSettings); internalCluster().startDataOnlyNode(dataNodeDataPathSettings); diff --git a/server/src/internalClusterTest/java/org/opensearch/gateway/GatewayIndexStateIT.java b/server/src/internalClusterTest/java/org/opensearch/gateway/GatewayIndexStateIT.java index 1542d6800eaa1..017865a1397e8 100644 --- a/server/src/internalClusterTest/java/org/opensearch/gateway/GatewayIndexStateIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/gateway/GatewayIndexStateIT.java @@ -241,16 +241,16 @@ public void testSimpleOpenClose() throws Exception { client().prepareIndex("test").setId("2").setSource("field1", "value1").execute().actionGet(); } - public void testJustMasterNode() throws Exception { + public void testJustClusterManagerNode() throws Exception { logger.info("--> cleaning nodes"); - logger.info("--> starting 1 master node non data"); + logger.info("--> starting 1 cluster-manager node non data"); internalCluster().startNode(nonDataNode()); logger.info("--> create an index"); client().admin().indices().prepareCreate("test").setWaitForActiveShards(ActiveShardCount.NONE).execute().actionGet(); - logger.info("--> restarting master node"); + logger.info("--> restarting cluster-manager node"); internalCluster().fullRestart(new RestartCallback() { @Override public Settings onNodeStopped(String nodeName) { @@ -273,10 +273,10 @@ public Settings onNodeStopped(String nodeName) { assertThat(clusterStateResponse.getState().metadata().hasIndex("test"), equalTo(true)); } - public void testJustMasterNodeAndJustDataNode() { + public void testJustClusterManagerNodeAndJustDataNode() { logger.info("--> cleaning nodes"); - logger.info("--> starting 1 master node non data"); + logger.info("--> starting 1 cluster-manager node non data"); internalCluster().startClusterManagerOnlyNode(); internalCluster().startDataOnlyNode(); diff --git a/server/src/internalClusterTest/java/org/opensearch/gateway/RecoverAfterNodesIT.java b/server/src/internalClusterTest/java/org/opensearch/gateway/RecoverAfterNodesIT.java index 77a9d37063c83..bda0ca82a741c 100644 --- a/server/src/internalClusterTest/java/org/opensearch/gateway/RecoverAfterNodesIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/gateway/RecoverAfterNodesIT.java @@ -129,7 +129,7 @@ public void testRecoverAfterNodes() throws Exception { public void testRecoverAfterMasterNodes() throws Exception { internalCluster().setBootstrapClusterManagerNodeIndex(0); - logger.info("--> start master_node (1)"); + logger.info("--> start cluster_manager_node (1)"); Client master1 = startNode(Settings.builder().put("gateway.recover_after_master_nodes", 2).put(clusterManagerOnlyNode())); assertThat( master1.admin() @@ -210,7 +210,7 @@ public void testRecoverAfterMasterNodes() throws Exception { hasItem(GatewayService.STATE_NOT_RECOVERED_BLOCK) ); - logger.info("--> start master_node (2)"); + logger.info("--> start cluster_manager_node (2)"); 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)); @@ -220,7 +220,7 @@ public void testRecoverAfterMasterNodes() throws Exception { public void testRecoverAfterDataNodes() throws Exception { internalCluster().setBootstrapClusterManagerNodeIndex(0); - logger.info("--> start master_node (1)"); + logger.info("--> start cluster_manager_node (1)"); Client master1 = startNode(Settings.builder().put("gateway.recover_after_data_nodes", 2).put(clusterManagerOnlyNode())); assertThat( master1.admin() @@ -262,7 +262,7 @@ public void testRecoverAfterDataNodes() throws Exception { hasItem(GatewayService.STATE_NOT_RECOVERED_BLOCK) ); - logger.info("--> start master_node (2)"); + logger.info("--> start cluster_manager_node (2)"); Client master2 = startNode(Settings.builder().put("gateway.recover_after_data_nodes", 2).put(clusterManagerOnlyNode())); assertThat( master2.admin() diff --git a/server/src/internalClusterTest/java/org/opensearch/gateway/RecoveryFromGatewayIT.java b/server/src/internalClusterTest/java/org/opensearch/gateway/RecoveryFromGatewayIT.java index 79ffe12d13129..11af1fb3cbfab 100644 --- a/server/src/internalClusterTest/java/org/opensearch/gateway/RecoveryFromGatewayIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/gateway/RecoveryFromGatewayIT.java @@ -445,7 +445,7 @@ public void testLatestVersionLoaded() throws Exception { .setSource(jsonBuilder().startObject().field("field", "value3").endObject()) .execute() .actionGet(); - // TODO: remove once refresh doesn't fail immediately if there a master block: + // TODO: remove once refresh doesn't fail immediately if there a cluster-manager block: // https://github.com/elastic/elasticsearch/issues/9997 // client().admin().cluster().prepareHealth("test").setWaitForYellowStatus().get(); logger.info("--> refreshing all indices after indexing is complete"); @@ -665,7 +665,7 @@ public void assertSyncIdsNotNull() { } public void testStartedShardFoundIfStateNotYetProcessed() throws Exception { - // nodes may need to report the shards they processed the initial recovered cluster state from the master + // nodes may need to report the shards they processed the initial recovered cluster state from the cluster-manager final String nodeName = internalCluster().startNode(); createIndex("test", Settings.builder().put(SETTING_NUMBER_OF_SHARDS, 1).build()); final String customDataPath = IndexMetadata.INDEX_DATA_PATH_SETTING.get( diff --git a/server/src/internalClusterTest/java/org/opensearch/index/mapper/DynamicMappingIT.java b/server/src/internalClusterTest/java/org/opensearch/index/mapper/DynamicMappingIT.java index d5924155e2ec7..df208651f9c80 100644 --- a/server/src/internalClusterTest/java/org/opensearch/index/mapper/DynamicMappingIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/index/mapper/DynamicMappingIT.java @@ -76,7 +76,7 @@ public void testConflictingDynamicMappings() { assertThat(e.getMessage(), Matchers.containsString("failed to parse field [foo] of type [long]")); } catch (IllegalArgumentException e) { // rare case: the node that processes the index request doesn't have the mappings - // yet and sends a mapping update to the master node to map "bar" as "text". This + // yet and sends a mapping update to the cluster-manager node to map "bar" as "text". This // fails as it had been already mapped as a long by the previous index request. assertThat(e.getMessage(), Matchers.containsString("mapper [foo] cannot be changed from type [long] to [text]")); } diff --git a/server/src/internalClusterTest/java/org/opensearch/indices/mapping/UpdateMappingIntegrationIT.java b/server/src/internalClusterTest/java/org/opensearch/indices/mapping/UpdateMappingIntegrationIT.java index 0a29794add5a8..8e2872f31abfc 100644 --- a/server/src/internalClusterTest/java/org/opensearch/indices/mapping/UpdateMappingIntegrationIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/indices/mapping/UpdateMappingIntegrationIT.java @@ -390,7 +390,7 @@ private void assertConcreteMappingsOnAll(final String index, final String... fie } /** - * Waits for the given mapping type to exists on the master node. + * Waits for the given mapping type to exists on the cluster-manager node. */ private void assertMappingOnMaster(final String index, final String... fieldNames) { GetMappingsResponse response = client().admin().indices().prepareGetMappings(index).get(); diff --git a/server/src/internalClusterTest/java/org/opensearch/indices/state/CloseWhileRelocatingShardsIT.java b/server/src/internalClusterTest/java/org/opensearch/indices/state/CloseWhileRelocatingShardsIT.java index caf741e9b8882..3d70622e122c0 100644 --- a/server/src/internalClusterTest/java/org/opensearch/indices/state/CloseWhileRelocatingShardsIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/indices/state/CloseWhileRelocatingShardsIT.java @@ -147,7 +147,7 @@ public void testCloseWhileRelocatingShards() throws Exception { ); final String targetNode = internalCluster().startDataOnlyNode(); - ensureClusterSizeConsistency(); // wait for the master to finish processing join. + ensureClusterSizeConsistency(); // wait for the cluster-manager to finish processing join. try { final ClusterService clusterService = internalCluster().getInstance(ClusterService.class, internalCluster().getMasterName()); 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 2e35b7159b6aa..79975a7d080ee 100644 --- a/server/src/internalClusterTest/java/org/opensearch/indices/store/IndicesStoreIntegrationIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/indices/store/IndicesStoreIntegrationIT.java @@ -105,7 +105,7 @@ protected Collection> nodePlugins() { @Override protected void ensureClusterStateConsistency() throws IOException { - // testShardActiveElseWhere might change the state of a non-master node + // testShardActiveElseWhere might change the state of a non-cluster-manager node // so we cannot check state consistency of this cluster } diff --git a/server/src/internalClusterTest/java/org/opensearch/recovery/FullRollingRestartIT.java b/server/src/internalClusterTest/java/org/opensearch/recovery/FullRollingRestartIT.java index a8423312de271..f636185fd4649 100644 --- a/server/src/internalClusterTest/java/org/opensearch/recovery/FullRollingRestartIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/recovery/FullRollingRestartIT.java @@ -199,7 +199,7 @@ public void testNoRebalanceOnRollingRestart() throws Exception { 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. + * We start 3 nodes and a dedicated cluster-manager. Restart on of the data-nodes and ensure that we got no relocations. * Yet we have 6 shards 0 replica so that means if the restarting node comes back both other nodes are subject * to relocating to the restarting node since all had 2 shards and now one node has nothing allocated. * We have a fix for this to wait until we have allocated unallocated shards now so this shouldn't happen. From fd5ad03372eabefb6a119ce3d5f44ba115e1c09c Mon Sep 17 00:00:00 2001 From: Tianli Feng Date: Fri, 13 May 2022 16:39:16 -0700 Subject: [PATCH 03/11] Replace 'master' terminology with 'cluster manager' in server/src/internalClusterTest directory Signed-off-by: Tianli Feng --- .../cluster/tasks/PendingTasksBlocksIT.java | 2 +- .../master/IndexingMasterFailoverIT.java | 8 +- .../opensearch/cluster/ClusterHealthIT.java | 6 +- .../cluster/ClusterStateDiffIT.java | 2 +- .../cluster/MinimumMasterNodesIT.java | 34 ++++---- .../opensearch/cluster/NoMasterNodeIT.java | 77 ++++++++++------- .../cluster/SpecificMasterNodesIT.java | 16 ++-- .../action/shard/ShardStateActionIT.java | 20 +++-- .../coordination/RareClusterStateIT.java | 10 +-- .../UnsafeBootstrapAndDetachCommandIT.java | 24 +++--- .../coordination/VotingConfigurationIT.java | 7 +- .../cluster/coordination/ZenDiscoveryIT.java | 6 +- .../cluster/routing/PrimaryAllocationIT.java | 6 +- .../discovery/ClusterDisruptionIT.java | 17 ++-- .../discovery/DiscoveryDisruptionIT.java | 22 +++-- .../discovery/MasterDisruptionIT.java | 16 ++-- .../discovery/SnapshotDisruptionIT.java | 4 +- .../discovery/StableMasterDisruptionIT.java | 57 +++++++------ .../org/opensearch/env/NodeEnvironmentIT.java | 2 +- .../indices/recovery/IndexRecoveryIT.java | 8 +- .../persistent/PersistentTasksExecutorIT.java | 2 +- .../BlobStoreRepositoryCleanupIT.java | 10 +-- .../opensearch/snapshots/CloneSnapshotIT.java | 15 ++-- .../snapshots/ConcurrentSnapshotsIT.java | 83 ++++++++++--------- .../DedicatedClusterSnapshotRestoreIT.java | 8 +- ...etadataLoadingDuringSnapshotRestoreIT.java | 2 +- .../opensearch/snapshots/RepositoriesIT.java | 6 +- .../RepositoryFilterUserMetadataIT.java | 12 +-- .../snapshots/SnapshotStatusApisIT.java | 2 +- .../ConcurrentDocumentOperationIT.java | 4 +- 30 files changed, 260 insertions(+), 228 deletions(-) diff --git a/server/src/internalClusterTest/java/org/opensearch/action/admin/cluster/tasks/PendingTasksBlocksIT.java b/server/src/internalClusterTest/java/org/opensearch/action/admin/cluster/tasks/PendingTasksBlocksIT.java index 8484cce1045d2..652115668db0b 100644 --- a/server/src/internalClusterTest/java/org/opensearch/action/admin/cluster/tasks/PendingTasksBlocksIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/action/admin/cluster/tasks/PendingTasksBlocksIT.java @@ -107,7 +107,7 @@ public boolean validateClusterForming() { assertNotNull(client().admin().cluster().preparePendingClusterTasks().get().getPendingTasks()); // starting one more node allows the cluster to recover - internalCluster().startDataOnlyNode(); // cannot update minimum_master_nodes before the cluster has formed + internalCluster().startDataOnlyNode(); // cannot update minimum_cluster_manager_nodes before the cluster has formed ensureGreen(); } 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 2a124d9e23607..59654be2d2b13 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 @@ -58,12 +58,12 @@ protected Collection> nodePlugins() { } /** - * Indexing operations which entail mapping changes require a blocking request to the master node to update the mapping. - * If the master node is being disrupted or if it cannot commit cluster state changes, it needs to retry within timeout limits. - * This retry logic is implemented in TransportMasterNodeAction and tested by the following master failover scenario. + * Indexing operations which entail mapping changes require a blocking request to the cluster-manager node to update the mapping. + * If the cluster-manager node is being disrupted or if it cannot commit cluster state changes, it needs to retry within timeout limits. + * This retry logic is implemented in TransportMasterNodeAction and tested by the following cluster-manager failover scenario. */ public void testMasterFailoverDuringIndexingWithMappingChanges() throws Throwable { - logger.info("--> start 4 nodes, 3 master, 1 data"); + logger.info("--> start 4 nodes, 3 cluster-manager, 1 data"); internalCluster().setBootstrapClusterManagerNodeIndex(2); diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/ClusterHealthIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/ClusterHealthIT.java index 8aea483c54e3b..bded5d2ade05b 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/ClusterHealthIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/ClusterHealthIT.java @@ -336,7 +336,7 @@ public void clusterStateProcessed(String source, ClusterState oldState, ClusterS assertFalse(client().admin().cluster().prepareHealth("index").setWaitForGreenStatus().get().isTimedOut()); // at this point the original health response should not have returned: there was never a point where the index was green AND - // the master had processed all pending tasks above LANGUID priority. + // the cluster-manager had processed all pending tasks above LANGUID priority. assertFalse(healthResponseFuture.isDone()); keepSubmittingTasks.set(false); assertFalse(healthResponseFuture.actionGet(TimeValue.timeValueSeconds(30)).isTimedOut()); @@ -346,7 +346,7 @@ public void clusterStateProcessed(String source, ClusterState oldState, ClusterS } } - public void testHealthOnMasterFailover() throws Exception { + public void testHealthOnClusterManagerFailover() throws Exception { final String node = internalCluster().startDataOnlyNode(); final boolean withIndex = randomBoolean(); if (withIndex) { @@ -395,7 +395,7 @@ public void testHealthOnMasterFailover() throws Exception { } } - public void testWaitForEventsTimesOutIfMasterBusy() { + public void testWaitForEventsTimesOutIfClusterManagerBusy() { final AtomicBoolean keepSubmittingTasks = new AtomicBoolean(true); final ClusterService clusterService = internalCluster().getInstance(ClusterService.class, internalCluster().getMasterName()); final PlainActionFuture completionFuture = new PlainActionFuture<>(); diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/ClusterStateDiffIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/ClusterStateDiffIT.java index 7654a937c8dc0..8b510c6a13829 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/ClusterStateDiffIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/ClusterStateDiffIT.java @@ -93,7 +93,7 @@ public class ClusterStateDiffIT extends OpenSearchIntegTestCase { public void testClusterStateDiffSerialization() throws Exception { NamedWriteableRegistry namedWriteableRegistry = new NamedWriteableRegistry(ClusterModule.getNamedWriteables()); - DiscoveryNode clusterManagerNode = randomNode("master"); + DiscoveryNode clusterManagerNode = randomNode("cluster-manager"); DiscoveryNode otherNode = randomNode("other"); DiscoveryNodes discoveryNodes = DiscoveryNodes.builder() .add(clusterManagerNode) diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/MinimumMasterNodesIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/MinimumMasterNodesIT.java index 0e442334abca7..e575c6b123905 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/MinimumMasterNodesIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/MinimumMasterNodesIT.java @@ -83,7 +83,7 @@ protected Collection> nodePlugins() { return classes; } - public void testTwoNodesNoMasterBlock() throws Exception { + public void testTwoNodesNoClusterManagerBlock() throws Exception { internalCluster().setBootstrapClusterManagerNodeIndex(1); Settings settings = Settings.builder().put("discovery.initial_state_timeout", "500ms").build(); @@ -156,7 +156,7 @@ public void testTwoNodesNoMasterBlock() throws Exception { logger.info("--> add voting config exclusion for non-cluster-manager node, to be sure it's not elected"); client().execute(AddVotingConfigExclusionsAction.INSTANCE, new AddVotingConfigExclusionsRequest(otherNode)).get(); logger.info("--> stop cluster-manager node, no cluster-manager block should appear"); - Settings masterDataPathSettings = internalCluster().dataPathSettings(clusterManagerNode); + Settings clusterManagerDataPathSettings = internalCluster().dataPathSettings(clusterManagerNode); internalCluster().stopRandomNode(InternalTestCluster.nameFilter(clusterManagerNode)); assertBusy(() -> { @@ -171,7 +171,7 @@ public void testTwoNodesNoMasterBlock() throws Exception { assertThat(state.nodes().getMasterNode(), equalTo(null)); logger.info("--> starting the previous cluster-manager node again..."); - node2Name = internalCluster().startNode(Settings.builder().put(settings).put(masterDataPathSettings).build()); + node2Name = internalCluster().startNode(Settings.builder().put(settings).put(clusterManagerDataPathSettings).build()); clusterHealthResponse = client().admin() .cluster() @@ -249,7 +249,7 @@ public void testTwoNodesNoMasterBlock() throws Exception { } } - public void testThreeNodesNoMasterBlock() throws Exception { + public void testThreeNodesNoClusterManagerBlock() throws Exception { internalCluster().setBootstrapClusterManagerNodeIndex(2); Settings settings = Settings.builder().put("discovery.initial_state_timeout", "500ms").build(); @@ -312,8 +312,8 @@ public void testThreeNodesNoMasterBlock() throws Exception { List nonClusterManagerNodes = new ArrayList<>( Sets.difference(Sets.newHashSet(internalCluster().getNodeNames()), Collections.singleton(internalCluster().getMasterName())) ); - Settings nonMasterDataPathSettings1 = internalCluster().dataPathSettings(nonClusterManagerNodes.get(0)); - Settings nonMasterDataPathSettings2 = internalCluster().dataPathSettings(nonClusterManagerNodes.get(1)); + Settings nonClusterManagerDataPathSettings1 = internalCluster().dataPathSettings(nonClusterManagerNodes.get(0)); + Settings nonClusterManagerDataPathSettings2 = internalCluster().dataPathSettings(nonClusterManagerNodes.get(1)); internalCluster().stopRandomNonMasterNode(); internalCluster().stopRandomNonMasterNode(); @@ -325,7 +325,7 @@ public void testThreeNodesNoMasterBlock() throws Exception { }); logger.info("--> start back the 2 nodes "); - internalCluster().startNodes(nonMasterDataPathSettings1, nonMasterDataPathSettings2); + internalCluster().startNodes(nonClusterManagerDataPathSettings1, nonClusterManagerDataPathSettings2); internalCluster().validateClusterFormed(); ensureGreen(); @@ -347,17 +347,17 @@ public void testCannotCommitStateThreeNodes() throws Exception { internalCluster().startNodes(3, settings); ensureStableCluster(3); - final String master = internalCluster().getMasterName(); + final String clusterManager = internalCluster().getMasterName(); Set otherNodes = new HashSet<>(Arrays.asList(internalCluster().getNodeNames())); - otherNodes.remove(master); + otherNodes.remove(clusterManager); NetworkDisruption partition = isolateMasterDisruption(NetworkDisruption.DISCONNECT); internalCluster().setDisruptionScheme(partition); final CountDownLatch latch = new CountDownLatch(1); final AtomicReference failure = new AtomicReference<>(); logger.debug("--> submitting for cluster state to be rejected"); - final ClusterService masterClusterService = internalCluster().clusterService(master); - masterClusterService.submitStateUpdateTask("test", new ClusterStateUpdateTask() { + final ClusterService clusterManagerClusterService = internalCluster().clusterService(clusterManager); + clusterManagerClusterService.submitStateUpdateTask("test", new ClusterStateUpdateTask() { @Override public void clusterStateProcessed(String source, ClusterState oldState, ClusterState newState) { latch.countDown(); @@ -387,11 +387,11 @@ public void onFailure(String source, Exception e) { assertThat(failure.get(), instanceOf(FailedToCommitClusterStateException.class)); logger.debug("--> check that there is no cluster-manager in minor partition"); - assertBusy(() -> assertThat(masterClusterService.state().nodes().getMasterNode(), nullValue())); + assertBusy(() -> assertThat(clusterManagerClusterService.state().nodes().getMasterNode(), nullValue())); - // let major partition to elect new master, to ensure that old master is not elected once partition is restored, - // 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"); + // let major partition to elect new cluster-manager, to ensure that old cluster-manager is not elected once partition is restored, + // otherwise persistent setting (which is a part of accepted state on old cluster-manager) will be propagated to other nodes + logger.debug("--> wait for cluster-manager to be elected in major partition"); assertBusy(() -> { DiscoveryNode clusterManagerNode = internalCluster().client(randomFrom(otherNodes)) .admin() @@ -403,7 +403,7 @@ public void onFailure(String source, Exception e) { .nodes() .getMasterNode(); assertThat(clusterManagerNode, notNullValue()); - assertThat(clusterManagerNode.getName(), not(equalTo(master))); + assertThat(clusterManagerNode.getName(), not(equalTo(clusterManager))); }); partition.stopDisrupting(); @@ -414,7 +414,7 @@ public void onFailure(String source, Exception e) { for (String node : internalCluster().getNodeNames()) { Settings nodeSetting = internalCluster().clusterService(node).state().metadata().settings(); assertThat( - node + " processed the cluster state despite of a min master node violation", + node + " processed the cluster state despite of a min cluster-manager node violation", nodeSetting.get("_SHOULD_NOT_BE_THERE_"), nullValue() ); diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/NoMasterNodeIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/NoMasterNodeIT.java index 2c50c2051b34a..de8996100f3b0 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/NoMasterNodeIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/NoMasterNodeIT.java @@ -87,7 +87,7 @@ protected Collection> nodePlugins() { return Collections.singletonList(MockTransportService.TestPlugin.class); } - public void testNoMasterActions() throws Exception { + public void testNoClusterManagerActions() throws Exception { Settings settings = Settings.builder() .put(AutoCreateIndex.AUTO_CREATE_INDEX_SETTING.getKey(), true) .put(NoMasterBlockService.NO_CLUSTER_MANAGER_BLOCK_SETTING.getKey(), "all") @@ -107,57 +107,63 @@ public void testNoMasterActions() throws Exception { internalCluster().setDisruptionScheme(disruptionScheme); disruptionScheme.startDisrupting(); - final Client clientToMasterlessNode = client(); + final Client clientToClusterManagerlessNode = client(); assertBusy(() -> { - ClusterState state = clientToMasterlessNode.admin().cluster().prepareState().setLocal(true).execute().actionGet().getState(); + ClusterState state = clientToClusterManagerlessNode.admin() + .cluster() + .prepareState() + .setLocal(true) + .execute() + .actionGet() + .getState(); assertTrue(state.blocks().hasGlobalBlockWithId(NoMasterBlockService.NO_MASTER_BLOCK_ID)); }); assertRequestBuilderThrows( - clientToMasterlessNode.prepareGet("test", "1"), + clientToClusterManagerlessNode.prepareGet("test", "1"), ClusterBlockException.class, RestStatus.SERVICE_UNAVAILABLE ); assertRequestBuilderThrows( - clientToMasterlessNode.prepareGet("no_index", "1"), + clientToClusterManagerlessNode.prepareGet("no_index", "1"), ClusterBlockException.class, RestStatus.SERVICE_UNAVAILABLE ); assertRequestBuilderThrows( - clientToMasterlessNode.prepareMultiGet().add("test", "1"), + clientToClusterManagerlessNode.prepareMultiGet().add("test", "1"), ClusterBlockException.class, RestStatus.SERVICE_UNAVAILABLE ); assertRequestBuilderThrows( - clientToMasterlessNode.prepareMultiGet().add("no_index", "1"), + clientToClusterManagerlessNode.prepareMultiGet().add("no_index", "1"), ClusterBlockException.class, RestStatus.SERVICE_UNAVAILABLE ); assertRequestBuilderThrows( - clientToMasterlessNode.admin().indices().prepareAnalyze("test", "this is a test"), + clientToClusterManagerlessNode.admin().indices().prepareAnalyze("test", "this is a test"), ClusterBlockException.class, RestStatus.SERVICE_UNAVAILABLE ); assertRequestBuilderThrows( - clientToMasterlessNode.admin().indices().prepareAnalyze("no_index", "this is a test"), + clientToClusterManagerlessNode.admin().indices().prepareAnalyze("no_index", "this is a test"), ClusterBlockException.class, RestStatus.SERVICE_UNAVAILABLE ); assertRequestBuilderThrows( - clientToMasterlessNode.prepareSearch("test").setSize(0), + clientToClusterManagerlessNode.prepareSearch("test").setSize(0), ClusterBlockException.class, RestStatus.SERVICE_UNAVAILABLE ); assertRequestBuilderThrows( - clientToMasterlessNode.prepareSearch("no_index").setSize(0), + clientToClusterManagerlessNode.prepareSearch("no_index").setSize(0), ClusterBlockException.class, RestStatus.SERVICE_UNAVAILABLE ); @@ -165,7 +171,7 @@ public void testNoMasterActions() throws Exception { checkUpdateAction( false, timeout, - clientToMasterlessNode.prepareUpdate("test", "1") + clientToClusterManagerlessNode.prepareUpdate("test", "1") .setScript(new Script(ScriptType.INLINE, Script.DEFAULT_SCRIPT_LANG, "test script", Collections.emptyMap())) .setTimeout(timeout) ); @@ -173,41 +179,49 @@ public void testNoMasterActions() throws Exception { checkUpdateAction( true, timeout, - clientToMasterlessNode.prepareUpdate("no_index", "1") + clientToClusterManagerlessNode.prepareUpdate("no_index", "1") .setScript(new Script(ScriptType.INLINE, Script.DEFAULT_SCRIPT_LANG, "test script", Collections.emptyMap())) .setTimeout(timeout) ); checkWriteAction( - clientToMasterlessNode.prepareIndex("test") + clientToClusterManagerlessNode.prepareIndex("test") .setId("1") .setSource(XContentFactory.jsonBuilder().startObject().endObject()) .setTimeout(timeout) ); checkWriteAction( - clientToMasterlessNode.prepareIndex("no_index") + clientToClusterManagerlessNode.prepareIndex("no_index") .setId("1") .setSource(XContentFactory.jsonBuilder().startObject().endObject()) .setTimeout(timeout) ); - BulkRequestBuilder bulkRequestBuilder = clientToMasterlessNode.prepareBulk(); + BulkRequestBuilder bulkRequestBuilder = clientToClusterManagerlessNode.prepareBulk(); bulkRequestBuilder.add( - clientToMasterlessNode.prepareIndex("test").setId("1").setSource(XContentFactory.jsonBuilder().startObject().endObject()) + clientToClusterManagerlessNode.prepareIndex("test") + .setId("1") + .setSource(XContentFactory.jsonBuilder().startObject().endObject()) ); bulkRequestBuilder.add( - clientToMasterlessNode.prepareIndex("test").setId("2").setSource(XContentFactory.jsonBuilder().startObject().endObject()) + clientToClusterManagerlessNode.prepareIndex("test") + .setId("2") + .setSource(XContentFactory.jsonBuilder().startObject().endObject()) ); bulkRequestBuilder.setTimeout(timeout); checkWriteAction(bulkRequestBuilder); - bulkRequestBuilder = clientToMasterlessNode.prepareBulk(); + bulkRequestBuilder = clientToClusterManagerlessNode.prepareBulk(); bulkRequestBuilder.add( - clientToMasterlessNode.prepareIndex("no_index").setId("1").setSource(XContentFactory.jsonBuilder().startObject().endObject()) + clientToClusterManagerlessNode.prepareIndex("no_index") + .setId("1") + .setSource(XContentFactory.jsonBuilder().startObject().endObject()) ); bulkRequestBuilder.add( - clientToMasterlessNode.prepareIndex("no_index").setId("2").setSource(XContentFactory.jsonBuilder().startObject().endObject()) + clientToClusterManagerlessNode.prepareIndex("no_index") + .setId("2") + .setSource(XContentFactory.jsonBuilder().startObject().endObject()) ); bulkRequestBuilder.setTimeout(timeout); checkWriteAction(bulkRequestBuilder); @@ -239,7 +253,7 @@ void checkWriteAction(ActionRequestBuilder builder) { } } - public void testNoMasterActionsWriteMasterBlock() throws Exception { + public void testNoClusterManagerActionsWriteClusterManagerBlock() throws Exception { Settings settings = Settings.builder() .put(AutoCreateIndex.AUTO_CREATE_INDEX_SETTING.getKey(), false) .put(NoMasterBlockService.NO_CLUSTER_MANAGER_BLOCK_SETTING.getKey(), "write") @@ -270,31 +284,34 @@ public void testNoMasterActionsWriteMasterBlock() throws Exception { internalCluster().setDisruptionScheme(disruptionScheme); disruptionScheme.startDisrupting(); - final Client clientToMasterlessNode = client(); + final Client clientToClusterManagerlessNode = client(); assertBusy(() -> { - ClusterState state = clientToMasterlessNode.admin().cluster().prepareState().setLocal(true).get().getState(); + ClusterState state = clientToClusterManagerlessNode.admin().cluster().prepareState().setLocal(true).get().getState(); assertTrue(state.blocks().hasGlobalBlockWithId(NoMasterBlockService.NO_MASTER_BLOCK_ID)); }); - GetResponse getResponse = clientToMasterlessNode.prepareGet("test1", "1").get(); + GetResponse getResponse = clientToClusterManagerlessNode.prepareGet("test1", "1").get(); assertExists(getResponse); - SearchResponse countResponse = clientToMasterlessNode.prepareSearch("test1").setAllowPartialSearchResults(true).setSize(0).get(); + SearchResponse countResponse = clientToClusterManagerlessNode.prepareSearch("test1") + .setAllowPartialSearchResults(true) + .setSize(0) + .get(); assertHitCount(countResponse, 1L); logger.info("--> here 3"); - SearchResponse searchResponse = clientToMasterlessNode.prepareSearch("test1").setAllowPartialSearchResults(true).get(); + SearchResponse searchResponse = clientToClusterManagerlessNode.prepareSearch("test1").setAllowPartialSearchResults(true).get(); assertHitCount(searchResponse, 1L); - countResponse = clientToMasterlessNode.prepareSearch("test2").setAllowPartialSearchResults(true).setSize(0).get(); + countResponse = clientToClusterManagerlessNode.prepareSearch("test2").setAllowPartialSearchResults(true).setSize(0).get(); assertThat(countResponse.getTotalShards(), equalTo(3)); assertThat(countResponse.getSuccessfulShards(), equalTo(1)); TimeValue timeout = TimeValue.timeValueMillis(200); long now = System.currentTimeMillis(); try { - clientToMasterlessNode.prepareUpdate("test1", "1") + clientToClusterManagerlessNode.prepareUpdate("test1", "1") .setDoc(Requests.INDEX_CONTENT_TYPE, "field", "value2") .setTimeout(timeout) .get(); @@ -308,7 +325,7 @@ public void testNoMasterActionsWriteMasterBlock() throws Exception { } try { - clientToMasterlessNode.prepareIndex("test1") + clientToClusterManagerlessNode.prepareIndex("test1") .setId("1") .setSource(XContentFactory.jsonBuilder().startObject().endObject()) .setTimeout(timeout) diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/SpecificMasterNodesIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/SpecificMasterNodesIT.java index 1bc94de1b51e1..507da332af1f3 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/SpecificMasterNodesIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/SpecificMasterNodesIT.java @@ -57,7 +57,7 @@ public class SpecificMasterNodesIT extends OpenSearchIntegTestCase { public void testSimpleOnlyMasterNodeElection() throws IOException { internalCluster().setBootstrapClusterManagerNodeIndex(0); - logger.info("--> start data node / non master node"); + logger.info("--> start data node / non cluster-manager node"); internalCluster().startNode(Settings.builder().put(dataOnlyNode()).put("discovery.initial_state_timeout", "1s")); try { assertThat( @@ -105,7 +105,7 @@ public void testSimpleOnlyMasterNodeElection() throws IOException { equalTo(masterNodeName) ); - logger.info("--> stop master node"); + logger.info("--> stop cluster-manager node"); Settings masterDataPathSettings = internalCluster().dataPathSettings(internalCluster().getMasterName()); internalCluster().stopCurrentMasterNode(); @@ -210,7 +210,7 @@ public void testElectOnlyBetweenMasterNodes() throws Exception { ); logger.info("--> start cluster-manager node (2)"); - final String nextMasterEligableNodeName = internalCluster().startClusterManagerOnlyNode(); + final String nextClusterManagerEligableNodeName = internalCluster().startClusterManagerOnlyNode(); assertThat( internalCluster().nonMasterClient() .admin() @@ -251,7 +251,7 @@ public void testElectOnlyBetweenMasterNodes() throws Exception { equalTo(masterNodeName) ); - logger.info("--> closing master node (1)"); + logger.info("--> closing cluster-manager node (1)"); client().execute(AddVotingConfigExclusionsAction.INSTANCE, new AddVotingConfigExclusionsRequest(masterNodeName)).get(); // removing the cluster-manager from the voting configuration immediately triggers the cluster-manager to step down assertBusy(() -> { @@ -266,7 +266,7 @@ public void testElectOnlyBetweenMasterNodes() throws Exception { .nodes() .getMasterNode() .getName(), - equalTo(nextMasterEligableNodeName) + equalTo(nextClusterManagerEligableNodeName) ); assertThat( internalCluster().masterClient() @@ -279,7 +279,7 @@ public void testElectOnlyBetweenMasterNodes() throws Exception { .nodes() .getMasterNode() .getName(), - equalTo(nextMasterEligableNodeName) + equalTo(nextClusterManagerEligableNodeName) ); }); internalCluster().stopRandomNode(InternalTestCluster.nameFilter(masterNodeName)); @@ -294,7 +294,7 @@ public void testElectOnlyBetweenMasterNodes() throws Exception { .nodes() .getMasterNode() .getName(), - equalTo(nextMasterEligableNodeName) + equalTo(nextClusterManagerEligableNodeName) ); assertThat( internalCluster().masterClient() @@ -307,7 +307,7 @@ public void testElectOnlyBetweenMasterNodes() throws Exception { .nodes() .getMasterNode() .getName(), - equalTo(nextMasterEligableNodeName) + equalTo(nextClusterManagerEligableNodeName) ); } diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/action/shard/ShardStateActionIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/action/shard/ShardStateActionIT.java index a5c35f3e25f09..b7e895f38ba19 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/action/shard/ShardStateActionIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/action/shard/ShardStateActionIT.java @@ -120,9 +120,12 @@ public void testFollowupRerouteCanBeSetToHigherPriority() { ); // ensure that the cluster-manager always has a HIGH priority pending task - final AtomicBoolean stopSpammingMaster = new AtomicBoolean(); - final ClusterService masterClusterService = internalCluster().getInstance(ClusterService.class, internalCluster().getMasterName()); - masterClusterService.submitStateUpdateTask("spam", new ClusterStateUpdateTask(Priority.HIGH) { + final AtomicBoolean stopSpammingClusterManager = new AtomicBoolean(); + final ClusterService clusterManagerClusterService = internalCluster().getInstance( + ClusterService.class, + internalCluster().getMasterName() + ); + clusterManagerClusterService.submitStateUpdateTask("spam", new ClusterStateUpdateTask(Priority.HIGH) { @Override public ClusterState execute(ClusterState currentState) { return currentState; @@ -135,19 +138,18 @@ public void onFailure(String source, Exception e) { @Override public void clusterStateProcessed(String source, ClusterState oldState, ClusterState newState) { - if (stopSpammingMaster.get() == false) { - masterClusterService.submitStateUpdateTask("spam", this); + if (stopSpammingClusterManager.get() == false) { + clusterManagerClusterService.submitStateUpdateTask("spam", this); } } }); - // even with the cluster-manager under such pressure, all shards of the index can be assigned; in particular, after the primaries - // have - // started there's a follow-up reroute at a higher priority than the spam + // even with the cluster-manager under such pressure, all shards of the index can be assigned; + // in particular, after the primaries have started there's a follow-up reroute at a higher priority than the spam createIndex("test"); assertFalse(client().admin().cluster().prepareHealth().setWaitForGreenStatus().get().isTimedOut()); - stopSpammingMaster.set(true); + stopSpammingClusterManager.set(true); assertFalse(client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).get().isTimedOut()); assertAcked( 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 1b361b8051416..1361d13dae91e 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/RareClusterStateIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/RareClusterStateIT.java @@ -179,7 +179,7 @@ public void testDeleteCreateInOneBulk() throws Exception { prepareCreate("test").setSettings(Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)).get(); ensureGreen("test"); - // block none master node. + // block none cluster-manager node. BlockClusterStateProcessing disruption = new BlockClusterStateProcessing(dataNode, random()); internalCluster().setDisruptionScheme(disruption); logger.info("--> indexing a doc"); @@ -212,7 +212,7 @@ public void testDeleteCreateInOneBulk() throws Exception { public void testDelayedMappingPropagationOnPrimary() throws Exception { // Here we want to test that things go well if there is a first request // that adds mappings but before mappings are propagated to all nodes - // another index request introduces the same mapping. The master node + // another index request introduces the same mapping. The cluster-manager node // will reply immediately since it did not change the cluster state // but the change might not be on the node that performed the indexing // operation yet @@ -341,7 +341,7 @@ public void testDelayedMappingPropagationOnReplica() throws Exception { assertThat(shards, hasSize(2)); for (ShardRouting shard : shards) { if (shard.primary()) { - // primary must be on the master + // primary must be on the cluster-manager assertEquals(state.nodes().getMasterNodeId(), shard.currentNodeId()); } else { assertTrue(shard.active()); @@ -357,7 +357,7 @@ public void testDelayedMappingPropagationOnReplica() throws Exception { ); final Index index = resolveIndex("index"); - // Wait for mappings to be available on master + // Wait for mappings to be available on cluster-manager assertBusy(() -> { final IndicesService indicesService = internalCluster().getInstance(IndicesService.class, clusterManager); final IndexService indexService = indicesService.indexServiceSafe(index); @@ -381,7 +381,7 @@ public void testDelayedMappingPropagationOnReplica() throws Exception { client().prepareIndex("index").setId("2").setSource("field2", 42) ); - // ...and wait for second mapping to be available on master + // ...and wait for second mapping to be available on cluster-manager assertBusy(() -> { final IndicesService indicesService = internalCluster().getInstance(IndicesService.class, clusterManager); final IndexService indexService = indicesService.indexServiceSafe(index); 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 ea3a2c57bea5e..88dbbcca3e4bb 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/UnsafeBootstrapAndDetachCommandIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/UnsafeBootstrapAndDetachCommandIT.java @@ -285,10 +285,10 @@ public void testDetachAbortedByUser() throws IOException { public void test3MasterNodes2Failed() throws Exception { internalCluster().setBootstrapClusterManagerNodeIndex(2); - List masterNodes = new ArrayList<>(); + List clusterManagerNodes = new ArrayList<>(); logger.info("--> start 1st cluster-manager-eligible node"); - masterNodes.add( + clusterManagerNodes.add( internalCluster().startClusterManagerOnlyNode( Settings.builder().put(DiscoverySettings.INITIAL_STATE_TIMEOUT_SETTING.getKey(), "0s").build() ) @@ -300,12 +300,12 @@ public void test3MasterNodes2Failed() throws Exception { ); // node ordinal 1 logger.info("--> start 2nd and 3rd cluster-manager-eligible nodes and bootstrap"); - masterNodes.addAll(internalCluster().startMasterOnlyNodes(2)); // node ordinals 2 and 3 + clusterManagerNodes.addAll(internalCluster().startMasterOnlyNodes(2)); // node ordinals 2 and 3 logger.info("--> wait for all nodes to join the cluster"); ensureStableCluster(4); - List currentClusterNodes = new ArrayList<>(masterNodes); + List currentClusterNodes = new ArrayList<>(clusterManagerNodes); currentClusterNodes.add(dataNode); currentClusterNodes.forEach(node -> ensureReadOnlyBlock(false, node)); @@ -313,14 +313,14 @@ public void test3MasterNodes2Failed() throws Exception { createIndex("test"); ensureGreen("test"); - Settings master1DataPathSettings = internalCluster().dataPathSettings(masterNodes.get(0)); - Settings master2DataPathSettings = internalCluster().dataPathSettings(masterNodes.get(1)); - Settings master3DataPathSettings = internalCluster().dataPathSettings(masterNodes.get(2)); + Settings master1DataPathSettings = internalCluster().dataPathSettings(clusterManagerNodes.get(0)); + Settings master2DataPathSettings = internalCluster().dataPathSettings(clusterManagerNodes.get(1)); + Settings master3DataPathSettings = internalCluster().dataPathSettings(clusterManagerNodes.get(2)); Settings dataNodeDataPathSettings = internalCluster().dataPathSettings(dataNode); - logger.info("--> stop 2nd and 3d master eligible node"); - internalCluster().stopRandomNode(InternalTestCluster.nameFilter(masterNodes.get(1))); - internalCluster().stopRandomNode(InternalTestCluster.nameFilter(masterNodes.get(2))); + logger.info("--> stop 2nd and 3d cluster-manager eligible node"); + internalCluster().stopRandomNode(InternalTestCluster.nameFilter(clusterManagerNodes.get(1))); + internalCluster().stopRandomNode(InternalTestCluster.nameFilter(clusterManagerNodes.get(2))); logger.info("--> ensure NO_MASTER_BLOCK on data-only node"); assertBusy(() -> { @@ -343,7 +343,7 @@ public void test3MasterNodes2Failed() throws Exception { logger.info("--> stop 1st cluster-manager-eligible node and data-only node"); NodeEnvironment nodeEnvironment = internalCluster().getMasterNodeInstance(NodeEnvironment.class); - internalCluster().stopRandomNode(InternalTestCluster.nameFilter(masterNodes.get(0))); + internalCluster().stopRandomNode(InternalTestCluster.nameFilter(clusterManagerNodes.get(0))); assertBusy(() -> internalCluster().getInstance(GatewayMetaState.class, dataNode).allPendingAsyncStatesWritten()); internalCluster().stopRandomDataNode(); @@ -490,7 +490,7 @@ public void testNoInitialBootstrapAfterDetach() throws Exception { String node = internalCluster().startClusterManagerOnlyNode( Settings.builder() - // give the cluster 2 seconds to elect the master (it should not) + // give the cluster 2 seconds to elect the cluster-manager (it should not) .put(DiscoverySettings.INITIAL_STATE_TIMEOUT_SETTING.getKey(), "2s") .put(clusterManagerNodeDataPathSettings) .build() 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 ef2d52e2de7b9..c12f3e302a29c 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/VotingConfigurationIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/VotingConfigurationIT.java @@ -64,9 +64,9 @@ protected Collection> nodePlugins() { public void testAbdicateAfterVotingConfigExclusionAdded() throws ExecutionException, InterruptedException { internalCluster().setBootstrapClusterManagerNodeIndex(0); internalCluster().startNodes(2); - final String originalMaster = internalCluster().getMasterName(); + final String originalClusterManager = internalCluster().getMasterName(); - logger.info("--> excluding master node {}", originalMaster); + logger.info("--> excluding cluster-manager node {}", originalMaster); client().execute(AddVotingConfigExclusionsAction.INSTANCE, new AddVotingConfigExclusionsRequest(originalMaster)).get(); client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).get(); assertNotEquals(originalMaster, internalCluster().getMasterName()); @@ -77,7 +77,8 @@ public void testElectsNodeNotInVotingConfiguration() throws Exception { 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 - // by failing at the pre-voting stage, so that the extra node must be elected instead when the master shuts down. This extra node + // by failing at the pre-voting stage, so that the extra node must be elected instead when the cluster-manager shuts down. This + // extra node // should then add itself into the voting configuration. assertFalse( 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 d70da69853f17..704965824a914 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/ZenDiscoveryIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/ZenDiscoveryIT.java @@ -89,9 +89,9 @@ public void testNoShardRelocationsOccurWhenElectedMasterNodeFails() throws Excep createIndex("test"); ensureSearchable("test"); RecoveryResponse r = client().admin().indices().prepareRecoveries("test").get(); - int numRecoveriesBeforeNewMaster = r.shardRecoveryStates().get("test").size(); + int numRecoveriesBeforeNewClusterManager = r.shardRecoveryStates().get("test").size(); - final String oldMaster = internalCluster().getMasterName(); + final String oldClusterManager = internalCluster().getMasterName(); internalCluster().stopCurrentMasterNode(); assertBusy(() -> { String current = internalCluster().getMasterName(); @@ -101,7 +101,7 @@ public void testNoShardRelocationsOccurWhenElectedMasterNodeFails() throws Excep ensureSearchable("test"); r = client().admin().indices().prepareRecoveries("test").get(); - int numRecoveriesAfterNewMaster = r.shardRecoveryStates().get("test").size(); + int numRecoveriesAfterNewClusterManager = r.shardRecoveryStates().get("test").size(); assertThat(numRecoveriesAfterNewMaster, equalTo(numRecoveriesBeforeNewMaster)); } 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 29b18825c4fce..7cc4877df49a8 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().startClusterManagerOnlyNode(Settings.EMPTY); + String clusterManager = internalCluster().startClusterManagerOnlyNode(Settings.EMPTY); internalCluster().startDataOnlyNodes(2); assertAcked( @@ -206,7 +206,7 @@ private Settings createStaleReplicaScenario(String clusterManager) throws Except public void testDoNotAllowStaleReplicasToBePromotedToPrimary() throws Exception { logger.info("--> starting 3 nodes, 1 cluster-manager, 2 data"); - String master = internalCluster().startClusterManagerOnlyNode(Settings.EMPTY); + String clusterManager = internalCluster().startClusterManagerOnlyNode(Settings.EMPTY); internalCluster().startDataOnlyNodes(2); assertAcked( client().admin() @@ -660,7 +660,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().startClusterManagerOnlyNode(Settings.EMPTY); + String clusterManager = 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/discovery/ClusterDisruptionIT.java b/server/src/internalClusterTest/java/org/opensearch/discovery/ClusterDisruptionIT.java index c52918ee80fe0..95e1a2f8f6925 100644 --- a/server/src/internalClusterTest/java/org/opensearch/discovery/ClusterDisruptionIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/discovery/ClusterDisruptionIT.java @@ -240,7 +240,7 @@ public void testAckedIndexing() throws Exception { node ); } - // in case of a bridge partition, shard allocation can fail "index.allocation.max_retries" times if the master + // in case of a bridge partition, shard allocation can fail "index.allocation.max_retries" times if the cluster-manager // is the super-connected node and recovery source and target are on opposite sides of the bridge if (disruptionScheme instanceof NetworkDisruption && ((NetworkDisruption) disruptionScheme).getDisruptedLinks() instanceof Bridge) { @@ -424,7 +424,7 @@ public Settings onNodeStopped(String nodeName) { return Settings.builder() .put(ClusterBootstrapService.INITIAL_CLUSTER_MANAGER_NODES_SETTING.getKey(), nodeName) /* - * the data node might join while the master is still not fully established as master just yet and bypasses the join + * the data node might join while the cluster-manager is still not fully established as cluster-manager just yet and bypasses the join * validation that is done before adding the node to the cluster. Only the join validation when handling the publish * request takes place, but at this point the cluster state has been successfully committed, and will subsequently be * exposed to the applier. The health check below therefore sees the cluster state with the 2 nodes and thinks all is @@ -458,7 +458,7 @@ public boolean validateClusterForming() { } /** - * Tests that indices are properly deleted even if there is a master transition in between. + * Tests that indices are properly deleted even if there is a cluster-manager transition in between. * Test for https://github.com/elastic/elasticsearch/issues/11665 */ public void testIndicesDeleted() throws Exception { @@ -476,13 +476,14 @@ public void testIndicesDeleted() throws Exception { internalCluster().setDisruptionScheme(networkDisruption); networkDisruption.startDisrupting(); // We know this will time out due to the partition, we check manually below to not proceed until - // the delete has been applied to the master node and the master eligible node. + // the delete has been applied to the cluster-manager node and the cluster-manager eligible node. internalCluster().client(masterNode1).admin().indices().prepareDelete(idxName).setTimeout("0s").get(); - // Don't restart the master node until we know the index deletion has taken effect on master and the master eligible node. + // Don't restart the cluster-manager node until we know the index deletion has taken effect on cluster-manager and the + // cluster-manager eligible node. assertBusy(() -> { - for (String masterNode : allMasterEligibleNodes) { - final ClusterState masterState = internalCluster().clusterService(masterNode).state(); - assertTrue("index not deleted on " + masterNode, masterState.metadata().hasIndex(idxName) == false); + for (String clusterManagerNode : allMasterEligibleNodes) { + final ClusterState masterState = internalCluster().clusterService(clusterManagerNode).state(); + assertTrue("index not deleted on " + clusterManagerNode, masterState.metadata().hasIndex(idxName) == false); } }); internalCluster().restartNode(masterNode1, InternalTestCluster.EMPTY_CALLBACK); diff --git a/server/src/internalClusterTest/java/org/opensearch/discovery/DiscoveryDisruptionIT.java b/server/src/internalClusterTest/java/org/opensearch/discovery/DiscoveryDisruptionIT.java index 6fb311ba9a7b2..a4ebbf50b24e5 100644 --- a/server/src/internalClusterTest/java/org/opensearch/discovery/DiscoveryDisruptionIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/discovery/DiscoveryDisruptionIT.java @@ -74,7 +74,7 @@ public void testClusterJoinDespiteOfPublishingIssues() throws Exception { discoveryNodes.getMasterNode().getName() ); - logger.info("blocking requests from non master [{}] to master [{}]", nonClusterManagerNode, clusterManagerNode); + logger.info("blocking requests from non cluster-manager [{}] to cluster-manager [{}]", nonClusterManagerNode, clusterManagerNode); MockTransportService nonMasterTransportService = (MockTransportService) internalCluster().getInstance( TransportService.class, nonClusterManagerNode @@ -83,7 +83,11 @@ public void testClusterJoinDespiteOfPublishingIssues() throws Exception { assertNoMaster(nonClusterManagerNode); - logger.info("blocking cluster state publishing from master [{}] to non master [{}]", clusterManagerNode, nonClusterManagerNode); + logger.info( + "blocking cluster state publishing from cluster-manager [{}] to non cluster-manager [{}]", + clusterManagerNode, + nonClusterManagerNode + ); MockTransportService masterTransportService = (MockTransportService) internalCluster().getInstance( TransportService.class, clusterManagerNode @@ -99,7 +103,7 @@ public void testClusterJoinDespiteOfPublishingIssues() throws Exception { } logger.info( - "allowing requests from non master [{}] to master [{}], waiting for two join request", + "allowing requests from non cluster-manager [{}] to cluster-manager [{}], waiting for two join request", nonClusterManagerNode, clusterManagerNode ); @@ -150,7 +154,7 @@ public void testElectMasterWithLatestVersion() throws Exception { ); internalCluster().setDisruptionScheme(isolateAllNodes); - logger.info("--> forcing a complete election to make sure \"preferred\" master is elected"); + logger.info("--> forcing a complete election to make sure \"preferred\" cluster-manager is elected"); isolateAllNodes.startDisrupting(); for (String node : nodes) { assertNoMaster(node); @@ -158,12 +162,12 @@ public void testElectMasterWithLatestVersion() throws Exception { internalCluster().clearDisruptionScheme(); ensureStableCluster(3); final String preferredMasterName = internalCluster().getMasterName(); - final DiscoveryNode preferredMaster = internalCluster().clusterService(preferredMasterName).localNode(); + final DiscoveryNode preferredClusterManager = internalCluster().clusterService(preferredMasterName).localNode(); - logger.info("--> preferred master is {}", preferredMaster); + logger.info("--> preferred cluster-manager is {}", preferredMaster); final Set nonPreferredNodes = new HashSet<>(nodes); nonPreferredNodes.remove(preferredMasterName); - final ServiceDisruptionScheme isolatePreferredMaster = isolateMasterDisruption(NetworkDisruption.DISCONNECT); + final ServiceDisruptionScheme isolatePreferredClusterManager = isolateMasterDisruption(NetworkDisruption.DISCONNECT); internalCluster().setDisruptionScheme(isolatePreferredMaster); isolatePreferredMaster.startDisrupting(); @@ -194,7 +198,7 @@ public void testElectMasterWithLatestVersion() throws Exception { } /** - * Adds an asymmetric break between a master and one of the nodes and makes + * Adds an asymmetric break between a cluster-manager and one of the nodes and makes * sure that the node is removed form the cluster, that the node start pinging and that * the cluster reforms when healed. */ @@ -210,7 +214,7 @@ public void testNodeNotReachableFromMaster() throws Exception { } } - logger.info("blocking request from master [{}] to [{}]", clusterManagerNode, nonClusterManagerNode); + logger.info("blocking request from cluster-manager [{}] to [{}]", clusterManagerNode, nonClusterManagerNode); MockTransportService masterTransportService = (MockTransportService) internalCluster().getInstance( TransportService.class, clusterManagerNode diff --git a/server/src/internalClusterTest/java/org/opensearch/discovery/MasterDisruptionIT.java b/server/src/internalClusterTest/java/org/opensearch/discovery/MasterDisruptionIT.java index 090423b380bf7..5d66c62adc236 100644 --- a/server/src/internalClusterTest/java/org/opensearch/discovery/MasterDisruptionIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/discovery/MasterDisruptionIT.java @@ -66,7 +66,7 @@ public class MasterDisruptionIT extends AbstractDisruptionTestCase { /** - * Test that cluster recovers from a long GC on master that causes other nodes to elect a new one + * Test that cluster recovers from a long GC on cluster-manager that causes other nodes to elect a new one */ public void testMasterNodeGCs() throws Exception { List nodes = startCluster(3); @@ -89,7 +89,7 @@ public void testMasterNodeGCs() throws Exception { List oldNonClusterManagerNodes = new ArrayList<>(oldNonClusterManagerNodesSet); - logger.info("waiting for nodes to de-elect master [{}]", oldClusterManagerNode); + logger.info("waiting for nodes to de-elect cluster-manager [{}]", oldClusterManagerNode); for (String node : oldNonClusterManagerNodesSet) { assertDifferentMaster(node, oldClusterManagerNode); } @@ -103,13 +103,13 @@ public void testMasterNodeGCs() throws Exception { ensureStableCluster(3, waitTime, false, oldNonClusterManagerNodes.get(0)); // make sure all nodes agree on master - String newMaster = internalCluster().getMasterName(); + String newClusterManager = internalCluster().getMasterName(); assertThat(newMaster, not(equalTo(oldClusterManagerNode))); assertMaster(newMaster, nodes); } /** - * This test isolates the master from rest of the cluster, waits for a new master to be elected, restores the partition + * This test isolates the cluster-manager from rest of the cluster, waits for a new cluster-manager to be elected, restores the partition * and verifies that all node agree on the new cluster state */ public void testIsolateMasterAndVerifyClusterStateConsensus() throws Exception { @@ -221,13 +221,13 @@ public void testVerifyApiBlocksDuringPartition() throws Exception { // Simulate a network issue between the unlucky node and the rest of the cluster. networkDisruption.startDisrupting(); - // The unlucky node must report *no* master node, since it can't connect to master and in fact it should + // The unlucky node must report *no* cluster-manager node, since it can't connect to cluster-manager and in fact it should // continuously ping until network failures have been resolved. However // It may a take a bit before the node detects it has been cut off from the elected master logger.info("waiting for isolated node [{}] to have no cluster-manager", isolatedNode); assertNoMaster(isolatedNode, NoMasterBlockService.NO_MASTER_BLOCK_WRITES, TimeValue.timeValueSeconds(30)); - logger.info("wait until elected master has been removed and a new 2 node cluster was from (via [{}])", isolatedNode); + logger.info("wait until elected cluster-manager has been removed and a new 2 node cluster was from (via [{}])", isolatedNode); ensureStableCluster(2, nonIsolatedNode); for (String node : partitions.getMajoritySide()) { @@ -251,7 +251,7 @@ public void testVerifyApiBlocksDuringPartition() throws Exception { networkDisruption.stopDisrupting(); - // Wait until the master node sees al 3 nodes again. + // Wait until the cluster-manager node sees al 3 nodes again. ensureStableCluster(3, new TimeValue(DISRUPTION_HEALING_OVERHEAD.millis() + networkDisruption.expectedTimeToHeal().millis())); logger.info( @@ -267,7 +267,7 @@ public void testVerifyApiBlocksDuringPartition() throws Exception { networkDisruption.startDisrupting(); - // The unlucky node must report *no* master node, since it can't connect to master and in fact it should + // The unlucky node must report *no* cluster-manager node, since it can't connect to cluster-manager and in fact it should // continuously ping until network failures have been resolved. However // It may a take a bit before the node detects it has been cut off from the elected master logger.info("waiting for isolated node [{}] to have no cluster-manager", isolatedNode); diff --git a/server/src/internalClusterTest/java/org/opensearch/discovery/SnapshotDisruptionIT.java b/server/src/internalClusterTest/java/org/opensearch/discovery/SnapshotDisruptionIT.java index e6ddfd94871ce..328e96c84cfe6 100644 --- a/server/src/internalClusterTest/java/org/opensearch/discovery/SnapshotDisruptionIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/discovery/SnapshotDisruptionIT.java @@ -158,7 +158,7 @@ public void clusterChanged(ClusterChangedEvent event) { assertNotNull(sne); assertThat( sne.getMessage(), - either(endsWith(" Failed to update cluster state during snapshot finalization")).or(endsWith(" no longer master")) + either(endsWith(" Failed to update cluster state during snapshot finalization")).or(endsWith(" no longer cluster-manager")) ); assertThat(sne.getSnapshotName(), is(snapshot)); } @@ -267,7 +267,7 @@ public void testMasterFailOverDuringShardSnapshots() throws Exception { networkDisruption.stopDisrupting(); awaitNoMoreRunningOperations(dataNode); - logger.info("--> make sure isolated master responds to snapshot request"); + logger.info("--> make sure isolated cluster-manager responds to snapshot request"); final SnapshotException sne = expectThrows( SnapshotException.class, () -> snapshotResponse.actionGet(TimeValue.timeValueSeconds(30L)) diff --git a/server/src/internalClusterTest/java/org/opensearch/discovery/StableMasterDisruptionIT.java b/server/src/internalClusterTest/java/org/opensearch/discovery/StableMasterDisruptionIT.java index 614c5a13c3253..0ecafa7755ad9 100644 --- a/server/src/internalClusterTest/java/org/opensearch/discovery/StableMasterDisruptionIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/discovery/StableMasterDisruptionIT.java @@ -91,16 +91,16 @@ public void testFailWithMinimumMasterNodesConfigured() throws Exception { List nodes = internalCluster().startNodes(3); ensureStableCluster(3); - // Figure out what is the elected master node + // Figure out what is the elected cluster-manager node final String masterNode = internalCluster().getMasterName(); - logger.info("---> legit elected master node={}", masterNode); + logger.info("---> legit elected cluster-manager node={}", masterNode); // Pick a node that isn't the elected master. Set nonMasters = new HashSet<>(nodes); nonMasters.remove(masterNode); final String unluckyNode = randomFrom(nonMasters.toArray(Strings.EMPTY_ARRAY)); - // Simulate a network issue between the unlucky node and elected master node in both directions. + // Simulate a network issue between the unlucky node and elected cluster-manager node in both directions. NetworkDisruption networkDisconnect = new NetworkDisruption( new NetworkDisruption.TwoPartitions(masterNode, unluckyNode), @@ -109,20 +109,20 @@ public void testFailWithMinimumMasterNodesConfigured() throws Exception { setDisruptionScheme(networkDisconnect); networkDisconnect.startDisrupting(); - // Wait until elected master has removed that the unlucky node... + // Wait until elected cluster-manager has removed that the unlucky node... ensureStableCluster(2, masterNode); - // The unlucky node must report *no* master node, since it can't connect to master and in fact it should + // The unlucky node must report *no* cluster-manager node, since it can't connect to cluster-manager and in fact it should // continuously ping until network failures have been resolved. However - // It may a take a bit before the node detects it has been cut off from the elected master + // It may a take a bit before the node detects it has been cut off from the elected cluster-manager ensureNoMaster(unluckyNode); networkDisconnect.stopDisrupting(); - // Wait until the master node sees all 3 nodes again. + // Wait until the cluster-manager node sees all 3 nodes again. ensureStableCluster(3); - // The elected master shouldn't have changed, since the unlucky node never could have elected itself as master + // The elected cluster-manager shouldn't have changed, since the unlucky node never could have elected itself as cluster-manager assertThat(internalCluster().getMasterName(), equalTo(masterNode)); } @@ -135,14 +135,14 @@ private void ensureNoMaster(String node) throws Exception { } /** - * Verify that nodes fault detection detects a disconnected node after master reelection + * Verify that nodes fault detection detects a disconnected node after cluster-manager reelection */ public void testFollowerCheckerDetectsDisconnectedNodeAfterMasterReelection() throws Exception { testFollowerCheckerAfterMasterReelection(NetworkDisruption.DISCONNECT, Settings.EMPTY); } /** - * Verify that nodes fault detection detects an unresponsive node after master reelection + * Verify that nodes fault detection detects an unresponsive node after cluster-manager reelection */ public void testFollowerCheckerDetectsUnresponsiveNodeAfterMasterReelection() throws Exception { testFollowerCheckerAfterMasterReelection( @@ -166,7 +166,7 @@ private void testFollowerCheckerAfterMasterReelection(NetworkLinkDisruptionType ensureStableCluster(3); - final String master = internalCluster().getMasterName(); + final String clusterManager = internalCluster().getMasterName(); final List nonMasters = Arrays.stream(internalCluster().getNodeNames()) .filter(n -> master.equals(n) == false) .collect(Collectors.toList()); @@ -182,7 +182,7 @@ private void testFollowerCheckerAfterMasterReelection(NetworkLinkDisruptionType setDisruptionScheme(networkDisruption); networkDisruption.startDisrupting(); - logger.info("--> waiting for master to remove it"); + logger.info("--> waiting for cluster-manager to remove it"); ensureStableCluster(2, master); ensureNoMaster(isolatedNode); @@ -191,8 +191,8 @@ private void testFollowerCheckerAfterMasterReelection(NetworkLinkDisruptionType } /** - * Tests that emulates a frozen elected master node that unfreezes and pushes its cluster state to other nodes that already are - * following another elected master node. These nodes should reject this cluster state and prevent them from following the stale master. + * Tests that emulates a frozen elected cluster-manager node that unfreezes and pushes its cluster state to other nodes that already are + * following another elected cluster-manager node. These nodes should reject this cluster state and prevent them from following the stale master. */ public void testStaleMasterNotHijackingMajority() throws Exception { final List nodes = internalCluster().startNodes( @@ -204,23 +204,24 @@ public void testStaleMasterNotHijackingMajority() throws Exception { ); ensureStableCluster(3); - // Save the current master node as old master node, because that node will get frozen + // Save the current cluster-manager node as old cluster-manager node, because that node will get frozen final String oldMasterNode = internalCluster().getMasterName(); - // Simulating a painful gc by suspending all threads for a long time on the current elected master node. + // Simulating a painful gc by suspending all threads for a long time on the current elected cluster-manager node. SingleNodeDisruption masterNodeDisruption = new LongGCDisruption(random(), oldMasterNode); // Save the majority side final List majoritySide = new ArrayList<>(nodes); majoritySide.remove(oldMasterNode); - // Keeps track of the previous and current master when a master node transition took place on each node on the majority side: + // Keeps track of the previous and current cluster-manager when a cluster-manager node transition took place on each node on the + // majority side: final Map>> masters = Collections.synchronizedMap(new HashMap<>()); for (final String node : majoritySide) { masters.put(node, new ArrayList<>()); internalCluster().getInstance(ClusterService.class, node).addListener(event -> { - DiscoveryNode previousMaster = event.previousState().nodes().getMasterNode(); - DiscoveryNode currentMaster = event.state().nodes().getMasterNode(); + DiscoveryNode previousClusterManager = event.previousState().nodes().getMasterNode(); + DiscoveryNode currentClusterManager = event.state().nodes().getMasterNode(); if (!Objects.equals(previousMaster, currentMaster)) { logger.info( "--> node {} received new cluster state: {} \n and had previous cluster state: {}", @@ -228,8 +229,8 @@ public void testStaleMasterNotHijackingMajority() throws Exception { event.state(), event.previousState() ); - String previousClusterManagerNodeName = previousMaster != null ? previousMaster.getName() : null; - String currentMasterNodeName = currentMaster != null ? currentMaster.getName() : null; + String previousClusterManagerNodeName = previousClusterManager != null ? previousMaster.getName() : null; + String currentMasterNodeName = currentClusterManager != null ? currentMaster.getName() : null; masters.get(node).add(new Tuple<>(previousClusterManagerNodeName, currentMasterNodeName)); } }); @@ -254,9 +255,11 @@ public void testStaleMasterNotHijackingMajority() throws Exception { } }); - // The old master node is frozen, but here we submit a cluster state update task that doesn't get executed, but will be queued and - // once the old master node un-freezes it gets executed. The old master node will send this update + the cluster state where it is - // flagged as master to the other nodes that follow the new master. These nodes should ignore this update. + // The old cluster-manager node is frozen, but here we submit a cluster state update task that doesn't get executed, but will be + // queued and + // once the old cluster-manager node un-freezes it gets executed. The old cluster-manager node will send this update + the cluster + // state where it is + // flagged as cluster-manager to the other nodes that follow the new master. These nodes should ignore this update. internalCluster().getInstance(ClusterService.class, oldMasterNode) .submitStateUpdateTask("sneaky-update", new ClusterStateUpdateTask(Priority.IMMEDIATE) { @Override @@ -270,9 +273,9 @@ public void onFailure(String source, Exception e) { } }); - // Save the new elected master node + // Save the new elected cluster-manager node final String newMasterNode = internalCluster().getMasterName(majoritySide.get(0)); - logger.info("--> new detected master node [{}]", newMasterNode); + logger.info("--> new detected cluster-manager node [{}]", newMasterNode); // Stop disruption logger.info("--> unfreezing node [{}]", oldMasterNode); @@ -287,7 +290,7 @@ public void onFailure(String source, Exception e) { String nodeName = entry.getKey(); List> transitions = entry.getValue(); assertTrue( - "[" + nodeName + "] should not apply state from old master [" + oldMasterNode + "] but it did: " + transitions, + "[" + nodeName + "] should not apply state from old cluster-manager [" + oldMasterNode + "] but it did: " + transitions, transitions.stream().noneMatch(t -> oldMasterNode.equals(t.v2())) ); } diff --git a/server/src/internalClusterTest/java/org/opensearch/env/NodeEnvironmentIT.java b/server/src/internalClusterTest/java/org/opensearch/env/NodeEnvironmentIT.java index 8eecf001da103..a150bf5c86a59 100644 --- a/server/src/internalClusterTest/java/org/opensearch/env/NodeEnvironmentIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/env/NodeEnvironmentIT.java @@ -100,7 +100,7 @@ public Settings onNodeStopped(String nodeName) { assertThat(ex.getMessage(), startsWith("node does not have the data role but has shard data")); } - logger.info("--> start the node again with data and master roles"); + logger.info("--> start the node again with data and cluster-manager roles"); internalCluster().startNode(dataPathSettings); logger.info("--> indexing a simple document"); 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 09caf8f1e4358..a64bb321f9128 100644 --- a/server/src/internalClusterTest/java/org/opensearch/indices/recovery/IndexRecoveryIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/indices/recovery/IndexRecoveryIT.java @@ -852,7 +852,7 @@ public void testTransientErrorsDuringRecoveryAreRetried() throws Exception { .put(NodeConnectionsService.CLUSTER_NODE_RECONNECT_INTERVAL_SETTING.getKey(), "500ms") .put(RecoverySettings.INDICES_RECOVERY_INTERNAL_ACTION_TIMEOUT_SETTING.getKey(), "10s") .build(); - // start a master node + // start a cluster-manager node internalCluster().startNode(nodeSettings); final String blueNodeName = internalCluster().startNode( @@ -1054,7 +1054,7 @@ public void testDisconnectsWhileRecovering() throws Exception { .put(RecoverySettings.INDICES_RECOVERY_INTERNAL_ACTION_TIMEOUT_SETTING.getKey(), "1s") .put(NodeConnectionsService.CLUSTER_NODE_RECONNECT_INTERVAL_SETTING.getKey(), "1s") .build(); - // start a master node + // start a cluster-manager node internalCluster().startNode(nodeSettings); final String blueNodeName = internalCluster().startNode( @@ -1211,7 +1211,7 @@ public void testDisconnectsDuringRecovery() throws Exception { ) .build(); TimeValue disconnectAfterDelay = TimeValue.timeValueMillis(randomIntBetween(0, 100)); - // start a master node + // start a cluster-manager node String masterNodeName = internalCluster().startClusterManagerOnlyNode(nodeSettings); final String blueNodeName = internalCluster().startNode( @@ -1466,7 +1466,7 @@ public void testDoNotInfinitelyWaitForMapping() { assertHitCount(client().prepareSearch().get(), numDocs); } - /** Makes sure the new master does not repeatedly fetch index metadata from recovering replicas */ + /** Makes sure the new cluster-manager does not repeatedly fetch index metadata from recovering replicas */ public void testOngoingRecoveryAndMasterFailOver() throws Exception { String indexName = "test"; internalCluster().startNodes(2); diff --git a/server/src/internalClusterTest/java/org/opensearch/persistent/PersistentTasksExecutorIT.java b/server/src/internalClusterTest/java/org/opensearch/persistent/PersistentTasksExecutorIT.java index 9ea80ae7dbd89..d4ce36ff0575e 100644 --- a/server/src/internalClusterTest/java/org/opensearch/persistent/PersistentTasksExecutorIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/persistent/PersistentTasksExecutorIT.java @@ -403,7 +403,7 @@ public void testUnassignRunningPersistentTask() throws Exception { PlainActionFuture> unassignmentFuture = new PlainActionFuture<>(); - // Disallow re-assignment after it is unallocated to verify master and node state + // Disallow re-assignment after it is unallocated to verify cluster-manager and node state TestPersistentTasksExecutor.setNonClusterStateCondition(false); persistentTasksClusterService.unassignPersistentTask(taskId, task.getAllocationId() + 1, "unassignment test", unassignmentFuture); diff --git a/server/src/internalClusterTest/java/org/opensearch/repositories/blobstore/BlobStoreRepositoryCleanupIT.java b/server/src/internalClusterTest/java/org/opensearch/repositories/blobstore/BlobStoreRepositoryCleanupIT.java index 7208a608e1ea1..81383ddb83f73 100644 --- a/server/src/internalClusterTest/java/org/opensearch/repositories/blobstore/BlobStoreRepositoryCleanupIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/repositories/blobstore/BlobStoreRepositoryCleanupIT.java @@ -55,7 +55,7 @@ public void testMasterFailoverDuringCleanup() throws Exception { startBlockedCleanup("test-repo"); final int nodeCount = internalCluster().numDataAndMasterNodes(); - logger.info("--> stopping master node"); + logger.info("--> stopping cluster-manager node"); internalCluster().stopCurrentMasterNode(); ensureStableCluster(nodeCount - 1); @@ -67,7 +67,7 @@ public void testMasterFailoverDuringCleanup() throws Exception { } public void testRepeatCleanupsDontRemove() throws Exception { - final String masterNode = startBlockedCleanup("test-repo"); + final String clusterManagerNode = startBlockedCleanup("test-repo"); logger.info("--> sending another cleanup"); assertFutureThrows(client().admin().cluster().prepareCleanupRepository("test-repo").execute(), IllegalStateException.class); @@ -81,8 +81,8 @@ public void testRepeatCleanupsDontRemove() throws Exception { .custom(RepositoryCleanupInProgress.TYPE); assertTrue(cleanup.hasCleanupInProgress()); - logger.info("--> unblocking master node"); - unblockNode("test-repo", masterNode); + logger.info("--> unblocking cluster-manager node"); + unblockNode("test-repo", clusterManagerNode); logger.info("--> wait for cleanup to finish and disappear from cluster state"); awaitClusterState( @@ -91,7 +91,7 @@ public void testRepeatCleanupsDontRemove() throws Exception { } private String startBlockedCleanup(String repoName) throws Exception { - logger.info("--> starting two master nodes and one data node"); + logger.info("--> starting two cluster-manager nodes and one data node"); internalCluster().startMasterOnlyNodes(2); internalCluster().startDataOnlyNodes(1); diff --git a/server/src/internalClusterTest/java/org/opensearch/snapshots/CloneSnapshotIT.java b/server/src/internalClusterTest/java/org/opensearch/snapshots/CloneSnapshotIT.java index 7dc33294ce783..c171b3450f562 100644 --- a/server/src/internalClusterTest/java/org/opensearch/snapshots/CloneSnapshotIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/snapshots/CloneSnapshotIT.java @@ -392,9 +392,9 @@ public void testMasterFailoverDuringCloneStep1() throws Exception { final String cloneName = "target-snapshot"; final ActionFuture cloneFuture = startCloneFromDataNode(repoName, sourceSnapshot, cloneName, testIndex); awaitNumberOfSnapshotsInProgress(1); - final String masterNode = internalCluster().getMasterName(); - waitForBlock(masterNode, repoName, TimeValue.timeValueSeconds(30L)); - internalCluster().restartNode(masterNode); + final String clusterManagerNode = internalCluster().getMasterName(); + waitForBlock(clusterManagerNode, repoName, TimeValue.timeValueSeconds(30L)); + internalCluster().restartNode(clusterManagerNode); boolean cloneSucceeded = false; try { cloneFuture.actionGet(TimeValue.timeValueSeconds(30L)); @@ -406,7 +406,8 @@ public void testMasterFailoverDuringCloneStep1() throws Exception { awaitNoMoreRunningOperations(internalCluster().getMasterName()); - // Check if the clone operation worked out by chance as a result of the clone request being retried because of the master failover + // Check if the clone operation worked out by chance as a result of the clone request being retried + // because of the cluster-manager failover cloneSucceeded = cloneSucceeded || getRepositoryData(repoName).getSnapshotIds().stream().anyMatch(snapshotId -> snapshotId.getName().equals(cloneName)); assertAllSnapshotsSuccessful(getRepositoryData(repoName), cloneSucceeded ? 2 : 1); @@ -471,9 +472,9 @@ public void testExceptionDuringShardClone() throws Exception { blockMasterFromFinalizingSnapshotOnSnapFile(repoName); final ActionFuture cloneFuture = startCloneFromDataNode(repoName, sourceSnapshot, targetSnapshot, testIndex); awaitNumberOfSnapshotsInProgress(1); - final String masterNode = internalCluster().getMasterName(); - waitForBlock(masterNode, repoName, TimeValue.timeValueSeconds(30L)); - unblockNode(repoName, masterNode); + final String clusterManagerNode = internalCluster().getMasterName(); + waitForBlock(clusterManagerNode, repoName, TimeValue.timeValueSeconds(30L)); + unblockNode(repoName, clusterManagerNode); expectThrows(SnapshotException.class, cloneFuture::actionGet); awaitNoMoreRunningOperations(internalCluster().getMasterName()); assertAllSnapshotsSuccessful(getRepositoryData(repoName), 1); diff --git a/server/src/internalClusterTest/java/org/opensearch/snapshots/ConcurrentSnapshotsIT.java b/server/src/internalClusterTest/java/org/opensearch/snapshots/ConcurrentSnapshotsIT.java index edae4fa4a6b5e..19c315049f0d0 100644 --- a/server/src/internalClusterTest/java/org/opensearch/snapshots/ConcurrentSnapshotsIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/snapshots/ConcurrentSnapshotsIT.java @@ -280,7 +280,7 @@ public void testMultipleReposAreIndependent2() throws Exception { } public void testMultipleReposAreIndependent3() throws Exception { - final String masterNode = internalCluster().startClusterManagerOnlyNode(LARGE_SNAPSHOT_POOL_SETTINGS); + final String clusterManagerNode = internalCluster().startClusterManagerOnlyNode(LARGE_SNAPSHOT_POOL_SETTINGS); internalCluster().startDataOnlyNode(); final String blockedRepoName = "test-repo-blocked"; final String otherRepoName = "test-repo"; @@ -289,14 +289,14 @@ public void testMultipleReposAreIndependent3() throws Exception { createIndexWithContent("test-index"); createFullSnapshot(blockedRepoName, "blocked-snapshot"); - blockNodeOnAnyFiles(blockedRepoName, masterNode); + blockNodeOnAnyFiles(blockedRepoName, clusterManagerNode); final ActionFuture slowDeleteFuture = startDeleteSnapshot(blockedRepoName, "*"); logger.info("--> waiting for concurrent snapshot(s) to finish"); createNSnapshots(otherRepoName, randomIntBetween(1, 5)); assertAcked(startDeleteSnapshot(otherRepoName, "*").get()); - unblockNode(blockedRepoName, masterNode); + unblockNode(blockedRepoName, clusterManagerNode); assertAcked(slowDeleteFuture.actionGet()); } @@ -506,7 +506,7 @@ public void testMasterFailOverWithQueuedDeletes() throws Exception { } }, 30L, TimeUnit.SECONDS); - logger.info("--> stopping current master node"); + logger.info("--> stopping current cluster-manager node"); internalCluster().stopCurrentMasterNode(); unblockNode(repoName, dataNode); @@ -516,13 +516,14 @@ public void testMasterFailOverWithQueuedDeletes() throws Exception { try { assertAcked(deleteFuture.actionGet()); } catch (RepositoryException rex) { - // rarely the master node fails over twice when shutting down the initial master and fails the transport listener + // rarely the cluster-manager node fails over twice + // when shutting down the initial cluster-manager and fails the transport listener assertThat(rex.repository(), is("_all")); assertThat(rex.getMessage(), endsWith("Failed to update cluster state during repository operation")); } catch (SnapshotMissingException sme) { - // very rarely a master node fail-over happens at such a time that the client on the data-node sees a disconnect exception - // after the master has already started the delete, leading to the delete retry to run into a situation where the - // snapshot has already been deleted potentially + // very rarely a cluster-manager node fail-over happens at such a time + // that the client on the data-node sees a disconnect exception after the cluster-manager has already started the delete, + // leading to the delete retry to run into a situation where the snapshot has already been deleted potentially assertThat(sme.getSnapshotName(), is(firstSnapshot)); } } @@ -656,25 +657,25 @@ public void testQueuedOperationsOnMasterDisconnect() throws Exception { createIndexWithContent("index-one"); createNSnapshots(repoName, randomIntBetween(2, 5)); - final String masterNode = internalCluster().getMasterName(); + final String clusterManagerNode = internalCluster().getMasterName(); final NetworkDisruption networkDisruption = isolateMasterDisruption(NetworkDisruption.DISCONNECT); internalCluster().setDisruptionScheme(networkDisruption); - blockNodeOnAnyFiles(repoName, masterNode); - ActionFuture firstDeleteFuture = client(masterNode).admin() + blockNodeOnAnyFiles(repoName, clusterManagerNode); + ActionFuture firstDeleteFuture = client(clusterManagerNode).admin() .cluster() .prepareDeleteSnapshot(repoName, "*") .execute(); - waitForBlock(masterNode, repoName, TimeValue.timeValueSeconds(30L)); + waitForBlock(clusterManagerNode, repoName, TimeValue.timeValueSeconds(30L)); - final ActionFuture createThirdSnapshot = client(masterNode).admin() + final ActionFuture createThirdSnapshot = client(clusterManagerNode).admin() .cluster() .prepareCreateSnapshot(repoName, "snapshot-three") .setWaitForCompletion(true) .execute(); awaitNumberOfSnapshotsInProgress(1); - final ActionFuture secondDeleteFuture = client(masterNode).admin() + final ActionFuture secondDeleteFuture = client(clusterManagerNode).admin() .cluster() .prepareDeleteSnapshot(repoName, "*") .execute(); @@ -682,7 +683,7 @@ public void testQueuedOperationsOnMasterDisconnect() throws Exception { networkDisruption.startDisrupting(); ensureStableCluster(3, dataNode); - unblockNode(repoName, masterNode); + unblockNode(repoName, clusterManagerNode); networkDisruption.stopDisrupting(); logger.info("--> make sure all failing requests get a response"); @@ -701,7 +702,7 @@ public void testQueuedOperationsOnMasterDisconnectAndRepoFailure() throws Except createIndexWithContent("index-one"); createNSnapshots(repoName, randomIntBetween(2, 5)); - final String masterNode = internalCluster().getMasterName(); + final String clusterManagerNode = internalCluster().getMasterName(); final NetworkDisruption networkDisruption = isolateMasterDisruption(NetworkDisruption.DISCONNECT); internalCluster().setDisruptionScheme(networkDisruption); @@ -710,14 +711,14 @@ public void testQueuedOperationsOnMasterDisconnectAndRepoFailure() throws Except repoName, "failing-snapshot-1" ); - waitForBlock(masterNode, repoName, TimeValue.timeValueSeconds(30L)); + waitForBlock(clusterManagerNode, repoName, TimeValue.timeValueSeconds(30L)); final ActionFuture secondFailedSnapshotFuture = startFullSnapshotFromMasterClient( repoName, "failing-snapshot-2" ); awaitNumberOfSnapshotsInProgress(2); - final ActionFuture failedDeleteFuture = client(masterNode).admin() + final ActionFuture failedDeleteFuture = client(clusterManagerNode).admin() .cluster() .prepareDeleteSnapshot(repoName, "*") .execute(); @@ -725,7 +726,7 @@ public void testQueuedOperationsOnMasterDisconnectAndRepoFailure() throws Except networkDisruption.startDisrupting(); ensureStableCluster(3, dataNode); - unblockNode(repoName, masterNode); + unblockNode(repoName, clusterManagerNode); networkDisruption.stopDisrupting(); logger.info("--> make sure all failing requests get a response"); @@ -777,10 +778,10 @@ public void testQueuedSnapshotOperationsAndBrokenRepoOnMasterFailOver() throws E createNSnapshots(repoName, randomIntBetween(2, 5)); final long generation = getRepositoryData(repoName).getGenId(); - final String masterNode = internalCluster().getMasterName(); - blockNodeOnAnyFiles(repoName, masterNode); + final String clusterManagerNode = internalCluster().getMasterName(); + blockNodeOnAnyFiles(repoName, clusterManagerNode); final ActionFuture snapshotThree = startFullSnapshotFromNonMasterClient(repoName, "snapshot-three"); - waitForBlock(masterNode, repoName, TimeValue.timeValueSeconds(30L)); + waitForBlock(clusterManagerNode, repoName, TimeValue.timeValueSeconds(30L)); corruptIndexN(repoPath, generation); @@ -805,10 +806,10 @@ public void testQueuedSnapshotOperationsAndBrokenRepoOnMasterFailOver2() throws createNSnapshots(repoName, randomIntBetween(2, 5)); final long generation = getRepositoryData(repoName).getGenId(); - final String masterNode = internalCluster().getMasterName(); + final String clusterManagerNode = internalCluster().getMasterName(); blockMasterFromFinalizingSnapshotOnIndexFile(repoName); final ActionFuture snapshotThree = startFullSnapshotFromNonMasterClient(repoName, "snapshot-three"); - waitForBlock(masterNode, repoName, TimeValue.timeValueSeconds(30L)); + waitForBlock(clusterManagerNode, repoName, TimeValue.timeValueSeconds(30L)); corruptIndexN(repoPath, generation); @@ -819,7 +820,7 @@ public void testQueuedSnapshotOperationsAndBrokenRepoOnMasterFailOver2() throws internalCluster().setDisruptionScheme(networkDisruption); networkDisruption.startDisrupting(); ensureStableCluster(3, dataNode); - unblockNode(repoName, masterNode); + unblockNode(repoName, clusterManagerNode); networkDisruption.stopDisrupting(); awaitNoMoreRunningOperations(); expectThrows(OpenSearchException.class, snapshotThree::actionGet); @@ -837,14 +838,14 @@ public void testQueuedSnapshotOperationsAndBrokenRepoOnMasterFailOverMultipleRep createIndexWithContent("index-one"); createNSnapshots(repoName, randomIntBetween(2, 5)); - final String masterNode = internalCluster().getMasterName(); + final String clusterManagerNode = internalCluster().getMasterName(); final String blockedRepoName = "repo-blocked"; createRepository(blockedRepoName, "mock"); createNSnapshots(blockedRepoName, randomIntBetween(1, 5)); - blockNodeOnAnyFiles(blockedRepoName, masterNode); + blockNodeOnAnyFiles(blockedRepoName, clusterManagerNode); final ActionFuture deleteFuture = startDeleteFromNonMasterClient(blockedRepoName, "*"); - waitForBlock(masterNode, blockedRepoName, TimeValue.timeValueSeconds(30L)); + waitForBlock(clusterManagerNode, blockedRepoName, TimeValue.timeValueSeconds(30L)); awaitNDeletionsInProgress(1); final ActionFuture createBlockedSnapshot = startFullSnapshotFromNonMasterClient( blockedRepoName, @@ -853,9 +854,9 @@ public void testQueuedSnapshotOperationsAndBrokenRepoOnMasterFailOverMultipleRep awaitNumberOfSnapshotsInProgress(1); final long generation = getRepositoryData(repoName).getGenId(); - blockNodeOnAnyFiles(repoName, masterNode); + blockNodeOnAnyFiles(repoName, clusterManagerNode); final ActionFuture snapshotThree = startFullSnapshotFromNonMasterClient(repoName, "snapshot-three"); - waitForBlock(masterNode, repoName, TimeValue.timeValueSeconds(30L)); + waitForBlock(clusterManagerNode, repoName, TimeValue.timeValueSeconds(30L)); awaitNumberOfSnapshotsInProgress(2); corruptIndexN(repoPath, generation); @@ -872,8 +873,8 @@ public void testQueuedSnapshotOperationsAndBrokenRepoOnMasterFailOverMultipleRep try { createBlockedSnapshot.actionGet(); } catch (OpenSearchException ex) { - // Ignored, thrown most of the time but due to retries when shutting down the master could randomly pass when the request is - // retried and gets executed after the above delete + // Ignored, thrown most of the time but due to retries when shutting down the cluster-manager could randomly pass + // when the request is retried and gets executed after the above delete } } @@ -1206,9 +1207,9 @@ public void testMasterFailoverAndMultipleQueuedUpSnapshotsAcrossTwoRepos() throw client().admin().cluster().prepareCreateSnapshot(otherRepoName, "snapshot-other-blocked-2").setWaitForCompletion(false).get(); awaitNumberOfSnapshotsInProgress(4); - final String initialMaster = internalCluster().getMasterName(); - waitForBlock(initialMaster, repoName, TimeValue.timeValueSeconds(30L)); - waitForBlock(initialMaster, otherRepoName, TimeValue.timeValueSeconds(30L)); + final String initialClusterManager = internalCluster().getMasterName(); + waitForBlock(initialClusterManager, repoName, TimeValue.timeValueSeconds(30L)); + waitForBlock(initialClusterManager, otherRepoName, TimeValue.timeValueSeconds(30L)); internalCluster().stopCurrentMasterNode(); ensureStableCluster(3, dataNode); @@ -1417,12 +1418,12 @@ private List createNSnapshots(String repoName, int count) { } private ActionFuture startDeleteFromNonMasterClient(String repoName, String snapshotName) { - logger.info("--> deleting snapshot [{}] from repo [{}] from non master client", snapshotName, repoName); + logger.info("--> deleting snapshot [{}] from repo [{}] from non cluster-manager client", snapshotName, repoName); return internalCluster().nonMasterClient().admin().cluster().prepareDeleteSnapshot(repoName, snapshotName).execute(); } private ActionFuture startFullSnapshotFromNonMasterClient(String repoName, String snapshotName) { - logger.info("--> creating full snapshot [{}] to repo [{}] from non master client", snapshotName, repoName); + logger.info("--> creating full snapshot [{}] to repo [{}] from non cluster-manager client", snapshotName, repoName); return internalCluster().nonMasterClient() .admin() .cluster() @@ -1432,7 +1433,7 @@ private ActionFuture startFullSnapshotFromNonMasterClien } private ActionFuture startFullSnapshotFromMasterClient(String repoName, String snapshotName) { - logger.info("--> creating full snapshot [{}] to repo [{}] from master client", snapshotName, repoName); + logger.info("--> creating full snapshot [{}] to repo [{}] from cluster-manager client", snapshotName, repoName); return internalCluster().masterClient() .admin() .cluster() @@ -1488,10 +1489,10 @@ private static List currentSnapshots(String repoName) { private ActionFuture startAndBlockOnDeleteSnapshot(String repoName, String snapshotName) throws InterruptedException { - final String masterName = internalCluster().getMasterName(); - blockNodeOnAnyFiles(repoName, masterName); + final String clusterManagerName = internalCluster().getMasterName(); + blockNodeOnAnyFiles(repoName, clusterManagerName); final ActionFuture fut = startDeleteSnapshot(repoName, snapshotName); - waitForBlock(masterName, repoName, TimeValue.timeValueSeconds(30L)); + waitForBlock(clusterManagerName, repoName, TimeValue.timeValueSeconds(30L)); return fut; } diff --git a/server/src/internalClusterTest/java/org/opensearch/snapshots/DedicatedClusterSnapshotRestoreIT.java b/server/src/internalClusterTest/java/org/opensearch/snapshots/DedicatedClusterSnapshotRestoreIT.java index 46638f31b6cca..5a17b72aa73cf 100644 --- a/server/src/internalClusterTest/java/org/opensearch/snapshots/DedicatedClusterSnapshotRestoreIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/snapshots/DedicatedClusterSnapshotRestoreIT.java @@ -873,7 +873,7 @@ public void testMasterShutdownDuringSnapshot() throws Exception { assertEquals(0, snapshotInfo.failedShards()); } - public void testMasterAndDataShutdownDuringSnapshot() throws Exception { + public void testClusterManagerAndDataShutdownDuringSnapshot() throws Exception { logger.info("--> starting three cluster-manager nodes and two data nodes"); internalCluster().startMasterOnlyNodes(3); internalCluster().startDataOnlyNodes(2); @@ -890,7 +890,7 @@ public void testMasterAndDataShutdownDuringSnapshot() throws Exception { final int numberOfShards = getNumShards("test-idx").numPrimaries; logger.info("number of shards: {}", numberOfShards); - final String masterNode = blockMasterFromFinalizingSnapshotOnSnapFile("test-repo"); + final String clusterManagerNode = blockMasterFromFinalizingSnapshotOnSnapFile("test-repo"); final String dataNode = blockNodeWithIndex("test-repo", "test-idx"); dataNodeClient().admin() @@ -902,7 +902,7 @@ public void testMasterAndDataShutdownDuringSnapshot() throws Exception { logger.info("--> stopping data node {}", dataNode); stopNode(dataNode); - logger.info("--> stopping cluster-manager node {} ", masterNode); + logger.info("--> stopping cluster-manager node {} ", clusterManagerNode); internalCluster().stopCurrentMasterNode(); logger.info("--> wait until the snapshot is done"); @@ -1143,7 +1143,7 @@ public void testDeduplicateIndexMetadata() throws Exception { assertThat(snapshot3IndexMetaFiles, hasSize(1)); // should have deleted the metadata blob referenced by the first two snapshots } - public void testDataNodeRestartWithBusyMasterDuringSnapshot() throws Exception { + public void testDataNodeRestartWithBusyClusterManagerDuringSnapshot() throws Exception { logger.info("--> starting a cluster-manager node and two data nodes"); internalCluster().startClusterManagerOnlyNode(); internalCluster().startDataOnlyNodes(2); diff --git a/server/src/internalClusterTest/java/org/opensearch/snapshots/MetadataLoadingDuringSnapshotRestoreIT.java b/server/src/internalClusterTest/java/org/opensearch/snapshots/MetadataLoadingDuringSnapshotRestoreIT.java index 608a439b40fec..498f5f7c8875a 100644 --- a/server/src/internalClusterTest/java/org/opensearch/snapshots/MetadataLoadingDuringSnapshotRestoreIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/snapshots/MetadataLoadingDuringSnapshotRestoreIT.java @@ -198,7 +198,7 @@ private void assertIndexMetadataLoads(final String snapshot, final String index, } private CountingMockRepository getCountingMockRepository() { - String master = internalCluster().getMasterName(); + String clusterManager = internalCluster().getMasterName(); RepositoriesService repositoriesService = internalCluster().getInstance(RepositoriesService.class, master); Repository repository = repositoriesService.repository("repository"); assertThat(repository, instanceOf(CountingMockRepository.class)); diff --git a/server/src/internalClusterTest/java/org/opensearch/snapshots/RepositoriesIT.java b/server/src/internalClusterTest/java/org/opensearch/snapshots/RepositoriesIT.java index 662e97dd84fda..e72110f4c4efd 100644 --- a/server/src/internalClusterTest/java/org/opensearch/snapshots/RepositoriesIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/snapshots/RepositoriesIT.java @@ -177,15 +177,15 @@ public void testResidualStaleIndicesAreDeletedByConsecutiveDelete() throws Excep // Make repository to throw exception when trying to delete stale indices // This will make sure stale indices stays in repository after snapshot delete - String masterNode = internalCluster().getMasterName(); - ((MockRepository) internalCluster().getInstance(RepositoriesService.class, masterNode).repository("test-repo")) + String clusterManagerNode = internalCluster().getMasterName(); + ((MockRepository) internalCluster().getInstance(RepositoriesService.class, clusterManagerNode).repository("test-repo")) .setThrowExceptionWhileDelete(true); logger.info("--> delete the bulk of the snapshots"); client.admin().cluster().prepareDeleteSnapshot(repositoryName, bulkSnapshotsPattern).get(); // Make repository to work normally - ((MockRepository) internalCluster().getInstance(RepositoriesService.class, masterNode).repository("test-repo")) + ((MockRepository) internalCluster().getInstance(RepositoriesService.class, clusterManagerNode).repository("test-repo")) .setThrowExceptionWhileDelete(false); // This snapshot should delete last snapshot's residual stale indices as well diff --git a/server/src/internalClusterTest/java/org/opensearch/snapshots/RepositoryFilterUserMetadataIT.java b/server/src/internalClusterTest/java/org/opensearch/snapshots/RepositoryFilterUserMetadataIT.java index 9ee479cdd7fe0..12d9b6f4ca440 100644 --- a/server/src/internalClusterTest/java/org/opensearch/snapshots/RepositoryFilterUserMetadataIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/snapshots/RepositoryFilterUserMetadataIT.java @@ -78,7 +78,9 @@ public void testFilteredRepoMetadataIsUsed() { .preparePutRepository(repoName) .setType(MetadataFilteringPlugin.TYPE) .setSettings( - Settings.builder().put("location", randomRepoPath()).put(MetadataFilteringPlugin.MASTER_SETTING_VALUE, masterName) + Settings.builder() + .put("location", randomRepoPath()) + .put(MetadataFilteringPlugin.CLUSTER_MANAGER_SETTING_VALUE, masterName) ) ); createIndex("test-idx"); @@ -91,12 +93,12 @@ public void testFilteredRepoMetadataIsUsed() { assertThat(snapshotInfo.userMetadata(), is(Collections.singletonMap(MetadataFilteringPlugin.MOCK_FILTERED_META, masterName))); } - // Mock plugin that stores the name of the master node that started a snapshot in each snapshot's metadata + // Mock plugin that stores the name of the cluster-manager node that started a snapshot in each snapshot's metadata public static final class MetadataFilteringPlugin extends org.opensearch.plugins.Plugin implements RepositoryPlugin { private static final String MOCK_FILTERED_META = "mock_filtered_meta"; - private static final String MASTER_SETTING_VALUE = "initial_master"; + private static final String CLUSTER_MANAGER_SETTING_VALUE = "initial_master"; private static final String TYPE = "mock_meta_filtering"; @@ -112,8 +114,8 @@ public Map getRepositories( metadata -> new FsRepository(metadata, env, namedXContentRegistry, clusterService, recoverySettings) { // Storing the initially expected metadata value here to verify that #filterUserMetadata is only called once on the - // initial master node starting the snapshot - private final String initialMetaValue = metadata.settings().get(MASTER_SETTING_VALUE); + // initial cluster-manager node starting the snapshot + private final String initialMetaValue = metadata.settings().get(CLUSTER_MANAGER_SETTING_VALUE); @Override public void finalizeSnapshot( diff --git a/server/src/internalClusterTest/java/org/opensearch/snapshots/SnapshotStatusApisIT.java b/server/src/internalClusterTest/java/org/opensearch/snapshots/SnapshotStatusApisIT.java index 6c697439b241d..1376961825e8b 100644 --- a/server/src/internalClusterTest/java/org/opensearch/snapshots/SnapshotStatusApisIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/snapshots/SnapshotStatusApisIT.java @@ -237,7 +237,7 @@ public void testCorrectCountsForDoneShards() throws Exception { blockDataNode(repoName, dataNodeOne); final String snapshotOne = "snap-1"; - // restarting a data node below so using a master client here + // restarting a data node below so using a cluster-manager client here final ActionFuture responseSnapshotOne = internalCluster().masterClient() .admin() .cluster() diff --git a/server/src/internalClusterTest/java/org/opensearch/versioning/ConcurrentDocumentOperationIT.java b/server/src/internalClusterTest/java/org/opensearch/versioning/ConcurrentDocumentOperationIT.java index e433a489ad572..661efbaf9cd01 100644 --- a/server/src/internalClusterTest/java/org/opensearch/versioning/ConcurrentDocumentOperationIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/versioning/ConcurrentDocumentOperationIT.java @@ -77,9 +77,9 @@ public void onFailure(Exception e) { client().admin().indices().prepareRefresh().execute().actionGet(); logger.info("done indexing, check all have the same field value"); - Map masterSource = client().prepareGet("test", "1").execute().actionGet().getSourceAsMap(); + Map clusterManagerSource = client().prepareGet("test", "1").execute().actionGet().getSourceAsMap(); for (int i = 0; i < (cluster().size() * 5); i++) { - assertThat(client().prepareGet("test", "1").execute().actionGet().getSourceAsMap(), equalTo(masterSource)); + assertThat(client().prepareGet("test", "1").execute().actionGet().getSourceAsMap(), equalTo(clusterManagerSource)); } } } From d41b1edaafd6f1248a1a4c36995aaae974a057f8 Mon Sep 17 00:00:00 2001 From: Tianli Feng Date: Sun, 15 May 2022 12:19:08 -0700 Subject: [PATCH 04/11] Resolve compile error Signed-off-by: Tianli Feng --- .../coordination/VotingConfigurationIT.java | 6 +-- .../cluster/coordination/ZenDiscoveryIT.java | 4 +- .../cluster/routing/PrimaryAllocationIT.java | 10 ++--- .../discovery/DiscoveryDisruptionIT.java | 12 +++--- .../discovery/MasterDisruptionIT.java | 4 +- .../discovery/StableMasterDisruptionIT.java | 43 +++++++++++-------- ...etadataLoadingDuringSnapshotRestoreIT.java | 2 +- 7 files changed, 43 insertions(+), 38 deletions(-) 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 c12f3e302a29c..544565f4c1cd4 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/VotingConfigurationIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/VotingConfigurationIT.java @@ -66,10 +66,10 @@ public void testAbdicateAfterVotingConfigExclusionAdded() throws ExecutionExcept internalCluster().startNodes(2); final String originalClusterManager = internalCluster().getMasterName(); - logger.info("--> excluding cluster-manager node {}", originalMaster); - client().execute(AddVotingConfigExclusionsAction.INSTANCE, new AddVotingConfigExclusionsRequest(originalMaster)).get(); + logger.info("--> excluding cluster-manager node {}", originalClusterManager); + client().execute(AddVotingConfigExclusionsAction.INSTANCE, new AddVotingConfigExclusionsRequest(originalClusterManager)).get(); client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).get(); - assertNotEquals(originalMaster, internalCluster().getMasterName()); + assertNotEquals(originalClusterManager, internalCluster().getMasterName()); } public void testElectsNodeNotInVotingConfiguration() throws Exception { 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 704965824a914..6c0a0c45ce9f0 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/ZenDiscoveryIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/ZenDiscoveryIT.java @@ -96,13 +96,13 @@ public void testNoShardRelocationsOccurWhenElectedMasterNodeFails() throws Excep assertBusy(() -> { String current = internalCluster().getMasterName(); assertThat(current, notNullValue()); - assertThat(current, not(equalTo(oldMaster))); + assertThat(current, not(equalTo(oldClusterManager))); }); ensureSearchable("test"); r = client().admin().indices().prepareRecoveries("test").get(); int numRecoveriesAfterNewClusterManager = r.shardRecoveryStates().get("test").size(); - assertThat(numRecoveriesAfterNewMaster, equalTo(numRecoveriesBeforeNewMaster)); + assertThat(numRecoveriesAfterNewClusterManager, equalTo(numRecoveriesBeforeNewClusterManager)); } public void testHandleNodeJoin_incompatibleClusterState() throws InterruptedException, ExecutionException, TimeoutException { 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 7cc4877df49a8..686c2a41572a1 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/routing/PrimaryAllocationIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/routing/PrimaryAllocationIT.java @@ -216,7 +216,7 @@ public void testDoNotAllowStaleReplicasToBePromotedToPrimary() throws Exception .get() ); ensureGreen(); - final Settings inSyncDataPathSettings = createStaleReplicaScenario(master); + final Settings inSyncDataPathSettings = createStaleReplicaScenario(clusterManager); logger.info("--> starting node that reuses data folder with the up-to-date primary shard"); internalCluster().startDataOnlyNode(inSyncDataPathSettings); @@ -674,7 +674,7 @@ public void testPrimaryReplicaResyncFailed() throws Exception { ensureGreen(); String timeout = randomFrom("0s", "1s", "2s"); assertAcked( - client(master).admin() + client(clusterManager).admin() .cluster() .prepareUpdateSettings() .setTransientSettings(Settings.builder().put("cluster.routing.allocation.enable", "none")) @@ -703,7 +703,7 @@ public void testPrimaryReplicaResyncFailed() throws Exception { internalCluster().stopRandomNode(InternalTestCluster.nameFilter(oldPrimary)); // Checks that we fails replicas in one side but not mark them as stale. assertBusy(() -> { - ClusterState state = client(master).admin().cluster().prepareState().get().getState(); + ClusterState state = client(clusterManager).admin().cluster().prepareState().get().getState(); final IndexShardRoutingTable shardRoutingTable = state.routingTable().shardRoutingTable(shardId); final String newPrimaryNode = state.getRoutingNodes().node(shardRoutingTable.primary.currentNodeId()).node().getName(); assertThat(newPrimaryNode, not(equalTo(oldPrimary))); @@ -715,7 +715,7 @@ public void testPrimaryReplicaResyncFailed() throws Exception { assertThat(state.metadata().index("test").inSyncAllocationIds(shardId.id()), hasSize(numberOfReplicas + 1)); }, 1, TimeUnit.MINUTES); assertAcked( - client(master).admin() + client(clusterManager).admin() .cluster() .prepareUpdateSettings() .setTransientSettings(Settings.builder().put("cluster.routing.allocation.enable", "all")) @@ -725,7 +725,7 @@ public void testPrimaryReplicaResyncFailed() throws Exception { partition.ensureHealthy(internalCluster()); logger.info("--> stop disrupting network and re-enable allocation"); assertBusy(() -> { - ClusterState state = client(master).admin().cluster().prepareState().get().getState(); + ClusterState state = client(clusterManager).admin().cluster().prepareState().get().getState(); assertThat(state.routingTable().shardRoutingTable(shardId).activeShards(), hasSize(numberOfReplicas)); assertThat(state.metadata().index("test").inSyncAllocationIds(shardId.id()), hasSize(numberOfReplicas + 1)); for (String node : replicaNodes) { diff --git a/server/src/internalClusterTest/java/org/opensearch/discovery/DiscoveryDisruptionIT.java b/server/src/internalClusterTest/java/org/opensearch/discovery/DiscoveryDisruptionIT.java index a4ebbf50b24e5..ccbd3b1e4bd38 100644 --- a/server/src/internalClusterTest/java/org/opensearch/discovery/DiscoveryDisruptionIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/discovery/DiscoveryDisruptionIT.java @@ -161,15 +161,15 @@ public void testElectMasterWithLatestVersion() throws Exception { } internalCluster().clearDisruptionScheme(); ensureStableCluster(3); - final String preferredMasterName = internalCluster().getMasterName(); - final DiscoveryNode preferredClusterManager = internalCluster().clusterService(preferredMasterName).localNode(); + final String preferredClusterManagerName = internalCluster().getMasterName(); + final DiscoveryNode preferredClusterManager = internalCluster().clusterService(preferredClusterManagerName).localNode(); - logger.info("--> preferred cluster-manager is {}", preferredMaster); + logger.info("--> preferred cluster-manager is {}", preferredClusterManager); final Set nonPreferredNodes = new HashSet<>(nodes); - nonPreferredNodes.remove(preferredMasterName); + nonPreferredNodes.remove(preferredClusterManagerName); final ServiceDisruptionScheme isolatePreferredClusterManager = isolateMasterDisruption(NetworkDisruption.DISCONNECT); - internalCluster().setDisruptionScheme(isolatePreferredMaster); - isolatePreferredMaster.startDisrupting(); + internalCluster().setDisruptionScheme(isolatePreferredClusterManager); + isolatePreferredClusterManager.startDisrupting(); client(randomFrom(nonPreferredNodes)).admin() .indices() diff --git a/server/src/internalClusterTest/java/org/opensearch/discovery/MasterDisruptionIT.java b/server/src/internalClusterTest/java/org/opensearch/discovery/MasterDisruptionIT.java index 5d66c62adc236..91b548c3f746f 100644 --- a/server/src/internalClusterTest/java/org/opensearch/discovery/MasterDisruptionIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/discovery/MasterDisruptionIT.java @@ -104,8 +104,8 @@ public void testMasterNodeGCs() throws Exception { // make sure all nodes agree on master String newClusterManager = internalCluster().getMasterName(); - assertThat(newMaster, not(equalTo(oldClusterManagerNode))); - assertMaster(newMaster, nodes); + assertThat(newClusterManager, not(equalTo(oldClusterManagerNode))); + assertMaster(newClusterManager, nodes); } /** diff --git a/server/src/internalClusterTest/java/org/opensearch/discovery/StableMasterDisruptionIT.java b/server/src/internalClusterTest/java/org/opensearch/discovery/StableMasterDisruptionIT.java index 0ecafa7755ad9..dc6ff06ada5ee 100644 --- a/server/src/internalClusterTest/java/org/opensearch/discovery/StableMasterDisruptionIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/discovery/StableMasterDisruptionIT.java @@ -168,7 +168,7 @@ private void testFollowerCheckerAfterMasterReelection(NetworkLinkDisruptionType final String clusterManager = internalCluster().getMasterName(); final List nonMasters = Arrays.stream(internalCluster().getNodeNames()) - .filter(n -> master.equals(n) == false) + .filter(n -> clusterManager.equals(n) == false) .collect(Collectors.toList()); final String isolatedNode = randomFrom(nonMasters); final String otherNode = nonMasters.get(nonMasters.get(0).equals(isolatedNode) ? 1 : 0); @@ -176,14 +176,14 @@ private void testFollowerCheckerAfterMasterReelection(NetworkLinkDisruptionType logger.info("--> isolating [{}]", isolatedNode); final NetworkDisruption networkDisruption = new NetworkDisruption( - new TwoPartitions(singleton(isolatedNode), Sets.newHashSet(master, otherNode)), + new TwoPartitions(singleton(isolatedNode), Sets.newHashSet(clusterManager, otherNode)), networkLinkDisruptionType ); setDisruptionScheme(networkDisruption); networkDisruption.startDisrupting(); logger.info("--> waiting for cluster-manager to remove it"); - ensureStableCluster(2, master); + ensureStableCluster(2, clusterManager); ensureNoMaster(isolatedNode); networkDisruption.stopDisrupting(); @@ -205,14 +205,14 @@ public void testStaleMasterNotHijackingMajority() throws Exception { ensureStableCluster(3); // Save the current cluster-manager node as old cluster-manager node, because that node will get frozen - final String oldMasterNode = internalCluster().getMasterName(); + final String oldClusterManagerNode = internalCluster().getMasterName(); // Simulating a painful gc by suspending all threads for a long time on the current elected cluster-manager node. - SingleNodeDisruption masterNodeDisruption = new LongGCDisruption(random(), oldMasterNode); + SingleNodeDisruption clusterManagerNodeDisruption = new LongGCDisruption(random(), oldClusterManagerNode); // Save the majority side final List majoritySide = new ArrayList<>(nodes); - majoritySide.remove(oldMasterNode); + majoritySide.remove(oldClusterManagerNode); // Keeps track of the previous and current cluster-manager when a cluster-manager node transition took place on each node on the // majority side: @@ -222,30 +222,30 @@ public void testStaleMasterNotHijackingMajority() throws Exception { internalCluster().getInstance(ClusterService.class, node).addListener(event -> { DiscoveryNode previousClusterManager = event.previousState().nodes().getMasterNode(); DiscoveryNode currentClusterManager = event.state().nodes().getMasterNode(); - if (!Objects.equals(previousMaster, currentMaster)) { + if (!Objects.equals(previousClusterManager, currentClusterManager)) { logger.info( "--> node {} received new cluster state: {} \n and had previous cluster state: {}", node, event.state(), event.previousState() ); - String previousClusterManagerNodeName = previousClusterManager != null ? previousMaster.getName() : null; - String currentMasterNodeName = currentClusterManager != null ? currentMaster.getName() : null; + String previousClusterManagerNodeName = previousClusterManager != null ? previousClusterManager.getName() : null; + String currentMasterNodeName = currentClusterManager != null ? currentClusterManager.getName() : null; masters.get(node).add(new Tuple<>(previousClusterManagerNodeName, currentMasterNodeName)); } }); } final CountDownLatch oldMasterNodeSteppedDown = new CountDownLatch(1); - internalCluster().getInstance(ClusterService.class, oldMasterNode).addListener(event -> { + internalCluster().getInstance(ClusterService.class, oldClusterManagerNode).addListener(event -> { if (event.state().nodes().getMasterNodeId() == null) { oldMasterNodeSteppedDown.countDown(); } }); - internalCluster().setDisruptionScheme(masterNodeDisruption); - logger.info("--> freezing node [{}]", oldMasterNode); - masterNodeDisruption.startDisrupting(); + internalCluster().setDisruptionScheme(clusterManagerNodeDisruption); + logger.info("--> freezing node [{}]", oldClusterManagerNode); + clusterManagerNodeDisruption.startDisrupting(); // Wait for majority side to elect a new master assertBusy(() -> { @@ -260,7 +260,7 @@ public void testStaleMasterNotHijackingMajority() throws Exception { // once the old cluster-manager node un-freezes it gets executed. The old cluster-manager node will send this update + the cluster // state where it is // flagged as cluster-manager to the other nodes that follow the new master. These nodes should ignore this update. - internalCluster().getInstance(ClusterService.class, oldMasterNode) + internalCluster().getInstance(ClusterService.class, oldClusterManagerNode) .submitStateUpdateTask("sneaky-update", new ClusterStateUpdateTask(Priority.IMMEDIATE) { @Override public ClusterState execute(ClusterState currentState) { @@ -278,11 +278,11 @@ public void onFailure(String source, Exception e) { logger.info("--> new detected cluster-manager node [{}]", newMasterNode); // Stop disruption - logger.info("--> unfreezing node [{}]", oldMasterNode); - masterNodeDisruption.stopDisrupting(); + logger.info("--> unfreezing node [{}]", oldClusterManagerNode); + clusterManagerNodeDisruption.stopDisrupting(); oldMasterNodeSteppedDown.await(30, TimeUnit.SECONDS); - logger.info("--> [{}] stepped down as master", oldMasterNode); + logger.info("--> [{}] stepped down as master", oldClusterManagerNode); ensureStableCluster(3); assertThat(masters.size(), equalTo(2)); @@ -290,8 +290,13 @@ public void onFailure(String source, Exception e) { String nodeName = entry.getKey(); List> transitions = entry.getValue(); assertTrue( - "[" + nodeName + "] should not apply state from old cluster-manager [" + oldMasterNode + "] but it did: " + transitions, - transitions.stream().noneMatch(t -> oldMasterNode.equals(t.v2())) + "[" + + nodeName + + "] should not apply state from old cluster-manager [" + + oldClusterManagerNode + + "] but it did: " + + transitions, + transitions.stream().noneMatch(t -> oldClusterManagerNode.equals(t.v2())) ); } } diff --git a/server/src/internalClusterTest/java/org/opensearch/snapshots/MetadataLoadingDuringSnapshotRestoreIT.java b/server/src/internalClusterTest/java/org/opensearch/snapshots/MetadataLoadingDuringSnapshotRestoreIT.java index 498f5f7c8875a..0750675d46b9c 100644 --- a/server/src/internalClusterTest/java/org/opensearch/snapshots/MetadataLoadingDuringSnapshotRestoreIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/snapshots/MetadataLoadingDuringSnapshotRestoreIT.java @@ -199,7 +199,7 @@ private void assertIndexMetadataLoads(final String snapshot, final String index, private CountingMockRepository getCountingMockRepository() { String clusterManager = internalCluster().getMasterName(); - RepositoriesService repositoriesService = internalCluster().getInstance(RepositoriesService.class, master); + RepositoriesService repositoriesService = internalCluster().getInstance(RepositoriesService.class, clusterManager); Repository repository = repositoriesService.repository("repository"); assertThat(repository, instanceOf(CountingMockRepository.class)); return (CountingMockRepository) repository; From f5fde30137064f4f5522cccbb789b25d09aef93a Mon Sep 17 00:00:00 2001 From: Tianli Feng Date: Sun, 15 May 2022 12:39:05 -0700 Subject: [PATCH 05/11] Replace 'master' terminology with 'cluster manager' in server/src/internalClusterTest directory Signed-off-by: Tianli Feng --- .../master/IndexingMasterFailoverIT.java | 4 +- .../cluster/MinimumMasterNodesIT.java | 2 +- .../opensearch/cluster/NoMasterNodeIT.java | 2 +- .../cluster/SimpleClusterStateIT.java | 11 +++- .../cluster/SpecificMasterNodesIT.java | 34 ++++++------ .../coordination/RareClusterStateIT.java | 12 ++-- .../UnsafeBootstrapAndDetachCommandIT.java | 44 +++++++-------- .../cluster/coordination/ZenDiscoveryIT.java | 6 +- .../cluster/routing/PrimaryAllocationIT.java | 2 +- .../allocation/decider/MockDiskUsagesIT.java | 12 ++-- .../discovery/ClusterDisruptionIT.java | 18 +++--- .../discovery/DiscoveryDisruptionIT.java | 55 ++++++++++++------- .../discovery/MasterDisruptionIT.java | 30 +++++----- .../discovery/SnapshotDisruptionIT.java | 30 +++++----- .../discovery/StableMasterDisruptionIT.java | 42 +++++++------- .../opensearch/gateway/MetadataNodesIT.java | 18 +++--- .../gateway/RecoverAfterNodesIT.java | 30 +++++----- .../index/mapper/DynamicMappingIT.java | 6 +- .../indices/recovery/IndexRecoveryIT.java | 8 +-- .../BlobStoreRepositoryCleanupIT.java | 10 ++-- .../opensearch/snapshots/CloneSnapshotIT.java | 40 +++++++------- .../snapshots/ConcurrentSnapshotsIT.java | 24 ++++---- .../DedicatedClusterSnapshotRestoreIT.java | 2 +- .../RepositoryFilterUserMetadataIT.java | 9 ++- .../snapshots/SnapshotShardsServiceIT.java | 2 +- .../test/OpenSearchIntegTestCase.java | 2 +- 26 files changed, 239 insertions(+), 216 deletions(-) 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 59654be2d2b13..cb88435d59633 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 @@ -62,7 +62,7 @@ protected Collection> nodePlugins() { * If the cluster-manager node is being disrupted or if it cannot commit cluster state changes, it needs to retry within timeout limits. * This retry logic is implemented in TransportMasterNodeAction and tested by the following cluster-manager failover scenario. */ - public void testMasterFailoverDuringIndexingWithMappingChanges() throws Throwable { + public void testClusterManagerFailoverDuringIndexingWithMappingChanges() throws Throwable { logger.info("--> start 4 nodes, 3 cluster-manager, 1 data"); internalCluster().setBootstrapClusterManagerNodeIndex(2); @@ -109,7 +109,7 @@ public void run() { barrier.await(); // interrupt communication between cluster-manager and other nodes in cluster - NetworkDisruption partition = isolateMasterDisruption(NetworkDisruption.DISCONNECT); + NetworkDisruption partition = isolateClusterManagerDisruption(NetworkDisruption.DISCONNECT); internalCluster().setDisruptionScheme(partition); logger.info("--> disrupting network"); diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/MinimumMasterNodesIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/MinimumMasterNodesIT.java index e575c6b123905..c2ea62de4efa6 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/MinimumMasterNodesIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/MinimumMasterNodesIT.java @@ -350,7 +350,7 @@ public void testCannotCommitStateThreeNodes() throws Exception { final String clusterManager = internalCluster().getMasterName(); Set otherNodes = new HashSet<>(Arrays.asList(internalCluster().getNodeNames())); otherNodes.remove(clusterManager); - NetworkDisruption partition = isolateMasterDisruption(NetworkDisruption.DISCONNECT); + NetworkDisruption partition = isolateClusterManagerDisruption(NetworkDisruption.DISCONNECT); internalCluster().setDisruptionScheme(partition); final CountDownLatch latch = new CountDownLatch(1); diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/NoMasterNodeIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/NoMasterNodeIT.java index de8996100f3b0..6e5ab4dd0d398 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/NoMasterNodeIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/NoMasterNodeIT.java @@ -338,7 +338,7 @@ public void testNoClusterManagerActionsWriteClusterManagerBlock() throws Excepti internalCluster().clearDisruptionScheme(true); } - public void testNoMasterActionsMetadataWriteMasterBlock() throws Exception { + public void testNoClusterManagerActionsMetadataWriteClusterManagerBlock() throws Exception { Settings settings = Settings.builder() .put(NoMasterBlockService.NO_CLUSTER_MANAGER_BLOCK_SETTING.getKey(), "metadata_write") .put(MappingUpdatedAction.INDICES_MAPPING_DYNAMIC_TIMEOUT_SETTING.getKey(), "100ms") diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/SimpleClusterStateIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/SimpleClusterStateIT.java index 19f7b0b4c630c..e3adeb1ad8d82 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/SimpleClusterStateIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/SimpleClusterStateIT.java @@ -286,7 +286,12 @@ public void testLargeClusterStatePublishing() throws Exception { .get() ); ensureGreen(); // wait for green state, so its both green, and there are no more pending events - MappingMetadata masterMappingMetadata = client().admin().indices().prepareGetMappings("test").get().getMappings().get("test"); + MappingMetadata clusterManagerMappingMetadata = client().admin() + .indices() + .prepareGetMappings("test") + .get() + .getMappings() + .get("test"); for (Client client : clients()) { MappingMetadata mappingMetadata = client.admin() .indices() @@ -295,8 +300,8 @@ public void testLargeClusterStatePublishing() throws Exception { .get() .getMappings() .get("test"); - assertThat(mappingMetadata.source().string(), equalTo(masterMappingMetadata.source().string())); - assertThat(mappingMetadata, equalTo(masterMappingMetadata)); + assertThat(mappingMetadata.source().string(), equalTo(clusterManagerMappingMetadata.source().string())); + assertThat(mappingMetadata, equalTo(clusterManagerMappingMetadata)); } } diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/SpecificMasterNodesIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/SpecificMasterNodesIT.java index 507da332af1f3..1b89e268df25b 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/SpecificMasterNodesIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/SpecificMasterNodesIT.java @@ -55,7 +55,7 @@ @ClusterScope(scope = Scope.TEST, numDataNodes = 0, autoManageMasterNodes = false) public class SpecificMasterNodesIT extends OpenSearchIntegTestCase { - public void testSimpleOnlyMasterNodeElection() throws IOException { + public void testSimpleOnlyClusterManagerNodeElection() throws IOException { internalCluster().setBootstrapClusterManagerNodeIndex(0); logger.info("--> start data node / non cluster-manager node"); internalCluster().startNode(Settings.builder().put(dataOnlyNode()).put("discovery.initial_state_timeout", "1s")); @@ -77,7 +77,7 @@ public void testSimpleOnlyMasterNodeElection() throws IOException { // all is well, no cluster-manager elected } logger.info("--> start cluster-manager node"); - final String masterNodeName = internalCluster().startClusterManagerOnlyNode(); + final String clusterManagerNodeName = internalCluster().startClusterManagerOnlyNode(); assertThat( internalCluster().nonMasterClient() .admin() @@ -89,7 +89,7 @@ public void testSimpleOnlyMasterNodeElection() throws IOException { .nodes() .getMasterNode() .getName(), - equalTo(masterNodeName) + equalTo(clusterManagerNodeName) ); assertThat( internalCluster().masterClient() @@ -102,11 +102,11 @@ public void testSimpleOnlyMasterNodeElection() throws IOException { .nodes() .getMasterNode() .getName(), - equalTo(masterNodeName) + equalTo(clusterManagerNodeName) ); logger.info("--> stop cluster-manager node"); - Settings masterDataPathSettings = internalCluster().dataPathSettings(internalCluster().getMasterName()); + Settings clusterManagerDataPathSettings = internalCluster().dataPathSettings(internalCluster().getMasterName()); internalCluster().stopCurrentMasterNode(); try { @@ -128,8 +128,8 @@ public void testSimpleOnlyMasterNodeElection() throws IOException { } logger.info("--> start previous cluster-manager node again"); - final String nextMasterEligibleNodeName = internalCluster().startNode( - Settings.builder().put(nonDataNode(masterNode())).put(masterDataPathSettings) + final String nextClusterManagerEligibleNodeName = internalCluster().startNode( + Settings.builder().put(nonDataNode(masterNode())).put(clusterManagerDataPathSettings) ); assertThat( internalCluster().nonMasterClient() @@ -142,7 +142,7 @@ public void testSimpleOnlyMasterNodeElection() throws IOException { .nodes() .getMasterNode() .getName(), - equalTo(nextMasterEligibleNodeName) + equalTo(nextClusterManagerEligibleNodeName) ); assertThat( internalCluster().masterClient() @@ -155,7 +155,7 @@ public void testSimpleOnlyMasterNodeElection() throws IOException { .nodes() .getMasterNode() .getName(), - equalTo(nextMasterEligibleNodeName) + equalTo(nextClusterManagerEligibleNodeName) ); } @@ -181,7 +181,7 @@ public void testElectOnlyBetweenMasterNodes() throws Exception { // all is well, no cluster-manager elected } logger.info("--> start cluster-manager node (1)"); - final String masterNodeName = internalCluster().startClusterManagerOnlyNode(); + final String clusterManagerNodeName = internalCluster().startClusterManagerOnlyNode(); assertThat( internalCluster().nonMasterClient() .admin() @@ -193,7 +193,7 @@ public void testElectOnlyBetweenMasterNodes() throws Exception { .nodes() .getMasterNode() .getName(), - equalTo(masterNodeName) + equalTo(clusterManagerNodeName) ); assertThat( internalCluster().masterClient() @@ -206,7 +206,7 @@ public void testElectOnlyBetweenMasterNodes() throws Exception { .nodes() .getMasterNode() .getName(), - equalTo(masterNodeName) + equalTo(clusterManagerNodeName) ); logger.info("--> start cluster-manager node (2)"); @@ -222,7 +222,7 @@ public void testElectOnlyBetweenMasterNodes() throws Exception { .nodes() .getMasterNode() .getName(), - equalTo(masterNodeName) + equalTo(clusterManagerNodeName) ); assertThat( internalCluster().nonMasterClient() @@ -235,7 +235,7 @@ public void testElectOnlyBetweenMasterNodes() throws Exception { .nodes() .getMasterNode() .getName(), - equalTo(masterNodeName) + equalTo(clusterManagerNodeName) ); assertThat( internalCluster().masterClient() @@ -248,11 +248,11 @@ public void testElectOnlyBetweenMasterNodes() throws Exception { .nodes() .getMasterNode() .getName(), - equalTo(masterNodeName) + equalTo(clusterManagerNodeName) ); logger.info("--> closing cluster-manager node (1)"); - client().execute(AddVotingConfigExclusionsAction.INSTANCE, new AddVotingConfigExclusionsRequest(masterNodeName)).get(); + client().execute(AddVotingConfigExclusionsAction.INSTANCE, new AddVotingConfigExclusionsRequest(clusterManagerNodeName)).get(); // removing the cluster-manager from the voting configuration immediately triggers the cluster-manager to step down assertBusy(() -> { assertThat( @@ -282,7 +282,7 @@ public void testElectOnlyBetweenMasterNodes() throws Exception { equalTo(nextClusterManagerEligableNodeName) ); }); - internalCluster().stopRandomNode(InternalTestCluster.nameFilter(masterNodeName)); + internalCluster().stopRandomNode(InternalTestCluster.nameFilter(clusterManagerNodeName)); assertThat( internalCluster().nonMasterClient() .admin() 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 1361d13dae91e..61b186c951ce8 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/RareClusterStateIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/RareClusterStateIT.java @@ -159,16 +159,16 @@ private ActionFuture { - assertFalse(masterCoordinator.publicationInProgress()); - final long applierVersion = masterCoordinator.getApplierState().version(); + assertFalse(clusterManagerCoordinator.publicationInProgress()); + final long applierVersion = clusterManagerCoordinator.getApplierState().version(); for (Discovery instance : internalCluster().getInstances(Discovery.class)) { assertEquals(((Coordinator) instance).getApplierState().version(), applierVersion); } }); ActionFuture future = req.execute(); - assertBusy(() -> assertTrue(masterCoordinator.cancelCommittedPublication())); + assertBusy(() -> assertTrue(clusterManagerCoordinator.cancelCommittedPublication())); return future; } @@ -202,9 +202,9 @@ public void testDeleteCreateInOneBulk() throws Exception { ensureGreen(TimeValue.timeValueMinutes(30), "test"); // due to publish_timeout of 0, wait for data node to have cluster state fully applied assertBusy(() -> { - long masterClusterStateVersion = internalCluster().clusterService(internalCluster().getMasterName()).state().version(); + long clusterManagerClusterStateVersion = internalCluster().clusterService(internalCluster().getMasterName()).state().version(); long dataClusterStateVersion = internalCluster().clusterService(dataNode).state().version(); - assertThat(masterClusterStateVersion, equalTo(dataClusterStateVersion)); + assertThat(clusterManagerClusterStateVersion, equalTo(dataClusterStateVersion)); }); assertHitCount(client().prepareSearch("test").get(), 0); } 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 88dbbcca3e4bb..b0153a1306928 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/UnsafeBootstrapAndDetachCommandIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/UnsafeBootstrapAndDetachCommandIT.java @@ -167,7 +167,7 @@ private void removeBlock() { } } - public void testBootstrapNotMasterEligible() { + public void testBootstrapNotClusterManagerEligible() { final Environment environment = TestEnvironment.newEnvironment( Settings.builder().put(nonMasterNode(internalCluster().getDefaultSettings())).build() ); @@ -283,7 +283,7 @@ public void testDetachAbortedByUser() throws IOException { expectThrows(() -> detachCluster(environment, true), OpenSearchNodeCommand.ABORTED_BY_USER_MSG); } - public void test3MasterNodes2Failed() throws Exception { + public void test3ClusterManagerNodes2Failed() throws Exception { internalCluster().setBootstrapClusterManagerNodeIndex(2); List clusterManagerNodes = new ArrayList<>(); @@ -313,9 +313,9 @@ public void test3MasterNodes2Failed() throws Exception { createIndex("test"); ensureGreen("test"); - Settings master1DataPathSettings = internalCluster().dataPathSettings(clusterManagerNodes.get(0)); - Settings master2DataPathSettings = internalCluster().dataPathSettings(clusterManagerNodes.get(1)); - Settings master3DataPathSettings = internalCluster().dataPathSettings(clusterManagerNodes.get(2)); + Settings clusterManager1DataPathSettings = internalCluster().dataPathSettings(clusterManagerNodes.get(0)); + Settings clusterManager2DataPathSettings = internalCluster().dataPathSettings(clusterManagerNodes.get(1)); + Settings clusterManager3DataPathSettings = internalCluster().dataPathSettings(clusterManagerNodes.get(2)); Settings dataNodeDataPathSettings = internalCluster().dataPathSettings(dataNode); logger.info("--> stop 2nd and 3d cluster-manager eligible node"); @@ -336,10 +336,10 @@ public void test3MasterNodes2Failed() throws Exception { }); logger.info("--> try to unsafely bootstrap 1st cluster-manager-eligible node, while node lock is held"); - Environment environmentMaster1 = TestEnvironment.newEnvironment( - Settings.builder().put(internalCluster().getDefaultSettings()).put(master1DataPathSettings).build() + Environment environmentClusterManager1 = TestEnvironment.newEnvironment( + Settings.builder().put(internalCluster().getDefaultSettings()).put(clusterManager1DataPathSettings).build() ); - expectThrows(() -> unsafeBootstrap(environmentMaster1), UnsafeBootstrapMasterCommand.FAILED_TO_OBTAIN_NODE_LOCK_MSG); + expectThrows(() -> unsafeBootstrap(environmentClusterManager1), UnsafeBootstrapMasterCommand.FAILED_TO_OBTAIN_NODE_LOCK_MSG); logger.info("--> stop 1st cluster-manager-eligible node and data-only node"); NodeEnvironment nodeEnvironment = internalCluster().getMasterNodeInstance(NodeEnvironment.class); @@ -348,7 +348,7 @@ public void test3MasterNodes2Failed() throws Exception { internalCluster().stopRandomDataNode(); logger.info("--> unsafely-bootstrap 1st cluster-manager-eligible node"); - MockTerminal terminal = unsafeBootstrap(environmentMaster1, false, true); + MockTerminal terminal = unsafeBootstrap(environmentClusterManager1, false, true); Metadata metadata = OpenSearchNodeCommand.createPersistedClusterStateService(Settings.EMPTY, nodeEnvironment.nodeDataPaths()) .loadBestOnDiskState().metadata; assertThat( @@ -364,7 +364,7 @@ public void test3MasterNodes2Failed() throws Exception { ); logger.info("--> start 1st cluster-manager-eligible node"); - String masterNode2 = internalCluster().startClusterManagerOnlyNode(master1DataPathSettings); + String clusterManagerNode2 = internalCluster().startClusterManagerOnlyNode(clusterManager1DataPathSettings); logger.info("--> detach-cluster on data-only node"); Environment environmentData = TestEnvironment.newEnvironment( @@ -391,7 +391,7 @@ public void test3MasterNodes2Failed() throws Exception { List bootstrappedNodes = new ArrayList<>(); bootstrappedNodes.add(dataNode2); - bootstrappedNodes.add(masterNode2); + bootstrappedNodes.add(clusterManagerNode2); bootstrappedNodes.forEach(node -> ensureReadOnlyBlock(true, node)); logger.info("--> ensure index test is green"); @@ -400,30 +400,30 @@ public void test3MasterNodes2Failed() throws Exception { assertThat(indexMetadata.getSettings().get(IndexMetadata.SETTING_HISTORY_UUID), notNullValue()); logger.info("--> detach-cluster on 2nd and 3rd cluster-manager-eligible nodes"); - Environment environmentMaster2 = TestEnvironment.newEnvironment( - Settings.builder().put(internalCluster().getDefaultSettings()).put(master2DataPathSettings).build() + Environment environmentClusterManager2 = TestEnvironment.newEnvironment( + Settings.builder().put(internalCluster().getDefaultSettings()).put(clusterManager2DataPathSettings).build() ); - detachCluster(environmentMaster2, false); - Environment environmentMaster3 = TestEnvironment.newEnvironment( - Settings.builder().put(internalCluster().getDefaultSettings()).put(master3DataPathSettings).build() + detachCluster(environmentClusterManager2, false); + Environment environmentClusterManager3 = TestEnvironment.newEnvironment( + Settings.builder().put(internalCluster().getDefaultSettings()).put(clusterManager3DataPathSettings).build() ); - detachCluster(environmentMaster3, false); + detachCluster(environmentClusterManager3, false); logger.info("--> start 2nd and 3rd cluster-manager-eligible nodes and ensure 4 nodes stable cluster"); - bootstrappedNodes.add(internalCluster().startClusterManagerOnlyNode(master2DataPathSettings)); - bootstrappedNodes.add(internalCluster().startClusterManagerOnlyNode(master3DataPathSettings)); + bootstrappedNodes.add(internalCluster().startClusterManagerOnlyNode(clusterManager2DataPathSettings)); + bootstrappedNodes.add(internalCluster().startClusterManagerOnlyNode(clusterManager3DataPathSettings)); ensureStableCluster(4); bootstrappedNodes.forEach(node -> ensureReadOnlyBlock(true, node)); removeBlock(); } - public void testAllMasterEligibleNodesFailedDanglingIndexImport() throws Exception { + public void testAllClusterManagerEligibleNodesFailedDanglingIndexImport() throws Exception { internalCluster().setBootstrapClusterManagerNodeIndex(0); Settings settings = Settings.builder().put(AUTO_IMPORT_DANGLING_INDICES_SETTING.getKey(), true).build(); logger.info("--> start mixed data and cluster-manager-eligible node and bootstrap cluster"); - String masterNode = internalCluster().startNode(settings); // node ordinal 0 + String clusterManagerNode = internalCluster().startNode(settings); // node ordinal 0 logger.info("--> start data-only node and ensure 2 nodes stable cluster"); String dataNode = internalCluster().startDataOnlyNode(settings); // node ordinal 1 @@ -458,7 +458,7 @@ public void testAllMasterEligibleNodesFailedDanglingIndexImport() throws Excepti detachCluster(environment, false); logger.info("--> stop cluster-manager-eligible node, clear its data and start it again - new cluster should form"); - internalCluster().restartNode(masterNode, new InternalTestCluster.RestartCallback() { + internalCluster().restartNode(clusterManagerNode, new InternalTestCluster.RestartCallback() { @Override public boolean clearData(String nodeName) { return true; 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 6c0a0c45ce9f0..84bf25141d5e0 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/ZenDiscoveryIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/ZenDiscoveryIT.java @@ -71,10 +71,10 @@ @OpenSearchIntegTestCase.ClusterScope(scope = OpenSearchIntegTestCase.Scope.TEST, numDataNodes = 0, numClientNodes = 0) public class ZenDiscoveryIT extends OpenSearchIntegTestCase { - public void testNoShardRelocationsOccurWhenElectedMasterNodeFails() throws Exception { + public void testNoShardRelocationsOccurWhenElectedClusterManagerNodeFails() throws Exception { - Settings masterNodeSettings = clusterManagerOnlyNode(); - internalCluster().startNodes(2, masterNodeSettings); + Settings clusterManagerNodeSettings = clusterManagerOnlyNode(); + internalCluster().startNodes(2, clusterManagerNodeSettings); Settings dateNodeSettings = dataNode(); internalCluster().startNodes(2, dateNodeSettings); ClusterHealthResponse clusterHealthResponse = client().admin() 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 686c2a41572a1..0dbdf57e34269 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/routing/PrimaryAllocationIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/routing/PrimaryAllocationIT.java @@ -294,7 +294,7 @@ public void testFailedAllocationOfStalePrimaryToDataNodeWithNoData() throws Exce } public void testForceStaleReplicaToBePromotedToPrimary() throws Exception { - logger.info("--> starting 3 nodes, 1 master, 2 data"); + logger.info("--> starting 3 nodes, 1 cluster-manager, 2 data"); String clusterManager = internalCluster().startClusterManagerOnlyNode(Settings.EMPTY); internalCluster().startDataOnlyNodes(2); assertAcked( diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/routing/allocation/decider/MockDiskUsagesIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/routing/allocation/decider/MockDiskUsagesIT.java index 05b0f10be02f3..520ad75535033 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/routing/allocation/decider/MockDiskUsagesIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/routing/allocation/decider/MockDiskUsagesIT.java @@ -269,9 +269,9 @@ public void testOnlyMovesEnoughShardsToDropBelowHighWatermark() throws Exception final MockInternalClusterInfoService clusterInfoService = getMockInternalClusterInfoService(); - final AtomicReference masterAppliedClusterState = new AtomicReference<>(); + final AtomicReference clusterManagerAppliedClusterState = new AtomicReference<>(); internalCluster().getCurrentMasterNodeInstance(ClusterService.class).addListener(event -> { - masterAppliedClusterState.set(event.state()); + clusterManagerAppliedClusterState.set(event.state()); clusterInfoService.refresh(); // so that a subsequent reroute sees disk usage according to the current state }); @@ -326,7 +326,7 @@ public void testOnlyMovesEnoughShardsToDropBelowHighWatermark() throws Exception fsInfoPath, 1000L, discoveryNode.getId().equals(nodeIds.get(2)) - ? 101L - masterAppliedClusterState.get().getRoutingNodes().node(nodeIds.get(2)).numberOfOwningShards() + ? 101L - clusterManagerAppliedClusterState.get().getRoutingNodes().node(nodeIds.get(2)).numberOfOwningShards() : 1000L ) ); @@ -349,7 +349,7 @@ public void testDoesNotExceedLowWatermarkWhenRebalancing() throws Exception { internalCluster().startNode(Settings.builder().put(Environment.PATH_DATA_SETTING.getKey(), createTempDir())); } - final AtomicReference masterAppliedClusterState = new AtomicReference<>(); + final AtomicReference clusterManagerAppliedClusterState = new AtomicReference<>(); final MockInternalClusterInfoService clusterInfoService = getMockInternalClusterInfoService(); @@ -360,7 +360,7 @@ public void testDoesNotExceedLowWatermarkWhenRebalancing() throws Exception { internalCluster().getCurrentMasterNodeInstance(ClusterService.class).addListener(event -> { assertThat(event.state().getRoutingNodes().node(nodeIds.get(2)).size(), lessThanOrEqualTo(1)); - masterAppliedClusterState.set(event.state()); + clusterManagerAppliedClusterState.set(event.state()); clusterInfoService.refresh(); // so that a subsequent reroute sees disk usage according to the current state }); @@ -385,7 +385,7 @@ public void testDoesNotExceedLowWatermarkWhenRebalancing() throws Exception { fsInfoPath, 1000L, discoveryNode.getId().equals(nodeIds.get(2)) - ? 150L - masterAppliedClusterState.get().getRoutingNodes().node(nodeIds.get(2)).numberOfOwningShards() + ? 150L - clusterManagerAppliedClusterState.get().getRoutingNodes().node(nodeIds.get(2)).numberOfOwningShards() : 1000L ) ); diff --git a/server/src/internalClusterTest/java/org/opensearch/discovery/ClusterDisruptionIT.java b/server/src/internalClusterTest/java/org/opensearch/discovery/ClusterDisruptionIT.java index 95e1a2f8f6925..7a8b6b447a68d 100644 --- a/server/src/internalClusterTest/java/org/opensearch/discovery/ClusterDisruptionIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/discovery/ClusterDisruptionIT.java @@ -409,7 +409,7 @@ public void onFailure(Exception e) { } } - public void testCannotJoinIfMasterLostDataFolder() throws Exception { + public void testCannotJoinIfClusterManagerLostDataFolder() throws Exception { String clusterManagerNode = internalCluster().startClusterManagerOnlyNode(); String dataNode = internalCluster().startDataOnlyNode(); @@ -463,30 +463,30 @@ public boolean validateClusterForming() { */ public void testIndicesDeleted() throws Exception { final String idxName = "test"; - final List allMasterEligibleNodes = internalCluster().startMasterOnlyNodes(2); + final List allClusterManagerEligibleNodes = internalCluster().startMasterOnlyNodes(2); final String dataNode = internalCluster().startDataOnlyNode(); ensureStableCluster(3); assertAcked(prepareCreate("test")); - final String masterNode1 = internalCluster().getMasterName(); + final String clusterManagerNode1 = internalCluster().getMasterName(); NetworkDisruption networkDisruption = new NetworkDisruption( - new TwoPartitions(masterNode1, dataNode), + new TwoPartitions(clusterManagerNode1, dataNode), NetworkDisruption.UNRESPONSIVE ); internalCluster().setDisruptionScheme(networkDisruption); networkDisruption.startDisrupting(); // We know this will time out due to the partition, we check manually below to not proceed until // the delete has been applied to the cluster-manager node and the cluster-manager eligible node. - internalCluster().client(masterNode1).admin().indices().prepareDelete(idxName).setTimeout("0s").get(); + internalCluster().client(clusterManagerNode1).admin().indices().prepareDelete(idxName).setTimeout("0s").get(); // Don't restart the cluster-manager node until we know the index deletion has taken effect on cluster-manager and the // cluster-manager eligible node. assertBusy(() -> { - for (String clusterManagerNode : allMasterEligibleNodes) { - final ClusterState masterState = internalCluster().clusterService(clusterManagerNode).state(); - assertTrue("index not deleted on " + clusterManagerNode, masterState.metadata().hasIndex(idxName) == false); + for (String clusterManagerNode : allClusterManagerEligibleNodes) { + final ClusterState clusterManagerState = internalCluster().clusterService(clusterManagerNode).state(); + assertTrue("index not deleted on " + clusterManagerNode, clusterManagerState.metadata().hasIndex(idxName) == false); } }); - internalCluster().restartNode(masterNode1, InternalTestCluster.EMPTY_CALLBACK); + internalCluster().restartNode(clusterManagerNode1, InternalTestCluster.EMPTY_CALLBACK); ensureYellow(); assertFalse(client().admin().indices().prepareExists(idxName).get().isExists()); } diff --git a/server/src/internalClusterTest/java/org/opensearch/discovery/DiscoveryDisruptionIT.java b/server/src/internalClusterTest/java/org/opensearch/discovery/DiscoveryDisruptionIT.java index ccbd3b1e4bd38..a4667d62a878c 100644 --- a/server/src/internalClusterTest/java/org/opensearch/discovery/DiscoveryDisruptionIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/discovery/DiscoveryDisruptionIT.java @@ -69,17 +69,17 @@ public void testClusterJoinDespiteOfPublishingIssues() throws Exception { DiscoveryNodes discoveryNodes = internalCluster().getInstance(ClusterService.class, nonClusterManagerNode).state().nodes(); - TransportService masterTranspotService = internalCluster().getInstance( + TransportService clusterManagerTranspotService = internalCluster().getInstance( TransportService.class, discoveryNodes.getMasterNode().getName() ); logger.info("blocking requests from non cluster-manager [{}] to cluster-manager [{}]", nonClusterManagerNode, clusterManagerNode); - MockTransportService nonMasterTransportService = (MockTransportService) internalCluster().getInstance( + MockTransportService nonClusterManagerTransportService = (MockTransportService) internalCluster().getInstance( TransportService.class, nonClusterManagerNode ); - nonMasterTransportService.addFailToSendNoConnectRule(masterTranspotService); + nonClusterManagerTransportService.addFailToSendNoConnectRule(clusterManagerTranspotService); assertNoMaster(nonClusterManagerNode); @@ -88,7 +88,7 @@ public void testClusterJoinDespiteOfPublishingIssues() throws Exception { clusterManagerNode, nonClusterManagerNode ); - MockTransportService masterTransportService = (MockTransportService) internalCluster().getInstance( + MockTransportService clusterManagerTransportService = (MockTransportService) internalCluster().getInstance( TransportService.class, clusterManagerNode ); @@ -97,9 +97,15 @@ public void testClusterJoinDespiteOfPublishingIssues() throws Exception { discoveryNodes.getLocalNode().getName() ); if (randomBoolean()) { - masterTransportService.addFailToSendNoConnectRule(localTransportService, PublicationTransportHandler.PUBLISH_STATE_ACTION_NAME); + clusterManagerTransportService.addFailToSendNoConnectRule( + localTransportService, + PublicationTransportHandler.PUBLISH_STATE_ACTION_NAME + ); } else { - masterTransportService.addFailToSendNoConnectRule(localTransportService, PublicationTransportHandler.COMMIT_STATE_ACTION_NAME); + clusterManagerTransportService.addFailToSendNoConnectRule( + localTransportService, + PublicationTransportHandler.COMMIT_STATE_ACTION_NAME + ); } logger.info( @@ -108,20 +114,23 @@ public void testClusterJoinDespiteOfPublishingIssues() throws Exception { clusterManagerNode ); final CountDownLatch countDownLatch = new CountDownLatch(2); - nonMasterTransportService.addSendBehavior(masterTransportService, (connection, requestId, action, request, options) -> { - if (action.equals(JoinHelper.JOIN_ACTION_NAME)) { - countDownLatch.countDown(); + nonClusterManagerTransportService.addSendBehavior( + clusterManagerTransportService, + (connection, requestId, action, request, options) -> { + if (action.equals(JoinHelper.JOIN_ACTION_NAME)) { + countDownLatch.countDown(); + } + connection.sendRequest(requestId, action, request, options); } - connection.sendRequest(requestId, action, request, options); - }); + ); - nonMasterTransportService.addConnectBehavior(masterTransportService, Transport::openConnection); + nonClusterManagerTransportService.addConnectBehavior(clusterManagerTransportService, Transport::openConnection); countDownLatch.await(); logger.info("waiting for cluster to reform"); - masterTransportService.clearOutboundRules(localTransportService); - nonMasterTransportService.clearOutboundRules(localTransportService); + clusterManagerTransportService.clearOutboundRules(localTransportService); + nonClusterManagerTransportService.clearOutboundRules(localTransportService); ensureStableCluster(2); @@ -145,7 +154,7 @@ public void testClusterFormingWithASlowNode() { ensureStableCluster(3); } - public void testElectMasterWithLatestVersion() throws Exception { + public void testElectClusterManagerWithLatestVersion() throws Exception { final Set nodes = new HashSet<>(internalCluster().startNodes(3)); ensureStableCluster(3); ServiceDisruptionScheme isolateAllNodes = new NetworkDisruption( @@ -167,7 +176,7 @@ public void testElectMasterWithLatestVersion() throws Exception { logger.info("--> preferred cluster-manager is {}", preferredClusterManager); final Set nonPreferredNodes = new HashSet<>(nodes); nonPreferredNodes.remove(preferredClusterManagerName); - final ServiceDisruptionScheme isolatePreferredClusterManager = isolateMasterDisruption(NetworkDisruption.DISCONNECT); + final ServiceDisruptionScheme isolatePreferredClusterManager = isolateClusterManagerDisruption(NetworkDisruption.DISCONNECT); internalCluster().setDisruptionScheme(isolatePreferredClusterManager); isolatePreferredClusterManager.startDisrupting(); @@ -202,7 +211,7 @@ public void testElectMasterWithLatestVersion() throws Exception { * sure that the node is removed form the cluster, that the node start pinging and that * the cluster reforms when healed. */ - public void testNodeNotReachableFromMaster() throws Exception { + public void testNodeNotReachableFromClusterManager() throws Exception { startCluster(3); String clusterManagerNode = internalCluster().getMasterName(); @@ -215,14 +224,18 @@ public void testNodeNotReachableFromMaster() throws Exception { } logger.info("blocking request from cluster-manager [{}] to [{}]", clusterManagerNode, nonClusterManagerNode); - MockTransportService masterTransportService = (MockTransportService) internalCluster().getInstance( + MockTransportService clusterManagerTransportService = (MockTransportService) internalCluster().getInstance( TransportService.class, clusterManagerNode ); if (randomBoolean()) { - masterTransportService.addUnresponsiveRule(internalCluster().getInstance(TransportService.class, nonClusterManagerNode)); + clusterManagerTransportService.addUnresponsiveRule( + internalCluster().getInstance(TransportService.class, nonClusterManagerNode) + ); } else { - masterTransportService.addFailToSendNoConnectRule(internalCluster().getInstance(TransportService.class, nonClusterManagerNode)); + clusterManagerTransportService.addFailToSendNoConnectRule( + internalCluster().getInstance(TransportService.class, nonClusterManagerNode) + ); } logger.info("waiting for [{}] to be removed from cluster", nonClusterManagerNode); @@ -232,7 +245,7 @@ public void testNodeNotReachableFromMaster() throws Exception { assertNoMaster(nonClusterManagerNode); logger.info("healing partition and checking cluster reforms"); - masterTransportService.clearAllRules(); + clusterManagerTransportService.clearAllRules(); ensureStableCluster(3); } diff --git a/server/src/internalClusterTest/java/org/opensearch/discovery/MasterDisruptionIT.java b/server/src/internalClusterTest/java/org/opensearch/discovery/MasterDisruptionIT.java index 91b548c3f746f..9f0fb964ef529 100644 --- a/server/src/internalClusterTest/java/org/opensearch/discovery/MasterDisruptionIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/discovery/MasterDisruptionIT.java @@ -60,7 +60,7 @@ import static org.hamcrest.Matchers.not; /** - * Tests relating to the loss of the master. + * Tests relating to the loss of the cluster-manager. */ @OpenSearchIntegTestCase.ClusterScope(scope = OpenSearchIntegTestCase.Scope.TEST, numDataNodes = 0) public class MasterDisruptionIT extends AbstractDisruptionTestCase { @@ -68,12 +68,12 @@ public class MasterDisruptionIT extends AbstractDisruptionTestCase { /** * Test that cluster recovers from a long GC on cluster-manager that causes other nodes to elect a new one */ - public void testMasterNodeGCs() throws Exception { + public void testClusterManagerNodeGCs() throws Exception { List nodes = startCluster(3); 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( + SingleNodeDisruption clusterManagerNodeDisruption = new IntermittentLongGCDisruption( random(), oldClusterManagerNode, 100, @@ -81,8 +81,8 @@ public void testMasterNodeGCs() throws Exception { 30000, 60000 ); - internalCluster().setDisruptionScheme(masterNodeDisruption); - masterNodeDisruption.startDisrupting(); + internalCluster().setDisruptionScheme(clusterManagerNodeDisruption); + clusterManagerNodeDisruption.startDisrupting(); Set oldNonClusterManagerNodesSet = new HashSet<>(nodes); oldNonClusterManagerNodesSet.remove(oldClusterManagerNode); @@ -94,15 +94,17 @@ public void testMasterNodeGCs() throws Exception { assertDifferentMaster(node, oldClusterManagerNode); } - logger.info("waiting for nodes to elect a new master"); + logger.info("waiting for nodes to elect a new cluster-manager"); ensureStableCluster(2, oldNonClusterManagerNodes.get(0)); // restore GC - masterNodeDisruption.stopDisrupting(); - final TimeValue waitTime = new TimeValue(DISRUPTION_HEALING_OVERHEAD.millis() + masterNodeDisruption.expectedTimeToHeal().millis()); + clusterManagerNodeDisruption.stopDisrupting(); + final TimeValue waitTime = new TimeValue( + DISRUPTION_HEALING_OVERHEAD.millis() + clusterManagerNodeDisruption.expectedTimeToHeal().millis() + ); ensureStableCluster(3, waitTime, false, oldNonClusterManagerNodes.get(0)); - // make sure all nodes agree on master + // make sure all nodes agree on cluster-manager String newClusterManager = internalCluster().getMasterName(); assertThat(newClusterManager, not(equalTo(oldClusterManagerNode))); assertMaster(newClusterManager, nodes); @@ -112,7 +114,7 @@ public void testMasterNodeGCs() throws Exception { * This test isolates the cluster-manager from rest of the cluster, waits for a new cluster-manager to be elected, restores the partition * and verifies that all node agree on the new cluster state */ - public void testIsolateMasterAndVerifyClusterStateConsensus() throws Exception { + public void testIsolateClusterManagerAndVerifyClusterStateConsensus() throws Exception { final List nodes = startCluster(3); assertAcked( @@ -169,7 +171,7 @@ public void testIsolateMasterAndVerifyClusterStateConsensus() throws Exception { try { assertEquals("unequal versions", state.version(), nodeState.version()); assertEquals("unequal node count", state.nodes().getSize(), nodeState.nodes().getSize()); - assertEquals("different masters ", state.nodes().getMasterNodeId(), nodeState.nodes().getMasterNodeId()); + assertEquals("different cluster-managers ", state.nodes().getMasterNodeId(), nodeState.nodes().getMasterNodeId()); assertEquals("different meta data version", state.metadata().version(), nodeState.metadata().version()); assertEquals("different routing", state.routingTable().toString(), nodeState.routingTable().toString()); } catch (AssertionError t) { @@ -193,7 +195,7 @@ public void testIsolateMasterAndVerifyClusterStateConsensus() throws Exception { } /** - * Verify that the proper block is applied when nodes lose their master + * Verify that the proper block is applied when nodes lose their cluster-manager */ public void testVerifyApiBlocksDuringPartition() throws Exception { internalCluster().startNodes(3, Settings.builder().putNull(NoMasterBlockService.NO_CLUSTER_MANAGER_BLOCK_SETTING.getKey()).build()); @@ -223,7 +225,7 @@ public void testVerifyApiBlocksDuringPartition() throws Exception { // The unlucky node must report *no* cluster-manager node, since it can't connect to cluster-manager and in fact it should // continuously ping until network failures have been resolved. However - // It may a take a bit before the node detects it has been cut off from the elected master + // It may a take a bit before the node detects it has been cut off from the elected cluster-manager logger.info("waiting for isolated node [{}] to have no cluster-manager", isolatedNode); assertNoMaster(isolatedNode, NoMasterBlockService.NO_MASTER_BLOCK_WRITES, TimeValue.timeValueSeconds(30)); @@ -269,7 +271,7 @@ public void testVerifyApiBlocksDuringPartition() throws Exception { // The unlucky node must report *no* cluster-manager node, since it can't connect to cluster-manager and in fact it should // continuously ping until network failures have been resolved. However - // It may a take a bit before the node detects it has been cut off from the elected master + // It may a take a bit before the node detects it has been cut off from the elected cluster-manager logger.info("waiting for isolated node [{}] to have no cluster-manager", isolatedNode); assertNoMaster(isolatedNode, NoMasterBlockService.NO_MASTER_BLOCK_ALL, TimeValue.timeValueSeconds(30)); diff --git a/server/src/internalClusterTest/java/org/opensearch/discovery/SnapshotDisruptionIT.java b/server/src/internalClusterTest/java/org/opensearch/discovery/SnapshotDisruptionIT.java index 328e96c84cfe6..3324b7de077fe 100644 --- a/server/src/internalClusterTest/java/org/opensearch/discovery/SnapshotDisruptionIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/discovery/SnapshotDisruptionIT.java @@ -94,12 +94,12 @@ public void testDisruptionAfterFinalization() throws Exception { createRepository("test-repo", "fs"); - final String masterNode1 = internalCluster().getMasterName(); + final String clusterManagerNode1 = internalCluster().getMasterName(); - NetworkDisruption networkDisruption = isolateMasterDisruption(NetworkDisruption.UNRESPONSIVE); + NetworkDisruption networkDisruption = isolateClusterManagerDisruption(NetworkDisruption.UNRESPONSIVE); internalCluster().setDisruptionScheme(networkDisruption); - ClusterService clusterService = internalCluster().clusterService(masterNode1); + ClusterService clusterService = internalCluster().clusterService(clusterManagerNode1); CountDownLatch disruptionStarted = new CountDownLatch(1); clusterService.addListener(new ClusterStateListener() { @Override @@ -124,7 +124,7 @@ public void clusterChanged(ClusterChangedEvent event) { final String snapshot = "test-snap"; logger.info("--> starting snapshot"); - ActionFuture future = client(masterNode1).admin() + ActionFuture future = client(clusterManagerNode1).admin() .cluster() .prepareCreateSnapshot("test-repo", snapshot) .setWaitForCompletion(true) @@ -147,7 +147,7 @@ public void clusterChanged(ClusterChangedEvent event) { logger.info("--> stopping disrupting"); networkDisruption.stopDisrupting(); - ensureStableCluster(4, masterNode1); + ensureStableCluster(4, clusterManagerNode1); logger.info("--> done"); try { @@ -177,13 +177,13 @@ public void testDisruptionAfterShardFinalization() throws Exception { final String repoName = "test-repo"; createRepository(repoName, "mock"); - final String masterNode = internalCluster().getMasterName(); + final String clusterManagerNode = internalCluster().getMasterName(); blockAllDataNodes(repoName); final String snapshot = "test-snap"; logger.info("--> starting snapshot"); - ActionFuture future = client(masterNode).admin() + ActionFuture future = client(clusterManagerNode).admin() .cluster() .prepareCreateSnapshot(repoName, snapshot) .setWaitForCompletion(true) @@ -191,7 +191,7 @@ public void testDisruptionAfterShardFinalization() throws Exception { waitForBlockOnAnyDataNode(repoName, TimeValue.timeValueSeconds(10L)); - NetworkDisruption networkDisruption = isolateMasterDisruption(NetworkDisruption.DISCONNECT); + NetworkDisruption networkDisruption = isolateClusterManagerDisruption(NetworkDisruption.DISCONNECT); internalCluster().setDisruptionScheme(networkDisruption); networkDisruption.startDisrupting(); @@ -203,7 +203,7 @@ public void testDisruptionAfterShardFinalization() throws Exception { networkDisruption.stopDisrupting(); unblockAllDataNodes(repoName); - ensureStableCluster(2, masterNode); + ensureStableCluster(2, clusterManagerNode); logger.info("--> done"); logger.info("--> recreate the index with potentially different shard counts"); @@ -213,17 +213,17 @@ public void testDisruptionAfterShardFinalization() throws Exception { logger.info("--> run a snapshot that fails to finalize but succeeds on the data node"); blockMasterFromFinalizingSnapshotOnIndexFile(repoName); - final ActionFuture snapshotFuture = client(masterNode).admin() + final ActionFuture snapshotFuture = client(clusterManagerNode).admin() .cluster() .prepareCreateSnapshot(repoName, "snapshot-2") .setWaitForCompletion(true) .execute(); - waitForBlock(masterNode, repoName, TimeValue.timeValueSeconds(10L)); - unblockNode(repoName, masterNode); + waitForBlock(clusterManagerNode, repoName, TimeValue.timeValueSeconds(10L)); + unblockNode(repoName, clusterManagerNode); assertFutureThrows(snapshotFuture, SnapshotException.class); logger.info("--> create a snapshot expected to be successful"); - final CreateSnapshotResponse successfulSnapshot = client(masterNode).admin() + final CreateSnapshotResponse successfulSnapshot = client(clusterManagerNode).admin() .cluster() .prepareCreateSnapshot(repoName, "snapshot-2") .setWaitForCompletion(true) @@ -235,7 +235,7 @@ public void testDisruptionAfterShardFinalization() throws Exception { assertAcked(client().admin().cluster().prepareDeleteSnapshot(repoName, "snapshot-2").get()); } - public void testMasterFailOverDuringShardSnapshots() throws Exception { + public void testClusterManagerFailOverDuringShardSnapshots() throws Exception { internalCluster().startMasterOnlyNodes(3); final String dataNode = internalCluster().startDataOnlyNode(); ensureStableCluster(4); @@ -258,7 +258,7 @@ public void testMasterFailOverDuringShardSnapshots() throws Exception { waitForBlock(dataNode, repoName, TimeValue.timeValueSeconds(30L)); - final NetworkDisruption networkDisruption = isolateMasterDisruption(NetworkDisruption.DISCONNECT); + final NetworkDisruption networkDisruption = isolateClusterManagerDisruption(NetworkDisruption.DISCONNECT); internalCluster().setDisruptionScheme(networkDisruption); networkDisruption.startDisrupting(); ensureStableCluster(3, dataNode); diff --git a/server/src/internalClusterTest/java/org/opensearch/discovery/StableMasterDisruptionIT.java b/server/src/internalClusterTest/java/org/opensearch/discovery/StableMasterDisruptionIT.java index dc6ff06ada5ee..3ff794358a94f 100644 --- a/server/src/internalClusterTest/java/org/opensearch/discovery/StableMasterDisruptionIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/discovery/StableMasterDisruptionIT.java @@ -92,25 +92,25 @@ public void testFailWithMinimumMasterNodesConfigured() throws Exception { ensureStableCluster(3); // Figure out what is the elected cluster-manager node - final String masterNode = internalCluster().getMasterName(); - logger.info("---> legit elected cluster-manager node={}", masterNode); + final String clusterManagerNode = internalCluster().getMasterName(); + logger.info("---> legit elected cluster-manager node={}", clusterManagerNode); - // Pick a node that isn't the elected master. + // Pick a node that isn't the elected cluster-manager. Set nonMasters = new HashSet<>(nodes); - nonMasters.remove(masterNode); + nonMasters.remove(clusterManagerNode); final String unluckyNode = randomFrom(nonMasters.toArray(Strings.EMPTY_ARRAY)); // Simulate a network issue between the unlucky node and elected cluster-manager node in both directions. NetworkDisruption networkDisconnect = new NetworkDisruption( - new NetworkDisruption.TwoPartitions(masterNode, unluckyNode), + new NetworkDisruption.TwoPartitions(clusterManagerNode, unluckyNode), NetworkDisruption.DISCONNECT ); setDisruptionScheme(networkDisconnect); networkDisconnect.startDisrupting(); // Wait until elected cluster-manager has removed that the unlucky node... - ensureStableCluster(2, masterNode); + ensureStableCluster(2, clusterManagerNode); // The unlucky node must report *no* cluster-manager node, since it can't connect to cluster-manager and in fact it should // continuously ping until network failures have been resolved. However @@ -123,7 +123,7 @@ public void testFailWithMinimumMasterNodesConfigured() throws Exception { ensureStableCluster(3); // The elected cluster-manager shouldn't have changed, since the unlucky node never could have elected itself as cluster-manager - assertThat(internalCluster().getMasterName(), equalTo(masterNode)); + assertThat(internalCluster().getMasterName(), equalTo(clusterManagerNode)); } private void ensureNoMaster(String node) throws Exception { @@ -161,7 +161,7 @@ private void testFollowerCheckerAfterMasterReelection(NetworkLinkDisruptionType internalCluster().startNodes(4, settings); ensureStableCluster(4); - logger.info("--> stopping current master"); + logger.info("--> stopping current cluster-manager"); internalCluster().stopCurrentMasterNode(); ensureStableCluster(3); @@ -192,7 +192,7 @@ private void testFollowerCheckerAfterMasterReelection(NetworkLinkDisruptionType /** * Tests that emulates a frozen elected cluster-manager node that unfreezes and pushes its cluster state to other nodes that already are - * following another elected cluster-manager node. These nodes should reject this cluster state and prevent them from following the stale master. + * following another elected cluster-manager node. These nodes should reject this cluster state and prevent them from following the stale cluster-manager. */ public void testStaleMasterNotHijackingMajority() throws Exception { final List nodes = internalCluster().startNodes( @@ -216,9 +216,9 @@ public void testStaleMasterNotHijackingMajority() throws Exception { // Keeps track of the previous and current cluster-manager when a cluster-manager node transition took place on each node on the // majority side: - final Map>> masters = Collections.synchronizedMap(new HashMap<>()); + final Map>> clusterManagers = Collections.synchronizedMap(new HashMap<>()); for (final String node : majoritySide) { - masters.put(node, new ArrayList<>()); + clusterManagers.put(node, new ArrayList<>()); internalCluster().getInstance(ClusterService.class, node).addListener(event -> { DiscoveryNode previousClusterManager = event.previousState().nodes().getMasterNode(); DiscoveryNode currentClusterManager = event.state().nodes().getMasterNode(); @@ -231,15 +231,15 @@ public void testStaleMasterNotHijackingMajority() throws Exception { ); String previousClusterManagerNodeName = previousClusterManager != null ? previousClusterManager.getName() : null; String currentMasterNodeName = currentClusterManager != null ? currentClusterManager.getName() : null; - masters.get(node).add(new Tuple<>(previousClusterManagerNodeName, currentMasterNodeName)); + clusterManagers.get(node).add(new Tuple<>(previousClusterManagerNodeName, currentMasterNodeName)); } }); } - final CountDownLatch oldMasterNodeSteppedDown = new CountDownLatch(1); + final CountDownLatch oldClusterManagerNodeSteppedDown = new CountDownLatch(1); internalCluster().getInstance(ClusterService.class, oldClusterManagerNode).addListener(event -> { if (event.state().nodes().getMasterNodeId() == null) { - oldMasterNodeSteppedDown.countDown(); + oldClusterManagerNodeSteppedDown.countDown(); } }); @@ -247,9 +247,9 @@ public void testStaleMasterNotHijackingMajority() throws Exception { logger.info("--> freezing node [{}]", oldClusterManagerNode); clusterManagerNodeDisruption.startDisrupting(); - // Wait for majority side to elect a new master + // Wait for majority side to elect a new cluster-manager assertBusy(() -> { - for (final Map.Entry>> entry : masters.entrySet()) { + for (final Map.Entry>> entry : clusterManagers.entrySet()) { final List> transitions = entry.getValue(); assertTrue(entry.getKey() + ": " + transitions, transitions.stream().anyMatch(transition -> transition.v2() != null)); } @@ -259,7 +259,7 @@ public void testStaleMasterNotHijackingMajority() throws Exception { // queued and // once the old cluster-manager node un-freezes it gets executed. The old cluster-manager node will send this update + the cluster // state where it is - // flagged as cluster-manager to the other nodes that follow the new master. These nodes should ignore this update. + // flagged as cluster-manager to the other nodes that follow the new cluster-manager. These nodes should ignore this update. internalCluster().getInstance(ClusterService.class, oldClusterManagerNode) .submitStateUpdateTask("sneaky-update", new ClusterStateUpdateTask(Priority.IMMEDIATE) { @Override @@ -281,12 +281,12 @@ public void onFailure(String source, Exception e) { logger.info("--> unfreezing node [{}]", oldClusterManagerNode); clusterManagerNodeDisruption.stopDisrupting(); - oldMasterNodeSteppedDown.await(30, TimeUnit.SECONDS); - logger.info("--> [{}] stepped down as master", oldClusterManagerNode); + oldClusterManagerNodeSteppedDown.await(30, TimeUnit.SECONDS); + logger.info("--> [{}] stepped down as cluster-manager", oldClusterManagerNode); ensureStableCluster(3); - assertThat(masters.size(), equalTo(2)); - for (Map.Entry>> entry : masters.entrySet()) { + assertThat(clusterManagers.size(), equalTo(2)); + for (Map.Entry>> entry : clusterManagers.entrySet()) { String nodeName = entry.getKey(); List> transitions = entry.getValue(); assertTrue( diff --git a/server/src/internalClusterTest/java/org/opensearch/gateway/MetadataNodesIT.java b/server/src/internalClusterTest/java/org/opensearch/gateway/MetadataNodesIT.java index c96a71d5b2617..4bbd968d851b8 100644 --- a/server/src/internalClusterTest/java/org/opensearch/gateway/MetadataNodesIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/gateway/MetadataNodesIT.java @@ -60,18 +60,18 @@ 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().startClusterManagerOnlyNode(Settings.EMPTY); + String clusterManagerNode = 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()); ensureGreen("test"); assertIndexInMetaState(dataNode, "test"); - assertIndexInMetaState(masterNode, "test"); + assertIndexInMetaState(clusterManagerNode, "test"); } 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().startClusterManagerOnlyNode(Settings.EMPTY); + String clusterManagerNode = internalCluster().startClusterManagerOnlyNode(Settings.EMPTY); List nodeNames = internalCluster().startDataOnlyNodes(2); String node1 = nodeNames.get(0); String node2 = nodeNames.get(1); @@ -90,8 +90,8 @@ public void testIndexFilesAreRemovedIfAllShardsFromIndexRemoved() throws Excepti Index resolveIndex = resolveIndex(index); assertIndexDirectoryExists(node1, resolveIndex); assertIndexDirectoryDeleted(node2, resolveIndex); - assertIndexInMetaState(masterNode, index); - assertIndexDirectoryDeleted(masterNode, resolveIndex); + assertIndexInMetaState(clusterManagerNode, index); + assertIndexDirectoryDeleted(clusterManagerNode, resolveIndex); logger.debug("relocating index..."); client().admin() @@ -104,8 +104,8 @@ public void testIndexFilesAreRemovedIfAllShardsFromIndexRemoved() throws Excepti assertIndexDirectoryDeleted(node1, resolveIndex); assertIndexInMetaState(node2, index); assertIndexDirectoryExists(node2, resolveIndex); - assertIndexInMetaState(masterNode, index); - assertIndexDirectoryDeleted(masterNode, resolveIndex); + assertIndexInMetaState(clusterManagerNode, index); + assertIndexDirectoryDeleted(clusterManagerNode, resolveIndex); client().admin().indices().prepareDelete(index).get(); assertIndexDirectoryDeleted(node1, resolveIndex); @@ -114,7 +114,7 @@ public void testIndexFilesAreRemovedIfAllShardsFromIndexRemoved() throws Excepti @SuppressWarnings("unchecked") public void testMetaWrittenWhenIndexIsClosedAndMetaUpdated() throws Exception { - String masterNode = internalCluster().startClusterManagerOnlyNode(Settings.EMPTY); + String clusterManagerNode = internalCluster().startClusterManagerOnlyNode(Settings.EMPTY); final String dataNode = internalCluster().startDataOnlyNode(Settings.EMPTY); final String index = "index"; @@ -123,7 +123,7 @@ public void testMetaWrittenWhenIndexIsClosedAndMetaUpdated() throws Exception { ensureGreen(); logger.info("--> wait for meta state written for index"); assertIndexInMetaState(dataNode, index); - assertIndexInMetaState(masterNode, index); + assertIndexInMetaState(clusterManagerNode, index); logger.info("--> close index"); client().admin().indices().prepareClose(index).get(); diff --git a/server/src/internalClusterTest/java/org/opensearch/gateway/RecoverAfterNodesIT.java b/server/src/internalClusterTest/java/org/opensearch/gateway/RecoverAfterNodesIT.java index bda0ca82a741c..fa624025cae35 100644 --- a/server/src/internalClusterTest/java/org/opensearch/gateway/RecoverAfterNodesIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/gateway/RecoverAfterNodesIT.java @@ -130,9 +130,9 @@ public void testRecoverAfterNodes() throws Exception { public void testRecoverAfterMasterNodes() throws Exception { internalCluster().setBootstrapClusterManagerNodeIndex(0); logger.info("--> start cluster_manager_node (1)"); - Client master1 = startNode(Settings.builder().put("gateway.recover_after_master_nodes", 2).put(clusterManagerOnlyNode())); + Client clusterManager1 = startNode(Settings.builder().put("gateway.recover_after_master_nodes", 2).put(clusterManagerOnlyNode())); assertThat( - master1.admin() + clusterManager1.admin() .cluster() .prepareState() .setLocal(true) @@ -147,7 +147,7 @@ public void testRecoverAfterMasterNodes() throws Exception { logger.info("--> start data_node (1)"); Client data1 = startNode(Settings.builder().put("gateway.recover_after_master_nodes", 2).put(dataOnlyNode())); assertThat( - master1.admin() + clusterManager1.admin() .cluster() .prepareState() .setLocal(true) @@ -174,7 +174,7 @@ public void testRecoverAfterMasterNodes() throws Exception { logger.info("--> start data_node (2)"); Client data2 = startNode(Settings.builder().put("gateway.recover_after_master_nodes", 2).put(dataOnlyNode())); assertThat( - master1.admin() + clusterManager1.admin() .cluster() .prepareState() .setLocal(true) @@ -211,9 +211,9 @@ public void testRecoverAfterMasterNodes() throws Exception { ); logger.info("--> start cluster_manager_node (2)"); - 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)); + Client clusterManager2 = startNode(Settings.builder().put("gateway.recover_after_master_nodes", 2).put(clusterManagerOnlyNode())); + assertThat(waitForNoBlocksOnNode(BLOCK_WAIT_TIMEOUT, clusterManager1).isEmpty(), equalTo(true)); + assertThat(waitForNoBlocksOnNode(BLOCK_WAIT_TIMEOUT, clusterManager2).isEmpty(), equalTo(true)); assertThat(waitForNoBlocksOnNode(BLOCK_WAIT_TIMEOUT, data1).isEmpty(), equalTo(true)); assertThat(waitForNoBlocksOnNode(BLOCK_WAIT_TIMEOUT, data2).isEmpty(), equalTo(true)); } @@ -221,9 +221,9 @@ public void testRecoverAfterMasterNodes() throws Exception { public void testRecoverAfterDataNodes() throws Exception { internalCluster().setBootstrapClusterManagerNodeIndex(0); logger.info("--> start cluster_manager_node (1)"); - Client master1 = startNode(Settings.builder().put("gateway.recover_after_data_nodes", 2).put(clusterManagerOnlyNode())); + Client clusterManager1 = startNode(Settings.builder().put("gateway.recover_after_data_nodes", 2).put(clusterManagerOnlyNode())); assertThat( - master1.admin() + clusterManager1.admin() .cluster() .prepareState() .setLocal(true) @@ -238,7 +238,7 @@ public void testRecoverAfterDataNodes() throws Exception { logger.info("--> start data_node (1)"); Client data1 = startNode(Settings.builder().put("gateway.recover_after_data_nodes", 2).put(dataOnlyNode())); assertThat( - master1.admin() + clusterManager1.admin() .cluster() .prepareState() .setLocal(true) @@ -263,9 +263,9 @@ public void testRecoverAfterDataNodes() throws Exception { ); logger.info("--> start cluster_manager_node (2)"); - Client master2 = startNode(Settings.builder().put("gateway.recover_after_data_nodes", 2).put(clusterManagerOnlyNode())); + Client clusterManager2 = startNode(Settings.builder().put("gateway.recover_after_data_nodes", 2).put(clusterManagerOnlyNode())); assertThat( - master2.admin() + clusterManager2.admin() .cluster() .prepareState() .setLocal(true) @@ -289,7 +289,7 @@ public void testRecoverAfterDataNodes() throws Exception { hasItem(GatewayService.STATE_NOT_RECOVERED_BLOCK) ); assertThat( - master2.admin() + clusterManager2.admin() .cluster() .prepareState() .setLocal(true) @@ -303,8 +303,8 @@ public void testRecoverAfterDataNodes() throws Exception { logger.info("--> start data_node (2)"); Client data2 = startNode(Settings.builder().put("gateway.recover_after_data_nodes", 2).put(dataOnlyNode())); - assertThat(waitForNoBlocksOnNode(BLOCK_WAIT_TIMEOUT, master1).isEmpty(), equalTo(true)); - assertThat(waitForNoBlocksOnNode(BLOCK_WAIT_TIMEOUT, master2).isEmpty(), equalTo(true)); + assertThat(waitForNoBlocksOnNode(BLOCK_WAIT_TIMEOUT, clusterManager1).isEmpty(), equalTo(true)); + assertThat(waitForNoBlocksOnNode(BLOCK_WAIT_TIMEOUT, clusterManager2).isEmpty(), equalTo(true)); assertThat(waitForNoBlocksOnNode(BLOCK_WAIT_TIMEOUT, data1).isEmpty(), equalTo(true)); assertThat(waitForNoBlocksOnNode(BLOCK_WAIT_TIMEOUT, data2).isEmpty(), equalTo(true)); } diff --git a/server/src/internalClusterTest/java/org/opensearch/index/mapper/DynamicMappingIT.java b/server/src/internalClusterTest/java/org/opensearch/index/mapper/DynamicMappingIT.java index df208651f9c80..1a582f99cc0a7 100644 --- a/server/src/internalClusterTest/java/org/opensearch/index/mapper/DynamicMappingIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/index/mapper/DynamicMappingIT.java @@ -145,14 +145,14 @@ public void testPreflightCheckAvoidsMaster() throws InterruptedException { ensureGreen("index"); client().prepareIndex("index").setId("1").setSource("field1", "value1").get(); - final CountDownLatch masterBlockedLatch = new CountDownLatch(1); + final CountDownLatch clusterManagerBlockedLatch = new CountDownLatch(1); final CountDownLatch indexingCompletedLatch = new CountDownLatch(1); internalCluster().getInstance(ClusterService.class, internalCluster().getMasterName()) .submitStateUpdateTask("block-state-updates", new ClusterStateUpdateTask() { @Override public ClusterState execute(ClusterState currentState) throws Exception { - masterBlockedLatch.countDown(); + clusterManagerBlockedLatch.countDown(); indexingCompletedLatch.await(); return currentState; } @@ -163,7 +163,7 @@ public void onFailure(String source, Exception e) { } }); - masterBlockedLatch.await(); + clusterManagerBlockedLatch.await(); final IndexRequestBuilder indexRequestBuilder = client().prepareIndex("index").setId("2").setSource("field2", "value2"); try { assertThat( 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 a64bb321f9128..1b4d885d09e33 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 cluster-manager node - String masterNodeName = internalCluster().startClusterManagerOnlyNode(nodeSettings); + String clusterManagerNodeName = internalCluster().startClusterManagerOnlyNode(nodeSettings); final String blueNodeName = internalCluster().startNode( Settings.builder().put("node.attr.color", "blue").put(nodeSettings).build() @@ -1239,9 +1239,9 @@ public void testDisconnectsDuringRecovery() throws Exception { ensureSearchable(indexName); assertHitCount(client().prepareSearch(indexName).get(), numDocs); - MockTransportService masterTransportService = (MockTransportService) internalCluster().getInstance( + MockTransportService clusterManagerTransportService = (MockTransportService) internalCluster().getInstance( TransportService.class, - masterNodeName + clusterManagerNodeName ); MockTransportService blueMockTransportService = (MockTransportService) internalCluster().getInstance( TransportService.class, @@ -1312,7 +1312,7 @@ public void sendRequest( }); for (MockTransportService mockTransportService : Arrays.asList(redMockTransportService, blueMockTransportService)) { - mockTransportService.addSendBehavior(masterTransportService, (connection, requestId, action, request, options) -> { + mockTransportService.addSendBehavior(clusterManagerTransportService, (connection, requestId, action, request, options) -> { logger.info("--> sending request {} on {}", action, connection.getNode()); if ((primaryRelocation && finalized.get()) == false) { assertNotEquals(action, ShardStateAction.SHARD_FAILED_ACTION_NAME); diff --git a/server/src/internalClusterTest/java/org/opensearch/repositories/blobstore/BlobStoreRepositoryCleanupIT.java b/server/src/internalClusterTest/java/org/opensearch/repositories/blobstore/BlobStoreRepositoryCleanupIT.java index 81383ddb83f73..6450644314c08 100644 --- a/server/src/internalClusterTest/java/org/opensearch/repositories/blobstore/BlobStoreRepositoryCleanupIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/repositories/blobstore/BlobStoreRepositoryCleanupIT.java @@ -51,7 +51,7 @@ @OpenSearchIntegTestCase.ClusterScope(scope = OpenSearchIntegTestCase.Scope.TEST, numDataNodes = 0) public class BlobStoreRepositoryCleanupIT extends AbstractSnapshotIntegTestCase { - public void testMasterFailoverDuringCleanup() throws Exception { + public void testClusterManagerFailoverDuringCleanup() throws Exception { startBlockedCleanup("test-repo"); final int nodeCount = internalCluster().numDataAndMasterNodes(); @@ -117,17 +117,17 @@ private String startBlockedCleanup(String repoName) throws Exception { ); garbageFuture.get(); - final String masterNode = blockMasterFromFinalizingSnapshotOnIndexFile(repoName); + final String clusterManagerNode = blockMasterFromFinalizingSnapshotOnIndexFile(repoName); logger.info("--> starting repository cleanup"); client().admin().cluster().prepareCleanupRepository(repoName).execute(); - logger.info("--> waiting for block to kick in on " + masterNode); - waitForBlock(masterNode, repoName, TimeValue.timeValueSeconds(60)); + logger.info("--> waiting for block to kick in on " + clusterManagerNode); + waitForBlock(clusterManagerNode, repoName, TimeValue.timeValueSeconds(60)); awaitClusterState( state -> state.custom(RepositoryCleanupInProgress.TYPE, RepositoryCleanupInProgress.EMPTY).hasCleanupInProgress() ); - return masterNode; + return clusterManagerNode; } public void testCleanupOldIndexN() throws ExecutionException, InterruptedException { diff --git a/server/src/internalClusterTest/java/org/opensearch/snapshots/CloneSnapshotIT.java b/server/src/internalClusterTest/java/org/opensearch/snapshots/CloneSnapshotIT.java index c171b3450f562..a215f994ca220 100644 --- a/server/src/internalClusterTest/java/org/opensearch/snapshots/CloneSnapshotIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/snapshots/CloneSnapshotIT.java @@ -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().startClusterManagerOnlyNode(LARGE_SNAPSHOT_POOL_SETTINGS); + final String clusterManagerNode = internalCluster().startClusterManagerOnlyNode(LARGE_SNAPSHOT_POOL_SETTINGS); internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); @@ -247,7 +247,7 @@ public void testLongRunningCloneAllowsConcurrentSnapshot() throws Exception { final String targetSnapshot = "target-snapshot"; blockMasterOnShardClone(repoName); final ActionFuture cloneFuture = startClone(repoName, sourceSnapshot, targetSnapshot, indexSlow); - waitForBlock(masterNode, repoName, TimeValue.timeValueSeconds(30L)); + waitForBlock(clusterManagerNode, repoName, TimeValue.timeValueSeconds(30L)); final String indexFast = "index-fast"; createIndexWithRandomDocs(indexFast, randomIntBetween(20, 100)); @@ -257,7 +257,7 @@ public void testLongRunningCloneAllowsConcurrentSnapshot() throws Exception { ); assertThat(cloneFuture.isDone(), is(false)); - unblockNode(repoName, masterNode); + unblockNode(repoName, clusterManagerNode); assertAcked(cloneFuture.get()); } @@ -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().startClusterManagerOnlyNode(LARGE_SNAPSHOT_POOL_SETTINGS); + final String clusterManagerNode = internalCluster().startClusterManagerOnlyNode(LARGE_SNAPSHOT_POOL_SETTINGS); internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); @@ -338,7 +338,7 @@ public void testBackToBackClonesForIndexNotInCluster() throws Exception { final String targetSnapshot1 = "target-snapshot"; blockMasterOnShardClone(repoName); final ActionFuture cloneFuture1 = startClone(repoName, sourceSnapshot, targetSnapshot1, indexBlocked); - waitForBlock(masterNode, repoName, TimeValue.timeValueSeconds(30L)); + waitForBlock(clusterManagerNode, repoName, TimeValue.timeValueSeconds(30L)); assertThat(cloneFuture1.isDone(), is(false)); final int extraClones = randomIntBetween(1, 5); @@ -366,7 +366,7 @@ public void testBackToBackClonesForIndexNotInCluster() throws Exception { assertFalse(extraSnapshotFuture.isDone()); } - unblockNode(repoName, masterNode); + unblockNode(repoName, clusterManagerNode); assertAcked(cloneFuture1.get()); for (ActionFuture extraCloneFuture : extraCloneFutures) { @@ -377,7 +377,7 @@ public void testBackToBackClonesForIndexNotInCluster() throws Exception { } } - public void testMasterFailoverDuringCloneStep1() throws Exception { + public void testClusterManagerFailoverDuringCloneStep1() throws Exception { internalCluster().startMasterOnlyNodes(3); internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; @@ -431,7 +431,7 @@ public void testFailsOnCloneMissingIndices() { ); } - public void testMasterFailoverDuringCloneStep2() throws Exception { + public void testClusterManagerFailoverDuringCloneStep2() throws Exception { // large snapshot pool so blocked snapshot threads from cloning don't prevent concurrent snapshot finalizations internalCluster().startMasterOnlyNodes(3, LARGE_SNAPSHOT_POOL_SETTINGS); internalCluster().startDataOnlyNode(); @@ -447,9 +447,9 @@ public void testMasterFailoverDuringCloneStep2() throws Exception { blockMasterOnShardClone(repoName); final ActionFuture cloneFuture = startCloneFromDataNode(repoName, sourceSnapshot, targetSnapshot, testIndex); awaitNumberOfSnapshotsInProgress(1); - final String masterNode = internalCluster().getMasterName(); - waitForBlock(masterNode, repoName, TimeValue.timeValueSeconds(30L)); - internalCluster().restartNode(masterNode); + final String clusterManagerNode = internalCluster().getMasterName(); + waitForBlock(clusterManagerNode, repoName, TimeValue.timeValueSeconds(30L)); + internalCluster().restartNode(clusterManagerNode); expectThrows(SnapshotException.class, cloneFuture::actionGet); awaitNoMoreRunningOperations(internalCluster().getMasterName()); @@ -491,8 +491,8 @@ public void testDoesNotStartOnBrokenSourceSnapshot() throws Exception { final String sourceSnapshot = "source-snapshot"; blockDataNode(repoName, dataNode); - final Client masterClient = internalCluster().masterClient(); - final ActionFuture sourceSnapshotFuture = masterClient.admin() + final Client clusterManagerClient = internalCluster().masterClient(); + final ActionFuture sourceSnapshotFuture = clusterManagerClient.admin() .cluster() .prepareCreateSnapshot(repoName, sourceSnapshot) .setWaitForCompletion(true) @@ -504,7 +504,7 @@ public void testDoesNotStartOnBrokenSourceSnapshot() throws Exception { final SnapshotException sne = expectThrows( SnapshotException.class, - () -> startClone(masterClient, repoName, sourceSnapshot, "target-snapshot", testIndex).actionGet( + () -> startClone(clusterManagerClient, repoName, sourceSnapshot, "target-snapshot", testIndex).actionGet( TimeValue.timeValueSeconds(30L) ) ); @@ -517,7 +517,7 @@ public void testDoesNotStartOnBrokenSourceSnapshot() throws Exception { } public void testStartSnapshotWithSuccessfulShardClonePendingFinalization() throws Exception { - final String masterName = internalCluster().startClusterManagerOnlyNode(LARGE_SNAPSHOT_POOL_SETTINGS); + final String clusterManagerName = internalCluster().startClusterManagerOnlyNode(LARGE_SNAPSHOT_POOL_SETTINGS); final String dataNode = internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); @@ -531,13 +531,13 @@ public void testStartSnapshotWithSuccessfulShardClonePendingFinalization() throw 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); blockNodeOnAnyFiles(repoName, dataNode); final ActionFuture otherSnapshot = startFullSnapshot(repoName, "other-snapshot"); awaitNumberOfSnapshotsInProgress(2); assertFalse(blockedClone.isDone()); - unblockNode(repoName, masterName); + unblockNode(repoName, clusterManagerName); awaitNumberOfSnapshotsInProgress(1); awaitMasterFinishRepoOperations(); unblockNode(repoName, dataNode); @@ -577,7 +577,7 @@ public void testStartCloneWithSuccessfulShardClonePendingFinalization() throws E } public void testStartCloneWithSuccessfulShardSnapshotPendingFinalization() throws Exception { - final String masterName = internalCluster().startClusterManagerOnlyNode(LARGE_SNAPSHOT_POOL_SETTINGS); + final String clusterManagerName = internalCluster().startClusterManagerOnlyNode(LARGE_SNAPSHOT_POOL_SETTINGS); internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); @@ -590,7 +590,7 @@ public void testStartCloneWithSuccessfulShardSnapshotPendingFinalization() throw blockMasterOnWriteIndexFile(repoName); final ActionFuture blockedSnapshot = startFullSnapshot(repoName, "snap-blocked"); - waitForBlock(masterName, repoName, TimeValue.timeValueSeconds(30L)); + waitForBlock(clusterManagerName, repoName, TimeValue.timeValueSeconds(30L)); awaitNumberOfSnapshotsInProgress(1); final String cloneName = "clone"; final ActionFuture clone = startClone(repoName, sourceSnapshot, cloneName, indexName); @@ -603,7 +603,7 @@ public void testStartCloneWithSuccessfulShardSnapshotPendingFinalization() throw }); assertFalse(blockedSnapshot.isDone()); } finally { - unblockNode(repoName, masterName); + unblockNode(repoName, clusterManagerName); } awaitNoMoreRunningOperations(); diff --git a/server/src/internalClusterTest/java/org/opensearch/snapshots/ConcurrentSnapshotsIT.java b/server/src/internalClusterTest/java/org/opensearch/snapshots/ConcurrentSnapshotsIT.java index 19c315049f0d0..f6f17860c5fcc 100644 --- a/server/src/internalClusterTest/java/org/opensearch/snapshots/ConcurrentSnapshotsIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/snapshots/ConcurrentSnapshotsIT.java @@ -447,7 +447,7 @@ public void testCascadedAborts() throws Exception { assertThat(client().admin().cluster().prepareGetSnapshots(repoName).get().getSnapshots(), empty()); } - public void testMasterFailOverWithQueuedDeletes() throws Exception { + public void testClusterManagerFailOverWithQueuedDeletes() throws Exception { internalCluster().startMasterOnlyNodes(3); final String dataNode = internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; @@ -658,7 +658,7 @@ public void testQueuedOperationsOnMasterDisconnect() throws Exception { createNSnapshots(repoName, randomIntBetween(2, 5)); final String clusterManagerNode = internalCluster().getMasterName(); - final NetworkDisruption networkDisruption = isolateMasterDisruption(NetworkDisruption.DISCONNECT); + final NetworkDisruption networkDisruption = isolateClusterManagerDisruption(NetworkDisruption.DISCONNECT); internalCluster().setDisruptionScheme(networkDisruption); blockNodeOnAnyFiles(repoName, clusterManagerNode); @@ -703,7 +703,7 @@ public void testQueuedOperationsOnMasterDisconnectAndRepoFailure() throws Except createNSnapshots(repoName, randomIntBetween(2, 5)); final String clusterManagerNode = internalCluster().getMasterName(); - final NetworkDisruption networkDisruption = isolateMasterDisruption(NetworkDisruption.DISCONNECT); + final NetworkDisruption networkDisruption = isolateClusterManagerDisruption(NetworkDisruption.DISCONNECT); internalCluster().setDisruptionScheme(networkDisruption); blockMasterFromFinalizingSnapshotOnIndexFile(repoName); @@ -816,7 +816,7 @@ public void testQueuedSnapshotOperationsAndBrokenRepoOnMasterFailOver2() throws final ActionFuture snapshotFour = startFullSnapshotFromNonMasterClient(repoName, "snapshot-four"); awaitNumberOfSnapshotsInProgress(2); - final NetworkDisruption networkDisruption = isolateMasterDisruption(NetworkDisruption.DISCONNECT); + final NetworkDisruption networkDisruption = isolateClusterManagerDisruption(NetworkDisruption.DISCONNECT); internalCluster().setDisruptionScheme(networkDisruption); networkDisruption.startDisrupting(); ensureStableCluster(3, dataNode); @@ -1012,13 +1012,13 @@ public void testQueuedOperationsAfterFinalizationFailure() throws Exception { final ActionFuture snapshotThree = startAndBlockFailingFullSnapshot(repoName, "snap-other"); - final String masterName = internalCluster().getMasterName(); + final String clusterManagerName = internalCluster().getMasterName(); final String snapshotOne = snapshotNames.get(0); final ActionFuture deleteSnapshotOne = startDeleteSnapshot(repoName, snapshotOne); awaitNDeletionsInProgress(1); - unblockNode(repoName, masterName); + unblockNode(repoName, clusterManagerName); expectThrows(SnapshotException.class, snapshotThree::actionGet); assertAcked(deleteSnapshotOne.get()); @@ -1068,20 +1068,20 @@ public void testEquivalentDeletesAreDeduplicated() throws Exception { } } - public void testMasterFailoverOnFinalizationLoop() throws Exception { + public void testClusterManagerFailoverOnFinalizationLoop() throws Exception { internalCluster().startMasterOnlyNodes(3); final String dataNode = internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); createIndexWithContent("index-test"); - final NetworkDisruption networkDisruption = isolateMasterDisruption(NetworkDisruption.DISCONNECT); + final NetworkDisruption networkDisruption = isolateClusterManagerDisruption(NetworkDisruption.DISCONNECT); internalCluster().setDisruptionScheme(networkDisruption); final List snapshotNames = createNSnapshots(repoName, randomIntBetween(2, 5)); - final String masterName = internalCluster().getMasterName(); + final String clusterManagerName = internalCluster().getMasterName(); blockMasterFromDeletingIndexNFile(repoName); final ActionFuture snapshotThree = startFullSnapshotFromMasterClient(repoName, "snap-other"); - waitForBlock(masterName, repoName, TimeValue.timeValueSeconds(30L)); + waitForBlock(clusterManagerName, repoName, TimeValue.timeValueSeconds(30L)); final String snapshotOne = snapshotNames.get(0); final ActionFuture deleteSnapshotOne = startDeleteSnapshot(repoName, snapshotOne); @@ -1089,7 +1089,7 @@ public void testMasterFailoverOnFinalizationLoop() throws Exception { networkDisruption.startDisrupting(); ensureStableCluster(3, dataNode); - unblockNode(repoName, masterName); + unblockNode(repoName, clusterManagerName); networkDisruption.stopDisrupting(); ensureStableCluster(4); @@ -1181,7 +1181,7 @@ public void testInterleavedAcrossMultipleRepos() throws Exception { assertSuccessful(createSlowFuture3); } - public void testMasterFailoverAndMultipleQueuedUpSnapshotsAcrossTwoRepos() throws Exception { + public void testClusterManagerFailoverAndMultipleQueuedUpSnapshotsAcrossTwoRepos() throws Exception { disableRepoConsistencyCheck("This test corrupts the repository on purpose"); internalCluster().startMasterOnlyNodes(3, LARGE_SNAPSHOT_POOL_SETTINGS); diff --git a/server/src/internalClusterTest/java/org/opensearch/snapshots/DedicatedClusterSnapshotRestoreIT.java b/server/src/internalClusterTest/java/org/opensearch/snapshots/DedicatedClusterSnapshotRestoreIT.java index 5a17b72aa73cf..2eca8555e1388 100644 --- a/server/src/internalClusterTest/java/org/opensearch/snapshots/DedicatedClusterSnapshotRestoreIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/snapshots/DedicatedClusterSnapshotRestoreIT.java @@ -835,7 +835,7 @@ public void sendResponse(RestResponse response) { } } - public void testMasterShutdownDuringSnapshot() throws Exception { + public void testClusterManagerShutdownDuringSnapshot() throws Exception { logger.info("--> starting two cluster-manager nodes and two data nodes"); internalCluster().startMasterOnlyNodes(2); internalCluster().startDataOnlyNodes(2); diff --git a/server/src/internalClusterTest/java/org/opensearch/snapshots/RepositoryFilterUserMetadataIT.java b/server/src/internalClusterTest/java/org/opensearch/snapshots/RepositoryFilterUserMetadataIT.java index 12d9b6f4ca440..ec41213c77b96 100644 --- a/server/src/internalClusterTest/java/org/opensearch/snapshots/RepositoryFilterUserMetadataIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/snapshots/RepositoryFilterUserMetadataIT.java @@ -70,7 +70,7 @@ protected Collection> nodePlugins() { } public void testFilteredRepoMetadataIsUsed() { - final String masterName = internalCluster().getMasterName(); + final String clusterManagerName = internalCluster().getMasterName(); final String repoName = "test-repo"; assertAcked( client().admin() @@ -80,7 +80,7 @@ public void testFilteredRepoMetadataIsUsed() { .setSettings( Settings.builder() .put("location", randomRepoPath()) - .put(MetadataFilteringPlugin.CLUSTER_MANAGER_SETTING_VALUE, masterName) + .put(MetadataFilteringPlugin.CLUSTER_MANAGER_SETTING_VALUE, clusterManagerName) ) ); createIndex("test-idx"); @@ -90,7 +90,10 @@ public void testFilteredRepoMetadataIsUsed() { .setWaitForCompletion(true) .get() .getSnapshotInfo(); - assertThat(snapshotInfo.userMetadata(), is(Collections.singletonMap(MetadataFilteringPlugin.MOCK_FILTERED_META, masterName))); + assertThat( + snapshotInfo.userMetadata(), + is(Collections.singletonMap(MetadataFilteringPlugin.MOCK_FILTERED_META, clusterManagerName)) + ); } // Mock plugin that stores the name of the cluster-manager node that started a snapshot in each snapshot's metadata diff --git a/server/src/internalClusterTest/java/org/opensearch/snapshots/SnapshotShardsServiceIT.java b/server/src/internalClusterTest/java/org/opensearch/snapshots/SnapshotShardsServiceIT.java index 4543a3e0a1b6d..ef7c61205855e 100644 --- a/server/src/internalClusterTest/java/org/opensearch/snapshots/SnapshotShardsServiceIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/snapshots/SnapshotShardsServiceIT.java @@ -83,7 +83,7 @@ public void testRetryPostingSnapshotStatusMessages() throws Exception { final SnapshotId snapshotId = getSnapshot("test-repo", "test-snap").snapshotId(); logger.info("--> start disrupting cluster"); - final NetworkDisruption networkDisruption = isolateMasterDisruption(NetworkDisruption.NetworkDelay.random(random())); + final NetworkDisruption networkDisruption = isolateClusterManagerDisruption(NetworkDisruption.NetworkDelay.random(random())); internalCluster().setDisruptionScheme(networkDisruption); networkDisruption.startDisrupting(); 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 f36f4dedfdfaa..3fcc0635f090e 100644 --- a/test/framework/src/main/java/org/opensearch/test/OpenSearchIntegTestCase.java +++ b/test/framework/src/main/java/org/opensearch/test/OpenSearchIntegTestCase.java @@ -712,7 +712,7 @@ public void setDisruptionScheme(ServiceDisruptionScheme scheme) { * @param disruptionType type of disruption to create * @return disruption */ - protected static NetworkDisruption isolateMasterDisruption(NetworkDisruption.NetworkLinkDisruptionType disruptionType) { + protected static NetworkDisruption isolateClusterManagerDisruption(NetworkDisruption.NetworkLinkDisruptionType disruptionType) { final String clusterManagerNode = internalCluster().getMasterName(); return new NetworkDisruption( new NetworkDisruption.TwoPartitions( From 05ef18c79128a6ed05c9003b8f012a6bccdddc7f Mon Sep 17 00:00:00 2001 From: Tianli Feng Date: Sun, 15 May 2022 12:42:47 -0700 Subject: [PATCH 06/11] Adjust comment line break Signed-off-by: Tianli Feng --- .../java/org/opensearch/cluster/ClusterHealthIT.java | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/ClusterHealthIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/ClusterHealthIT.java index bded5d2ade05b..5381dcfe4bdd2 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/ClusterHealthIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/ClusterHealthIT.java @@ -364,9 +364,8 @@ public void testHealthOnClusterManagerFailover() throws Exception { ); } final List> responseFutures = new ArrayList<>(); - // Run a few health requests concurrent to cluster-manager fail-overs against a data-node to make sure cluster-manager failover is - // handled - // without exceptions + // Run a few health requests concurrent to cluster-manager fail-overs against a data-node + // to make sure cluster-manager failover is handled without exceptions final int iterations = withIndex ? 10 : 20; for (int i = 0; i < iterations; ++i) { responseFutures.add( From 9fbc35fb461810dc347a986ded45acd16bfda4fa Mon Sep 17 00:00:00 2001 From: Tianli Feng Date: Mon, 16 May 2022 20:45:21 -0700 Subject: [PATCH 07/11] Replace master with cluster_manager in server/src/internalClusterTest Signed-off-by: Tianli Feng --- ...java => MinimumClusterManagerNodesIT.java} | 2 +- ...ava => SpecificClusterManagerNodesIT.java} | 4 ++-- ... => StableClusterManagerDisruptionIT.java} | 24 +++++++++---------- .../opensearch/snapshots/CloneSnapshotIT.java | 6 ++--- .../snapshots/ConcurrentSnapshotsIT.java | 2 +- .../AbstractSnapshotIntegTestCase.java | 2 +- 6 files changed, 20 insertions(+), 20 deletions(-) rename server/src/internalClusterTest/java/org/opensearch/cluster/{MinimumMasterNodesIT.java => MinimumClusterManagerNodesIT.java} (99%) rename server/src/internalClusterTest/java/org/opensearch/cluster/{SpecificMasterNodesIT.java => SpecificClusterManagerNodesIT.java} (98%) rename server/src/internalClusterTest/java/org/opensearch/discovery/{StableMasterDisruptionIT.java => StableClusterManagerDisruptionIT.java} (93%) diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/MinimumMasterNodesIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/MinimumClusterManagerNodesIT.java similarity index 99% rename from server/src/internalClusterTest/java/org/opensearch/cluster/MinimumMasterNodesIT.java rename to server/src/internalClusterTest/java/org/opensearch/cluster/MinimumClusterManagerNodesIT.java index c2ea62de4efa6..8f512ade7465f 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/MinimumMasterNodesIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/MinimumClusterManagerNodesIT.java @@ -74,7 +74,7 @@ import static org.hamcrest.Matchers.nullValue; @ClusterScope(scope = Scope.TEST, numDataNodes = 0, autoManageMasterNodes = false) -public class MinimumMasterNodesIT extends OpenSearchIntegTestCase { +public class MinimumClusterManagerNodesIT extends OpenSearchIntegTestCase { @Override protected Collection> nodePlugins() { diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/SpecificMasterNodesIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/SpecificClusterManagerNodesIT.java similarity index 98% rename from server/src/internalClusterTest/java/org/opensearch/cluster/SpecificMasterNodesIT.java rename to server/src/internalClusterTest/java/org/opensearch/cluster/SpecificClusterManagerNodesIT.java index 1b89e268df25b..a58a195939db0 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/SpecificMasterNodesIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/SpecificClusterManagerNodesIT.java @@ -53,7 +53,7 @@ import static org.hamcrest.Matchers.nullValue; @ClusterScope(scope = Scope.TEST, numDataNodes = 0, autoManageMasterNodes = false) -public class SpecificMasterNodesIT extends OpenSearchIntegTestCase { +public class SpecificClusterManagerNodesIT extends OpenSearchIntegTestCase { public void testSimpleOnlyClusterManagerNodeElection() throws IOException { internalCluster().setBootstrapClusterManagerNodeIndex(0); @@ -159,7 +159,7 @@ public void testSimpleOnlyClusterManagerNodeElection() throws IOException { ); } - public void testElectOnlyBetweenMasterNodes() throws Exception { + public void testElectOnlyBetweenClusterManagerNodes() throws Exception { internalCluster().setBootstrapClusterManagerNodeIndex(0); logger.info("--> start data node / non cluster-manager node"); internalCluster().startNode(Settings.builder().put(dataOnlyNode()).put("discovery.initial_state_timeout", "1s")); diff --git a/server/src/internalClusterTest/java/org/opensearch/discovery/StableMasterDisruptionIT.java b/server/src/internalClusterTest/java/org/opensearch/discovery/StableClusterManagerDisruptionIT.java similarity index 93% rename from server/src/internalClusterTest/java/org/opensearch/discovery/StableMasterDisruptionIT.java rename to server/src/internalClusterTest/java/org/opensearch/discovery/StableClusterManagerDisruptionIT.java index 3ff794358a94f..3a91e11075665 100644 --- a/server/src/internalClusterTest/java/org/opensearch/discovery/StableMasterDisruptionIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/discovery/StableClusterManagerDisruptionIT.java @@ -77,7 +77,7 @@ * not detect a cluster-manager failure too quickly. */ @OpenSearchIntegTestCase.ClusterScope(scope = OpenSearchIntegTestCase.Scope.TEST, numDataNodes = 0) -public class StableMasterDisruptionIT extends OpenSearchIntegTestCase { +public class StableClusterManagerDisruptionIT extends OpenSearchIntegTestCase { @Override protected Collection> nodePlugins() { @@ -87,7 +87,7 @@ protected Collection> nodePlugins() { /** * Test that no split brain occurs under partial network partition. See https://github.com/elastic/elasticsearch/issues/2488 */ - public void testFailWithMinimumMasterNodesConfigured() throws Exception { + public void testFailWithMinimumClusterManagerNodesConfigured() throws Exception { List nodes = internalCluster().startNodes(3); ensureStableCluster(3); @@ -96,9 +96,9 @@ public void testFailWithMinimumMasterNodesConfigured() throws Exception { logger.info("---> legit elected cluster-manager node={}", clusterManagerNode); // Pick a node that isn't the elected cluster-manager. - Set nonMasters = new HashSet<>(nodes); - nonMasters.remove(clusterManagerNode); - final String unluckyNode = randomFrom(nonMasters.toArray(Strings.EMPTY_ARRAY)); + Set nonClusterManagers = new HashSet<>(nodes); + nonClusterManagers.remove(clusterManagerNode); + final String unluckyNode = randomFrom(nonClusterManagers.toArray(Strings.EMPTY_ARRAY)); // Simulate a network issue between the unlucky node and elected cluster-manager node in both directions. @@ -167,11 +167,11 @@ private void testFollowerCheckerAfterMasterReelection(NetworkLinkDisruptionType ensureStableCluster(3); final String clusterManager = internalCluster().getMasterName(); - final List nonMasters = Arrays.stream(internalCluster().getNodeNames()) + final List nonClusterManagers = Arrays.stream(internalCluster().getNodeNames()) .filter(n -> clusterManager.equals(n) == false) .collect(Collectors.toList()); - final String isolatedNode = randomFrom(nonMasters); - final String otherNode = nonMasters.get(nonMasters.get(0).equals(isolatedNode) ? 1 : 0); + final String isolatedNode = randomFrom(nonClusterManagers); + final String otherNode = nonClusterManagers.get(nonClusterManagers.get(0).equals(isolatedNode) ? 1 : 0); logger.info("--> isolating [{}]", isolatedNode); @@ -230,8 +230,8 @@ public void testStaleMasterNotHijackingMajority() throws Exception { event.previousState() ); String previousClusterManagerNodeName = previousClusterManager != null ? previousClusterManager.getName() : null; - String currentMasterNodeName = currentClusterManager != null ? currentClusterManager.getName() : null; - clusterManagers.get(node).add(new Tuple<>(previousClusterManagerNodeName, currentMasterNodeName)); + String currentClusterManagerNodeName = currentClusterManager != null ? currentClusterManager.getName() : null; + clusterManagers.get(node).add(new Tuple<>(previousClusterManagerNodeName, currentClusterManagerNodeName)); } }); } @@ -274,8 +274,8 @@ public void onFailure(String source, Exception e) { }); // Save the new elected cluster-manager node - final String newMasterNode = internalCluster().getMasterName(majoritySide.get(0)); - logger.info("--> new detected cluster-manager node [{}]", newMasterNode); + final String newClusterManagerNode = internalCluster().getMasterName(majoritySide.get(0)); + logger.info("--> new detected cluster-manager node [{}]", newClusterManagerNode); // Stop disruption logger.info("--> unfreezing node [{}]", oldClusterManagerNode); diff --git a/server/src/internalClusterTest/java/org/opensearch/snapshots/CloneSnapshotIT.java b/server/src/internalClusterTest/java/org/opensearch/snapshots/CloneSnapshotIT.java index a215f994ca220..6f8659cbf230b 100644 --- a/server/src/internalClusterTest/java/org/opensearch/snapshots/CloneSnapshotIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/snapshots/CloneSnapshotIT.java @@ -539,7 +539,7 @@ public void testStartSnapshotWithSuccessfulShardClonePendingFinalization() throw assertFalse(blockedClone.isDone()); unblockNode(repoName, clusterManagerName); awaitNumberOfSnapshotsInProgress(1); - awaitMasterFinishRepoOperations(); + awaitClusterManagerFinishRepoOperations(); unblockNode(repoName, dataNode); assertAcked(blockedClone.get()); assertEquals(getSnapshot(repoName, cloneName).state(), SnapshotState.SUCCESS); @@ -569,7 +569,7 @@ public void testStartCloneWithSuccessfulShardClonePendingFinalization() throws E assertFalse(blockedClone.isDone()); unblockNode(repoName, clusterManagerName); awaitNoMoreRunningOperations(clusterManagerName); - awaitMasterFinishRepoOperations(); + awaitClusterManagerFinishRepoOperations(); assertAcked(blockedClone.get()); assertAcked(otherClone.get()); assertEquals(getSnapshot(repoName, cloneName).state(), SnapshotState.SUCCESS); @@ -607,7 +607,7 @@ public void testStartCloneWithSuccessfulShardSnapshotPendingFinalization() throw } awaitNoMoreRunningOperations(); - awaitMasterFinishRepoOperations(); + awaitClusterManagerFinishRepoOperations(); assertSuccessful(blockedSnapshot); assertAcked(clone.get()); diff --git a/server/src/internalClusterTest/java/org/opensearch/snapshots/ConcurrentSnapshotsIT.java b/server/src/internalClusterTest/java/org/opensearch/snapshots/ConcurrentSnapshotsIT.java index f6f17860c5fcc..4e9d8ea91d05a 100644 --- a/server/src/internalClusterTest/java/org/opensearch/snapshots/ConcurrentSnapshotsIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/snapshots/ConcurrentSnapshotsIT.java @@ -1385,7 +1385,7 @@ public void testStartWithSuccessfulShardSnapshotPendingFinalization() throws Exc unblockNode(repoName, clusterManagerName); awaitNumberOfSnapshotsInProgress(1); - awaitMasterFinishRepoOperations(); + awaitClusterManagerFinishRepoOperations(); unblockNode(repoName, dataNode); assertSuccessful(blockedSnapshot); 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 70839be718e47..3594bf9f53ca4 100644 --- a/test/framework/src/main/java/org/opensearch/snapshots/AbstractSnapshotIntegTestCase.java +++ b/test/framework/src/main/java/org/opensearch/snapshots/AbstractSnapshotIntegTestCase.java @@ -627,7 +627,7 @@ protected SnapshotInfo getSnapshot(String repository, String snapshot) { return snapshotInfos.get(0); } - protected void awaitMasterFinishRepoOperations() throws Exception { + protected void awaitClusterManagerFinishRepoOperations() throws Exception { logger.info("--> waiting for cluster-manager to finish all repo operations on its SNAPSHOT pool"); final ThreadPool clusterManagerThreadPool = internalCluster().getMasterNodeInstance(ThreadPool.class); assertBusy(() -> { From 02af408bcf8bf72ebff9f3a01592cf3cf0e9f49f Mon Sep 17 00:00:00 2001 From: Tianli Feng Date: Wed, 18 May 2022 15:00:48 -0700 Subject: [PATCH 08/11] Replace master with cluster_manager in test method names in server/src/internalClusterTest Signed-off-by: Tianli Feng --- .../StableClusterManagerDisruptionIT.java | 12 ++++++------ .../opensearch/gateway/RecoverAfterNodesIT.java | 2 +- .../opensearch/index/mapper/DynamicMappingIT.java | 2 +- .../indices/recovery/IndexRecoveryIT.java | 2 +- .../IngestProcessorNotInstalledOnAllNodesIT.java | 2 +- .../snapshots/ConcurrentSnapshotsIT.java | 14 +++++++------- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/server/src/internalClusterTest/java/org/opensearch/discovery/StableClusterManagerDisruptionIT.java b/server/src/internalClusterTest/java/org/opensearch/discovery/StableClusterManagerDisruptionIT.java index 3a91e11075665..fcc2b7a7d5ad4 100644 --- a/server/src/internalClusterTest/java/org/opensearch/discovery/StableClusterManagerDisruptionIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/discovery/StableClusterManagerDisruptionIT.java @@ -137,15 +137,15 @@ private void ensureNoMaster(String node) throws Exception { /** * Verify that nodes fault detection detects a disconnected node after cluster-manager reelection */ - public void testFollowerCheckerDetectsDisconnectedNodeAfterMasterReelection() throws Exception { - testFollowerCheckerAfterMasterReelection(NetworkDisruption.DISCONNECT, Settings.EMPTY); + public void testFollowerCheckerDetectsDisconnectedNodeAfterClusterManagerReelection() throws Exception { + testFollowerCheckerAfterClusterManagerReelection(NetworkDisruption.DISCONNECT, Settings.EMPTY); } /** * Verify that nodes fault detection detects an unresponsive node after cluster-manager reelection */ - public void testFollowerCheckerDetectsUnresponsiveNodeAfterMasterReelection() throws Exception { - testFollowerCheckerAfterMasterReelection( + public void testFollowerCheckerDetectsUnresponsiveNodeAfterClusterManagerReelection() throws Exception { + testFollowerCheckerAfterClusterManagerReelection( NetworkDisruption.UNRESPONSIVE, Settings.builder() .put(LeaderChecker.LEADER_CHECK_TIMEOUT_SETTING.getKey(), "1s") @@ -156,7 +156,7 @@ public void testFollowerCheckerDetectsUnresponsiveNodeAfterMasterReelection() th ); } - private void testFollowerCheckerAfterMasterReelection(NetworkLinkDisruptionType networkLinkDisruptionType, Settings settings) + private void testFollowerCheckerAfterClusterManagerReelection(NetworkLinkDisruptionType networkLinkDisruptionType, Settings settings) throws Exception { internalCluster().startNodes(4, settings); ensureStableCluster(4); @@ -194,7 +194,7 @@ private void testFollowerCheckerAfterMasterReelection(NetworkLinkDisruptionType * Tests that emulates a frozen elected cluster-manager node that unfreezes and pushes its cluster state to other nodes that already are * following another elected cluster-manager node. These nodes should reject this cluster state and prevent them from following the stale cluster-manager. */ - public void testStaleMasterNotHijackingMajority() throws Exception { + public void testStaleClusterManagerNotHijackingMajority() throws Exception { final List nodes = internalCluster().startNodes( 3, Settings.builder() diff --git a/server/src/internalClusterTest/java/org/opensearch/gateway/RecoverAfterNodesIT.java b/server/src/internalClusterTest/java/org/opensearch/gateway/RecoverAfterNodesIT.java index fa624025cae35..c18d94e02ab9c 100644 --- a/server/src/internalClusterTest/java/org/opensearch/gateway/RecoverAfterNodesIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/gateway/RecoverAfterNodesIT.java @@ -127,7 +127,7 @@ public void testRecoverAfterNodes() throws Exception { assertThat(waitForNoBlocksOnNode(BLOCK_WAIT_TIMEOUT, clientNode3).isEmpty(), equalTo(true)); } - public void testRecoverAfterMasterNodes() throws Exception { + public void testRecoverAfterClusterManagerNodes() throws Exception { internalCluster().setBootstrapClusterManagerNodeIndex(0); logger.info("--> start cluster_manager_node (1)"); Client clusterManager1 = startNode(Settings.builder().put("gateway.recover_after_master_nodes", 2).put(clusterManagerOnlyNode())); diff --git a/server/src/internalClusterTest/java/org/opensearch/index/mapper/DynamicMappingIT.java b/server/src/internalClusterTest/java/org/opensearch/index/mapper/DynamicMappingIT.java index 1a582f99cc0a7..c90c5f45af176 100644 --- a/server/src/internalClusterTest/java/org/opensearch/index/mapper/DynamicMappingIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/index/mapper/DynamicMappingIT.java @@ -140,7 +140,7 @@ public void run() { } } - public void testPreflightCheckAvoidsMaster() throws InterruptedException { + public void testPreflightCheckAvoidsClusterManager() throws InterruptedException { createIndex("index", Settings.builder().put(INDEX_MAPPING_TOTAL_FIELDS_LIMIT_SETTING.getKey(), 2).build()); ensureGreen("index"); client().prepareIndex("index").setId("1").setSource("field1", "value1").get(); 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 1b4d885d09e33..4650000f1e20a 100644 --- a/server/src/internalClusterTest/java/org/opensearch/indices/recovery/IndexRecoveryIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/indices/recovery/IndexRecoveryIT.java @@ -1467,7 +1467,7 @@ public void testDoNotInfinitelyWaitForMapping() { } /** Makes sure the new cluster-manager does not repeatedly fetch index metadata from recovering replicas */ - public void testOngoingRecoveryAndMasterFailOver() throws Exception { + public void testOngoingRecoveryAndClusterManagerFailOver() throws Exception { String indexName = "test"; internalCluster().startNodes(2); String nodeWithPrimary = internalCluster().startDataOnlyNode(); diff --git a/server/src/internalClusterTest/java/org/opensearch/ingest/IngestProcessorNotInstalledOnAllNodesIT.java b/server/src/internalClusterTest/java/org/opensearch/ingest/IngestProcessorNotInstalledOnAllNodesIT.java index 1aed4de79cd63..a615cceffb5df 100644 --- a/server/src/internalClusterTest/java/org/opensearch/ingest/IngestProcessorNotInstalledOnAllNodesIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/ingest/IngestProcessorNotInstalledOnAllNodesIT.java @@ -91,7 +91,7 @@ public void testFailPipelineCreation() throws Exception { } } - public void testFailPipelineCreationProcessorNotInstalledOnMasterNode() throws Exception { + public void testFailPipelineCreationProcessorNotInstalledOnClusterManagerNode() throws Exception { internalCluster().startNode(); installPlugin = true; internalCluster().startNode(); diff --git a/server/src/internalClusterTest/java/org/opensearch/snapshots/ConcurrentSnapshotsIT.java b/server/src/internalClusterTest/java/org/opensearch/snapshots/ConcurrentSnapshotsIT.java index 4e9d8ea91d05a..0fd46b6b04bc5 100644 --- a/server/src/internalClusterTest/java/org/opensearch/snapshots/ConcurrentSnapshotsIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/snapshots/ConcurrentSnapshotsIT.java @@ -628,7 +628,7 @@ public void testQueuedDeletesWithOverlap() throws Exception { assertThat(client().admin().cluster().prepareGetSnapshots(repoName).get().getSnapshots(), empty()); } - public void testQueuedOperationsOnMasterRestart() throws Exception { + public void testQueuedOperationsOnClusterManagerRestart() throws Exception { internalCluster().startMasterOnlyNodes(3); internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; @@ -649,7 +649,7 @@ public void testQueuedOperationsOnMasterRestart() throws Exception { awaitNoMoreRunningOperations(); } - public void testQueuedOperationsOnMasterDisconnect() throws Exception { + public void testQueuedOperationsOnClusterManagerDisconnect() throws Exception { internalCluster().startMasterOnlyNodes(3); final String dataNode = internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; @@ -694,7 +694,7 @@ public void testQueuedOperationsOnMasterDisconnect() throws Exception { awaitNoMoreRunningOperations(); } - public void testQueuedOperationsOnMasterDisconnectAndRepoFailure() throws Exception { + public void testQueuedOperationsOnClusterManagerDisconnectAndRepoFailure() throws Exception { internalCluster().startMasterOnlyNodes(3); final String dataNode = internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; @@ -737,7 +737,7 @@ public void testQueuedOperationsOnMasterDisconnectAndRepoFailure() throws Except awaitNoMoreRunningOperations(); } - public void testQueuedOperationsAndBrokenRepoOnMasterFailOver() throws Exception { + public void testQueuedOperationsAndBrokenRepoOnClusterManagerFailOver() throws Exception { disableRepoConsistencyCheck("This test corrupts the repository on purpose"); internalCluster().startMasterOnlyNodes(3); @@ -766,7 +766,7 @@ public void testQueuedOperationsAndBrokenRepoOnMasterFailOver() throws Exception expectThrows(RepositoryException.class, deleteFuture::actionGet); } - public void testQueuedSnapshotOperationsAndBrokenRepoOnMasterFailOver() throws Exception { + public void testQueuedSnapshotOperationsAndBrokenRepoOnClusterManagerFailOver() throws Exception { disableRepoConsistencyCheck("This test corrupts the repository on purpose"); internalCluster().startMasterOnlyNodes(3); @@ -794,7 +794,7 @@ public void testQueuedSnapshotOperationsAndBrokenRepoOnMasterFailOver() throws E expectThrows(OpenSearchException.class, snapshotFour::actionGet); } - public void testQueuedSnapshotOperationsAndBrokenRepoOnMasterFailOver2() throws Exception { + public void testQueuedSnapshotOperationsAndBrokenRepoOnClusterManagerFailOver2() throws Exception { disableRepoConsistencyCheck("This test corrupts the repository on purpose"); internalCluster().startMasterOnlyNodes(3); @@ -827,7 +827,7 @@ public void testQueuedSnapshotOperationsAndBrokenRepoOnMasterFailOver2() throws expectThrows(OpenSearchException.class, snapshotFour::actionGet); } - public void testQueuedSnapshotOperationsAndBrokenRepoOnMasterFailOverMultipleRepos() throws Exception { + public void testQueuedSnapshotOperationsAndBrokenRepoOnClusterManagerFailOverMultipleRepos() throws Exception { disableRepoConsistencyCheck("This test corrupts the repository on purpose"); internalCluster().startMasterOnlyNodes(3, LARGE_SNAPSHOT_POOL_SETTINGS); From 87d07e5b81ed67d4f72842ef335ae627839e4954 Mon Sep 17 00:00:00 2001 From: Tianli Feng Date: Wed, 18 May 2022 15:07:16 -0700 Subject: [PATCH 09/11] Replace master with cluster_manager in server/src/internalClusterTest Signed-off-by: Tianli Feng --- .../indices/mapping/UpdateMappingIntegrationIT.java | 4 ++-- .../org/opensearch/snapshots/CloneSnapshotIT.java | 12 ++++++------ .../opensearch/snapshots/ConcurrentSnapshotsIT.java | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/server/src/internalClusterTest/java/org/opensearch/indices/mapping/UpdateMappingIntegrationIT.java b/server/src/internalClusterTest/java/org/opensearch/indices/mapping/UpdateMappingIntegrationIT.java index 8e2872f31abfc..51ff5de34240a 100644 --- a/server/src/internalClusterTest/java/org/opensearch/indices/mapping/UpdateMappingIntegrationIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/indices/mapping/UpdateMappingIntegrationIT.java @@ -386,13 +386,13 @@ private void assertConcreteMappingsOnAll(final String index, final String... fie assertNotNull("field " + fieldName + " doesn't exists on " + node, fieldType); } } - assertMappingOnMaster(index, fieldNames); + assertMappingOnClusterManager(index, fieldNames); } /** * Waits for the given mapping type to exists on the cluster-manager node. */ - private void assertMappingOnMaster(final String index, final String... fieldNames) { + private void assertMappingOnClusterManager(final String index, final String... fieldNames) { GetMappingsResponse response = client().admin().indices().prepareGetMappings(index).get(); MappingMetadata mappings = response.getMappings().get(index); assertThat(mappings, notNullValue()); diff --git a/server/src/internalClusterTest/java/org/opensearch/snapshots/CloneSnapshotIT.java b/server/src/internalClusterTest/java/org/opensearch/snapshots/CloneSnapshotIT.java index 6f8659cbf230b..d5f36608941d5 100644 --- a/server/src/internalClusterTest/java/org/opensearch/snapshots/CloneSnapshotIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/snapshots/CloneSnapshotIT.java @@ -245,7 +245,7 @@ public void testLongRunningCloneAllowsConcurrentSnapshot() throws Exception { createFullSnapshot(repoName, sourceSnapshot); final String targetSnapshot = "target-snapshot"; - blockMasterOnShardClone(repoName); + blockClusterManagerOnShardClone(repoName); final ActionFuture cloneFuture = startClone(repoName, sourceSnapshot, targetSnapshot, indexSlow); waitForBlock(clusterManagerNode, repoName, TimeValue.timeValueSeconds(30L)); @@ -336,7 +336,7 @@ public void testBackToBackClonesForIndexNotInCluster() throws Exception { assertAcked(admin().indices().prepareDelete(indexBlocked).get()); final String targetSnapshot1 = "target-snapshot"; - blockMasterOnShardClone(repoName); + blockClusterManagerOnShardClone(repoName); final ActionFuture cloneFuture1 = startClone(repoName, sourceSnapshot, targetSnapshot1, indexBlocked); waitForBlock(clusterManagerNode, repoName, TimeValue.timeValueSeconds(30L)); assertThat(cloneFuture1.isDone(), is(false)); @@ -388,7 +388,7 @@ public void testClusterManagerFailoverDuringCloneStep1() throws Exception { final String sourceSnapshot = "source-snapshot"; createFullSnapshot(repoName, sourceSnapshot); - blockMasterOnReadIndexMeta(repoName); + blockClusterManagerOnReadIndexMeta(repoName); final String cloneName = "target-snapshot"; final ActionFuture cloneFuture = startCloneFromDataNode(repoName, sourceSnapshot, cloneName, testIndex); awaitNumberOfSnapshotsInProgress(1); @@ -444,7 +444,7 @@ public void testClusterManagerFailoverDuringCloneStep2() throws Exception { createFullSnapshot(repoName, sourceSnapshot); final String targetSnapshot = "target-snapshot"; - blockMasterOnShardClone(repoName); + blockClusterManagerOnShardClone(repoName); final ActionFuture cloneFuture = startCloneFromDataNode(repoName, sourceSnapshot, targetSnapshot, testIndex); awaitNumberOfSnapshotsInProgress(1); final String clusterManagerNode = internalCluster().getMasterName(); @@ -642,12 +642,12 @@ private static ActionFuture startClone( return client.admin().cluster().prepareCloneSnapshot(repoName, sourceSnapshot, targetSnapshot).setIndices(indices).execute(); } - private void blockMasterOnReadIndexMeta(String repoName) { + private void blockClusterManagerOnReadIndexMeta(String repoName) { ((MockRepository) internalCluster().getCurrentMasterNodeInstance(RepositoriesService.class).repository(repoName)) .setBlockOnReadIndexMeta(); } - private void blockMasterOnShardClone(String repoName) { + private void blockClusterManagerOnShardClone(String repoName) { ((MockRepository) internalCluster().getCurrentMasterNodeInstance(RepositoriesService.class).repository(repoName)) .setBlockOnWriteShardLevelMeta(); } diff --git a/server/src/internalClusterTest/java/org/opensearch/snapshots/ConcurrentSnapshotsIT.java b/server/src/internalClusterTest/java/org/opensearch/snapshots/ConcurrentSnapshotsIT.java index 0fd46b6b04bc5..d44c145837d49 100644 --- a/server/src/internalClusterTest/java/org/opensearch/snapshots/ConcurrentSnapshotsIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/snapshots/ConcurrentSnapshotsIT.java @@ -1417,12 +1417,12 @@ private List createNSnapshots(String repoName, int count) { return snapshotNames; } - private ActionFuture startDeleteFromNonMasterClient(String repoName, String snapshotName) { + private ActionFuture startDeleteFromNonClusterManagerClient(String repoName, String snapshotName) { logger.info("--> deleting snapshot [{}] from repo [{}] from non cluster-manager client", snapshotName, repoName); return internalCluster().nonMasterClient().admin().cluster().prepareDeleteSnapshot(repoName, snapshotName).execute(); } - private ActionFuture startFullSnapshotFromNonMasterClient(String repoName, String snapshotName) { + private ActionFuture startFullSnapshotFromNonClusterManagerClient(String repoName, String snapshotName) { logger.info("--> creating full snapshot [{}] to repo [{}] from non cluster-manager client", snapshotName, repoName); return internalCluster().nonMasterClient() .admin() @@ -1432,7 +1432,7 @@ private ActionFuture startFullSnapshotFromNonMasterClien .execute(); } - private ActionFuture startFullSnapshotFromMasterClient(String repoName, String snapshotName) { + private ActionFuture startFullSnapshotFromClusterManagerClient(String repoName, String snapshotName) { logger.info("--> creating full snapshot [{}] to repo [{}] from cluster-manager client", snapshotName, repoName); return internalCluster().masterClient() .admin() From 22d2c3e789df892447b606be25d2bbfb6ccd82e2 Mon Sep 17 00:00:00 2001 From: Tianli Feng Date: Wed, 18 May 2022 15:19:48 -0700 Subject: [PATCH 10/11] Replace master with cluster_manager in ConcurrentSnapshotsIT in server/src/internalClusterTest Signed-off-by: Tianli Feng --- .../snapshots/ConcurrentSnapshotsIT.java | 48 ++++++++++++------- 1 file changed, 30 insertions(+), 18 deletions(-) diff --git a/server/src/internalClusterTest/java/org/opensearch/snapshots/ConcurrentSnapshotsIT.java b/server/src/internalClusterTest/java/org/opensearch/snapshots/ConcurrentSnapshotsIT.java index d44c145837d49..04ec3f027f908 100644 --- a/server/src/internalClusterTest/java/org/opensearch/snapshots/ConcurrentSnapshotsIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/snapshots/ConcurrentSnapshotsIT.java @@ -458,7 +458,10 @@ public void testClusterManagerFailOverWithQueuedDeletes() throws Exception { final String firstSnapshot = "snapshot-one"; blockDataNode(repoName, dataNode); - final ActionFuture firstSnapshotResponse = startFullSnapshotFromNonMasterClient(repoName, firstSnapshot); + final ActionFuture firstSnapshotResponse = startFullSnapshotFromNonClusterManagerClient( + repoName, + firstSnapshot + ); waitForBlock(dataNode, repoName, TimeValue.timeValueSeconds(30L)); final String dataNode2 = internalCluster().startDataOnlyNode(); @@ -475,11 +478,14 @@ public void testClusterManagerFailOverWithQueuedDeletes() throws Exception { return snapshotsInProgress.entries().size() == 2 && snapshotHasCompletedShard(secondSnapshot, snapshotsInProgress); }); - final ActionFuture firstDeleteFuture = startDeleteFromNonMasterClient(repoName, firstSnapshot); + final ActionFuture firstDeleteFuture = startDeleteFromNonClusterManagerClient(repoName, firstSnapshot); awaitNDeletionsInProgress(1); blockNodeOnAnyFiles(repoName, dataNode2); - final ActionFuture snapshotThreeFuture = startFullSnapshotFromNonMasterClient(repoName, "snapshot-three"); + final ActionFuture snapshotThreeFuture = startFullSnapshotFromNonClusterManagerClient( + repoName, + "snapshot-three" + ); waitForBlock(dataNode2, repoName, TimeValue.timeValueSeconds(30L)); assertThat(firstSnapshotResponse.isDone(), is(false)); @@ -488,7 +494,7 @@ public void testClusterManagerFailOverWithQueuedDeletes() throws Exception { logger.info("--> waiting for all three snapshots to show up as in-progress"); assertBusy(() -> assertThat(currentSnapshots(repoName), hasSize(3)), 30L, TimeUnit.SECONDS); - final ActionFuture deleteAllSnapshots = startDeleteFromNonMasterClient(repoName, "*"); + final ActionFuture deleteAllSnapshots = startDeleteFromNonClusterManagerClient(repoName, "*"); logger.info("--> wait for delete to be enqueued in cluster state"); awaitClusterState(state -> { final SnapshotDeletionsInProgress deletionsInProgress = state.custom(SnapshotDeletionsInProgress.TYPE); @@ -552,7 +558,10 @@ public void testAssertMultipleSnapshotsAndPrimaryFailOver() throws Exception { index(testIndex, "_doc", "some_id", "foo", "bar"); blockDataNode(repoName, dataNode); - final ActionFuture firstSnapshotResponse = startFullSnapshotFromMasterClient(repoName, "snapshot-one"); + final ActionFuture firstSnapshotResponse = startFullSnapshotFromClusterManagerClient( + repoName, + "snapshot-one" + ); waitForBlock(dataNode, repoName, TimeValue.timeValueSeconds(30L)); internalCluster().startDataOnlyNode(); @@ -560,7 +569,10 @@ public void testAssertMultipleSnapshotsAndPrimaryFailOver() throws Exception { ensureGreen(testIndex); final String secondSnapshot = "snapshot-two"; - final ActionFuture secondSnapshotResponse = startFullSnapshotFromMasterClient(repoName, secondSnapshot); + final ActionFuture secondSnapshotResponse = startFullSnapshotFromClusterManagerClient( + repoName, + secondSnapshot + ); // make sure second snapshot is in progress before restarting data node waitUntilInprogress(repoName, secondSnapshot, TimeValue.timeValueSeconds(5L)); @@ -707,12 +719,12 @@ public void testQueuedOperationsOnClusterManagerDisconnectAndRepoFailure() throw internalCluster().setDisruptionScheme(networkDisruption); blockMasterFromFinalizingSnapshotOnIndexFile(repoName); - final ActionFuture firstFailedSnapshotFuture = startFullSnapshotFromMasterClient( + final ActionFuture firstFailedSnapshotFuture = startFullSnapshotFromClusterManagerClient( repoName, "failing-snapshot-1" ); waitForBlock(clusterManagerNode, repoName, TimeValue.timeValueSeconds(30L)); - final ActionFuture secondFailedSnapshotFuture = startFullSnapshotFromMasterClient( + final ActionFuture secondFailedSnapshotFuture = startFullSnapshotFromClusterManagerClient( repoName, "failing-snapshot-2" ); @@ -756,7 +768,7 @@ public void testQueuedOperationsAndBrokenRepoOnClusterManagerFailOver() throws E client().admin().cluster().prepareCreateSnapshot(repoName, "snapshot-three").setWaitForCompletion(false).get(); - final ActionFuture deleteFuture = startDeleteFromNonMasterClient(repoName, "*"); + final ActionFuture deleteFuture = startDeleteFromNonClusterManagerClient(repoName, "*"); awaitNDeletionsInProgress(2); internalCluster().stopCurrentMasterNode(); @@ -780,12 +792,12 @@ public void testQueuedSnapshotOperationsAndBrokenRepoOnClusterManagerFailOver() final long generation = getRepositoryData(repoName).getGenId(); final String clusterManagerNode = internalCluster().getMasterName(); blockNodeOnAnyFiles(repoName, clusterManagerNode); - final ActionFuture snapshotThree = startFullSnapshotFromNonMasterClient(repoName, "snapshot-three"); + final ActionFuture snapshotThree = startFullSnapshotFromNonClusterManagerClient(repoName, "snapshot-three"); waitForBlock(clusterManagerNode, repoName, TimeValue.timeValueSeconds(30L)); corruptIndexN(repoPath, generation); - final ActionFuture snapshotFour = startFullSnapshotFromNonMasterClient(repoName, "snapshot-four"); + final ActionFuture snapshotFour = startFullSnapshotFromNonClusterManagerClient(repoName, "snapshot-four"); internalCluster().stopCurrentMasterNode(); ensureStableCluster(3); @@ -808,12 +820,12 @@ public void testQueuedSnapshotOperationsAndBrokenRepoOnClusterManagerFailOver2() final long generation = getRepositoryData(repoName).getGenId(); final String clusterManagerNode = internalCluster().getMasterName(); blockMasterFromFinalizingSnapshotOnIndexFile(repoName); - final ActionFuture snapshotThree = startFullSnapshotFromNonMasterClient(repoName, "snapshot-three"); + final ActionFuture snapshotThree = startFullSnapshotFromNonClusterManagerClient(repoName, "snapshot-three"); waitForBlock(clusterManagerNode, repoName, TimeValue.timeValueSeconds(30L)); corruptIndexN(repoPath, generation); - final ActionFuture snapshotFour = startFullSnapshotFromNonMasterClient(repoName, "snapshot-four"); + final ActionFuture snapshotFour = startFullSnapshotFromNonClusterManagerClient(repoName, "snapshot-four"); awaitNumberOfSnapshotsInProgress(2); final NetworkDisruption networkDisruption = isolateClusterManagerDisruption(NetworkDisruption.DISCONNECT); @@ -844,10 +856,10 @@ public void testQueuedSnapshotOperationsAndBrokenRepoOnClusterManagerFailOverMul createRepository(blockedRepoName, "mock"); createNSnapshots(blockedRepoName, randomIntBetween(1, 5)); blockNodeOnAnyFiles(blockedRepoName, clusterManagerNode); - final ActionFuture deleteFuture = startDeleteFromNonMasterClient(blockedRepoName, "*"); + final ActionFuture deleteFuture = startDeleteFromNonClusterManagerClient(blockedRepoName, "*"); waitForBlock(clusterManagerNode, blockedRepoName, TimeValue.timeValueSeconds(30L)); awaitNDeletionsInProgress(1); - final ActionFuture createBlockedSnapshot = startFullSnapshotFromNonMasterClient( + final ActionFuture createBlockedSnapshot = startFullSnapshotFromNonClusterManagerClient( blockedRepoName, "queued-snapshot" ); @@ -855,13 +867,13 @@ public void testQueuedSnapshotOperationsAndBrokenRepoOnClusterManagerFailOverMul final long generation = getRepositoryData(repoName).getGenId(); blockNodeOnAnyFiles(repoName, clusterManagerNode); - final ActionFuture snapshotThree = startFullSnapshotFromNonMasterClient(repoName, "snapshot-three"); + final ActionFuture snapshotThree = startFullSnapshotFromNonClusterManagerClient(repoName, "snapshot-three"); waitForBlock(clusterManagerNode, repoName, TimeValue.timeValueSeconds(30L)); awaitNumberOfSnapshotsInProgress(2); corruptIndexN(repoPath, generation); - final ActionFuture snapshotFour = startFullSnapshotFromNonMasterClient(repoName, "snapshot-four"); + final ActionFuture snapshotFour = startFullSnapshotFromNonClusterManagerClient(repoName, "snapshot-four"); awaitNumberOfSnapshotsInProgress(3); internalCluster().stopCurrentMasterNode(); ensureStableCluster(3); @@ -1080,7 +1092,7 @@ public void testClusterManagerFailoverOnFinalizationLoop() throws Exception { final List snapshotNames = createNSnapshots(repoName, randomIntBetween(2, 5)); final String clusterManagerName = internalCluster().getMasterName(); blockMasterFromDeletingIndexNFile(repoName); - final ActionFuture snapshotThree = startFullSnapshotFromMasterClient(repoName, "snap-other"); + final ActionFuture snapshotThree = startFullSnapshotFromClusterManagerClient(repoName, "snap-other"); waitForBlock(clusterManagerName, repoName, TimeValue.timeValueSeconds(30L)); final String snapshotOne = snapshotNames.get(0); From 2176adf85fb9ad49a4a8abc00193337c016d1532 Mon Sep 17 00:00:00 2001 From: Tianli Feng Date: Wed, 18 May 2022 15:19:48 -0700 Subject: [PATCH 11/11] Replace master with cluster_manager in server/src/internalClusterTest Signed-off-by: Tianli Feng --- .../action/admin/cluster/tasks/PendingTasksBlocksIT.java | 2 +- ...terFailoverIT.java => IndexingClusterManagerFailoverIT.java} | 2 +- .../{NoMasterNodeIT.java => NoClusterManagerNodeIT.java} | 2 +- ...{MasterDisruptionIT.java => ClusterManagerDisruptionIT.java} | 2 +- ...ingIT.java => DedicatedClusterManagerGetFieldMappingIT.java} | 2 +- .../opensearch/snapshots/RepositoryFilterUserMetadataIT.java | 2 +- 6 files changed, 6 insertions(+), 6 deletions(-) rename server/src/internalClusterTest/java/org/opensearch/action/support/master/{IndexingMasterFailoverIT.java => IndexingClusterManagerFailoverIT.java} (98%) rename server/src/internalClusterTest/java/org/opensearch/cluster/{NoMasterNodeIT.java => NoClusterManagerNodeIT.java} (99%) rename server/src/internalClusterTest/java/org/opensearch/discovery/{MasterDisruptionIT.java => ClusterManagerDisruptionIT.java} (99%) rename server/src/internalClusterTest/java/org/opensearch/indices/mapping/{DedicatedMasterGetFieldMappingIT.java => DedicatedClusterManagerGetFieldMappingIT.java} (94%) diff --git a/server/src/internalClusterTest/java/org/opensearch/action/admin/cluster/tasks/PendingTasksBlocksIT.java b/server/src/internalClusterTest/java/org/opensearch/action/admin/cluster/tasks/PendingTasksBlocksIT.java index 652115668db0b..7c10d52c7a111 100644 --- a/server/src/internalClusterTest/java/org/opensearch/action/admin/cluster/tasks/PendingTasksBlocksIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/action/admin/cluster/tasks/PendingTasksBlocksIT.java @@ -91,7 +91,7 @@ public void testPendingTasksWithClusterNotRecoveredBlock() throws Exception { } // restart the cluster but prevent it from performing state recovery - final int nodeCount = client().admin().cluster().prepareNodesInfo("data:true", "master:true").get().getNodes().size(); + final int nodeCount = client().admin().cluster().prepareNodesInfo("data:true", "cluster_manager:true").get().getNodes().size(); internalCluster().fullRestart(new InternalTestCluster.RestartCallback() { @Override public Settings onNodeStopped(String nodeName) { diff --git a/server/src/internalClusterTest/java/org/opensearch/action/support/master/IndexingMasterFailoverIT.java b/server/src/internalClusterTest/java/org/opensearch/action/support/master/IndexingClusterManagerFailoverIT.java similarity index 98% rename from server/src/internalClusterTest/java/org/opensearch/action/support/master/IndexingMasterFailoverIT.java rename to server/src/internalClusterTest/java/org/opensearch/action/support/master/IndexingClusterManagerFailoverIT.java index cb88435d59633..14e0dd94ea640 100644 --- a/server/src/internalClusterTest/java/org/opensearch/action/support/master/IndexingMasterFailoverIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/action/support/master/IndexingClusterManagerFailoverIT.java @@ -48,7 +48,7 @@ import static org.hamcrest.Matchers.equalTo; @OpenSearchIntegTestCase.ClusterScope(scope = OpenSearchIntegTestCase.Scope.TEST, numDataNodes = 0, autoManageMasterNodes = false) -public class IndexingMasterFailoverIT extends OpenSearchIntegTestCase { +public class IndexingClusterManagerFailoverIT extends OpenSearchIntegTestCase { @Override protected Collection> nodePlugins() { diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/NoMasterNodeIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/NoClusterManagerNodeIT.java similarity index 99% rename from server/src/internalClusterTest/java/org/opensearch/cluster/NoMasterNodeIT.java rename to server/src/internalClusterTest/java/org/opensearch/cluster/NoClusterManagerNodeIT.java index 6e5ab4dd0d398..26852e59d1c86 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/NoMasterNodeIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/NoClusterManagerNodeIT.java @@ -75,7 +75,7 @@ import static org.hamcrest.Matchers.greaterThan; @ClusterScope(scope = Scope.TEST, numDataNodes = 0) -public class NoMasterNodeIT extends OpenSearchIntegTestCase { +public class NoClusterManagerNodeIT extends OpenSearchIntegTestCase { @Override protected int numberOfReplicas() { diff --git a/server/src/internalClusterTest/java/org/opensearch/discovery/MasterDisruptionIT.java b/server/src/internalClusterTest/java/org/opensearch/discovery/ClusterManagerDisruptionIT.java similarity index 99% rename from server/src/internalClusterTest/java/org/opensearch/discovery/MasterDisruptionIT.java rename to server/src/internalClusterTest/java/org/opensearch/discovery/ClusterManagerDisruptionIT.java index 9f0fb964ef529..4515e0828be2e 100644 --- a/server/src/internalClusterTest/java/org/opensearch/discovery/MasterDisruptionIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/discovery/ClusterManagerDisruptionIT.java @@ -63,7 +63,7 @@ * Tests relating to the loss of the cluster-manager. */ @OpenSearchIntegTestCase.ClusterScope(scope = OpenSearchIntegTestCase.Scope.TEST, numDataNodes = 0) -public class MasterDisruptionIT extends AbstractDisruptionTestCase { +public class ClusterManagerDisruptionIT extends AbstractDisruptionTestCase { /** * Test that cluster recovers from a long GC on cluster-manager that causes other nodes to elect a new one diff --git a/server/src/internalClusterTest/java/org/opensearch/indices/mapping/DedicatedMasterGetFieldMappingIT.java b/server/src/internalClusterTest/java/org/opensearch/indices/mapping/DedicatedClusterManagerGetFieldMappingIT.java similarity index 94% rename from server/src/internalClusterTest/java/org/opensearch/indices/mapping/DedicatedMasterGetFieldMappingIT.java rename to server/src/internalClusterTest/java/org/opensearch/indices/mapping/DedicatedClusterManagerGetFieldMappingIT.java index a4123ccc46ab6..72f7bd44541a6 100644 --- a/server/src/internalClusterTest/java/org/opensearch/indices/mapping/DedicatedMasterGetFieldMappingIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/indices/mapping/DedicatedClusterManagerGetFieldMappingIT.java @@ -38,7 +38,7 @@ import static org.opensearch.test.OpenSearchIntegTestCase.Scope; @ClusterScope(scope = Scope.TEST, numDataNodes = 0) -public class DedicatedMasterGetFieldMappingIT extends SimpleGetFieldMappingsIT { +public class DedicatedClusterManagerGetFieldMappingIT extends SimpleGetFieldMappingsIT { @Before public void before1() throws Exception { diff --git a/server/src/internalClusterTest/java/org/opensearch/snapshots/RepositoryFilterUserMetadataIT.java b/server/src/internalClusterTest/java/org/opensearch/snapshots/RepositoryFilterUserMetadataIT.java index ec41213c77b96..d84eb9ea1e269 100644 --- a/server/src/internalClusterTest/java/org/opensearch/snapshots/RepositoryFilterUserMetadataIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/snapshots/RepositoryFilterUserMetadataIT.java @@ -101,7 +101,7 @@ public static final class MetadataFilteringPlugin extends org.opensearch.plugins private static final String MOCK_FILTERED_META = "mock_filtered_meta"; - private static final String CLUSTER_MANAGER_SETTING_VALUE = "initial_master"; + private static final String CLUSTER_MANAGER_SETTING_VALUE = "initial_cluster_manager"; private static final String TYPE = "mock_meta_filtering";