From 5db75c1fd754ed4e8d4fafa1f8dc96989a907ad4 Mon Sep 17 00:00:00 2001 From: Tianli Feng Date: Fri, 22 Jul 2022 11:03:10 -0700 Subject: [PATCH] Deprecate public methods and variables that contain 'master' terminology in 'test/framework' directory (#3978) * Deprecate methods with 'master' name mainly in class 'InternalTestCluster', 'NodeRoles', and 'AbstractSnapshotIntegTestCase' * Deprecate variables contain 'master' in the name in class 'InternalTestCluster' Signed-off-by: Tianli Feng --- .../ingest/common/IngestRestartIT.java | 2 +- .../reindex/DeleteByQueryBasicTests.java | 4 +- .../opensearch/index/reindex/RetryTests.java | 2 +- ...eCloudStorageBlobStoreRepositoryTests.java | 2 +- .../s3/S3BlobStoreRepositoryTests.java | 2 +- .../admin/cluster/node/tasks/TasksIT.java | 4 +- ...ansportClusterStateActionDisruptionIT.java | 4 +- .../admin/indices/create/CreateIndexIT.java | 2 +- .../admin/indices/create/ShrinkIndexIT.java | 2 +- .../IndexingClusterManagerFailoverIT.java | 2 +- ...tReplicationActionRetryOnClosedNodeIT.java | 2 +- .../opensearch/cluster/ClusterHealthIT.java | 12 +- .../cluster/ClusterInfoServiceIT.java | 10 +- .../cluster/MinimumClusterManagerNodesIT.java | 15 +- .../SpecificClusterManagerNodesIT.java | 34 +-- .../cluster/UpdateSettingsValidationIT.java | 4 +- .../action/shard/ShardStateActionIT.java | 2 +- .../coordination/RareClusterStateIT.java | 12 +- .../UnsafeBootstrapAndDetachCommandIT.java | 18 +- .../coordination/VotingConfigurationIT.java | 6 +- .../cluster/coordination/ZenDiscoveryIT.java | 8 +- .../decider/DiskThresholdDeciderIT.java | 16 +- .../allocation/decider/MockDiskUsagesIT.java | 6 +- .../discovery/ClusterDisruptionIT.java | 6 +- .../discovery/ClusterManagerDisruptionIT.java | 8 +- .../discovery/DiscoveryDisruptionIT.java | 6 +- .../discovery/SnapshotDisruptionIT.java | 14 +- .../StableClusterManagerDisruptionIT.java | 12 +- .../index/mapper/DynamicMappingIT.java | 2 +- .../indices/recovery/IndexRecoveryIT.java | 2 +- .../recovery/ReplicaToPrimaryPromotionIT.java | 4 +- .../indices/settings/UpdateSettingsIT.java | 2 +- .../state/CloseWhileRelocatingShardsIT.java | 5 +- .../indices/state/ReopenWhileClosingIT.java | 2 +- .../store/IndicesStoreIntegrationIT.java | 10 +- .../persistent/PersistentTasksExecutorIT.java | 4 +- .../decider/EnableAssignmentDeciderIT.java | 2 +- .../repositories/RepositoriesServiceIT.java | 4 +- .../BlobStoreRepositoryCleanupIT.java | 16 +- .../SearchScrollWithFailingNodesIT.java | 2 +- .../opensearch/snapshots/CloneSnapshotIT.java | 34 +-- .../snapshots/ConcurrentSnapshotsIT.java | 84 +++---- .../CorruptedBlobStoreRepositoryIT.java | 17 +- .../DedicatedClusterSnapshotRestoreIT.java | 20 +- ...etadataLoadingDuringSnapshotRestoreIT.java | 2 +- .../opensearch/snapshots/RepositoriesIT.java | 4 +- .../RepositoryFilterUserMetadataIT.java | 2 +- .../SharedClusterSnapshotRestoreIT.java | 4 +- .../snapshots/SnapshotStatusApisIT.java | 2 +- ...BootstrapServiceDeprecatedMasterTests.java | 4 +- .../ClusterBootstrapServiceTests.java | 4 +- .../coordination/CoordinatorTests.java | 4 +- .../routing/MovePrimaryFirstTests.java | 2 +- .../opensearch/env/NodeEnvironmentTests.java | 6 +- .../env/NodeRepurposeCommandTests.java | 8 +- .../GatewayMetaStatePersistedStateTests.java | 4 +- .../gateway/GatewayServiceTests.java | 4 +- .../transport/ConnectionProfileTests.java | 4 +- .../transport/RemoteClusterServiceTests.java | 4 +- .../blobstore/BlobStoreTestUtil.java | 2 +- ...earchBlobStoreRepositoryIntegTestCase.java | 11 +- .../AbstractSnapshotIntegTestCase.java | 62 ++++-- .../opensearch/test/InternalTestCluster.java | 206 +++++++++++++++--- .../java/org/opensearch/test/NodeRoles.java | 46 +++- .../test/OpenSearchIntegTestCase.java | 2 +- .../BlockMasterServiceOnMaster.java | 2 +- .../BusyMasterServiceDisruption.java | 2 +- .../test/rest/yaml/ClientYamlTestClient.java | 6 + .../yaml/ClientYamlTestExecutionContext.java | 8 +- .../test/rest/yaml/section/DoSection.java | 2 +- .../test/test/InternalTestClusterTests.java | 4 +- 71 files changed, 539 insertions(+), 299 deletions(-) diff --git a/modules/ingest-common/src/internalClusterTest/java/org/opensearch/ingest/common/IngestRestartIT.java b/modules/ingest-common/src/internalClusterTest/java/org/opensearch/ingest/common/IngestRestartIT.java index c662843b91ebb..f27c903d8795f 100644 --- a/modules/ingest-common/src/internalClusterTest/java/org/opensearch/ingest/common/IngestRestartIT.java +++ b/modules/ingest-common/src/internalClusterTest/java/org/opensearch/ingest/common/IngestRestartIT.java @@ -166,7 +166,7 @@ public void testScriptDisabled() throws Exception { checkPipelineExists.accept(pipelineIdWithScript); checkPipelineExists.accept(pipelineIdWithoutScript); - internalCluster().restartNode(internalCluster().getMasterName(), new InternalTestCluster.RestartCallback() { + internalCluster().restartNode(internalCluster().getClusterManagerName(), new InternalTestCluster.RestartCallback() { @Override public Settings onNodeStopped(String nodeName) { diff --git a/modules/reindex/src/test/java/org/opensearch/index/reindex/DeleteByQueryBasicTests.java b/modules/reindex/src/test/java/org/opensearch/index/reindex/DeleteByQueryBasicTests.java index 21bbb02fb147c..baf3c83bd0050 100644 --- a/modules/reindex/src/test/java/org/opensearch/index/reindex/DeleteByQueryBasicTests.java +++ b/modules/reindex/src/test/java/org/opensearch/index/reindex/DeleteByQueryBasicTests.java @@ -274,9 +274,9 @@ public void testDeleteByQueryOnReadOnlyAllowDeleteIndex() throws Exception { InternalTestCluster internalTestCluster = internalCluster(); InternalClusterInfoService infoService = (InternalClusterInfoService) internalTestCluster.getInstance( ClusterInfoService.class, - internalTestCluster.getMasterName() + internalTestCluster.getClusterManagerName() ); - ThreadPool threadPool = internalTestCluster.getInstance(ThreadPool.class, internalTestCluster.getMasterName()); + ThreadPool threadPool = internalTestCluster.getInstance(ThreadPool.class, internalTestCluster.getClusterManagerName()); // Refresh the cluster info after a random delay to check the disk threshold and release the block on the index threadPool.schedule(infoService::refresh, TimeValue.timeValueMillis(randomIntBetween(1, 100)), ThreadPool.Names.MANAGEMENT); // The delete by query request will be executed successfully because the block will be released diff --git a/modules/reindex/src/test/java/org/opensearch/index/reindex/RetryTests.java b/modules/reindex/src/test/java/org/opensearch/index/reindex/RetryTests.java index 55234bcaaf0e2..0b052f8fd57a3 100644 --- a/modules/reindex/src/test/java/org/opensearch/index/reindex/RetryTests.java +++ b/modules/reindex/src/test/java/org/opensearch/index/reindex/RetryTests.java @@ -206,7 +206,7 @@ private void testCase( assertFalse(initialBulkResponse.buildFailureMessage(), initialBulkResponse.hasFailures()); client().admin().indices().prepareRefresh("source").get(); - AbstractBulkByScrollRequestBuilder builder = request.apply(internalCluster().masterClient()); + AbstractBulkByScrollRequestBuilder builder = request.apply(internalCluster().clusterManagerClient()); // Make sure we use more than one batch so we have to scroll builder.source().setSize(DOC_COUNT / randomIntBetween(2, 10)); diff --git a/plugins/repository-gcs/src/internalClusterTest/java/org/opensearch/repositories/gcs/GoogleCloudStorageBlobStoreRepositoryTests.java b/plugins/repository-gcs/src/internalClusterTest/java/org/opensearch/repositories/gcs/GoogleCloudStorageBlobStoreRepositoryTests.java index 274a416d57431..c0a396724897f 100644 --- a/plugins/repository-gcs/src/internalClusterTest/java/org/opensearch/repositories/gcs/GoogleCloudStorageBlobStoreRepositoryTests.java +++ b/plugins/repository-gcs/src/internalClusterTest/java/org/opensearch/repositories/gcs/GoogleCloudStorageBlobStoreRepositoryTests.java @@ -130,7 +130,7 @@ protected Settings nodeSettings(int nodeOrdinal) { public void testDeleteSingleItem() { final String repoName = createRepository(randomName()); - final RepositoriesService repositoriesService = internalCluster().getMasterNodeInstance(RepositoriesService.class); + final RepositoriesService repositoriesService = internalCluster().getClusterManagerNodeInstance(RepositoriesService.class); final BlobStoreRepository repository = (BlobStoreRepository) repositoriesService.repository(repoName); PlainActionFuture.get( f -> repository.threadPool() diff --git a/plugins/repository-s3/src/internalClusterTest/java/org/opensearch/repositories/s3/S3BlobStoreRepositoryTests.java b/plugins/repository-s3/src/internalClusterTest/java/org/opensearch/repositories/s3/S3BlobStoreRepositoryTests.java index e31a9f8cf3856..b35d4080a413a 100644 --- a/plugins/repository-s3/src/internalClusterTest/java/org/opensearch/repositories/s3/S3BlobStoreRepositoryTests.java +++ b/plugins/repository-s3/src/internalClusterTest/java/org/opensearch/repositories/s3/S3BlobStoreRepositoryTests.java @@ -172,7 +172,7 @@ public void testEnforcedCooldownPeriod() throws IOException { .get() .getSnapshotInfo() .snapshotId(); - final RepositoriesService repositoriesService = internalCluster().getCurrentMasterNodeInstance(RepositoriesService.class); + final RepositoriesService repositoriesService = internalCluster().getCurrentClusterManagerNodeInstance(RepositoriesService.class); final BlobStoreRepository repository = (BlobStoreRepository) repositoriesService.repository(repoName); final RepositoryData repositoryData = getRepositoryData(repository); final RepositoryData modifiedRepositoryData = repositoryData.withVersions( 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 9c6c67116ef8a..d37285211f774 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 @@ -158,14 +158,14 @@ public void testClusterManagerNodeOperationTasks() { registerTaskManagerListeners(ClusterHealthAction.NAME); // 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(); + internalCluster().clusterManagerClient().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-cluster-manager node - should produce one task on cluster-manager and one task on another node - internalCluster().nonMasterClient().admin().cluster().prepareHealth().get(); + internalCluster().nonClusterManagerClient().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 List tasks = findEvents(ClusterHealthAction.NAME, Tuple::v1); 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 3be75d672d823..1a0cad36c8f04 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 @@ -194,7 +194,7 @@ public void runRepeatedlyWhileChangingClusterManager(Runnable runnable) throws E ) ); - final String clusterManagerName = internalCluster().getMasterName(); + final String clusterManagerName = internalCluster().getClusterManagerName(); final AtomicBoolean shutdown = new AtomicBoolean(); final Thread assertingThread = new Thread(() -> { @@ -245,7 +245,7 @@ public void runRepeatedlyWhileChangingClusterManager(Runnable runnable) throws E clusterManagerName, () -> randomFrom(internalCluster().getNodeNames()) ); - final String claimedClusterManagerName = internalCluster().getMasterName(nonClusterManagerNode); + final String claimedClusterManagerName = internalCluster().getClusterManagerName(nonClusterManagerNode); assertThat(claimedClusterManagerName, not(equalTo(clusterManagerName))); }); diff --git a/server/src/internalClusterTest/java/org/opensearch/action/admin/indices/create/CreateIndexIT.java b/server/src/internalClusterTest/java/org/opensearch/action/admin/indices/create/CreateIndexIT.java index 3ef2a63c7d0ac..51ef63ae9e9c1 100644 --- a/server/src/internalClusterTest/java/org/opensearch/action/admin/indices/create/CreateIndexIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/action/admin/indices/create/CreateIndexIT.java @@ -340,7 +340,7 @@ public void testFailureToCreateIndexCleansUpIndicesService() { IllegalStateException.class ); - IndicesService indicesService = internalCluster().getInstance(IndicesService.class, internalCluster().getMasterName()); + IndicesService indicesService = internalCluster().getInstance(IndicesService.class, internalCluster().getClusterManagerName()); for (IndexService indexService : indicesService) { assertThat(indexService.index().getName(), not("test-idx-2")); } diff --git a/server/src/internalClusterTest/java/org/opensearch/action/admin/indices/create/ShrinkIndexIT.java b/server/src/internalClusterTest/java/org/opensearch/action/admin/indices/create/ShrinkIndexIT.java index e8a6c68a41076..daa124fab2220 100644 --- a/server/src/internalClusterTest/java/org/opensearch/action/admin/indices/create/ShrinkIndexIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/action/admin/indices/create/ShrinkIndexIT.java @@ -496,7 +496,7 @@ public void testCreateShrinkIndexFails() throws Exception { final InternalClusterInfoService infoService = (InternalClusterInfoService) internalCluster().getInstance( ClusterInfoService.class, - internalCluster().getMasterName() + internalCluster().getClusterManagerName() ); infoService.refresh(); // kick off a retry and wait until it's done! diff --git a/server/src/internalClusterTest/java/org/opensearch/action/support/clustermanager/IndexingClusterManagerFailoverIT.java b/server/src/internalClusterTest/java/org/opensearch/action/support/clustermanager/IndexingClusterManagerFailoverIT.java index 60ba9a4bfcf98..959b16d4c4694 100644 --- a/server/src/internalClusterTest/java/org/opensearch/action/support/clustermanager/IndexingClusterManagerFailoverIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/action/support/clustermanager/IndexingClusterManagerFailoverIT.java @@ -67,7 +67,7 @@ public void testClusterManagerFailoverDuringIndexingWithMappingChanges() throws internalCluster().setBootstrapClusterManagerNodeIndex(2); - internalCluster().startMasterOnlyNodes(3, Settings.EMPTY); + internalCluster().startClusterManagerOnlyNodes(3, Settings.EMPTY); String dataNode = internalCluster().startDataOnlyNode(Settings.EMPTY); diff --git a/server/src/internalClusterTest/java/org/opensearch/action/support/replication/TransportReplicationActionRetryOnClosedNodeIT.java b/server/src/internalClusterTest/java/org/opensearch/action/support/replication/TransportReplicationActionRetryOnClosedNodeIT.java index 8a9f3eb5f2e63..725cc894185e3 100644 --- a/server/src/internalClusterTest/java/org/opensearch/action/support/replication/TransportReplicationActionRetryOnClosedNodeIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/action/support/replication/TransportReplicationActionRetryOnClosedNodeIT.java @@ -203,7 +203,7 @@ public void sendRequest( } public void testRetryOnStoppedTransportService() throws Exception { - internalCluster().startMasterOnlyNodes(2); + internalCluster().startClusterManagerOnlyNodes(2); String primary = internalCluster().startDataOnlyNode(); assertAcked( prepareCreate("test").setSettings( diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/ClusterHealthIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/ClusterHealthIT.java index 14eaeb1e6dfcf..56f290ef4b50c 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/ClusterHealthIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/ClusterHealthIT.java @@ -307,7 +307,10 @@ public void testWaitForEventsRetriesIfOtherConditionsNotMet() { .execute(); final AtomicBoolean keepSubmittingTasks = new AtomicBoolean(true); - final ClusterService clusterService = internalCluster().getInstance(ClusterService.class, internalCluster().getMasterName()); + final ClusterService clusterService = internalCluster().getInstance( + ClusterService.class, + internalCluster().getClusterManagerName() + ); final PlainActionFuture completionFuture = new PlainActionFuture<>(); clusterService.submitStateUpdateTask("looping task", new ClusterStateUpdateTask(Priority.LOW) { @Override @@ -377,7 +380,7 @@ public void testHealthOnClusterManagerFailover() throws Exception { .setClusterManagerNodeTimeout(TimeValue.timeValueMinutes(2)) .execute() ); - internalCluster().restartNode(internalCluster().getMasterName(), InternalTestCluster.EMPTY_CALLBACK); + internalCluster().restartNode(internalCluster().getClusterManagerName(), InternalTestCluster.EMPTY_CALLBACK); } if (withIndex) { assertAcked( @@ -396,7 +399,10 @@ public void testHealthOnClusterManagerFailover() throws Exception { public void testWaitForEventsTimesOutIfClusterManagerBusy() { final AtomicBoolean keepSubmittingTasks = new AtomicBoolean(true); - final ClusterService clusterService = internalCluster().getInstance(ClusterService.class, internalCluster().getMasterName()); + final ClusterService clusterService = internalCluster().getInstance( + ClusterService.class, + internalCluster().getClusterManagerName() + ); final PlainActionFuture completionFuture = new PlainActionFuture<>(); clusterService.submitStateUpdateTask("looping task", new ClusterStateUpdateTask(Priority.LOW) { @Override diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/ClusterInfoServiceIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/ClusterInfoServiceIT.java index dae9505fe67bf..b133b864a6b82 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/ClusterInfoServiceIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/ClusterInfoServiceIT.java @@ -169,7 +169,7 @@ public void testClusterInfoServiceCollectsInformation() { // Get the cluster info service on the cluster-manager node final InternalClusterInfoService infoService = (InternalClusterInfoService) internalTestCluster.getInstance( ClusterInfoService.class, - internalTestCluster.getMasterName() + internalTestCluster.getClusterManagerName() ); infoService.setUpdateFrequency(TimeValue.timeValueMillis(200)); ClusterInfo info = infoService.refresh(); @@ -193,7 +193,7 @@ public void testClusterInfoServiceCollectsInformation() { logger.info("--> shard size: {}", size.value); assertThat("shard size is greater than 0", size.value, greaterThanOrEqualTo(0L)); } - ClusterService clusterService = internalTestCluster.getInstance(ClusterService.class, internalTestCluster.getMasterName()); + ClusterService clusterService = internalTestCluster.getInstance(ClusterService.class, internalTestCluster.getClusterManagerName()); ClusterState state = clusterService.state(); for (ShardRouting shard : state.routingTable().allShards()) { String dataPath = info.getDataPath(shard); @@ -221,7 +221,7 @@ public void testClusterInfoServiceInformationClearOnError() { InternalTestCluster internalTestCluster = internalCluster(); InternalClusterInfoService infoService = (InternalClusterInfoService) internalTestCluster.getInstance( ClusterInfoService.class, - internalTestCluster.getMasterName() + internalTestCluster.getClusterManagerName() ); // get one healthy sample ClusterInfo info = infoService.refresh(); @@ -231,7 +231,7 @@ public void testClusterInfoServiceInformationClearOnError() { MockTransportService mockTransportService = (MockTransportService) internalCluster().getInstance( TransportService.class, - internalTestCluster.getMasterName() + internalTestCluster.getClusterManagerName() ); final AtomicBoolean timeout = new AtomicBoolean(false); @@ -272,7 +272,7 @@ public void testClusterInfoServiceInformationClearOnError() { // now we cause an exception timeout.set(false); - ActionFilters actionFilters = internalTestCluster.getInstance(ActionFilters.class, internalTestCluster.getMasterName()); + ActionFilters actionFilters = internalTestCluster.getInstance(ActionFilters.class, internalTestCluster.getClusterManagerName()); BlockingActionFilter blockingActionFilter = null; for (ActionFilter filter : actionFilters.filters()) { if (filter instanceof BlockingActionFilter) { diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/MinimumClusterManagerNodesIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/MinimumClusterManagerNodesIT.java index c431dfaa14fa0..0bed559085b27 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/MinimumClusterManagerNodesIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/MinimumClusterManagerNodesIT.java @@ -151,7 +151,7 @@ public void testTwoNodesNoClusterManagerBlock() throws Exception { ); } - String clusterManagerNode = internalCluster().getMasterName(); + String clusterManagerNode = internalCluster().getClusterManagerName(); 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(); @@ -204,7 +204,7 @@ public void testTwoNodesNoClusterManagerBlock() throws Exception { clearRequest.setWaitForRemoval(false); client().execute(ClearVotingConfigExclusionsAction.INSTANCE, clearRequest).get(); - clusterManagerNode = internalCluster().getMasterName(); + clusterManagerNode = internalCluster().getClusterManagerName(); 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(); @@ -310,12 +310,15 @@ public void testThreeNodesNoClusterManagerBlock() throws Exception { } List nonClusterManagerNodes = new ArrayList<>( - Sets.difference(Sets.newHashSet(internalCluster().getNodeNames()), Collections.singleton(internalCluster().getMasterName())) + Sets.difference( + Sets.newHashSet(internalCluster().getNodeNames()), + Collections.singleton(internalCluster().getClusterManagerName()) + ) ); Settings nonClusterManagerDataPathSettings1 = internalCluster().dataPathSettings(nonClusterManagerNodes.get(0)); Settings nonClusterManagerDataPathSettings2 = internalCluster().dataPathSettings(nonClusterManagerNodes.get(1)); - internalCluster().stopRandomNonMasterNode(); - internalCluster().stopRandomNonMasterNode(); + internalCluster().stopRandomNonClusterManagerNode(); + internalCluster().stopRandomNonClusterManagerNode(); logger.info("--> verify that there is no cluster-manager anymore on remaining node"); // spin here to wait till the state is set @@ -347,7 +350,7 @@ public void testCannotCommitStateThreeNodes() throws Exception { internalCluster().startNodes(3, settings); ensureStableCluster(3); - final String clusterManager = internalCluster().getMasterName(); + final String clusterManager = internalCluster().getClusterManagerName(); Set otherNodes = new HashSet<>(Arrays.asList(internalCluster().getNodeNames())); otherNodes.remove(clusterManager); NetworkDisruption partition = isolateClusterManagerDisruption(NetworkDisruption.DISCONNECT); diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/SpecificClusterManagerNodesIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/SpecificClusterManagerNodesIT.java index 073f006d105f2..3c3d10d5e2bc2 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/SpecificClusterManagerNodesIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/SpecificClusterManagerNodesIT.java @@ -45,8 +45,8 @@ import java.io.IOException; +import static org.opensearch.test.NodeRoles.clusterManagerNode; import static org.opensearch.test.NodeRoles.dataOnlyNode; -import static org.opensearch.test.NodeRoles.masterNode; import static org.opensearch.test.NodeRoles.nonDataNode; import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertAcked; import static org.hamcrest.Matchers.equalTo; @@ -79,7 +79,7 @@ public void testSimpleOnlyClusterManagerNodeElection() throws IOException { logger.info("--> start cluster-manager node"); final String clusterManagerNodeName = internalCluster().startClusterManagerOnlyNode(); assertThat( - internalCluster().nonMasterClient() + internalCluster().nonClusterManagerClient() .admin() .cluster() .prepareState() @@ -92,7 +92,7 @@ public void testSimpleOnlyClusterManagerNodeElection() throws IOException { equalTo(clusterManagerNodeName) ); assertThat( - internalCluster().masterClient() + internalCluster().clusterManagerClient() .admin() .cluster() .prepareState() @@ -106,8 +106,8 @@ public void testSimpleOnlyClusterManagerNodeElection() throws IOException { ); logger.info("--> stop cluster-manager node"); - Settings clusterManagerDataPathSettings = internalCluster().dataPathSettings(internalCluster().getMasterName()); - internalCluster().stopCurrentMasterNode(); + Settings clusterManagerDataPathSettings = internalCluster().dataPathSettings(internalCluster().getClusterManagerName()); + internalCluster().stopCurrentClusterManagerNode(); try { assertThat( @@ -129,10 +129,10 @@ public void testSimpleOnlyClusterManagerNodeElection() throws IOException { logger.info("--> start previous cluster-manager node again"); final String nextClusterManagerEligibleNodeName = internalCluster().startNode( - Settings.builder().put(nonDataNode(masterNode())).put(clusterManagerDataPathSettings) + Settings.builder().put(nonDataNode(clusterManagerNode())).put(clusterManagerDataPathSettings) ); assertThat( - internalCluster().nonMasterClient() + internalCluster().nonClusterManagerClient() .admin() .cluster() .prepareState() @@ -145,7 +145,7 @@ public void testSimpleOnlyClusterManagerNodeElection() throws IOException { equalTo(nextClusterManagerEligibleNodeName) ); assertThat( - internalCluster().masterClient() + internalCluster().clusterManagerClient() .admin() .cluster() .prepareState() @@ -183,7 +183,7 @@ public void testElectOnlyBetweenClusterManagerNodes() throws Exception { logger.info("--> start cluster-manager node (1)"); final String clusterManagerNodeName = internalCluster().startClusterManagerOnlyNode(); assertThat( - internalCluster().nonMasterClient() + internalCluster().nonClusterManagerClient() .admin() .cluster() .prepareState() @@ -196,7 +196,7 @@ public void testElectOnlyBetweenClusterManagerNodes() throws Exception { equalTo(clusterManagerNodeName) ); assertThat( - internalCluster().masterClient() + internalCluster().clusterManagerClient() .admin() .cluster() .prepareState() @@ -212,7 +212,7 @@ public void testElectOnlyBetweenClusterManagerNodes() throws Exception { logger.info("--> start cluster-manager node (2)"); final String nextClusterManagerEligableNodeName = internalCluster().startClusterManagerOnlyNode(); assertThat( - internalCluster().nonMasterClient() + internalCluster().nonClusterManagerClient() .admin() .cluster() .prepareState() @@ -225,7 +225,7 @@ public void testElectOnlyBetweenClusterManagerNodes() throws Exception { equalTo(clusterManagerNodeName) ); assertThat( - internalCluster().nonMasterClient() + internalCluster().nonClusterManagerClient() .admin() .cluster() .prepareState() @@ -238,7 +238,7 @@ public void testElectOnlyBetweenClusterManagerNodes() throws Exception { equalTo(clusterManagerNodeName) ); assertThat( - internalCluster().masterClient() + internalCluster().clusterManagerClient() .admin() .cluster() .prepareState() @@ -256,7 +256,7 @@ public void testElectOnlyBetweenClusterManagerNodes() throws Exception { // removing the cluster-manager from the voting configuration immediately triggers the cluster-manager to step down assertBusy(() -> { assertThat( - internalCluster().nonMasterClient() + internalCluster().nonClusterManagerClient() .admin() .cluster() .prepareState() @@ -269,7 +269,7 @@ public void testElectOnlyBetweenClusterManagerNodes() throws Exception { equalTo(nextClusterManagerEligableNodeName) ); assertThat( - internalCluster().masterClient() + internalCluster().clusterManagerClient() .admin() .cluster() .prepareState() @@ -284,7 +284,7 @@ public void testElectOnlyBetweenClusterManagerNodes() throws Exception { }); internalCluster().stopRandomNode(InternalTestCluster.nameFilter(clusterManagerNodeName)); assertThat( - internalCluster().nonMasterClient() + internalCluster().nonClusterManagerClient() .admin() .cluster() .prepareState() @@ -297,7 +297,7 @@ public void testElectOnlyBetweenClusterManagerNodes() throws Exception { equalTo(nextClusterManagerEligableNodeName) ); assertThat( - internalCluster().masterClient() + internalCluster().clusterManagerClient() .admin() .cluster() .prepareState() diff --git a/server/src/internalClusterTest/java/org/opensearch/cluster/UpdateSettingsValidationIT.java b/server/src/internalClusterTest/java/org/opensearch/cluster/UpdateSettingsValidationIT.java index 66f22a4fdf1b3..4b830acddefdf 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/UpdateSettingsValidationIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/UpdateSettingsValidationIT.java @@ -39,14 +39,14 @@ import org.opensearch.test.OpenSearchIntegTestCase.ClusterScope; import org.opensearch.test.OpenSearchIntegTestCase.Scope; +import static org.opensearch.test.NodeRoles.nonClusterManagerNode; import static org.opensearch.test.NodeRoles.nonDataNode; -import static org.opensearch.test.NodeRoles.nonMasterNode; import static org.hamcrest.Matchers.equalTo; @ClusterScope(scope = Scope.TEST, numDataNodes = 0) public class UpdateSettingsValidationIT extends OpenSearchIntegTestCase { public void testUpdateSettingsValidation() throws Exception { - internalCluster().startNodes(nonDataNode(), nonMasterNode(), nonMasterNode()); + internalCluster().startNodes(nonDataNode(), nonClusterManagerNode(), nonClusterManagerNode()); createIndex("test"); NumShards test = getNumShards("test"); 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 b7e895f38ba19..e0d070c385def 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 @@ -123,7 +123,7 @@ public void testFollowupRerouteCanBeSetToHigherPriority() { final AtomicBoolean stopSpammingClusterManager = new AtomicBoolean(); final ClusterService clusterManagerClusterService = internalCluster().getInstance( ClusterService.class, - internalCluster().getMasterName() + internalCluster().getClusterManagerName() ); clusterManagerClusterService.submitStateUpdateTask("spam", new ClusterStateUpdateTask(Priority.HIGH) { @Override 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 90b9ff7cab3b5..3b99ce73adf5b 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/RareClusterStateIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/RareClusterStateIT.java @@ -105,7 +105,7 @@ public void testAssignmentWithJustAddedNodes() { // close to have some unassigned started shards shards.. client().admin().indices().prepareClose(index).get(); - final String clusterManagerName = internalCluster().getMasterName(); + final String clusterManagerName = internalCluster().getClusterManagerName(); final ClusterService clusterService = internalCluster().clusterService(clusterManagerName); final AllocationService allocationService = internalCluster().getInstance(AllocationService.class, clusterManagerName); clusterService.submitStateUpdateTask("test-inject-node-and-reroute", new ClusterStateUpdateTask() { @@ -159,7 +159,7 @@ private ActionFuture { assertFalse(clusterManagerCoordinator.publicationInProgress()); final long applierVersion = clusterManagerCoordinator.getApplierState().version(); @@ -202,7 +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 clusterManagerClusterStateVersion = internalCluster().clusterService(internalCluster().getMasterName()).state().version(); + long clusterManagerClusterStateVersion = internalCluster().clusterService(internalCluster().getClusterManagerName()) + .state() + .version(); long dataClusterStateVersion = internalCluster().clusterService(dataNode).state().version(); assertThat(clusterManagerClusterStateVersion, equalTo(dataClusterStateVersion)); }); @@ -220,7 +222,7 @@ public void testDelayedMappingPropagationOnPrimary() throws Exception { final List nodeNames = internalCluster().startNodes(2); assertFalse(client().admin().cluster().prepareHealth().setWaitForNodes("2").get().isTimedOut()); - final String clusterManager = internalCluster().getMasterName(); + final String clusterManager = internalCluster().getClusterManagerName(); assertThat(nodeNames, hasItem(clusterManager)); String otherNode = null; for (String node : nodeNames) { @@ -308,7 +310,7 @@ public void testDelayedMappingPropagationOnReplica() throws Exception { final List nodeNames = internalCluster().startNodes(2); assertFalse(client().admin().cluster().prepareHealth().setWaitForNodes("2").get().isTimedOut()); - final String clusterManager = internalCluster().getMasterName(); + final String clusterManager = internalCluster().getClusterManagerName(); assertThat(nodeNames, hasItem(clusterManager)); String otherNode = null; for (String node : nodeNames) { 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 72e24b0396695..0bbeeea9e27a2 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/UnsafeBootstrapAndDetachCommandIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/UnsafeBootstrapAndDetachCommandIT.java @@ -62,7 +62,7 @@ import static org.opensearch.gateway.DanglingIndicesState.AUTO_IMPORT_DANGLING_INDICES_SETTING; import static org.opensearch.index.query.QueryBuilders.matchAllQuery; import static org.opensearch.indices.recovery.RecoverySettings.INDICES_RECOVERY_MAX_BYTES_PER_SEC_SETTING; -import static org.opensearch.test.NodeRoles.nonMasterNode; +import static org.opensearch.test.NodeRoles.nonClusterManagerNode; import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertAcked; import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertHitCount; @@ -175,7 +175,7 @@ private void removeBlock() { public void testBootstrapNotClusterManagerEligible() { final Environment environment = TestEnvironment.newEnvironment( - Settings.builder().put(nonMasterNode(internalCluster().getDefaultSettings())).build() + Settings.builder().put(nonClusterManagerNode(internalCluster().getDefaultSettings())).build() ); expectThrows(() -> unsafeBootstrap(environment), UnsafeBootstrapClusterManagerCommand.NOT_CLUSTER_MANAGER_NODE_MSG); } @@ -238,7 +238,7 @@ public void testBootstrapNoClusterState() throws IOException { String node = internalCluster().startNode(); Settings dataPathSettings = internalCluster().dataPathSettings(node); ensureStableCluster(1); - NodeEnvironment nodeEnvironment = internalCluster().getMasterNodeInstance(NodeEnvironment.class); + NodeEnvironment nodeEnvironment = internalCluster().getClusterManagerNodeInstance(NodeEnvironment.class); internalCluster().stopRandomDataNode(); Environment environment = TestEnvironment.newEnvironment( Settings.builder().put(internalCluster().getDefaultSettings()).put(dataPathSettings).build() @@ -253,7 +253,7 @@ public void testDetachNoClusterState() throws IOException { String node = internalCluster().startNode(); Settings dataPathSettings = internalCluster().dataPathSettings(node); ensureStableCluster(1); - NodeEnvironment nodeEnvironment = internalCluster().getMasterNodeInstance(NodeEnvironment.class); + NodeEnvironment nodeEnvironment = internalCluster().getClusterManagerNodeInstance(NodeEnvironment.class); internalCluster().stopRandomDataNode(); Environment environment = TestEnvironment.newEnvironment( Settings.builder().put(internalCluster().getDefaultSettings()).put(dataPathSettings).build() @@ -306,7 +306,7 @@ public void test3ClusterManagerNodes2Failed() throws Exception { ); // node ordinal 1 logger.info("--> start 2nd and 3rd cluster-manager-eligible nodes and bootstrap"); - clusterManagerNodes.addAll(internalCluster().startMasterOnlyNodes(2)); // node ordinals 2 and 3 + clusterManagerNodes.addAll(internalCluster().startClusterManagerOnlyNodes(2)); // node ordinals 2 and 3 logger.info("--> wait for all nodes to join the cluster"); ensureStableCluster(4); @@ -351,7 +351,7 @@ public void test3ClusterManagerNodes2Failed() throws Exception { ); logger.info("--> stop 1st cluster-manager-eligible node and data-only node"); - NodeEnvironment nodeEnvironment = internalCluster().getMasterNodeInstance(NodeEnvironment.class); + NodeEnvironment nodeEnvironment = internalCluster().getClusterManagerNodeInstance(NodeEnvironment.class); internalCluster().stopRandomNode(InternalTestCluster.nameFilter(clusterManagerNodes.get(0))); assertBusy(() -> internalCluster().getInstance(GatewayMetaState.class, dataNode).allPendingAsyncStatesWritten()); internalCluster().stopRandomDataNode(); @@ -492,7 +492,7 @@ public void testNoInitialBootstrapAfterDetach() throws Exception { internalCluster().setBootstrapClusterManagerNodeIndex(0); String clusterManagerNode = internalCluster().startClusterManagerOnlyNode(); Settings clusterManagerNodeDataPathSettings = internalCluster().dataPathSettings(clusterManagerNode); - internalCluster().stopCurrentMasterNode(); + internalCluster().stopCurrentClusterManagerNode(); final Environment environment = TestEnvironment.newEnvironment( Settings.builder().put(internalCluster().getDefaultSettings()).put(clusterManagerNodeDataPathSettings).build() @@ -527,7 +527,7 @@ public void testCanRunUnsafeBootstrapAfterErroneousDetachWithoutLoosingMetadata( ensureReadOnlyBlock(false, clusterManagerNode); - internalCluster().stopCurrentMasterNode(); + internalCluster().stopCurrentClusterManagerNode(); final Environment environment = TestEnvironment.newEnvironment( Settings.builder().put(internalCluster().getDefaultSettings()).put(clusterManagerNodeDataPathSettings).build() @@ -557,7 +557,7 @@ public void testUnsafeBootstrapWithApplyClusterReadOnlyBlockAsFalse() throws Exc ensureReadOnlyBlock(false, clusterManagerNode); - internalCluster().stopCurrentMasterNode(); + internalCluster().stopCurrentClusterManagerNode(); final Environment environment = TestEnvironment.newEnvironment( Settings.builder().put(internalCluster().getDefaultSettings()).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 64474546f6106..de1114e152767 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/VotingConfigurationIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/VotingConfigurationIT.java @@ -64,12 +64,12 @@ protected Collection> nodePlugins() { public void testAbdicateAfterVotingConfigExclusionAdded() throws ExecutionException, InterruptedException { internalCluster().setBootstrapClusterManagerNodeIndex(0); internalCluster().startNodes(2); - final String originalClusterManager = internalCluster().getMasterName(); + final String originalClusterManager = internalCluster().getClusterManagerName(); logger.info("--> excluding cluster-manager node {}", originalClusterManager); client().execute(AddVotingConfigExclusionsAction.INSTANCE, new AddVotingConfigExclusionsRequest(originalClusterManager)).get(); client().admin().cluster().prepareHealth().setWaitForEvents(Priority.LANGUID).get(); - assertNotEquals(originalClusterManager, internalCluster().getMasterName()); + assertNotEquals(originalClusterManager, internalCluster().getClusterManagerName()); } public void testElectsNodeNotInVotingConfiguration() throws Exception { @@ -134,7 +134,7 @@ public void testElectsNodeNotInVotingConfiguration() throws Exception { } } - internalCluster().stopCurrentMasterNode(); + internalCluster().stopCurrentClusterManagerNode(); assertFalse( internalCluster().client() .admin() 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 84bf25141d5e0..66ff9eb15ae0e 100644 --- a/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/ZenDiscoveryIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/cluster/coordination/ZenDiscoveryIT.java @@ -91,10 +91,10 @@ public void testNoShardRelocationsOccurWhenElectedClusterManagerNodeFails() thro RecoveryResponse r = client().admin().indices().prepareRecoveries("test").get(); int numRecoveriesBeforeNewClusterManager = r.shardRecoveryStates().get("test").size(); - final String oldClusterManager = internalCluster().getMasterName(); - internalCluster().stopCurrentMasterNode(); + final String oldClusterManager = internalCluster().getClusterManagerName(); + internalCluster().stopCurrentClusterManagerNode(); assertBusy(() -> { - String current = internalCluster().getMasterName(); + String current = internalCluster().getClusterManagerName(); assertThat(current, notNullValue()); assertThat(current, not(equalTo(oldClusterManager))); }); @@ -170,7 +170,7 @@ public void testDiscoveryStats() throws Exception { ensureGreen(); // ensures that all events are processed (in particular state recovery fully completed) assertBusy( () -> assertThat( - internalCluster().clusterService(internalCluster().getMasterName()).getMasterService().numberOfPendingTasks(), + internalCluster().clusterService(internalCluster().getClusterManagerName()).getMasterService().numberOfPendingTasks(), equalTo(0) ) ); // see https://github.com/elastic/elasticsearch/issues/24388 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 e26d5be03cf7a..45daea3d066d3 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 @@ -160,10 +160,9 @@ public void testHighWatermarkNotExceeded() throws Exception { final String dataNodeName = internalCluster().startDataOnlyNode(); ensureStableCluster(3); - final InternalClusterInfoService clusterInfoService = (InternalClusterInfoService) internalCluster().getCurrentMasterNodeInstance( - ClusterInfoService.class - ); - internalCluster().getCurrentMasterNodeInstance(ClusterService.class).addListener(event -> clusterInfoService.refresh()); + final InternalClusterInfoService clusterInfoService = (InternalClusterInfoService) internalCluster() + .getCurrentClusterManagerNodeInstance(ClusterInfoService.class); + internalCluster().getCurrentClusterManagerNodeInstance(ClusterService.class).addListener(event -> clusterInfoService.refresh()); final String dataNode0Id = internalCluster().getInstance(NodeEnvironment.class, dataNodeName).nodeId(); final Path dataNode0Path = internalCluster().getInstance(Environment.class, dataNodeName).dataFiles()[0]; @@ -203,10 +202,9 @@ public void testRestoreSnapshotAllocationDoesNotExceedWatermark() throws Excepti .setSettings(Settings.builder().put("location", randomRepoPath()).put("compress", randomBoolean())) ); - final InternalClusterInfoService clusterInfoService = (InternalClusterInfoService) internalCluster().getCurrentMasterNodeInstance( - ClusterInfoService.class - ); - internalCluster().getCurrentMasterNodeInstance(ClusterService.class).addListener(event -> clusterInfoService.refresh()); + final InternalClusterInfoService clusterInfoService = (InternalClusterInfoService) internalCluster() + .getCurrentClusterManagerNodeInstance(ClusterInfoService.class); + internalCluster().getCurrentClusterManagerNodeInstance(ClusterService.class).addListener(event -> clusterInfoService.refresh()); final String dataNode0Id = internalCluster().getInstance(NodeEnvironment.class, dataNodeName).nodeId(); final Path dataNode0Path = internalCluster().getInstance(Environment.class, dataNodeName).dataFiles()[0]; @@ -330,7 +328,7 @@ private long createReasonableSizedShards(final String indexName) throws Interrup } private void refreshDiskUsage() { - final ClusterInfoService clusterInfoService = internalCluster().getCurrentMasterNodeInstance(ClusterInfoService.class); + final ClusterInfoService clusterInfoService = internalCluster().getCurrentClusterManagerNodeInstance(ClusterInfoService.class); ((InternalClusterInfoService) clusterInfoService).refresh(); // if the nodes were all under the low watermark already (but unbalanced) then a change in the disk usage doesn't trigger a reroute // even though it's now possible to achieve better balance, so we have to do an explicit reroute. TODO fix this? 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 520ad75535033..a7755841c9ea9 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 @@ -270,7 +270,7 @@ public void testOnlyMovesEnoughShardsToDropBelowHighWatermark() throws Exception final MockInternalClusterInfoService clusterInfoService = getMockInternalClusterInfoService(); final AtomicReference clusterManagerAppliedClusterState = new AtomicReference<>(); - internalCluster().getCurrentMasterNodeInstance(ClusterService.class).addListener(event -> { + internalCluster().getCurrentClusterManagerNodeInstance(ClusterService.class).addListener(event -> { clusterManagerAppliedClusterState.set(event.state()); clusterInfoService.refresh(); // so that a subsequent reroute sees disk usage according to the current state }); @@ -358,7 +358,7 @@ public void testDoesNotExceedLowWatermarkWhenRebalancing() throws Exception { false ).map(RoutingNode::nodeId).collect(Collectors.toList()); - internalCluster().getCurrentMasterNodeInstance(ClusterService.class).addListener(event -> { + internalCluster().getCurrentClusterManagerNodeInstance(ClusterService.class).addListener(event -> { assertThat(event.state().getRoutingNodes().node(nodeIds.get(2)).size(), lessThanOrEqualTo(1)); clusterManagerAppliedClusterState.set(event.state()); clusterInfoService.refresh(); // so that a subsequent reroute sees disk usage according to the current state @@ -544,7 +544,7 @@ private Map getShardCountByNodeId() { } private MockInternalClusterInfoService getMockInternalClusterInfoService() { - return (MockInternalClusterInfoService) internalCluster().getCurrentMasterNodeInstance(ClusterInfoService.class); + return (MockInternalClusterInfoService) internalCluster().getCurrentClusterManagerNodeInstance(ClusterInfoService.class); } } diff --git a/server/src/internalClusterTest/java/org/opensearch/discovery/ClusterDisruptionIT.java b/server/src/internalClusterTest/java/org/opensearch/discovery/ClusterDisruptionIT.java index 915aef5cb1d25..184c866aee2db 100644 --- a/server/src/internalClusterTest/java/org/opensearch/discovery/ClusterDisruptionIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/discovery/ClusterDisruptionIT.java @@ -338,7 +338,7 @@ public void testRejoinDocumentExistsInAllShardCopies() throws Exception { // simulate handling of sending shard failure during an isolation public void testSendingShardFailure() throws Exception { List nodes = startCluster(3); - String clusterManagerNode = internalCluster().getMasterName(); + String clusterManagerNode = internalCluster().getClusterManagerName(); List nonClusterManagerNodes = nodes.stream().filter(node -> !node.equals(clusterManagerNode)).collect(Collectors.toList()); String nonClusterManagerNode = randomFrom(nonClusterManagerNodes); assertAcked( @@ -463,12 +463,12 @@ public boolean validateClusterForming() { */ public void testIndicesDeleted() throws Exception { final String idxName = "test"; - final List allClusterManagerEligibleNodes = internalCluster().startMasterOnlyNodes(2); + final List allClusterManagerEligibleNodes = internalCluster().startClusterManagerOnlyNodes(2); final String dataNode = internalCluster().startDataOnlyNode(); ensureStableCluster(3); assertAcked(prepareCreate("test")); - final String clusterManagerNode1 = internalCluster().getMasterName(); + final String clusterManagerNode1 = internalCluster().getClusterManagerName(); NetworkDisruption networkDisruption = new NetworkDisruption( new TwoPartitions(clusterManagerNode1, dataNode), NetworkDisruption.UNRESPONSIVE diff --git a/server/src/internalClusterTest/java/org/opensearch/discovery/ClusterManagerDisruptionIT.java b/server/src/internalClusterTest/java/org/opensearch/discovery/ClusterManagerDisruptionIT.java index cd8846067ad1f..412b325b14e73 100644 --- a/server/src/internalClusterTest/java/org/opensearch/discovery/ClusterManagerDisruptionIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/discovery/ClusterManagerDisruptionIT.java @@ -71,7 +71,7 @@ public class ClusterManagerDisruptionIT extends AbstractDisruptionTestCase { public void testClusterManagerNodeGCs() throws Exception { List nodes = startCluster(3); - String oldClusterManagerNode = internalCluster().getMasterName(); + String oldClusterManagerNode = internalCluster().getClusterManagerName(); // a very long GC, but it's OK as we remove the disruption when it has had an effect SingleNodeDisruption clusterManagerNodeDisruption = new IntermittentLongGCDisruption( random(), @@ -105,7 +105,7 @@ public void testClusterManagerNodeGCs() throws Exception { ensureStableCluster(3, waitTime, false, oldNonClusterManagerNodes.get(0)); // make sure all nodes agree on cluster-manager - String newClusterManager = internalCluster().getMasterName(); + String newClusterManager = internalCluster().getClusterManagerName(); assertThat(newClusterManager, not(equalTo(oldClusterManagerNode))); assertClusterManager(newClusterManager, nodes); } @@ -126,7 +126,7 @@ public void testIsolateClusterManagerAndVerifyClusterStateConsensus() throws Exc ); ensureGreen(); - String isolatedNode = internalCluster().getMasterName(); + String isolatedNode = internalCluster().getClusterManagerName(); TwoPartitions partitions = isolateNode(isolatedNode); NetworkDisruption networkDisruption = addRandomDisruptionType(partitions); networkDisruption.startDisrupting(); @@ -296,7 +296,7 @@ public void testMappingTimeout() throws Exception { Settings.builder() .put("index.number_of_shards", 1) .put("index.number_of_replicas", 1) - .put("index.routing.allocation.exclude._name", internalCluster().getMasterName()) + .put("index.routing.allocation.exclude._name", internalCluster().getClusterManagerName()) .build() ); diff --git a/server/src/internalClusterTest/java/org/opensearch/discovery/DiscoveryDisruptionIT.java b/server/src/internalClusterTest/java/org/opensearch/discovery/DiscoveryDisruptionIT.java index 1825fbdcf32d5..a2864b6dfd1da 100644 --- a/server/src/internalClusterTest/java/org/opensearch/discovery/DiscoveryDisruptionIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/discovery/DiscoveryDisruptionIT.java @@ -136,7 +136,7 @@ public void testClusterJoinDespiteOfPublishingIssues() throws Exception { // shutting down the nodes, to avoid the leakage check tripping // on the states associated with the commit requests we may have dropped - internalCluster().stopRandomNonMasterNode(); + internalCluster().stopRandomNonClusterManagerNode(); } public void testClusterFormingWithASlowNode() { @@ -170,7 +170,7 @@ public void testElectClusterManagerWithLatestVersion() throws Exception { } internalCluster().clearDisruptionScheme(); ensureStableCluster(3); - final String preferredClusterManagerName = internalCluster().getMasterName(); + final String preferredClusterManagerName = internalCluster().getClusterManagerName(); final DiscoveryNode preferredClusterManager = internalCluster().clusterService(preferredClusterManagerName).localNode(); logger.info("--> preferred cluster-manager is {}", preferredClusterManager); @@ -214,7 +214,7 @@ public void testElectClusterManagerWithLatestVersion() throws Exception { public void testNodeNotReachableFromClusterManager() throws Exception { startCluster(3); - String clusterManagerNode = internalCluster().getMasterName(); + String clusterManagerNode = internalCluster().getClusterManagerName(); String nonClusterManagerNode = null; while (nonClusterManagerNode == null) { nonClusterManagerNode = randomFrom(internalCluster().getNodeNames()); diff --git a/server/src/internalClusterTest/java/org/opensearch/discovery/SnapshotDisruptionIT.java b/server/src/internalClusterTest/java/org/opensearch/discovery/SnapshotDisruptionIT.java index 3324b7de077fe..691e3ca51eb8c 100644 --- a/server/src/internalClusterTest/java/org/opensearch/discovery/SnapshotDisruptionIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/discovery/SnapshotDisruptionIT.java @@ -86,7 +86,7 @@ protected Settings nodeSettings(int nodeOrdinal) { public void testDisruptionAfterFinalization() throws Exception { final String idxName = "test"; - internalCluster().startMasterOnlyNodes(3); + internalCluster().startClusterManagerOnlyNodes(3); final String dataNode = internalCluster().startDataOnlyNode(); ensureStableCluster(4); @@ -94,7 +94,7 @@ public void testDisruptionAfterFinalization() throws Exception { createRepository("test-repo", "fs"); - final String clusterManagerNode1 = internalCluster().getMasterName(); + final String clusterManagerNode1 = internalCluster().getClusterManagerName(); NetworkDisruption networkDisruption = isolateClusterManagerDisruption(NetworkDisruption.UNRESPONSIVE); internalCluster().setDisruptionScheme(networkDisruption); @@ -168,7 +168,7 @@ public void clusterChanged(ClusterChangedEvent event) { public void testDisruptionAfterShardFinalization() throws Exception { final String idxName = "test"; - internalCluster().startMasterOnlyNodes(1); + internalCluster().startClusterManagerOnlyNodes(1); internalCluster().startDataOnlyNode(); ensureStableCluster(2); createIndex(idxName); @@ -177,7 +177,7 @@ public void testDisruptionAfterShardFinalization() throws Exception { final String repoName = "test-repo"; createRepository(repoName, "mock"); - final String clusterManagerNode = internalCluster().getMasterName(); + final String clusterManagerNode = internalCluster().getClusterManagerName(); blockAllDataNodes(repoName); @@ -212,7 +212,7 @@ public void testDisruptionAfterShardFinalization() throws Exception { index(idxName, "type", JsonXContent.contentBuilder().startObject().field("foo", "bar").endObject()); logger.info("--> run a snapshot that fails to finalize but succeeds on the data node"); - blockMasterFromFinalizingSnapshotOnIndexFile(repoName); + blockClusterManagerFromFinalizingSnapshotOnIndexFile(repoName); final ActionFuture snapshotFuture = client(clusterManagerNode).admin() .cluster() .prepareCreateSnapshot(repoName, "snapshot-2") @@ -236,7 +236,7 @@ public void testDisruptionAfterShardFinalization() throws Exception { } public void testClusterManagerFailOverDuringShardSnapshots() throws Exception { - internalCluster().startMasterOnlyNodes(3); + internalCluster().startClusterManagerOnlyNodes(3); final String dataNode = internalCluster().startDataOnlyNode(); ensureStableCluster(4); final String repoName = "test-repo"; @@ -249,7 +249,7 @@ public void testClusterManagerFailOverDuringShardSnapshots() throws Exception { blockDataNode(repoName, dataNode); logger.info("--> create snapshot via cluster-manager node client"); - final ActionFuture snapshotResponse = internalCluster().masterClient() + final ActionFuture snapshotResponse = internalCluster().clusterManagerClient() .admin() .cluster() .prepareCreateSnapshot(repoName, "test-snap") diff --git a/server/src/internalClusterTest/java/org/opensearch/discovery/StableClusterManagerDisruptionIT.java b/server/src/internalClusterTest/java/org/opensearch/discovery/StableClusterManagerDisruptionIT.java index 8992e4749c1aa..ffbaa35f61b72 100644 --- a/server/src/internalClusterTest/java/org/opensearch/discovery/StableClusterManagerDisruptionIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/discovery/StableClusterManagerDisruptionIT.java @@ -92,7 +92,7 @@ public void testFailWithMinimumClusterManagerNodesConfigured() throws Exception ensureStableCluster(3); // Figure out what is the elected cluster-manager node - final String clusterManagerNode = internalCluster().getMasterName(); + final String clusterManagerNode = internalCluster().getClusterManagerName(); logger.info("---> legit elected cluster-manager node={}", clusterManagerNode); // Pick a node that isn't the elected cluster-manager. @@ -123,7 +123,7 @@ public void testFailWithMinimumClusterManagerNodesConfigured() 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(clusterManagerNode)); + assertThat(internalCluster().getClusterManagerName(), equalTo(clusterManagerNode)); } private void ensureNoMaster(String node) throws Exception { @@ -162,11 +162,11 @@ private void testFollowerCheckerAfterClusterManagerReelection(NetworkLinkDisrupt ensureStableCluster(4); logger.info("--> stopping current cluster-manager"); - internalCluster().stopCurrentMasterNode(); + internalCluster().stopCurrentClusterManagerNode(); ensureStableCluster(3); - final String clusterManager = internalCluster().getMasterName(); + final String clusterManager = internalCluster().getClusterManagerName(); final List nonClusterManagers = Arrays.stream(internalCluster().getNodeNames()) .filter(n -> clusterManager.equals(n) == false) .collect(Collectors.toList()); @@ -205,7 +205,7 @@ public void testStaleClusterManagerNotHijackingMajority() throws Exception { ensureStableCluster(3); // Save the current cluster-manager node as old cluster-manager node, because that node will get frozen - final String oldClusterManagerNode = internalCluster().getMasterName(); + final String oldClusterManagerNode = internalCluster().getClusterManagerName(); // Simulating a painful gc by suspending all threads for a long time on the current elected cluster-manager node. SingleNodeDisruption clusterManagerNodeDisruption = new LongGCDisruption(random(), oldClusterManagerNode); @@ -274,7 +274,7 @@ public void onFailure(String source, Exception e) { }); // Save the new elected cluster-manager node - final String newClusterManagerNode = internalCluster().getMasterName(majoritySide.get(0)); + final String newClusterManagerNode = internalCluster().getClusterManagerName(majoritySide.get(0)); logger.info("--> new detected cluster-manager node [{}]", newClusterManagerNode); // Stop disruption 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 c90c5f45af176..f9b2fb44e24be 100644 --- a/server/src/internalClusterTest/java/org/opensearch/index/mapper/DynamicMappingIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/index/mapper/DynamicMappingIT.java @@ -148,7 +148,7 @@ public void testPreflightCheckAvoidsClusterManager() throws InterruptedException final CountDownLatch clusterManagerBlockedLatch = new CountDownLatch(1); final CountDownLatch indexingCompletedLatch = new CountDownLatch(1); - internalCluster().getInstance(ClusterService.class, internalCluster().getMasterName()) + internalCluster().getInstance(ClusterService.class, internalCluster().getClusterManagerName()) .submitStateUpdateTask("block-state-updates", new ClusterStateUpdateTask() { @Override public ClusterState execute(ClusterState currentState) throws Exception { 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 82131b0260f49..bb1456c8b5d4f 100644 --- a/server/src/internalClusterTest/java/org/opensearch/indices/recovery/IndexRecoveryIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/indices/recovery/IndexRecoveryIT.java @@ -775,7 +775,7 @@ public void testSnapshotRecovery() throws Exception { logger.info("--> request recoveries"); RecoveryResponse response = client().admin().indices().prepareRecoveries(INDEX_NAME).execute().actionGet(); - Repository repository = internalCluster().getMasterNodeInstance(RepositoriesService.class).repository(REPO_NAME); + Repository repository = internalCluster().getClusterManagerNodeInstance(RepositoriesService.class).repository(REPO_NAME); final RepositoryData repositoryData = PlainActionFuture.get(repository::getRepositoryData); for (Map.Entry> indexRecoveryStates : response.shardRecoveryStates().entrySet()) { diff --git a/server/src/internalClusterTest/java/org/opensearch/indices/recovery/ReplicaToPrimaryPromotionIT.java b/server/src/internalClusterTest/java/org/opensearch/indices/recovery/ReplicaToPrimaryPromotionIT.java index b74dc2f4236a0..939743355f5f4 100644 --- a/server/src/internalClusterTest/java/org/opensearch/indices/recovery/ReplicaToPrimaryPromotionIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/indices/recovery/ReplicaToPrimaryPromotionIT.java @@ -80,7 +80,7 @@ public void testPromoteReplicaToPrimary() throws Exception { } // pick up a data node that contains a random primary shard - ClusterState state = client(internalCluster().getMasterName()).admin().cluster().prepareState().get().getState(); + ClusterState state = client(internalCluster().getClusterManagerName()).admin().cluster().prepareState().get().getState(); final int numShards = state.metadata().index(indexName).getNumberOfShards(); final ShardRouting primaryShard = state.routingTable().index(indexName).shard(randomIntBetween(0, numShards - 1)).primaryShard(); final DiscoveryNode randomNode = state.nodes().resolveNode(primaryShard.currentNodeId()); @@ -89,7 +89,7 @@ public void testPromoteReplicaToPrimary() throws Exception { internalCluster().stopRandomNode(InternalTestCluster.nameFilter(randomNode.getName())); ensureYellowAndNoInitializingShards(indexName); - state = client(internalCluster().getMasterName()).admin().cluster().prepareState().get().getState(); + state = client(internalCluster().getClusterManagerName()).admin().cluster().prepareState().get().getState(); for (IndexShardRoutingTable shardRoutingTable : state.routingTable().index(indexName)) { for (ShardRouting shardRouting : shardRoutingTable.activeShards()) { assertThat(shardRouting + " should be promoted as a primary", shardRouting.primary(), is(true)); diff --git a/server/src/internalClusterTest/java/org/opensearch/indices/settings/UpdateSettingsIT.java b/server/src/internalClusterTest/java/org/opensearch/indices/settings/UpdateSettingsIT.java index 6dab7781e08db..9970ff99a806c 100644 --- a/server/src/internalClusterTest/java/org/opensearch/indices/settings/UpdateSettingsIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/indices/settings/UpdateSettingsIT.java @@ -836,7 +836,7 @@ private void runTestDefaultNumberOfReplicasTest(final boolean closeIndex) { public void testNoopUpdate() { internalCluster().ensureAtLeastNumDataNodes(2); - final ClusterService clusterService = internalCluster().getMasterNodeInstance(ClusterService.class); + final ClusterService clusterService = internalCluster().getClusterManagerNodeInstance(ClusterService.class); assertAcked( client().admin() .indices() 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 3d70622e122c0..cdebe6c869be5 100644 --- a/server/src/internalClusterTest/java/org/opensearch/indices/state/CloseWhileRelocatingShardsIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/indices/state/CloseWhileRelocatingShardsIT.java @@ -150,7 +150,10 @@ public void testCloseWhileRelocatingShards() throws Exception { ensureClusterSizeConsistency(); // wait for the cluster-manager to finish processing join. try { - final ClusterService clusterService = internalCluster().getInstance(ClusterService.class, internalCluster().getMasterName()); + final ClusterService clusterService = internalCluster().getInstance( + ClusterService.class, + internalCluster().getClusterManagerName() + ); final ClusterState state = clusterService.state(); final CountDownLatch latch = new CountDownLatch(indices.length); final CountDownLatch release = new CountDownLatch(indices.length); diff --git a/server/src/internalClusterTest/java/org/opensearch/indices/state/ReopenWhileClosingIT.java b/server/src/internalClusterTest/java/org/opensearch/indices/state/ReopenWhileClosingIT.java index 38e50a64c8105..028baa0176367 100644 --- a/server/src/internalClusterTest/java/org/opensearch/indices/state/ReopenWhileClosingIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/indices/state/ReopenWhileClosingIT.java @@ -150,7 +150,7 @@ private void createIndexWithDocs(final String indexName, final Collection creating index [test] with one shard and on replica"); assertAcked( prepareCreate("test").setSettings( @@ -133,7 +133,7 @@ public void testIndexCleanup() throws Exception { assertThat(Files.exists(indexDirectory(node_2, index)), equalTo(true)); logger.info("--> starting node server3"); - final String node_3 = internalCluster().startNode(nonMasterNode()); + final String node_3 = internalCluster().startNode(nonClusterManagerNode()); logger.info("--> running cluster_health"); ClusterHealthResponse clusterHealth = client().admin() .cluster() @@ -459,7 +459,7 @@ public void testShardActiveElsewhereDoesNotDeleteAnother() throws Exception { public void testShardActiveElseWhere() throws Exception { List nodes = internalCluster().startNodes(2); - final String clusterManagerNode = internalCluster().getMasterName(); + final String clusterManagerNode = internalCluster().getClusterManagerName(); final String nonClusterManagerNode = nodes.get(0).equals(clusterManagerNode) ? nodes.get(1) : nodes.get(0); final String clusterManagerId = internalCluster().clusterService(clusterManagerNode).localNode().getId(); diff --git a/server/src/internalClusterTest/java/org/opensearch/persistent/PersistentTasksExecutorIT.java b/server/src/internalClusterTest/java/org/opensearch/persistent/PersistentTasksExecutorIT.java index d4ce36ff0575e..13d7e838b920a 100644 --- a/server/src/internalClusterTest/java/org/opensearch/persistent/PersistentTasksExecutorIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/persistent/PersistentTasksExecutorIT.java @@ -224,7 +224,7 @@ public void testPersistentActionWithNoAvailableNode() throws Exception { public void testPersistentActionWithNonClusterStateCondition() throws Exception { PersistentTasksClusterService persistentTasksClusterService = internalCluster().getInstance( PersistentTasksClusterService.class, - internalCluster().getMasterName() + internalCluster().getClusterManagerName() ); // Speed up rechecks to a rate that is quicker than what settings would allow persistentTasksClusterService.setRecheckInterval(TimeValue.timeValueMillis(1)); @@ -384,7 +384,7 @@ public void testCreatePersistentTaskWithDuplicateId() throws Exception { public void testUnassignRunningPersistentTask() throws Exception { PersistentTasksClusterService persistentTasksClusterService = internalCluster().getInstance( PersistentTasksClusterService.class, - internalCluster().getMasterName() + internalCluster().getClusterManagerName() ); // Speed up rechecks to a rate that is quicker than what settings would allow persistentTasksClusterService.setRecheckInterval(TimeValue.timeValueMillis(1)); diff --git a/server/src/internalClusterTest/java/org/opensearch/persistent/decider/EnableAssignmentDeciderIT.java b/server/src/internalClusterTest/java/org/opensearch/persistent/decider/EnableAssignmentDeciderIT.java index 5d75482567731..aa1eeacbadd9d 100644 --- a/server/src/internalClusterTest/java/org/opensearch/persistent/decider/EnableAssignmentDeciderIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/persistent/decider/EnableAssignmentDeciderIT.java @@ -87,7 +87,7 @@ public void testEnableAssignmentAfterRestart() throws Exception { } latch.await(); - ClusterService clusterService = internalCluster().clusterService(internalCluster().getMasterName()); + ClusterService clusterService = internalCluster().clusterService(internalCluster().getClusterManagerName()); PersistentTasksCustomMetadata tasks = clusterService.state().getMetadata().custom(PersistentTasksCustomMetadata.TYPE); assertEquals(numberOfTasks, tasks.tasks().stream().filter(t -> TestPersistentTasksExecutor.NAME.equals(t.getTaskName())).count()); diff --git a/server/src/internalClusterTest/java/org/opensearch/repositories/RepositoriesServiceIT.java b/server/src/internalClusterTest/java/org/opensearch/repositories/RepositoriesServiceIT.java index 78cf55e2f223c..84178f0255d81 100644 --- a/server/src/internalClusterTest/java/org/opensearch/repositories/RepositoriesServiceIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/repositories/RepositoriesServiceIT.java @@ -65,7 +65,9 @@ public void testUpdateRepository() { final String repositoryName = "test-repo"; final Client client = client(); - final RepositoriesService repositoriesService = cluster.getDataOrMasterNodeInstances(RepositoriesService.class).iterator().next(); + final RepositoriesService repositoriesService = cluster.getDataOrClusterManagerNodeInstances(RepositoriesService.class) + .iterator() + .next(); final Settings.Builder repoSettings = Settings.builder().put("location", randomRepoPath()); 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 6450644314c08..f3954578bffc8 100644 --- a/server/src/internalClusterTest/java/org/opensearch/repositories/blobstore/BlobStoreRepositoryCleanupIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/repositories/blobstore/BlobStoreRepositoryCleanupIT.java @@ -56,7 +56,7 @@ public void testClusterManagerFailoverDuringCleanup() throws Exception { final int nodeCount = internalCluster().numDataAndMasterNodes(); logger.info("--> stopping cluster-manager node"); - internalCluster().stopCurrentMasterNode(); + internalCluster().stopCurrentClusterManagerNode(); ensureStableCluster(nodeCount - 1); @@ -92,7 +92,7 @@ public void testRepeatCleanupsDontRemove() throws Exception { private String startBlockedCleanup(String repoName) throws Exception { logger.info("--> starting two cluster-manager nodes and one data node"); - internalCluster().startMasterOnlyNodes(2); + internalCluster().startClusterManagerOnlyNodes(2); internalCluster().startDataOnlyNodes(1); createRepository(repoName, "mock"); @@ -100,7 +100,10 @@ private String startBlockedCleanup(String repoName) throws Exception { logger.info("--> snapshot"); client().admin().cluster().prepareCreateSnapshot(repoName, "test-snap").setWaitForCompletion(true).get(); - final RepositoriesService service = internalCluster().getInstance(RepositoriesService.class, internalCluster().getMasterName()); + final RepositoriesService service = internalCluster().getInstance( + RepositoriesService.class, + internalCluster().getClusterManagerName() + ); final BlobStoreRepository repository = (BlobStoreRepository) service.repository(repoName); logger.info("--> creating a garbage data blob"); @@ -117,7 +120,7 @@ private String startBlockedCleanup(String repoName) throws Exception { ); garbageFuture.get(); - final String clusterManagerNode = blockMasterFromFinalizingSnapshotOnIndexFile(repoName); + final String clusterManagerNode = blockClusterManagerFromFinalizingSnapshotOnIndexFile(repoName); logger.info("--> starting repository cleanup"); client().admin().cluster().prepareCleanupRepository(repoName).execute(); @@ -146,7 +149,10 @@ public void testCleanupOldIndexN() throws ExecutionException, InterruptedExcepti assertThat(createSnapshotResponse.getSnapshotInfo().state(), is(SnapshotState.SUCCESS)); } - final RepositoriesService service = internalCluster().getInstance(RepositoriesService.class, internalCluster().getMasterName()); + final RepositoriesService service = internalCluster().getInstance( + RepositoriesService.class, + internalCluster().getClusterManagerName() + ); final BlobStoreRepository repository = (BlobStoreRepository) service.repository(repoName); logger.info("--> write two outdated index-N blobs"); diff --git a/server/src/internalClusterTest/java/org/opensearch/search/scroll/SearchScrollWithFailingNodesIT.java b/server/src/internalClusterTest/java/org/opensearch/search/scroll/SearchScrollWithFailingNodesIT.java index a56f8667fab48..c6519cc3a0cb3 100644 --- a/server/src/internalClusterTest/java/org/opensearch/search/scroll/SearchScrollWithFailingNodesIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/search/scroll/SearchScrollWithFailingNodesIT.java @@ -97,7 +97,7 @@ public void testScanScrollWithShardExceptions() throws Exception { assertThat(numHits, equalTo(100L)); clearScroll("_all"); - internalCluster().stopRandomNonMasterNode(); + internalCluster().stopRandomNonClusterManagerNode(); searchResponse = client().prepareSearch().setQuery(matchAllQuery()).setSize(10).setScroll(TimeValue.timeValueMinutes(1)).get(); assertThat(searchResponse.getSuccessfulShards(), lessThan(searchResponse.getTotalShards())); diff --git a/server/src/internalClusterTest/java/org/opensearch/snapshots/CloneSnapshotIT.java b/server/src/internalClusterTest/java/org/opensearch/snapshots/CloneSnapshotIT.java index d5f36608941d5..7b95bf93f8bf4 100644 --- a/server/src/internalClusterTest/java/org/opensearch/snapshots/CloneSnapshotIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/snapshots/CloneSnapshotIT.java @@ -91,7 +91,7 @@ public void testShardClone() throws Exception { final String sourceSnapshot = "source-snapshot"; final SnapshotInfo sourceSnapshotInfo = createFullSnapshot(repoName, sourceSnapshot); - final BlobStoreRepository repository = (BlobStoreRepository) internalCluster().getCurrentMasterNodeInstance( + final BlobStoreRepository repository = (BlobStoreRepository) internalCluster().getCurrentClusterManagerNodeInstance( RepositoriesService.class ).repository(repoName); final RepositoryData repositoryData = getRepositoryData(repoName); @@ -378,7 +378,7 @@ public void testBackToBackClonesForIndexNotInCluster() throws Exception { } public void testClusterManagerFailoverDuringCloneStep1() throws Exception { - internalCluster().startMasterOnlyNodes(3); + internalCluster().startClusterManagerOnlyNodes(3); internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); @@ -392,7 +392,7 @@ public void testClusterManagerFailoverDuringCloneStep1() throws Exception { final String cloneName = "target-snapshot"; final ActionFuture cloneFuture = startCloneFromDataNode(repoName, sourceSnapshot, cloneName, testIndex); awaitNumberOfSnapshotsInProgress(1); - final String clusterManagerNode = internalCluster().getMasterName(); + final String clusterManagerNode = internalCluster().getClusterManagerName(); waitForBlock(clusterManagerNode, repoName, TimeValue.timeValueSeconds(30L)); internalCluster().restartNode(clusterManagerNode); boolean cloneSucceeded = false; @@ -404,7 +404,7 @@ public void testClusterManagerFailoverDuringCloneStep1() throws Exception { // snapshot on disconnect slowly enough for it to work out } - awaitNoMoreRunningOperations(internalCluster().getMasterName()); + awaitNoMoreRunningOperations(internalCluster().getClusterManagerName()); // Check if the clone operation worked out by chance as a result of the clone request being retried // because of the cluster-manager failover @@ -433,7 +433,7 @@ public void testFailsOnCloneMissingIndices() { 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().startClusterManagerOnlyNodes(3, LARGE_SNAPSHOT_POOL_SETTINGS); internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); @@ -447,18 +447,18 @@ public void testClusterManagerFailoverDuringCloneStep2() throws Exception { blockClusterManagerOnShardClone(repoName); final ActionFuture cloneFuture = startCloneFromDataNode(repoName, sourceSnapshot, targetSnapshot, testIndex); awaitNumberOfSnapshotsInProgress(1); - final String clusterManagerNode = internalCluster().getMasterName(); + final String clusterManagerNode = internalCluster().getClusterManagerName(); waitForBlock(clusterManagerNode, repoName, TimeValue.timeValueSeconds(30L)); internalCluster().restartNode(clusterManagerNode); expectThrows(SnapshotException.class, cloneFuture::actionGet); - awaitNoMoreRunningOperations(internalCluster().getMasterName()); + awaitNoMoreRunningOperations(internalCluster().getClusterManagerName()); assertAllSnapshotsSuccessful(getRepositoryData(repoName), 2); } public void testExceptionDuringShardClone() 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().startClusterManagerOnlyNodes(3, LARGE_SNAPSHOT_POOL_SETTINGS); internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); @@ -469,14 +469,14 @@ public void testExceptionDuringShardClone() throws Exception { createFullSnapshot(repoName, sourceSnapshot); final String targetSnapshot = "target-snapshot"; - blockMasterFromFinalizingSnapshotOnSnapFile(repoName); + blockClusterManagerFromFinalizingSnapshotOnSnapFile(repoName); final ActionFuture cloneFuture = startCloneFromDataNode(repoName, sourceSnapshot, targetSnapshot, testIndex); awaitNumberOfSnapshotsInProgress(1); - final String clusterManagerNode = internalCluster().getMasterName(); + final String clusterManagerNode = internalCluster().getClusterManagerName(); waitForBlock(clusterManagerNode, repoName, TimeValue.timeValueSeconds(30L)); unblockNode(repoName, clusterManagerNode); expectThrows(SnapshotException.class, cloneFuture::actionGet); - awaitNoMoreRunningOperations(internalCluster().getMasterName()); + awaitNoMoreRunningOperations(internalCluster().getClusterManagerName()); assertAllSnapshotsSuccessful(getRepositoryData(repoName), 1); assertAcked(startDeleteSnapshot(repoName, sourceSnapshot).get()); } @@ -491,7 +491,7 @@ public void testDoesNotStartOnBrokenSourceSnapshot() throws Exception { final String sourceSnapshot = "source-snapshot"; blockDataNode(repoName, dataNode); - final Client clusterManagerClient = internalCluster().masterClient(); + final Client clusterManagerClient = internalCluster().clusterManagerClient(); final ActionFuture sourceSnapshotFuture = clusterManagerClient.admin() .cluster() .prepareCreateSnapshot(repoName, sourceSnapshot) @@ -528,7 +528,7 @@ public void testStartSnapshotWithSuccessfulShardClonePendingFinalization() throw final String sourceSnapshot = "source-snapshot"; createFullSnapshot(repoName, sourceSnapshot); - blockMasterOnWriteIndexFile(repoName); + blockClusterManagerOnWriteIndexFile(repoName); final String cloneName = "clone-blocked"; final ActionFuture blockedClone = startClone(repoName, sourceSnapshot, cloneName, indexName); waitForBlock(clusterManagerName, repoName, TimeValue.timeValueSeconds(30L)); @@ -558,7 +558,7 @@ public void testStartCloneWithSuccessfulShardClonePendingFinalization() throws E final String sourceSnapshot = "source-snapshot"; createFullSnapshot(repoName, sourceSnapshot); - blockMasterOnWriteIndexFile(repoName); + blockClusterManagerOnWriteIndexFile(repoName); final String cloneName = "clone-blocked"; final ActionFuture blockedClone = startClone(repoName, sourceSnapshot, cloneName, indexName); waitForBlock(clusterManagerName, repoName, TimeValue.timeValueSeconds(30L)); @@ -588,7 +588,7 @@ public void testStartCloneWithSuccessfulShardSnapshotPendingFinalization() throw final String sourceSnapshot = "source-snapshot"; createFullSnapshot(repoName, sourceSnapshot); - blockMasterOnWriteIndexFile(repoName); + blockClusterManagerOnWriteIndexFile(repoName); final ActionFuture blockedSnapshot = startFullSnapshot(repoName, "snap-blocked"); waitForBlock(clusterManagerName, repoName, TimeValue.timeValueSeconds(30L)); awaitNumberOfSnapshotsInProgress(1); @@ -643,12 +643,12 @@ private static ActionFuture startClone( } private void blockClusterManagerOnReadIndexMeta(String repoName) { - ((MockRepository) internalCluster().getCurrentMasterNodeInstance(RepositoriesService.class).repository(repoName)) + ((MockRepository) internalCluster().getCurrentClusterManagerNodeInstance(RepositoriesService.class).repository(repoName)) .setBlockOnReadIndexMeta(); } private void blockClusterManagerOnShardClone(String repoName) { - ((MockRepository) internalCluster().getCurrentMasterNodeInstance(RepositoriesService.class).repository(repoName)) + ((MockRepository) internalCluster().getCurrentClusterManagerNodeInstance(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 04ec3f027f908..b6d482cad8860 100644 --- a/server/src/internalClusterTest/java/org/opensearch/snapshots/ConcurrentSnapshotsIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/snapshots/ConcurrentSnapshotsIT.java @@ -224,7 +224,7 @@ public void testBlockedRepoDoesNotBlockOtherRepos() throws Exception { .setWaitForCompletion(false) .get(); - unblockNode(blockedRepoName, internalCluster().getMasterName()); + unblockNode(blockedRepoName, internalCluster().getClusterManagerName()); expectThrows(SnapshotException.class, createSlowFuture::actionGet); assertBusy(() -> assertThat(currentSnapshots(otherRepoName), empty()), 30L, TimeUnit.SECONDS); @@ -312,7 +312,7 @@ public void testSnapshotRunsAfterInProgressDelete() throws Exception { final String firstSnapshot = "first-snapshot"; createFullSnapshot(repoName, firstSnapshot); - blockMasterFromFinalizingSnapshotOnIndexFile(repoName); + blockClusterManagerFromFinalizingSnapshotOnIndexFile(repoName); final ActionFuture deleteFuture = startDeleteSnapshot(repoName, firstSnapshot); waitForBlock(clusterManagerNode, repoName, TimeValue.timeValueSeconds(30L)); @@ -448,7 +448,7 @@ public void testCascadedAborts() throws Exception { } public void testClusterManagerFailOverWithQueuedDeletes() throws Exception { - internalCluster().startMasterOnlyNodes(3); + internalCluster().startClusterManagerOnlyNodes(3); final String dataNode = internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); @@ -513,7 +513,7 @@ public void testClusterManagerFailOverWithQueuedDeletes() throws Exception { }, 30L, TimeUnit.SECONDS); logger.info("--> stopping current cluster-manager node"); - internalCluster().stopCurrentMasterNode(); + internalCluster().stopCurrentClusterManagerNode(); unblockNode(repoName, dataNode); unblockNode(repoName, dataNode2); @@ -591,7 +591,7 @@ public void testQueuedDeletesWithFailures() throws Exception { createIndexWithContent("index-one"); createNSnapshots(repoName, randomIntBetween(2, 5)); - blockMasterFromFinalizingSnapshotOnIndexFile(repoName); + blockClusterManagerFromFinalizingSnapshotOnIndexFile(repoName); final ActionFuture firstDeleteFuture = startDeleteSnapshot(repoName, "*"); waitForBlock(clusterManagerNode, repoName, TimeValue.timeValueSeconds(30L)); @@ -641,7 +641,7 @@ public void testQueuedDeletesWithOverlap() throws Exception { } public void testQueuedOperationsOnClusterManagerRestart() throws Exception { - internalCluster().startMasterOnlyNodes(3); + internalCluster().startClusterManagerOnlyNodes(3); internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); @@ -655,21 +655,21 @@ public void testQueuedOperationsOnClusterManagerRestart() throws Exception { startDeleteSnapshot(repoName, "*"); awaitNDeletionsInProgress(2); - internalCluster().stopCurrentMasterNode(); + internalCluster().stopCurrentClusterManagerNode(); ensureStableCluster(3); awaitNoMoreRunningOperations(); } public void testQueuedOperationsOnClusterManagerDisconnect() throws Exception { - internalCluster().startMasterOnlyNodes(3); + internalCluster().startClusterManagerOnlyNodes(3); final String dataNode = internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); createIndexWithContent("index-one"); createNSnapshots(repoName, randomIntBetween(2, 5)); - final String clusterManagerNode = internalCluster().getMasterName(); + final String clusterManagerNode = internalCluster().getClusterManagerName(); final NetworkDisruption networkDisruption = isolateClusterManagerDisruption(NetworkDisruption.DISCONNECT); internalCluster().setDisruptionScheme(networkDisruption); @@ -707,18 +707,18 @@ public void testQueuedOperationsOnClusterManagerDisconnect() throws Exception { } public void testQueuedOperationsOnClusterManagerDisconnectAndRepoFailure() throws Exception { - internalCluster().startMasterOnlyNodes(3); + internalCluster().startClusterManagerOnlyNodes(3); final String dataNode = internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); createIndexWithContent("index-one"); createNSnapshots(repoName, randomIntBetween(2, 5)); - final String clusterManagerNode = internalCluster().getMasterName(); + final String clusterManagerNode = internalCluster().getClusterManagerName(); final NetworkDisruption networkDisruption = isolateClusterManagerDisruption(NetworkDisruption.DISCONNECT); internalCluster().setDisruptionScheme(networkDisruption); - blockMasterFromFinalizingSnapshotOnIndexFile(repoName); + blockClusterManagerFromFinalizingSnapshotOnIndexFile(repoName); final ActionFuture firstFailedSnapshotFuture = startFullSnapshotFromClusterManagerClient( repoName, "failing-snapshot-1" @@ -752,7 +752,7 @@ public void testQueuedOperationsOnClusterManagerDisconnectAndRepoFailure() throw public void testQueuedOperationsAndBrokenRepoOnClusterManagerFailOver() throws Exception { disableRepoConsistencyCheck("This test corrupts the repository on purpose"); - internalCluster().startMasterOnlyNodes(3); + internalCluster().startClusterManagerOnlyNodes(3); internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; final Path repoPath = randomRepoPath(); @@ -771,7 +771,7 @@ public void testQueuedOperationsAndBrokenRepoOnClusterManagerFailOver() throws E final ActionFuture deleteFuture = startDeleteFromNonClusterManagerClient(repoName, "*"); awaitNDeletionsInProgress(2); - internalCluster().stopCurrentMasterNode(); + internalCluster().stopCurrentClusterManagerNode(); ensureStableCluster(3); awaitNoMoreRunningOperations(); @@ -781,7 +781,7 @@ public void testQueuedOperationsAndBrokenRepoOnClusterManagerFailOver() throws E public void testQueuedSnapshotOperationsAndBrokenRepoOnClusterManagerFailOver() throws Exception { disableRepoConsistencyCheck("This test corrupts the repository on purpose"); - internalCluster().startMasterOnlyNodes(3); + internalCluster().startClusterManagerOnlyNodes(3); internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; final Path repoPath = randomRepoPath(); @@ -790,7 +790,7 @@ public void testQueuedSnapshotOperationsAndBrokenRepoOnClusterManagerFailOver() createNSnapshots(repoName, randomIntBetween(2, 5)); final long generation = getRepositoryData(repoName).getGenId(); - final String clusterManagerNode = internalCluster().getMasterName(); + final String clusterManagerNode = internalCluster().getClusterManagerName(); blockNodeOnAnyFiles(repoName, clusterManagerNode); final ActionFuture snapshotThree = startFullSnapshotFromNonClusterManagerClient(repoName, "snapshot-three"); waitForBlock(clusterManagerNode, repoName, TimeValue.timeValueSeconds(30L)); @@ -798,7 +798,7 @@ public void testQueuedSnapshotOperationsAndBrokenRepoOnClusterManagerFailOver() corruptIndexN(repoPath, generation); final ActionFuture snapshotFour = startFullSnapshotFromNonClusterManagerClient(repoName, "snapshot-four"); - internalCluster().stopCurrentMasterNode(); + internalCluster().stopCurrentClusterManagerNode(); ensureStableCluster(3); awaitNoMoreRunningOperations(); @@ -809,7 +809,7 @@ public void testQueuedSnapshotOperationsAndBrokenRepoOnClusterManagerFailOver() public void testQueuedSnapshotOperationsAndBrokenRepoOnClusterManagerFailOver2() throws Exception { disableRepoConsistencyCheck("This test corrupts the repository on purpose"); - internalCluster().startMasterOnlyNodes(3); + internalCluster().startClusterManagerOnlyNodes(3); final String dataNode = internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; final Path repoPath = randomRepoPath(); @@ -818,8 +818,8 @@ public void testQueuedSnapshotOperationsAndBrokenRepoOnClusterManagerFailOver2() createNSnapshots(repoName, randomIntBetween(2, 5)); final long generation = getRepositoryData(repoName).getGenId(); - final String clusterManagerNode = internalCluster().getMasterName(); - blockMasterFromFinalizingSnapshotOnIndexFile(repoName); + final String clusterManagerNode = internalCluster().getClusterManagerName(); + blockClusterManagerFromFinalizingSnapshotOnIndexFile(repoName); final ActionFuture snapshotThree = startFullSnapshotFromNonClusterManagerClient(repoName, "snapshot-three"); waitForBlock(clusterManagerNode, repoName, TimeValue.timeValueSeconds(30L)); @@ -842,7 +842,7 @@ public void testQueuedSnapshotOperationsAndBrokenRepoOnClusterManagerFailOver2() public void testQueuedSnapshotOperationsAndBrokenRepoOnClusterManagerFailOverMultipleRepos() throws Exception { disableRepoConsistencyCheck("This test corrupts the repository on purpose"); - internalCluster().startMasterOnlyNodes(3, LARGE_SNAPSHOT_POOL_SETTINGS); + internalCluster().startClusterManagerOnlyNodes(3, LARGE_SNAPSHOT_POOL_SETTINGS); internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; final Path repoPath = randomRepoPath(); @@ -850,7 +850,7 @@ public void testQueuedSnapshotOperationsAndBrokenRepoOnClusterManagerFailOverMul createIndexWithContent("index-one"); createNSnapshots(repoName, randomIntBetween(2, 5)); - final String clusterManagerNode = internalCluster().getMasterName(); + final String clusterManagerNode = internalCluster().getClusterManagerName(); final String blockedRepoName = "repo-blocked"; createRepository(blockedRepoName, "mock"); @@ -875,7 +875,7 @@ public void testQueuedSnapshotOperationsAndBrokenRepoOnClusterManagerFailOverMul final ActionFuture snapshotFour = startFullSnapshotFromNonClusterManagerClient(repoName, "snapshot-four"); awaitNumberOfSnapshotsInProgress(3); - internalCluster().stopCurrentMasterNode(); + internalCluster().stopCurrentClusterManagerNode(); ensureStableCluster(3); awaitNoMoreRunningOperations(); @@ -1014,7 +1014,7 @@ public void testBackToBackQueuedDeletes() throws Exception { } public void testQueuedOperationsAfterFinalizationFailure() throws Exception { - internalCluster().startMasterOnlyNodes(3); + internalCluster().startClusterManagerOnlyNodes(3); internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); @@ -1024,7 +1024,7 @@ public void testQueuedOperationsAfterFinalizationFailure() throws Exception { final ActionFuture snapshotThree = startAndBlockFailingFullSnapshot(repoName, "snap-other"); - final String clusterManagerName = internalCluster().getMasterName(); + final String clusterManagerName = internalCluster().getClusterManagerName(); final String snapshotOne = snapshotNames.get(0); final ActionFuture deleteSnapshotOne = startDeleteSnapshot(repoName, snapshotOne); @@ -1044,7 +1044,7 @@ public void testStartDeleteDuringFinalizationCleanup() throws Exception { createIndexWithContent("index-test"); createNSnapshots(repoName, randomIntBetween(1, 5)); final String snapshotName = "snap-name"; - blockMasterFromDeletingIndexNFile(repoName); + blockClusterManagerFromDeletingIndexNFile(repoName); final ActionFuture snapshotFuture = startFullSnapshot(repoName, snapshotName); waitForBlock(clusterManagerName, repoName, TimeValue.timeValueSeconds(30L)); final ActionFuture deleteFuture = startDeleteSnapshot(repoName, snapshotName); @@ -1081,7 +1081,7 @@ public void testEquivalentDeletesAreDeduplicated() throws Exception { } public void testClusterManagerFailoverOnFinalizationLoop() throws Exception { - internalCluster().startMasterOnlyNodes(3); + internalCluster().startClusterManagerOnlyNodes(3); final String dataNode = internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); @@ -1090,8 +1090,8 @@ public void testClusterManagerFailoverOnFinalizationLoop() throws Exception { internalCluster().setDisruptionScheme(networkDisruption); final List snapshotNames = createNSnapshots(repoName, randomIntBetween(2, 5)); - final String clusterManagerName = internalCluster().getMasterName(); - blockMasterFromDeletingIndexNFile(repoName); + final String clusterManagerName = internalCluster().getClusterManagerName(); + blockClusterManagerFromDeletingIndexNFile(repoName); final ActionFuture snapshotThree = startFullSnapshotFromClusterManagerClient(repoName, "snap-other"); waitForBlock(clusterManagerName, repoName, TimeValue.timeValueSeconds(30L)); @@ -1196,7 +1196,7 @@ public void testInterleavedAcrossMultipleRepos() throws Exception { public void testClusterManagerFailoverAndMultipleQueuedUpSnapshotsAcrossTwoRepos() throws Exception { disableRepoConsistencyCheck("This test corrupts the repository on purpose"); - internalCluster().startMasterOnlyNodes(3, LARGE_SNAPSHOT_POOL_SETTINGS); + internalCluster().startClusterManagerOnlyNodes(3, LARGE_SNAPSHOT_POOL_SETTINGS); final String dataNode = internalCluster().startDataOnlyNode(); final String repoName = "test-repo"; final String otherRepoName = "other-test-repo"; @@ -1210,8 +1210,8 @@ public void testClusterManagerFailoverAndMultipleQueuedUpSnapshotsAcrossTwoRepos corruptIndexN(repoPath, getRepositoryData(repoName).getGenId()); - blockMasterFromFinalizingSnapshotOnIndexFile(repoName); - blockMasterFromFinalizingSnapshotOnIndexFile(otherRepoName); + blockClusterManagerFromFinalizingSnapshotOnIndexFile(repoName); + blockClusterManagerFromFinalizingSnapshotOnIndexFile(otherRepoName); client().admin().cluster().prepareCreateSnapshot(repoName, "snapshot-blocked-1").setWaitForCompletion(false).get(); client().admin().cluster().prepareCreateSnapshot(repoName, "snapshot-blocked-2").setWaitForCompletion(false).get(); @@ -1219,11 +1219,11 @@ public void testClusterManagerFailoverAndMultipleQueuedUpSnapshotsAcrossTwoRepos client().admin().cluster().prepareCreateSnapshot(otherRepoName, "snapshot-other-blocked-2").setWaitForCompletion(false).get(); awaitNumberOfSnapshotsInProgress(4); - final String initialClusterManager = internalCluster().getMasterName(); + final String initialClusterManager = internalCluster().getClusterManagerName(); waitForBlock(initialClusterManager, repoName, TimeValue.timeValueSeconds(30L)); waitForBlock(initialClusterManager, otherRepoName, TimeValue.timeValueSeconds(30L)); - internalCluster().stopCurrentMasterNode(); + internalCluster().stopCurrentClusterManagerNode(); ensureStableCluster(3, dataNode); awaitNoMoreRunningOperations(); @@ -1338,7 +1338,7 @@ public void testQueuedDeleteAfterFinalizationFailure() throws Exception { final String clusterManagerNode = internalCluster().startClusterManagerOnlyNode(); final String repoName = "test-repo"; createRepository(repoName, "mock"); - blockMasterFromFinalizingSnapshotOnIndexFile(repoName); + blockClusterManagerFromFinalizingSnapshotOnIndexFile(repoName); final String snapshotName = "snap-1"; final ActionFuture snapshotFuture = startFullSnapshot(repoName, snapshotName); waitForBlock(clusterManagerNode, repoName, TimeValue.timeValueSeconds(30L)); @@ -1386,7 +1386,7 @@ public void testStartWithSuccessfulShardSnapshotPendingFinalization() throws Exc createIndexWithContent("test-idx"); createFullSnapshot(repoName, "first-snapshot"); - blockMasterOnWriteIndexFile(repoName); + blockClusterManagerOnWriteIndexFile(repoName); final ActionFuture blockedSnapshot = startFullSnapshot(repoName, "snap-blocked"); waitForBlock(clusterManagerName, repoName, TimeValue.timeValueSeconds(30L)); awaitNumberOfSnapshotsInProgress(1); @@ -1431,12 +1431,12 @@ private List createNSnapshots(String repoName, int count) { 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(); + return internalCluster().nonClusterManagerClient().admin().cluster().prepareDeleteSnapshot(repoName, snapshotName).execute(); } private ActionFuture startFullSnapshotFromNonClusterManagerClient(String repoName, String snapshotName) { logger.info("--> creating full snapshot [{}] to repo [{}] from non cluster-manager client", snapshotName, repoName); - return internalCluster().nonMasterClient() + return internalCluster().nonClusterManagerClient() .admin() .cluster() .prepareCreateSnapshot(repoName, snapshotName) @@ -1446,7 +1446,7 @@ private ActionFuture startFullSnapshotFromNonClusterMana private ActionFuture startFullSnapshotFromClusterManagerClient(String repoName, String snapshotName) { logger.info("--> creating full snapshot [{}] to repo [{}] from cluster-manager client", snapshotName, repoName); - return internalCluster().masterClient() + return internalCluster().clusterManagerClient() .admin() .cluster() .prepareCreateSnapshot(repoName, snapshotName) @@ -1501,7 +1501,7 @@ private static List currentSnapshots(String repoName) { private ActionFuture startAndBlockOnDeleteSnapshot(String repoName, String snapshotName) throws InterruptedException { - final String clusterManagerName = internalCluster().getMasterName(); + final String clusterManagerName = internalCluster().getClusterManagerName(); blockNodeOnAnyFiles(repoName, clusterManagerName); final ActionFuture fut = startDeleteSnapshot(repoName, snapshotName); waitForBlock(clusterManagerName, repoName, TimeValue.timeValueSeconds(30L)); @@ -1510,9 +1510,9 @@ private ActionFuture startAndBlockOnDeleteSnapshot(String private ActionFuture startAndBlockFailingFullSnapshot(String blockedRepoName, String snapshotName) throws InterruptedException { - blockMasterFromFinalizingSnapshotOnIndexFile(blockedRepoName); + blockClusterManagerFromFinalizingSnapshotOnIndexFile(blockedRepoName); final ActionFuture fut = startFullSnapshot(blockedRepoName, snapshotName); - waitForBlock(internalCluster().getMasterName(), blockedRepoName, TimeValue.timeValueSeconds(30L)); + waitForBlock(internalCluster().getClusterManagerName(), blockedRepoName, TimeValue.timeValueSeconds(30L)); return fut; } diff --git a/server/src/internalClusterTest/java/org/opensearch/snapshots/CorruptedBlobStoreRepositoryIT.java b/server/src/internalClusterTest/java/org/opensearch/snapshots/CorruptedBlobStoreRepositoryIT.java index c253f1a4f876e..b806ee3e55a94 100644 --- a/server/src/internalClusterTest/java/org/opensearch/snapshots/CorruptedBlobStoreRepositoryIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/snapshots/CorruptedBlobStoreRepositoryIT.java @@ -205,7 +205,7 @@ public void testConcurrentlyChangeRepositoryContentsInBwCMode() throws Exception equalTo(createSnapshotResponse.getSnapshotInfo().totalShards()) ); - final Repository repository = internalCluster().getMasterNodeInstance(RepositoriesService.class).repository(repoName); + final Repository repository = internalCluster().getClusterManagerNodeInstance(RepositoriesService.class).repository(repoName); logger.info("--> move index-N blob to next generation"); final RepositoryData repositoryData = getRepositoryData(repository); @@ -215,7 +215,7 @@ public void testConcurrentlyChangeRepositoryContentsInBwCMode() throws Exception logger.info("--> verify index-N blob is found at the new location"); assertThat(getRepositoryData(repository).getGenId(), is(beforeMoveGen + 1)); - final SnapshotsService snapshotsService = internalCluster().getCurrentMasterNodeInstance(SnapshotsService.class); + final SnapshotsService snapshotsService = internalCluster().getCurrentClusterManagerNodeInstance(SnapshotsService.class); logger.info("--> wait for all listeners on snapshots service to be resolved to avoid snapshot task batching causing a conflict"); assertBusy(() -> assertTrue(snapshotsService.assertAllListenersResolved())); @@ -267,7 +267,8 @@ public void testFindDanglingLatestGeneration() throws Exception { equalTo(createSnapshotResponse.getSnapshotInfo().totalShards()) ); - final Repository repository = internalCluster().getCurrentMasterNodeInstance(RepositoriesService.class).repository(repoName); + final Repository repository = internalCluster().getCurrentClusterManagerNodeInstance(RepositoriesService.class) + .repository(repoName); logger.info("--> move index-N blob to next generation"); final RepositoryData repositoryData = getRepositoryData(repoName); @@ -367,8 +368,8 @@ public void testHandlingMissingRootLevelSnapshotMetadata() throws Exception { ); logger.info("--> verify that repo is assumed in old metadata format"); - final SnapshotsService snapshotsService = internalCluster().getCurrentMasterNodeInstance(SnapshotsService.class); - final ThreadPool threadPool = internalCluster().getCurrentMasterNodeInstance(ThreadPool.class); + final SnapshotsService snapshotsService = internalCluster().getCurrentClusterManagerNodeInstance(SnapshotsService.class); + final ThreadPool threadPool = internalCluster().getCurrentClusterManagerNodeInstance(ThreadPool.class); assertThat( PlainActionFuture.get( f -> threadPool.generic() @@ -435,7 +436,8 @@ public void testMountCorruptedRepositoryData() throws Exception { ); logger.info("--> corrupt index-N blob"); - final Repository repository = internalCluster().getCurrentMasterNodeInstance(RepositoriesService.class).repository(repoName); + final Repository repository = internalCluster().getCurrentClusterManagerNodeInstance(RepositoriesService.class) + .repository(repoName); final RepositoryData repositoryData = getRepositoryData(repoName); Files.write(repo.resolve("index-" + repositoryData.getGenId()), randomByteArrayOfLength(randomIntBetween(1, 100))); @@ -444,7 +446,8 @@ public void testMountCorruptedRepositoryData() throws Exception { final String otherRepoName = "other-repo"; createRepository(otherRepoName, "fs", Settings.builder().put("location", repo).put("compress", false)); - final Repository otherRepo = internalCluster().getCurrentMasterNodeInstance(RepositoriesService.class).repository(otherRepoName); + final Repository otherRepo = internalCluster().getCurrentClusterManagerNodeInstance(RepositoriesService.class) + .repository(otherRepoName); logger.info("--> verify loading repository data from newly mounted repository throws RepositoryException"); expectThrows(RepositoryException.class, () -> getRepositoryData(otherRepo)); diff --git a/server/src/internalClusterTest/java/org/opensearch/snapshots/DedicatedClusterSnapshotRestoreIT.java b/server/src/internalClusterTest/java/org/opensearch/snapshots/DedicatedClusterSnapshotRestoreIT.java index 2eca8555e1388..7bb63fad7ad24 100644 --- a/server/src/internalClusterTest/java/org/opensearch/snapshots/DedicatedClusterSnapshotRestoreIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/snapshots/DedicatedClusterSnapshotRestoreIT.java @@ -124,7 +124,7 @@ import java.util.function.Consumer; import static org.opensearch.index.seqno.RetentionLeaseActions.RETAIN_ALL; -import static org.opensearch.test.NodeRoles.nonMasterNode; +import static org.opensearch.test.NodeRoles.nonClusterManagerNode; import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertAcked; import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertFutureThrows; import static org.opensearch.test.hamcrest.OpenSearchAssertions.assertRequestBuilderThrows; @@ -760,7 +760,7 @@ public void testRegistrationFailure() { internalCluster().startNode(); logger.info("--> start second node"); // Make sure the first node is elected as cluster-manager - internalCluster().startNode(nonMasterNode()); + internalCluster().startNode(nonClusterManagerNode()); // Register mock repositories for (int i = 0; i < 5; i++) { clusterAdmin().preparePutRepository("test-repo" + i) @@ -837,7 +837,7 @@ public void sendResponse(RestResponse response) { public void testClusterManagerShutdownDuringSnapshot() throws Exception { logger.info("--> starting two cluster-manager nodes and two data nodes"); - internalCluster().startMasterOnlyNodes(2); + internalCluster().startClusterManagerOnlyNodes(2); internalCluster().startDataOnlyNodes(2); final Path repoPath = randomRepoPath(); @@ -860,7 +860,7 @@ public void testClusterManagerShutdownDuringSnapshot() throws Exception { .get(); logger.info("--> stopping cluster-manager node"); - internalCluster().stopCurrentMasterNode(); + internalCluster().stopCurrentClusterManagerNode(); logger.info("--> wait until the snapshot is done"); @@ -875,7 +875,7 @@ public void testClusterManagerShutdownDuringSnapshot() throws Exception { public void testClusterManagerAndDataShutdownDuringSnapshot() throws Exception { logger.info("--> starting three cluster-manager nodes and two data nodes"); - internalCluster().startMasterOnlyNodes(3); + internalCluster().startClusterManagerOnlyNodes(3); internalCluster().startDataOnlyNodes(2); final Path repoPath = randomRepoPath(); @@ -890,7 +890,7 @@ public void testClusterManagerAndDataShutdownDuringSnapshot() throws Exception { final int numberOfShards = getNumShards("test-idx").numPrimaries; logger.info("number of shards: {}", numberOfShards); - final String clusterManagerNode = blockMasterFromFinalizingSnapshotOnSnapFile("test-repo"); + final String clusterManagerNode = blockClusterManagerFromFinalizingSnapshotOnSnapFile("test-repo"); final String dataNode = blockNodeWithIndex("test-repo", "test-idx"); dataNodeClient().admin() @@ -903,7 +903,7 @@ public void testClusterManagerAndDataShutdownDuringSnapshot() throws Exception { logger.info("--> stopping data node {}", dataNode); stopNode(dataNode); logger.info("--> stopping cluster-manager node {} ", clusterManagerNode); - internalCluster().stopCurrentMasterNode(); + internalCluster().stopCurrentClusterManagerNode(); logger.info("--> wait until the snapshot is done"); @@ -1159,7 +1159,7 @@ public void testDataNodeRestartWithBusyClusterManagerDuringSnapshot() throws Exc logger.info("--> snapshot"); ServiceDisruptionScheme disruption = new BusyMasterServiceDisruption(random(), Priority.HIGH); setDisruptionScheme(disruption); - client(internalCluster().getMasterName()).admin() + client(internalCluster().getClusterManagerName()).admin() .cluster() .prepareCreateSnapshot("test-repo", "test-snap") .setWaitForCompletion(false) @@ -1213,7 +1213,7 @@ public void testDataNodeRestartAfterShardSnapshotFailure() throws Exception { blockAllDataNodes("test-repo"); logger.info("--> snapshot"); - client(internalCluster().getMasterName()).admin() + client(internalCluster().getClusterManagerName()).admin() .cluster() .prepareCreateSnapshot("test-repo", "test-snap") .setWaitForCompletion(false) @@ -1399,7 +1399,7 @@ public void testCreateSnapshotLegacyPath() throws Exception { createRepository(repoName, "fs"); createIndex("some-index"); - final SnapshotsService snapshotsService = internalCluster().getMasterNodeInstance(SnapshotsService.class); + final SnapshotsService snapshotsService = internalCluster().getClusterManagerNodeInstance(SnapshotsService.class); final Snapshot snapshot1 = PlainActionFuture.get( f -> snapshotsService.createSnapshotLegacy(new CreateSnapshotRequest(repoName, "snap-1"), f) ); diff --git a/server/src/internalClusterTest/java/org/opensearch/snapshots/MetadataLoadingDuringSnapshotRestoreIT.java b/server/src/internalClusterTest/java/org/opensearch/snapshots/MetadataLoadingDuringSnapshotRestoreIT.java index 0750675d46b9c..5e44355c8424c 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 clusterManager = internalCluster().getMasterName(); + String clusterManager = internalCluster().getClusterManagerName(); RepositoriesService repositoriesService = internalCluster().getInstance(RepositoriesService.class, clusterManager); 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 e72110f4c4efd..197a8a10f3a20 100644 --- a/server/src/internalClusterTest/java/org/opensearch/snapshots/RepositoriesIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/snapshots/RepositoriesIT.java @@ -157,7 +157,7 @@ public void testResidualStaleIndicesAreDeletedByConsecutiveDelete() throws Excep createFullSnapshot(repositoryName, snapshotToBeDeletedLastName); // Create more snapshots to be deleted in bulk - int maxThreadsForSnapshotDeletion = internalCluster().getMasterNodeInstance(ThreadPool.class) + int maxThreadsForSnapshotDeletion = internalCluster().getClusterManagerNodeInstance(ThreadPool.class) .info(ThreadPool.Names.SNAPSHOT) .getMax(); for (int i = 1; i <= maxThreadsForSnapshotDeletion + 1; i++) { @@ -177,7 +177,7 @@ 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 clusterManagerNode = internalCluster().getMasterName(); + String clusterManagerNode = internalCluster().getClusterManagerName(); ((MockRepository) internalCluster().getInstance(RepositoriesService.class, clusterManagerNode).repository("test-repo")) .setThrowExceptionWhileDelete(true); diff --git a/server/src/internalClusterTest/java/org/opensearch/snapshots/RepositoryFilterUserMetadataIT.java b/server/src/internalClusterTest/java/org/opensearch/snapshots/RepositoryFilterUserMetadataIT.java index d84eb9ea1e269..979e6443a9b4c 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 clusterManagerName = internalCluster().getMasterName(); + final String clusterManagerName = internalCluster().getClusterManagerName(); final String repoName = "test-repo"; assertAcked( client().admin() diff --git a/server/src/internalClusterTest/java/org/opensearch/snapshots/SharedClusterSnapshotRestoreIT.java b/server/src/internalClusterTest/java/org/opensearch/snapshots/SharedClusterSnapshotRestoreIT.java index fa04bfbf4e959..ee9e162a34f5c 100644 --- a/server/src/internalClusterTest/java/org/opensearch/snapshots/SharedClusterSnapshotRestoreIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/snapshots/SharedClusterSnapshotRestoreIT.java @@ -1916,7 +1916,7 @@ public void testSnapshotCanceledOnRemovedShard() throws Exception { waitForBlock(blockedNode, repo, TimeValue.timeValueSeconds(10)); logger.info("--> removing primary shard that is being snapshotted"); - ClusterState clusterState = internalCluster().clusterService(internalCluster().getMasterName()).state(); + ClusterState clusterState = internalCluster().clusterService(internalCluster().getClusterManagerName()).state(); IndexRoutingTable indexRoutingTable = clusterState.getRoutingTable().index(index); String nodeWithPrimary = clusterState.nodes().get(indexRoutingTable.shard(0).primaryShard().currentNodeId()).getName(); assertNotNull("should be at least one node with a primary shard", nodeWithPrimary); @@ -2368,7 +2368,7 @@ public void testIndexLatestFailuresIgnored() throws Exception { final String repoName = "test-repo"; final Path repoPath = randomRepoPath(); createRepository(repoName, "mock", repoPath); - final MockRepository repository = (MockRepository) internalCluster().getCurrentMasterNodeInstance(RepositoriesService.class) + final MockRepository repository = (MockRepository) internalCluster().getCurrentClusterManagerNodeInstance(RepositoriesService.class) .repository(repoName); repository.setFailOnIndexLatest(true); createFullSnapshot(repoName, "snapshot-1"); diff --git a/server/src/internalClusterTest/java/org/opensearch/snapshots/SnapshotStatusApisIT.java b/server/src/internalClusterTest/java/org/opensearch/snapshots/SnapshotStatusApisIT.java index 1376961825e8b..b6fa4fbc2fc96 100644 --- a/server/src/internalClusterTest/java/org/opensearch/snapshots/SnapshotStatusApisIT.java +++ b/server/src/internalClusterTest/java/org/opensearch/snapshots/SnapshotStatusApisIT.java @@ -238,7 +238,7 @@ public void testCorrectCountsForDoneShards() throws Exception { final String snapshotOne = "snap-1"; // restarting a data node below so using a cluster-manager client here - final ActionFuture responseSnapshotOne = internalCluster().masterClient() + final ActionFuture responseSnapshotOne = internalCluster().clusterManagerClient() .admin() .cluster() .prepareCreateSnapshot(repoName, snapshotOne) diff --git a/server/src/test/java/org/opensearch/cluster/coordination/ClusterBootstrapServiceDeprecatedMasterTests.java b/server/src/test/java/org/opensearch/cluster/coordination/ClusterBootstrapServiceDeprecatedMasterTests.java index e4fd8064098dd..fb3a628827462 100644 --- a/server/src/test/java/org/opensearch/cluster/coordination/ClusterBootstrapServiceDeprecatedMasterTests.java +++ b/server/src/test/java/org/opensearch/cluster/coordination/ClusterBootstrapServiceDeprecatedMasterTests.java @@ -56,7 +56,7 @@ import static org.opensearch.cluster.coordination.ClusterBootstrapService.UNCONFIGURED_BOOTSTRAP_TIMEOUT_SETTING; import static org.opensearch.common.settings.Settings.builder; import static org.opensearch.node.Node.NODE_NAME_SETTING; -import static org.opensearch.test.NodeRoles.nonMasterNode; +import static org.opensearch.test.NodeRoles.nonClusterManagerNode; import static org.hamcrest.Matchers.containsInAnyOrder; import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; @@ -298,7 +298,7 @@ public void testFailBootstrapNonMasterEligibleNodeWithSingleNodeDiscovery() { final Settings.Builder settings = Settings.builder() .put(DiscoveryModule.DISCOVERY_TYPE_SETTING.getKey(), DiscoveryModule.SINGLE_NODE_DISCOVERY_TYPE) .put(NODE_NAME_SETTING.getKey(), localNode.getName()) - .put(nonMasterNode()); + .put(nonClusterManagerNode()); assertThat( expectThrows( diff --git a/server/src/test/java/org/opensearch/cluster/coordination/ClusterBootstrapServiceTests.java b/server/src/test/java/org/opensearch/cluster/coordination/ClusterBootstrapServiceTests.java index b2b7c167ec7c7..9f9ccf34a6a9d 100644 --- a/server/src/test/java/org/opensearch/cluster/coordination/ClusterBootstrapServiceTests.java +++ b/server/src/test/java/org/opensearch/cluster/coordination/ClusterBootstrapServiceTests.java @@ -63,7 +63,7 @@ import static org.opensearch.discovery.DiscoveryModule.DISCOVERY_SEED_PROVIDERS_SETTING; import static org.opensearch.discovery.SettingsBasedSeedHostsProvider.DISCOVERY_SEED_HOSTS_SETTING; import static org.opensearch.node.Node.NODE_NAME_SETTING; -import static org.opensearch.test.NodeRoles.nonMasterNode; +import static org.opensearch.test.NodeRoles.nonClusterManagerNode; import static org.hamcrest.Matchers.allOf; import static org.hamcrest.Matchers.containsInAnyOrder; import static org.hamcrest.Matchers.containsString; @@ -680,7 +680,7 @@ public void testFailBootstrapNonClusterManagerEligibleNodeWithSingleNodeDiscover final Settings.Builder settings = Settings.builder() .put(DiscoveryModule.DISCOVERY_TYPE_SETTING.getKey(), DiscoveryModule.SINGLE_NODE_DISCOVERY_TYPE) .put(NODE_NAME_SETTING.getKey(), localNode.getName()) - .put(nonMasterNode()); + .put(nonClusterManagerNode()); assertThat( expectThrows( diff --git a/server/src/test/java/org/opensearch/cluster/coordination/CoordinatorTests.java b/server/src/test/java/org/opensearch/cluster/coordination/CoordinatorTests.java index 81fbaf5fce8c0..9f9de698296b8 100644 --- a/server/src/test/java/org/opensearch/cluster/coordination/CoordinatorTests.java +++ b/server/src/test/java/org/opensearch/cluster/coordination/CoordinatorTests.java @@ -90,7 +90,7 @@ import static org.opensearch.discovery.PeerFinder.DISCOVERY_FIND_PEERS_INTERVAL_SETTING; import static org.opensearch.monitor.StatusInfo.Status.HEALTHY; import static org.opensearch.monitor.StatusInfo.Status.UNHEALTHY; -import static org.opensearch.test.NodeRoles.nonMasterNode; +import static org.opensearch.test.NodeRoles.nonClusterManagerNode; import static org.hamcrest.Matchers.allOf; import static org.hamcrest.Matchers.anyOf; import static org.hamcrest.Matchers.containsString; @@ -1702,7 +1702,7 @@ public void testReconfiguresToExcludeClusterManagerIneligibleNodesInVotingConfig chosenNode.close(); cluster.clusterNodes.replaceAll( - cn -> cn == chosenNode ? cn.restartedNode(Function.identity(), Function.identity(), nonMasterNode()) : cn + cn -> cn == chosenNode ? cn.restartedNode(Function.identity(), Function.identity(), nonClusterManagerNode()) : cn ); cluster.stabilise(); diff --git a/server/src/test/java/org/opensearch/cluster/routing/MovePrimaryFirstTests.java b/server/src/test/java/org/opensearch/cluster/routing/MovePrimaryFirstTests.java index aa2be1fb652cd..a30581e2576e2 100644 --- a/server/src/test/java/org/opensearch/cluster/routing/MovePrimaryFirstTests.java +++ b/server/src/test/java/org/opensearch/cluster/routing/MovePrimaryFirstTests.java @@ -56,7 +56,7 @@ protected void createAndIndex(String index, int replicaCount, int shardCount) { * enabled, cluster should not become red and zone2 nodes have all the primaries */ public void testClusterGreenAfterPartialRelocation() throws InterruptedException { - internalCluster().startMasterOnlyNodes(1); + internalCluster().startClusterManagerOnlyNodes(1); final String z1 = "zone-1", z2 = "zone-2"; final int primaryShardCount = 6; assertTrue("Primary shard count must be even for equal distribution across two nodes", primaryShardCount % 2 == 0); diff --git a/server/src/test/java/org/opensearch/env/NodeEnvironmentTests.java b/server/src/test/java/org/opensearch/env/NodeEnvironmentTests.java index f9e1b8e30af41..d886922d56882 100644 --- a/server/src/test/java/org/opensearch/env/NodeEnvironmentTests.java +++ b/server/src/test/java/org/opensearch/env/NodeEnvironmentTests.java @@ -66,7 +66,7 @@ import java.util.concurrent.atomic.AtomicReference; import static org.opensearch.test.NodeRoles.nonDataNode; -import static org.opensearch.test.NodeRoles.nonMasterNode; +import static org.opensearch.test.NodeRoles.nonClusterManagerNode; import static org.hamcrest.CoreMatchers.equalTo; import static org.hamcrest.Matchers.arrayWithSize; import static org.hamcrest.Matchers.containsString; @@ -473,7 +473,7 @@ public void testCustomDataPaths() throws Exception { public void testNodeIdNotPersistedAtInitialization() throws IOException { NodeEnvironment env = newNodeEnvironment( new String[0], - nonMasterNode(nonDataNode(Settings.builder().put("node.local_storage", false).build())) + nonClusterManagerNode(nonDataNode(Settings.builder().put("node.local_storage", false).build())) ); String nodeID = env.nodeId(); env.close(); @@ -566,7 +566,7 @@ public void testEnsureNoShardDataOrIndexMetadata() throws IOException { verifyFailsOnMetadata(noDataNoClusterManagerSettings, indexPath); // build settings using same path.data as original but without cluster-manager role - Settings noClusterManagerSettings = nonMasterNode(settings); + Settings noClusterManagerSettings = nonClusterManagerNode(settings); // test that we can create cluster_manager=false env regardless of data. newNodeEnvironment(noClusterManagerSettings).close(); diff --git a/server/src/test/java/org/opensearch/env/NodeRepurposeCommandTests.java b/server/src/test/java/org/opensearch/env/NodeRepurposeCommandTests.java index ffcbb3eed91f7..009ff324809b4 100644 --- a/server/src/test/java/org/opensearch/env/NodeRepurposeCommandTests.java +++ b/server/src/test/java/org/opensearch/env/NodeRepurposeCommandTests.java @@ -64,9 +64,9 @@ import static org.opensearch.env.NodeRepurposeCommand.NO_CLEANUP; import static org.opensearch.env.NodeRepurposeCommand.NO_DATA_TO_CLEAN_UP_FOUND; import static org.opensearch.env.NodeRepurposeCommand.NO_SHARD_DATA_TO_CLEAN_UP_FOUND; -import static org.opensearch.test.NodeRoles.masterNode; +import static org.opensearch.test.NodeRoles.clusterManagerNode; import static org.opensearch.test.NodeRoles.nonDataNode; -import static org.opensearch.test.NodeRoles.nonMasterNode; +import static org.opensearch.test.NodeRoles.nonClusterManagerNode; import static org.opensearch.test.NodeRoles.removeRoles; import static org.hamcrest.Matchers.allOf; import static org.hamcrest.Matchers.containsString; @@ -102,13 +102,13 @@ public void createNodePaths() throws IOException { writer.writeFullStateAndCommit(1L, ClusterState.EMPTY_STATE); } } - dataNoClusterManagerSettings = nonMasterNode(dataClusterManagerSettings); + dataNoClusterManagerSettings = nonClusterManagerNode(dataClusterManagerSettings); noDataNoClusterManagerSettings = removeRoles( dataClusterManagerSettings, Collections.unmodifiableSet(new HashSet<>(Arrays.asList(DiscoveryNodeRole.DATA_ROLE, DiscoveryNodeRole.CLUSTER_MANAGER_ROLE))) ); - noDataClusterManagerSettings = masterNode(nonDataNode(dataClusterManagerSettings)); + noDataClusterManagerSettings = clusterManagerNode(nonDataNode(dataClusterManagerSettings)); } public void testEarlyExitNoCleanup() throws Exception { diff --git a/server/src/test/java/org/opensearch/gateway/GatewayMetaStatePersistedStateTests.java b/server/src/test/java/org/opensearch/gateway/GatewayMetaStatePersistedStateTests.java index 339b04f45c830..cc9a7a70b99f4 100644 --- a/server/src/test/java/org/opensearch/gateway/GatewayMetaStatePersistedStateTests.java +++ b/server/src/test/java/org/opensearch/gateway/GatewayMetaStatePersistedStateTests.java @@ -75,7 +75,7 @@ import java.util.concurrent.TimeUnit; import java.util.concurrent.atomic.AtomicReference; -import static org.opensearch.test.NodeRoles.nonMasterNode; +import static org.opensearch.test.NodeRoles.nonClusterManagerNode; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.instanceOf; import static org.hamcrest.Matchers.not; @@ -405,7 +405,7 @@ public void testDataOnlyNodePersistence() throws Exception { ); Settings settings = Settings.builder() .put(ClusterName.CLUSTER_NAME_SETTING.getKey(), clusterName.value()) - .put(nonMasterNode()) + .put(nonClusterManagerNode()) .put(Node.NODE_NAME_SETTING.getKey(), "test") .build(); final MockGatewayMetaState gateway = new MockGatewayMetaState(localNode, bigArrays); diff --git a/server/src/test/java/org/opensearch/gateway/GatewayServiceTests.java b/server/src/test/java/org/opensearch/gateway/GatewayServiceTests.java index ba0268b627b95..2d8a26f8bbe87 100644 --- a/server/src/test/java/org/opensearch/gateway/GatewayServiceTests.java +++ b/server/src/test/java/org/opensearch/gateway/GatewayServiceTests.java @@ -61,7 +61,7 @@ import java.util.HashSet; import static org.opensearch.gateway.GatewayService.STATE_NOT_RECOVERED_BLOCK; -import static org.opensearch.test.NodeRoles.masterNode; +import static org.opensearch.test.NodeRoles.clusterManagerNode; import static org.hamcrest.CoreMatchers.not; import static org.hamcrest.Matchers.hasItem; @@ -130,7 +130,7 @@ public void testRecoverStateUpdateTask() throws Exception { ClusterStateUpdateTask clusterStateUpdateTask = service.new RecoverStateUpdateTask(); String nodeId = randomAlphaOfLength(10); DiscoveryNode clusterManagerNode = DiscoveryNode.createLocal( - settings(Version.CURRENT).put(masterNode()).build(), + settings(Version.CURRENT).put(clusterManagerNode()).build(), new TransportAddress(TransportAddress.META_ADDRESS, 9300), nodeId ); diff --git a/server/src/test/java/org/opensearch/transport/ConnectionProfileTests.java b/server/src/test/java/org/opensearch/transport/ConnectionProfileTests.java index d6dc56204f5da..d3a20e9b68e34 100644 --- a/server/src/test/java/org/opensearch/transport/ConnectionProfileTests.java +++ b/server/src/test/java/org/opensearch/transport/ConnectionProfileTests.java @@ -44,8 +44,8 @@ import java.util.HashSet; import java.util.List; +import static org.opensearch.test.NodeRoles.nonClusterManagerNode; import static org.opensearch.test.NodeRoles.nonDataNode; -import static org.opensearch.test.NodeRoles.nonMasterNode; import static org.opensearch.test.NodeRoles.removeRoles; import static org.hamcrest.Matchers.equalTo; @@ -240,7 +240,7 @@ public void testDefaultConnectionProfile() { assertEquals(TransportSettings.TRANSPORT_COMPRESS.get(Settings.EMPTY), profile.getCompressionEnabled()); assertEquals(TransportSettings.PING_SCHEDULE.get(Settings.EMPTY), profile.getPingInterval()); - profile = ConnectionProfile.buildDefaultConnectionProfile(nonMasterNode()); + profile = ConnectionProfile.buildDefaultConnectionProfile(nonClusterManagerNode()); assertEquals(12, profile.getNumConnections()); assertEquals(1, profile.getNumConnectionsPerType(TransportRequestOptions.Type.PING)); assertEquals(6, profile.getNumConnectionsPerType(TransportRequestOptions.Type.REG)); diff --git a/server/src/test/java/org/opensearch/transport/RemoteClusterServiceTests.java b/server/src/test/java/org/opensearch/transport/RemoteClusterServiceTests.java index 9bb8b79377939..b8dd17da45acb 100644 --- a/server/src/test/java/org/opensearch/transport/RemoteClusterServiceTests.java +++ b/server/src/test/java/org/opensearch/transport/RemoteClusterServiceTests.java @@ -63,7 +63,7 @@ import java.util.function.BiFunction; import static org.opensearch.test.NodeRoles.clusterManagerOnlyNode; -import static org.opensearch.test.NodeRoles.nonMasterNode; +import static org.opensearch.test.NodeRoles.nonClusterManagerNode; import static org.opensearch.test.NodeRoles.removeRoles; import static org.hamcrest.Matchers.either; import static org.hamcrest.Matchers.equalTo; @@ -552,7 +552,7 @@ public void testRemoteNodeAttribute() throws IOException, InterruptedException { public void testRemoteNodeRoles() throws IOException, InterruptedException { final Settings settings = Settings.EMPTY; final List knownNodes = new CopyOnWriteArrayList<>(); - final Settings data = nonMasterNode(); + final Settings data = nonClusterManagerNode(); final Settings dedicatedClusterManager = clusterManagerOnlyNode(); try ( MockTransportService c1N1 = startTransport("cluster_1_node_1", knownNodes, Version.CURRENT, dedicatedClusterManager); diff --git a/test/framework/src/main/java/org/opensearch/repositories/blobstore/BlobStoreTestUtil.java b/test/framework/src/main/java/org/opensearch/repositories/blobstore/BlobStoreTestUtil.java index 50158c6ecf053..f9bc0d1066d8e 100644 --- a/test/framework/src/main/java/org/opensearch/repositories/blobstore/BlobStoreTestUtil.java +++ b/test/framework/src/main/java/org/opensearch/repositories/blobstore/BlobStoreTestUtil.java @@ -105,7 +105,7 @@ public final class BlobStoreTestUtil { public static void assertRepoConsistency(InternalTestCluster testCluster, String repoName) { - final BlobStoreRepository repo = (BlobStoreRepository) testCluster.getCurrentMasterNodeInstance(RepositoriesService.class) + final BlobStoreRepository repo = (BlobStoreRepository) testCluster.getCurrentClusterManagerNodeInstance(RepositoriesService.class) .repository(repoName); BlobStoreTestUtil.assertConsistency(repo, repo.threadPool().executor(ThreadPool.Names.GENERIC)); } diff --git a/test/framework/src/main/java/org/opensearch/repositories/blobstore/OpenSearchBlobStoreRepositoryIntegTestCase.java b/test/framework/src/main/java/org/opensearch/repositories/blobstore/OpenSearchBlobStoreRepositoryIntegTestCase.java index 7d9810a11e143..f2b713852584b 100644 --- a/test/framework/src/main/java/org/opensearch/repositories/blobstore/OpenSearchBlobStoreRepositoryIntegTestCase.java +++ b/test/framework/src/main/java/org/opensearch/repositories/blobstore/OpenSearchBlobStoreRepositoryIntegTestCase.java @@ -107,7 +107,7 @@ protected final String createRepository(final String name, final Settings settin client().admin().cluster().preparePutRepository(name).setType(repositoryType()).setVerify(verify).setSettings(settings) ); - internalCluster().getDataOrMasterNodeInstances(RepositoriesService.class).forEach(repositories -> { + internalCluster().getDataOrClusterManagerNodeInstances(RepositoriesService.class).forEach(repositories -> { assertThat(repositories.repository(name), notNullValue()); assertThat(repositories.repository(name), instanceOf(BlobStoreRepository.class)); assertThat(repositories.repository(name).isReadOnly(), is(false)); @@ -280,7 +280,7 @@ protected static void writeBlob(BlobContainer container, String blobName, BytesA protected BlobStore newBlobStore() { final String repository = createRepository(randomName()); - final BlobStoreRepository blobStoreRepository = (BlobStoreRepository) internalCluster().getMasterNodeInstance( + final BlobStoreRepository blobStoreRepository = (BlobStoreRepository) internalCluster().getClusterManagerNodeInstance( RepositoriesService.class ).repository(repository); return PlainActionFuture.get( @@ -470,8 +470,11 @@ public void testIndicesDeletedFromRepository() throws Exception { assertAcked(client().admin().cluster().prepareDeleteSnapshot(repoName, "test-snap").get()); logger.info("--> verify index folder deleted from blob container"); - RepositoriesService repositoriesSvc = internalCluster().getInstance(RepositoriesService.class, internalCluster().getMasterName()); - ThreadPool threadPool = internalCluster().getInstance(ThreadPool.class, internalCluster().getMasterName()); + RepositoriesService repositoriesSvc = internalCluster().getInstance( + RepositoriesService.class, + internalCluster().getClusterManagerName() + ); + ThreadPool threadPool = internalCluster().getInstance(ThreadPool.class, internalCluster().getClusterManagerName()); BlobStoreRepository repository = (BlobStoreRepository) repositoriesSvc.repository(repoName); final SetOnce indicesBlobContainer = new SetOnce<>(); 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 3594bf9f53ca4..bbac1ef591418 100644 --- a/test/framework/src/main/java/org/opensearch/snapshots/AbstractSnapshotIntegTestCase.java +++ b/test/framework/src/main/java/org/opensearch/snapshots/AbstractSnapshotIntegTestCase.java @@ -166,7 +166,7 @@ protected void disableRepoConsistencyCheck(String reason) { } protected RepositoryData getRepositoryData(String repository) { - return getRepositoryData(internalCluster().getCurrentMasterNodeInstance(RepositoriesService.class).repository(repository)); + return getRepositoryData(internalCluster().getCurrentClusterManagerNodeInstance(RepositoriesService.class).repository(repository)); } protected RepositoryData getRepositoryData(Repository repository) { @@ -175,7 +175,7 @@ protected RepositoryData getRepositoryData(Repository repository) { public static long getFailureCount(String repository) { long failureCount = 0; - for (RepositoriesService repositoriesService : internalCluster().getDataOrMasterNodeInstances(RepositoriesService.class)) { + for (RepositoriesService repositoriesService : internalCluster().getDataOrClusterManagerNodeInstances(RepositoriesService.class)) { MockRepository mockRepository = (MockRepository) repositoriesService.repository(repository); failureCount += mockRepository.getFailureCount(); } @@ -251,33 +251,57 @@ public SnapshotInfo waitForCompletion(String repository, String snapshotName, Ti return null; } - public static String blockMasterFromFinalizingSnapshotOnIndexFile(final String repositoryName) { - final String clusterManagerName = internalCluster().getMasterName(); + public static String blockClusterManagerFromFinalizingSnapshotOnIndexFile(final String repositoryName) { + final String clusterManagerName = internalCluster().getClusterManagerName(); ((MockRepository) internalCluster().getInstance(RepositoriesService.class, clusterManagerName).repository(repositoryName)) .setBlockAndFailOnWriteIndexFile(); return clusterManagerName; } - public static String blockMasterOnWriteIndexFile(final String repositoryName) { - final String clusterManagerName = internalCluster().getMasterName(); - ((MockRepository) internalCluster().getMasterNodeInstance(RepositoriesService.class).repository(repositoryName)) + public static String blockClusterManagerOnWriteIndexFile(final String repositoryName) { + final String clusterManagerName = internalCluster().getClusterManagerName(); + ((MockRepository) internalCluster().getClusterManagerNodeInstance(RepositoriesService.class).repository(repositoryName)) .setBlockOnWriteIndexFile(); return clusterManagerName; } - public static void blockMasterFromDeletingIndexNFile(String repositoryName) { - final String clusterManagerName = internalCluster().getMasterName(); + public static void blockClusterManagerFromDeletingIndexNFile(String repositoryName) { + final String clusterManagerName = internalCluster().getClusterManagerName(); ((MockRepository) internalCluster().getInstance(RepositoriesService.class, clusterManagerName).repository(repositoryName)) .setBlockOnDeleteIndexFile(); } - public static String blockMasterFromFinalizingSnapshotOnSnapFile(final String repositoryName) { - final String clusterManagerName = internalCluster().getMasterName(); + public static String blockClusterManagerFromFinalizingSnapshotOnSnapFile(final String repositoryName) { + final String clusterManagerName = internalCluster().getClusterManagerName(); ((MockRepository) internalCluster().getInstance(RepositoriesService.class, clusterManagerName).repository(repositoryName)) .setBlockAndFailOnWriteSnapFiles(true); return clusterManagerName; } + /** @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #blockClusterManagerFromFinalizingSnapshotOnIndexFile(String)} */ + @Deprecated + public static String blockMasterFromFinalizingSnapshotOnIndexFile(final String repositoryName) { + return blockClusterManagerFromFinalizingSnapshotOnIndexFile(repositoryName); + } + + /** @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #blockClusterManagerOnWriteIndexFile(String)} */ + @Deprecated + public static String blockMasterOnWriteIndexFile(final String repositoryName) { + return blockClusterManagerOnWriteIndexFile(repositoryName); + } + + /** @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #blockClusterManagerFromDeletingIndexNFile(String)} */ + @Deprecated + public static void blockMasterFromDeletingIndexNFile(String repositoryName) { + blockClusterManagerFromDeletingIndexNFile(repositoryName); + } + + /** @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #blockClusterManagerFromFinalizingSnapshotOnSnapFile(String)} */ + @Deprecated + public static String blockMasterFromFinalizingSnapshotOnSnapFile(final String repositoryName) { + return blockClusterManagerFromFinalizingSnapshotOnSnapFile(repositoryName); + } + public static String blockNodeWithIndex(final String repositoryName, final String indexName) { for (String node : internalCluster().nodesInclude(indexName)) { ((MockRepository) internalCluster().getInstance(RepositoriesService.class, node).repository(repositoryName)).blockOnDataFiles( @@ -479,7 +503,7 @@ protected void addBwCFailedSnapshot(String repoName, String snapshotName, Map adding old version FAILED snapshot [{}] to repository [{}]", snapshotId, repoName); final SnapshotInfo snapshotInfo = new SnapshotInfo( @@ -511,7 +535,7 @@ protected void addBwCFailedSnapshot(String repoName, String snapshotName, Map statePredicate) throws Exception { - awaitClusterState(internalCluster().getMasterName(), statePredicate); + awaitClusterState(internalCluster().getClusterManagerName(), statePredicate); } protected void awaitClusterState(String viaNode, Predicate statePredicate) throws Exception { @@ -601,7 +625,7 @@ protected ActionFuture startDeleteSnapshot(String repoName protected void updateClusterState(final Function updater) throws Exception { final PlainActionFuture future = PlainActionFuture.newFuture(); - final ClusterService clusterService = internalCluster().getCurrentMasterNodeInstance(ClusterService.class); + final ClusterService clusterService = internalCluster().getCurrentClusterManagerNodeInstance(ClusterService.class); clusterService.submitStateUpdateTask("test", new ClusterStateUpdateTask() { @Override public ClusterState execute(ClusterState currentState) { @@ -629,7 +653,7 @@ protected SnapshotInfo getSnapshot(String repository, String snapshot) { 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); + final ThreadPool clusterManagerThreadPool = internalCluster().getClusterManagerNodeInstance(ThreadPool.class); assertBusy(() -> { for (ThreadPoolStats.Stats stat : clusterManagerThreadPool.stats()) { if (ThreadPool.Names.SNAPSHOT.equals(stat.getName())) { @@ -639,4 +663,10 @@ protected void awaitClusterManagerFinishRepoOperations() throws Exception { } }); } + + /** @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #awaitClusterManagerFinishRepoOperations()} */ + @Deprecated + protected void awaitMasterFinishRepoOperations() throws Exception { + awaitClusterManagerFinishRepoOperations(); + } } diff --git a/test/framework/src/main/java/org/opensearch/test/InternalTestCluster.java b/test/framework/src/main/java/org/opensearch/test/InternalTestCluster.java index 7124cc6a180ac..c68e1eac3e1d8 100644 --- a/test/framework/src/main/java/org/opensearch/test/InternalTestCluster.java +++ b/test/framework/src/main/java/org/opensearch/test/InternalTestCluster.java @@ -207,8 +207,15 @@ public final class InternalTestCluster extends TestCluster { nodeAndClient.node.settings() ); - public static final int DEFAULT_LOW_NUM_MASTER_NODES = 1; - public static final int DEFAULT_HIGH_NUM_MASTER_NODES = 3; + public static final int DEFAULT_LOW_NUM_CLUSTER_MANAGER_NODES = 1; + public static final int DEFAULT_HIGH_NUM_CLUSTER_MANAGER_NODES = 3; + + /** @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #DEFAULT_LOW_NUM_CLUSTER_MANAGER_NODES} */ + @Deprecated + public static final int DEFAULT_LOW_NUM_MASTER_NODES = DEFAULT_LOW_NUM_CLUSTER_MANAGER_NODES; + /** @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #DEFAULT_HIGH_NUM_CLUSTER_MANAGER_NODES} */ + @Deprecated + public static final int DEFAULT_HIGH_NUM_MASTER_NODES = DEFAULT_HIGH_NUM_CLUSTER_MANAGER_NODES; static final int DEFAULT_MIN_NUM_DATA_NODES = 1; static final int DEFAULT_MAX_NUM_DATA_NODES = TEST_NIGHTLY ? 6 : 3; @@ -341,9 +348,9 @@ public InternalTestCluster( if (useDedicatedClusterManagerNodes) { if (random.nextBoolean()) { // use a dedicated cluster-manager, but only low number to reduce overhead to tests - this.numSharedDedicatedClusterManagerNodes = DEFAULT_LOW_NUM_MASTER_NODES; + this.numSharedDedicatedClusterManagerNodes = DEFAULT_LOW_NUM_CLUSTER_MANAGER_NODES; } else { - this.numSharedDedicatedClusterManagerNodes = DEFAULT_HIGH_NUM_MASTER_NODES; + this.numSharedDedicatedClusterManagerNodes = DEFAULT_HIGH_NUM_CLUSTER_MANAGER_NODES; } } else { this.numSharedDedicatedClusterManagerNodes = 0; @@ -670,7 +677,7 @@ public synchronized void ensureAtMostNumDataNodes(int n) throws IOException { // prevent killing the cluster-manager if possible and client nodes final Stream collection = n == 0 ? nodes.values().stream() - : nodes.values().stream().filter(DATA_NODE_PREDICATE.and(new NodeNamePredicate(getMasterName()).negate())); + : nodes.values().stream().filter(DATA_NODE_PREDICATE.and(new NodeNamePredicate(getClusterManagerName()).negate())); final Iterator values = collection.iterator(); logger.info("changing cluster size from {} data nodes to {}", size, n); @@ -825,8 +832,8 @@ public Client dataNodeClient() { * Returns a node client to the current cluster-manager node. * Note: use this with care tests should not rely on a certain nodes client. */ - public Client masterClient() { - NodeAndClient randomNodeAndClient = getRandomNodeAndClient(new NodeNamePredicate(getMasterName())); + public Client clusterManagerClient() { + NodeAndClient randomNodeAndClient = getRandomNodeAndClient(new NodeNamePredicate(getClusterManagerName())); if (randomNodeAndClient != null) { return randomNodeAndClient.nodeClient(); // ensure node client cluster-manager is requested } @@ -836,14 +843,33 @@ public Client masterClient() { /** * Returns a node client to random node but not the cluster-manager. This method will fail if no non-cluster-manager client is available. */ - public Client nonMasterClient() { - NodeAndClient randomNodeAndClient = getRandomNodeAndClient(new NodeNamePredicate(getMasterName()).negate()); + public Client nonClusterManagerClient() { + NodeAndClient randomNodeAndClient = getRandomNodeAndClient(new NodeNamePredicate(getClusterManagerName()).negate()); if (randomNodeAndClient != null) { return randomNodeAndClient.nodeClient(); // ensure node client non-cluster-manager is requested } throw new AssertionError("No non-cluster-manager client found"); } + /** + * Returns a node client to the current cluster-manager node. + * Note: use this with care tests should not rely on a certain nodes client. + * @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #clusterManagerClient()} + */ + @Deprecated + public Client masterClient() { + return clusterManagerClient(); + } + + /** + * Returns a node client to random node but not the cluster-manager. This method will fail if no non-cluster-manager client is available. + * @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #nonClusterManagerClient()} + */ + @Deprecated + public Client nonMasterClient() { + return nonClusterManagerClient(); + } + /** * Returns a client to a coordinating only node */ @@ -902,7 +928,10 @@ public synchronized void close() throws IOException { } } - public static final int REMOVED_MINIMUM_MASTER_NODES = Integer.MAX_VALUE; + public static final int REMOVED_MINIMUM_CLUSTER_MANAGER_NODES = Integer.MAX_VALUE; + /** @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #REMOVED_MINIMUM_CLUSTER_MANAGER_NODES} */ + @Deprecated + public static final int REMOVED_MINIMUM_MASTER_NODES = REMOVED_MINIMUM_CLUSTER_MANAGER_NODES; private final class NodeAndClient implements Closeable { private MockNode node; @@ -935,10 +964,16 @@ public String getName() { return name; } - public boolean isMasterEligible() { + public boolean isClusterManagerEligible() { return DiscoveryNode.isClusterManagerNode(node.settings()); } + /** @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #isClusterManagerEligible()} */ + @Deprecated + public boolean isMasterEligible() { + return isClusterManagerEligible(); + } + Client client() { return getOrBuildNodeClient(); } @@ -1127,7 +1162,7 @@ private synchronized void reset(boolean wipeData) throws IOException { assertTrue( "expected at least one cluster-manager-eligible node left in " + nodes, - nodes.isEmpty() || nodes.values().stream().anyMatch(NodeAndClient::isMasterEligible) + nodes.isEmpty() || nodes.values().stream().anyMatch(NodeAndClient::isClusterManagerEligible) ); final int prevNodeCount = nodes.size(); @@ -1560,16 +1595,33 @@ public Iterable getDataNodeInstances(Class clazz) { return getInstances(clazz, DATA_NODE_PREDICATE); } + public synchronized T getCurrentClusterManagerNodeInstance(Class clazz) { + return getInstance(clazz, new NodeNamePredicate(getClusterManagerName())); + } + + /** + * Returns an Iterable to all instances for the given class >T< across all data and cluster-manager nodes + * in the cluster. + */ + public Iterable getDataOrClusterManagerNodeInstances(Class clazz) { + return getInstances(clazz, DATA_NODE_PREDICATE.or(CLUSTER_MANAGER_NODE_PREDICATE)); + } + + /** @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #getCurrentClusterManagerNodeInstance(Class)} */ + @Deprecated public synchronized T getCurrentMasterNodeInstance(Class clazz) { - return getInstance(clazz, new NodeNamePredicate(getMasterName())); + return getCurrentClusterManagerNodeInstance(clazz); } /** * Returns an Iterable to all instances for the given class >T< across all data and cluster-manager nodes * in the cluster. + * + * @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #getDataOrClusterManagerNodeInstances(Class)} */ + @Deprecated public Iterable getDataOrMasterNodeInstances(Class clazz) { - return getInstances(clazz, DATA_NODE_PREDICATE.or(CLUSTER_MANAGER_NODE_PREDICATE)); + return getDataOrClusterManagerNodeInstances(clazz); } private Iterable getInstances(Class clazz, Predicate predicate) { @@ -1592,10 +1644,16 @@ public T getDataNodeInstance(Class clazz) { return getInstance(clazz, DATA_NODE_PREDICATE); } - public T getMasterNodeInstance(Class clazz) { + public T getClusterManagerNodeInstance(Class clazz) { return getInstance(clazz, CLUSTER_MANAGER_NODE_PREDICATE); } + /** @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #getClusterManagerNodeInstance(Class)} */ + @Deprecated + public T getMasterNodeInstance(Class clazz) { + return getClusterManagerNodeInstance(clazz); + } + private synchronized T getInstance(Class clazz, Predicate predicate) { NodeAndClient randomNodeAndClient = getRandomNodeAndClient(predicate); assert randomNodeAndClient != null; @@ -1662,11 +1720,11 @@ public synchronized void stopRandomNode(final Predicate filter) throws if (nodeAndClient != null) { if (nodePrefix.equals(OpenSearchIntegTestCase.SUITE_CLUSTER_NODE_PREFIX) && nodeAndClient.nodeAndClientId() < sharedNodesSeeds.length - && nodeAndClient.isMasterEligible() + && nodeAndClient.isClusterManagerEligible() && autoManageClusterManagerNodes && nodes.values() .stream() - .filter(NodeAndClient::isMasterEligible) + .filter(NodeAndClient::isClusterManagerEligible) .filter(n -> n.nodeAndClientId() < sharedNodesSeeds.length) .count() == 1) { throw new AssertionError("Tried to stop the only cluster-manager eligible shared node"); @@ -1677,12 +1735,12 @@ public synchronized void stopRandomNode(final Predicate filter) throws } /** - * Stops the current cluster-manager node forcefully + * Stops the current cluster-manager node forcefully. */ - public synchronized void stopCurrentMasterNode() throws IOException { + public synchronized void stopCurrentClusterManagerNode() throws IOException { ensureOpen(); assert size() > 0; - String clusterManagerNodeName = getMasterName(); + String clusterManagerNodeName = getClusterManagerName(); final NodeAndClient clusterManagerNode = nodes.get(clusterManagerNodeName); assert clusterManagerNode != null; logger.info("Closing cluster-manager node [{}] ", clusterManagerNodeName); @@ -1692,18 +1750,42 @@ public synchronized void stopCurrentMasterNode() throws IOException { /** * Stops any of the current nodes but not the cluster-manager node. */ - public synchronized void stopRandomNonMasterNode() throws IOException { - NodeAndClient nodeAndClient = getRandomNodeAndClient(new NodeNamePredicate(getMasterName()).negate()); + public synchronized void stopRandomNonClusterManagerNode() throws IOException { + NodeAndClient nodeAndClient = getRandomNodeAndClient(new NodeNamePredicate(getClusterManagerName()).negate()); if (nodeAndClient != null) { - logger.info("Closing random non cluster-manager node [{}] current cluster-manager [{}] ", nodeAndClient.name, getMasterName()); + logger.info( + "Closing random non cluster-manager node [{}] current cluster-manager [{}] ", + nodeAndClient.name, + getClusterManagerName() + ); stopNodesAndClient(nodeAndClient); } } + /** + * Stops the current cluster-manager node forcefully. + * + * @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #stopCurrentClusterManagerNode()} + */ + @Deprecated + public synchronized void stopCurrentMasterNode() throws IOException { + stopCurrentClusterManagerNode(); + } + + /** + * Stops any of the current nodes but not the cluster-manager node. + * + * @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #stopRandomNonClusterManagerNode()} + */ + @Deprecated + public synchronized void stopRandomNonMasterNode() throws IOException { + stopRandomNonClusterManagerNode(); + } + private synchronized void startAndPublishNodesAndClients(List nodeAndClients) { if (nodeAndClients.size() > 0) { final int newClusterManagers = (int) nodeAndClients.stream() - .filter(NodeAndClient::isMasterEligible) + .filter(NodeAndClient::isClusterManagerEligible) .filter(nac -> nodes.containsKey(nac.name) == false) // filter out old cluster-managers .count(); final int currentClusterManagers = getClusterManagerNodesCount(); @@ -1877,8 +1959,8 @@ private Set excludeClusterManagers(Collection nodeAndClie final Set excludedNodeNames = new HashSet<>(); if (autoManageClusterManagerNodes && nodeAndClients.size() > 0) { - final long currentClusterManagers = nodes.values().stream().filter(NodeAndClient::isMasterEligible).count(); - final long stoppingClusterManagers = nodeAndClients.stream().filter(NodeAndClient::isMasterEligible).count(); + final long currentClusterManagers = nodes.values().stream().filter(NodeAndClient::isClusterManagerEligible).count(); + final long stoppingClusterManagers = nodeAndClients.stream().filter(NodeAndClient::isClusterManagerEligible).count(); assert stoppingClusterManagers <= currentClusterManagers : currentClusterManagers + " < " + stoppingClusterManagers; if (stoppingClusterManagers != currentClusterManagers && stoppingClusterManagers > 0) { @@ -1887,7 +1969,10 @@ private Set excludeClusterManagers(Collection nodeAndClie // However, we do not yet have a way to be sure there's a majority left, because the voting configuration may not yet have // been updated when the previous nodes shut down, so we must always explicitly withdraw votes. // TODO add cluster health API to check that voting configuration is optimal so this isn't always needed - nodeAndClients.stream().filter(NodeAndClient::isMasterEligible).map(NodeAndClient::getName).forEach(excludedNodeNames::add); + nodeAndClients.stream() + .filter(NodeAndClient::isClusterManagerEligible) + .map(NodeAndClient::getName) + .forEach(excludedNodeNames::add); assert excludedNodeNames.size() == stoppingClusterManagers; logger.info("adding voting config exclusions {} prior to restart/shutdown", excludedNodeNames); @@ -1956,15 +2041,15 @@ public synchronized void fullRestart(RestartCallback callback) throws Exception /** * Returns the name of the current cluster-manager node in the cluster. */ - public String getMasterName() { - return getMasterName(null); + public String getClusterManagerName() { + return getClusterManagerName(null); } /** * Returns the name of the current cluster-manager node in the cluster and executes the request via the node specified * in the viaNode parameter. If viaNode isn't specified a random node will be picked to the send the request to. */ - public String getMasterName(@Nullable String viaNode) { + public String getClusterManagerName(@Nullable String viaNode) { try { Client client = viaNode != null ? client(viaNode) : client(); return client.admin().cluster().prepareState().get().getState().nodes().getClusterManagerNode().getName(); @@ -1974,6 +2059,27 @@ public String getMasterName(@Nullable String viaNode) { } } + /** + * Returns the name of the current cluster-manager node in the cluster. + * + * @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #getClusterManagerName()} + */ + @Deprecated + public String getMasterName() { + return getClusterManagerName(); + } + + /** + * Returns the name of the current cluster-manager node in the cluster and executes the request via the node specified + * in the viaNode parameter. If viaNode isn't specified a random node will be picked to the send the request to. + * + * @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #getClusterManagerName(String)} + */ + @Deprecated + public String getMasterName(@Nullable String viaNode) { + return getClusterManagerName(viaNode); + } + synchronized Set allDataNodesButN(int count) { final int numNodes = numDataNodes() - count; assert size() >= numNodes; @@ -2021,7 +2127,7 @@ private List bootstrapClusterManagerNodeWithSpecifiedIndex(List newSettings = new ArrayList<>(); for (Settings settings : allNodesSettings) { @@ -2034,7 +2140,7 @@ private List bootstrapClusterManagerNodeWithSpecifiedIndex(List nodeNames = new ArrayList<>(); - for (Settings nodeSettings : getDataOrMasterNodeInstances(Settings.class)) { + for (Settings nodeSettings : getDataOrClusterManagerNodeInstances(Settings.class)) { if (DiscoveryNode.isClusterManagerNode(nodeSettings)) { nodeNames.add(Node.NODE_NAME_SETTING.get(nodeSettings)); } @@ -2157,12 +2263,24 @@ public synchronized List startNodes(Settings... extraSettings) { return nodes.stream().map(NodeAndClient::getName).collect(Collectors.toList()); } + public List startClusterManagerOnlyNodes(int numNodes) { + return startClusterManagerOnlyNodes(numNodes, Settings.EMPTY); + } + + public List startClusterManagerOnlyNodes(int numNodes, Settings settings) { + return startNodes(numNodes, Settings.builder().put(onlyRole(settings, DiscoveryNodeRole.CLUSTER_MANAGER_ROLE)).build()); + } + + /** @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #startClusterManagerOnlyNodes(int)} */ + @Deprecated public List startMasterOnlyNodes(int numNodes) { - return startMasterOnlyNodes(numNodes, Settings.EMPTY); + return startClusterManagerOnlyNodes(numNodes); } + /** @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #startClusterManagerOnlyNodes(int, Settings)} */ + @Deprecated public List startMasterOnlyNodes(int numNodes, Settings settings) { - return startNodes(numNodes, Settings.builder().put(onlyRole(settings, DiscoveryNodeRole.CLUSTER_MANAGER_ROLE)).build()); + return startClusterManagerOnlyNodes(numNodes, settings); } public List startDataOnlyNodes(int numNodes) { @@ -2191,6 +2309,18 @@ public String startClusterManagerOnlyNode(Settings settings) { return startNode(settings1); } + /** @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #startClusterManagerOnlyNode()} */ + @Deprecated + public String startMasterOnlyNode() { + return startClusterManagerOnlyNode(); + } + + /** @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #startClusterManagerOnlyNode(Settings)} */ + @Deprecated + public String startMasterOnlyNode(Settings settings) { + return startClusterManagerOnlyNode(settings); + } + public String startDataOnlyNode() { return startDataOnlyNode(Settings.EMPTY); } @@ -2222,8 +2352,14 @@ public int numDataAndMasterNodes() { return filterNodes(nodes, DATA_NODE_PREDICATE.or(CLUSTER_MANAGER_NODE_PREDICATE)).size(); } + public int numClusterManagerNodes() { + return filterNodes(nodes, NodeAndClient::isClusterManagerEligible).size(); + } + + /** @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #numClusterManagerNodes()} */ + @Deprecated public int numMasterNodes() { - return filterNodes(nodes, NodeAndClient::isMasterEligible).size(); + return numClusterManagerNodes(); } public void setDisruptionScheme(ServiceDisruptionScheme scheme) { diff --git a/test/framework/src/main/java/org/opensearch/test/NodeRoles.java b/test/framework/src/main/java/org/opensearch/test/NodeRoles.java index 4f448e230a2b6..958b6c81def34 100644 --- a/test/framework/src/main/java/org/opensearch/test/NodeRoles.java +++ b/test/framework/src/main/java/org/opensearch/test/NodeRoles.java @@ -168,11 +168,11 @@ public static Settings nonIngestNode(final Settings settings) { return removeRoles(settings, Collections.singleton(DiscoveryNodeRole.INGEST_ROLE)); } - public static Settings masterNode() { - return masterNode(Settings.EMPTY); + public static Settings clusterManagerNode() { + return clusterManagerNode(Settings.EMPTY); } - public static Settings masterNode(final Settings settings) { + public static Settings clusterManagerNode(final Settings settings) { return addRoles(settings, Collections.singleton(DiscoveryNodeRole.CLUSTER_MANAGER_ROLE)); } @@ -184,12 +184,48 @@ public static Settings clusterManagerOnlyNode(final Settings settings) { return onlyRole(settings, DiscoveryNodeRole.CLUSTER_MANAGER_ROLE); } + public static Settings nonClusterManagerNode() { + return nonClusterManagerNode(Settings.EMPTY); + } + + public static Settings nonClusterManagerNode(final Settings settings) { + return removeRoles(settings, Collections.singleton(DiscoveryNodeRole.CLUSTER_MANAGER_ROLE)); + } + + /** @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #clusterManagerNode()} */ + @Deprecated + public static Settings masterNode() { + return clusterManagerNode(); + } + + /** @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #clusterManagerNode(Settings)} */ + @Deprecated + public static Settings masterNode(final Settings settings) { + return clusterManagerNode(settings); + } + + /** @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #clusterManagerOnlyNode()} */ + @Deprecated + public static Settings masterOnlyNode() { + return clusterManagerOnlyNode(); + } + + /** @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #clusterManagerOnlyNode(Settings)} */ + @Deprecated + public static Settings masterOnlyNode(final Settings settings) { + return clusterManagerOnlyNode(settings); + } + + /** @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #nonClusterManagerNode()} */ + @Deprecated public static Settings nonMasterNode() { - return nonMasterNode(Settings.EMPTY); + return nonClusterManagerNode(); } + /** @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #nonClusterManagerNode(Settings)} */ + @Deprecated public static Settings nonMasterNode(final Settings settings) { - return removeRoles(settings, Collections.singleton(DiscoveryNodeRole.CLUSTER_MANAGER_ROLE)); + return nonClusterManagerNode(settings); } public static Settings remoteClusterClientNode() { 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 6344fe3435675..0f868efdd5c45 100644 --- a/test/framework/src/main/java/org/opensearch/test/OpenSearchIntegTestCase.java +++ b/test/framework/src/main/java/org/opensearch/test/OpenSearchIntegTestCase.java @@ -713,7 +713,7 @@ public void setDisruptionScheme(ServiceDisruptionScheme scheme) { * @return disruption */ protected static NetworkDisruption isolateClusterManagerDisruption(NetworkDisruption.NetworkLinkDisruptionType disruptionType) { - final String clusterManagerNode = internalCluster().getMasterName(); + final String clusterManagerNode = internalCluster().getClusterManagerName(); return new NetworkDisruption( new NetworkDisruption.TwoPartitions( Collections.singleton(clusterManagerNode), diff --git a/test/framework/src/main/java/org/opensearch/test/disruption/BlockMasterServiceOnMaster.java b/test/framework/src/main/java/org/opensearch/test/disruption/BlockMasterServiceOnMaster.java index 85f8e5c250066..19aaba154109d 100644 --- a/test/framework/src/main/java/org/opensearch/test/disruption/BlockMasterServiceOnMaster.java +++ b/test/framework/src/main/java/org/opensearch/test/disruption/BlockMasterServiceOnMaster.java @@ -53,7 +53,7 @@ public BlockMasterServiceOnMaster(Random random) { @Override public void startDisrupting() { - disruptedNode = cluster.getMasterName(); + disruptedNode = cluster.getClusterManagerName(); final String disruptionNodeCopy = disruptedNode; if (disruptionNodeCopy == null) { return; diff --git a/test/framework/src/main/java/org/opensearch/test/disruption/BusyMasterServiceDisruption.java b/test/framework/src/main/java/org/opensearch/test/disruption/BusyMasterServiceDisruption.java index 4830f9b0359fb..d764c23404a91 100644 --- a/test/framework/src/main/java/org/opensearch/test/disruption/BusyMasterServiceDisruption.java +++ b/test/framework/src/main/java/org/opensearch/test/disruption/BusyMasterServiceDisruption.java @@ -52,7 +52,7 @@ public BusyMasterServiceDisruption(Random random, Priority priority) { @Override public void startDisrupting() { - disruptedNode = cluster.getMasterName(); + disruptedNode = cluster.getClusterManagerName(); final String disruptionNodeCopy = disruptedNode; if (disruptionNodeCopy == null) { return; diff --git a/test/framework/src/main/java/org/opensearch/test/rest/yaml/ClientYamlTestClient.java b/test/framework/src/main/java/org/opensearch/test/rest/yaml/ClientYamlTestClient.java index 6a87a89db4959..56ccb91dc3331 100644 --- a/test/framework/src/main/java/org/opensearch/test/rest/yaml/ClientYamlTestClient.java +++ b/test/framework/src/main/java/org/opensearch/test/rest/yaml/ClientYamlTestClient.java @@ -105,6 +105,12 @@ public Version getClusterManagerVersion() { return clusterManagerVersion; } + /** @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #getClusterManagerVersion()} */ + @Deprecated + public Version getMasterVersion() { + return getClusterManagerVersion(); + } + /** * Calls an api with the provided parameters and body */ diff --git a/test/framework/src/main/java/org/opensearch/test/rest/yaml/ClientYamlTestExecutionContext.java b/test/framework/src/main/java/org/opensearch/test/rest/yaml/ClientYamlTestExecutionContext.java index 8e6bbd009dc2f..78818aefe44cc 100644 --- a/test/framework/src/main/java/org/opensearch/test/rest/yaml/ClientYamlTestExecutionContext.java +++ b/test/framework/src/main/java/org/opensearch/test/rest/yaml/ClientYamlTestExecutionContext.java @@ -227,8 +227,14 @@ public Version esVersion() { return clientYamlTestClient.getEsVersion(); } - public Version masterVersion() { + public Version clusterManagerVersion() { return clientYamlTestClient.getClusterManagerVersion(); } + /** @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #clusterManagerVersion()} */ + @Deprecated + public Version masterVersion() { + return clusterManagerVersion(); + } + } diff --git a/test/framework/src/main/java/org/opensearch/test/rest/yaml/section/DoSection.java b/test/framework/src/main/java/org/opensearch/test/rest/yaml/section/DoSection.java index 6fdc77984c339..f71c67ce456bc 100644 --- a/test/framework/src/main/java/org/opensearch/test/rest/yaml/section/DoSection.java +++ b/test/framework/src/main/java/org/opensearch/test/rest/yaml/section/DoSection.java @@ -321,7 +321,7 @@ public void execute(ClientYamlTestExecutionContext executionContext) throws IOEx } fail(formatStatusCodeMessage(response, catchStatusCode)); } - checkWarningHeaders(response.getWarningHeaders(), executionContext.masterVersion()); + checkWarningHeaders(response.getWarningHeaders(), executionContext.clusterManagerVersion()); } catch (ClientYamlTestResponseException e) { ClientYamlTestResponse restTestResponse = e.getRestTestResponse(); if (!Strings.hasLength(catchParam)) { diff --git a/test/framework/src/test/java/org/opensearch/test/test/InternalTestClusterTests.java b/test/framework/src/test/java/org/opensearch/test/test/InternalTestClusterTests.java index a0b392f3fa669..b802b48960f61 100644 --- a/test/framework/src/test/java/org/opensearch/test/test/InternalTestClusterTests.java +++ b/test/framework/src/test/java/org/opensearch/test/test/InternalTestClusterTests.java @@ -304,13 +304,13 @@ public Path nodeConfigPath(int nodeOrdinal) { ); try { cluster.beforeTest(random()); - final int originalClusterManagerCount = cluster.numMasterNodes(); + final int originalClusterManagerCount = cluster.numClusterManagerNodes(); final Map shardNodePaths = new HashMap<>(); for (String name : cluster.getNodeNames()) { shardNodePaths.put(name, getNodePaths(cluster, name)); } String poorNode = randomValueOtherThanMany( - n -> originalClusterManagerCount == 1 && n.equals(cluster.getMasterName()), + n -> originalClusterManagerCount == 1 && n.equals(cluster.getClusterManagerName()), () -> randomFrom(cluster.getNodeNames()) ); Path dataPath = getNodePaths(cluster, poorNode)[0];