Skip to content

Commit 7e63c2b

Browse files
committed
Remove MasterService class
This has been deprecated and is replaced by ClusterManagerService. Signed-off-by: Andrew Ross <andrross@amazon.com>
1 parent e6fc600 commit 7e63c2b

File tree

8 files changed

+1105
-1161
lines changed

8 files changed

+1105
-1161
lines changed

server/src/main/java/org/opensearch/cluster/service/ClusterManagerService.java

Lines changed: 995 additions & 3 deletions
Large diffs are not rendered by default.

server/src/main/java/org/opensearch/cluster/service/ClusterService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,7 @@ public ClusterManagerService getClusterManagerService() {
262262

263263
/** @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #getClusterManagerService()} */
264264
@Deprecated
265-
public MasterService getMasterService() {
265+
public ClusterManagerService getMasterService() {
266266
return clusterManagerService;
267267
}
268268

server/src/main/java/org/opensearch/cluster/service/MasterService.java

Lines changed: 0 additions & 1050 deletions
This file was deleted.

server/src/test/java/org/opensearch/cluster/coordination/NodeJoinTests.java

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@
4949
import org.opensearch.cluster.node.DiscoveryNodeRole;
5050
import org.opensearch.cluster.node.DiscoveryNodes;
5151
import org.opensearch.cluster.service.ClusterManagerService;
52+
import org.opensearch.cluster.service.ClusterManagerServiceTests;
5253
import org.opensearch.cluster.service.FakeThreadPoolClusterManagerService;
53-
import org.opensearch.cluster.service.MasterServiceTests;
5454
import org.opensearch.common.Randomness;
5555
import org.opensearch.common.settings.ClusterSettings;
5656
import org.opensearch.common.settings.Settings;
@@ -549,9 +549,11 @@ public void testJoinUpdateVotingConfigExclusion() throws Exception {
549549
)
550550
);
551551

552-
assertTrue(MasterServiceTests.discoveryState(clusterManagerService).getVotingConfigExclusions().stream().anyMatch(exclusion -> {
553-
return "knownNodeName".equals(exclusion.getNodeName()) && "newNodeId".equals(exclusion.getNodeId());
554-
}));
552+
assertTrue(
553+
ClusterManagerServiceTests.discoveryState(clusterManagerService).getVotingConfigExclusions().stream().anyMatch(exclusion -> {
554+
return "knownNodeName".equals(exclusion.getNodeName()) && "newNodeId".equals(exclusion.getNodeId());
555+
})
556+
);
555557
}
556558

557559
private ClusterState buildStateWithVotingConfigExclusion(
@@ -777,7 +779,7 @@ public void testConcurrentJoining() {
777779
throw new RuntimeException(e);
778780
}
779781

780-
assertTrue(MasterServiceTests.discoveryState(clusterManagerService).nodes().isLocalNodeElectedMaster());
782+
assertTrue(ClusterManagerServiceTests.discoveryState(clusterManagerService).nodes().isLocalNodeElectedMaster());
781783
for (DiscoveryNode successfulNode : successfulNodes) {
782784
assertTrue(successfulNode + " joined cluster", clusterStateHasNode(successfulNode));
783785
assertFalse(successfulNode + " voted for cluster-manager", coordinator.missingJoinVoteFrom(successfulNode));
@@ -861,11 +863,11 @@ public void testJoinFailsWhenDecommissioned() {
861863
}
862864

863865
private boolean isLocalNodeElectedMaster() {
864-
return MasterServiceTests.discoveryState(clusterManagerService).nodes().isLocalNodeElectedMaster();
866+
return ClusterManagerServiceTests.discoveryState(clusterManagerService).nodes().isLocalNodeElectedMaster();
865867
}
866868

867869
private boolean clusterStateHasNode(DiscoveryNode node) {
868-
return node.equals(MasterServiceTests.discoveryState(clusterManagerService).nodes().get(node.getId()));
870+
return node.equals(ClusterManagerServiceTests.discoveryState(clusterManagerService).nodes().get(node.getId()));
869871
}
870872

871873
private static ClusterState initialStateWithDecommissionedAttribute(

server/src/test/java/org/opensearch/cluster/service/MasterServiceTests.java renamed to server/src/test/java/org/opensearch/cluster/service/ClusterManagerServiceTests.java

Lines changed: 85 additions & 84 deletions
Large diffs are not rendered by default.

server/src/test/java/org/opensearch/cluster/service/ClusterServiceTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public void testDeprecatedGetMasterServiceBWC() {
3232
threadPool
3333
)
3434
) {
35-
MasterService masterService = clusterService.getMasterService();
35+
ClusterManagerService masterService = clusterService.getMasterService();
3636
ClusterManagerService clusterManagerService = clusterService.getClusterManagerService();
3737
assertThat(masterService, equalTo(clusterManagerService));
3838
}

server/src/test/java/org/opensearch/cluster/service/MasterServiceRenamedSettingTests.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ public void testClusterManagerServiceSettingsExist() {
3333
"Both 'cluster.service.slow_cluster_manager_task_logging_threshold' and its predecessor should be supported built-in settings",
3434
settings.containsAll(
3535
Arrays.asList(
36-
MasterService.MASTER_SERVICE_SLOW_TASK_LOGGING_THRESHOLD_SETTING,
37-
MasterService.CLUSTER_MANAGER_SERVICE_SLOW_TASK_LOGGING_THRESHOLD_SETTING
36+
ClusterManagerService.MASTER_SERVICE_SLOW_TASK_LOGGING_THRESHOLD_SETTING,
37+
ClusterManagerService.CLUSTER_MANAGER_SERVICE_SLOW_TASK_LOGGING_THRESHOLD_SETTING
3838
)
3939
)
4040
);
@@ -45,8 +45,8 @@ public void testClusterManagerServiceSettingsExist() {
4545
*/
4646
public void testSettingFallback() {
4747
assertEquals(
48-
MasterService.MASTER_SERVICE_SLOW_TASK_LOGGING_THRESHOLD_SETTING.get(Settings.EMPTY),
49-
MasterService.CLUSTER_MANAGER_SERVICE_SLOW_TASK_LOGGING_THRESHOLD_SETTING.get(Settings.EMPTY)
48+
ClusterManagerService.MASTER_SERVICE_SLOW_TASK_LOGGING_THRESHOLD_SETTING.get(Settings.EMPTY),
49+
ClusterManagerService.CLUSTER_MANAGER_SERVICE_SLOW_TASK_LOGGING_THRESHOLD_SETTING.get(Settings.EMPTY)
5050
);
5151
}
5252

@@ -57,11 +57,11 @@ public void testSettingGetValue() {
5757
Settings settings = Settings.builder().put("cluster.service.slow_cluster_manager_task_logging_threshold", "9s").build();
5858
assertEquals(
5959
TimeValue.timeValueSeconds(9),
60-
MasterService.CLUSTER_MANAGER_SERVICE_SLOW_TASK_LOGGING_THRESHOLD_SETTING.get(settings)
60+
ClusterManagerService.CLUSTER_MANAGER_SERVICE_SLOW_TASK_LOGGING_THRESHOLD_SETTING.get(settings)
6161
);
6262
assertEquals(
63-
MasterService.MASTER_SERVICE_SLOW_TASK_LOGGING_THRESHOLD_SETTING.getDefault(Settings.EMPTY),
64-
MasterService.MASTER_SERVICE_SLOW_TASK_LOGGING_THRESHOLD_SETTING.get(settings)
63+
ClusterManagerService.MASTER_SERVICE_SLOW_TASK_LOGGING_THRESHOLD_SETTING.getDefault(Settings.EMPTY),
64+
ClusterManagerService.MASTER_SERVICE_SLOW_TASK_LOGGING_THRESHOLD_SETTING.get(settings)
6565

6666
);
6767
}
@@ -73,10 +73,10 @@ public void testSettingGetValueWithFallback() {
7373
Settings settings = Settings.builder().put("cluster.service.slow_master_task_logging_threshold", "8s").build();
7474
assertEquals(
7575
TimeValue.timeValueSeconds(8),
76-
MasterService.CLUSTER_MANAGER_SERVICE_SLOW_TASK_LOGGING_THRESHOLD_SETTING.get(settings)
76+
ClusterManagerService.CLUSTER_MANAGER_SERVICE_SLOW_TASK_LOGGING_THRESHOLD_SETTING.get(settings)
7777

7878
);
79-
assertSettingDeprecationsAndWarnings(new Setting<?>[] { MasterService.MASTER_SERVICE_SLOW_TASK_LOGGING_THRESHOLD_SETTING });
79+
assertSettingDeprecationsAndWarnings(new Setting<?>[] { ClusterManagerService.MASTER_SERVICE_SLOW_TASK_LOGGING_THRESHOLD_SETTING });
8080
}
8181

8282
/**
@@ -89,11 +89,11 @@ public void testSettingGetValueWhenBothAreConfigured() {
8989
.build();
9090
assertEquals(
9191
TimeValue.timeValueSeconds(9),
92-
MasterService.CLUSTER_MANAGER_SERVICE_SLOW_TASK_LOGGING_THRESHOLD_SETTING.get(settings)
92+
ClusterManagerService.CLUSTER_MANAGER_SERVICE_SLOW_TASK_LOGGING_THRESHOLD_SETTING.get(settings)
9393

9494
);
95-
assertEquals(TimeValue.timeValueSeconds(8), MasterService.MASTER_SERVICE_SLOW_TASK_LOGGING_THRESHOLD_SETTING.get(settings));
96-
assertSettingDeprecationsAndWarnings(new Setting<?>[] { MasterService.MASTER_SERVICE_SLOW_TASK_LOGGING_THRESHOLD_SETTING });
95+
assertEquals(TimeValue.timeValueSeconds(8), ClusterManagerService.MASTER_SERVICE_SLOW_TASK_LOGGING_THRESHOLD_SETTING.get(settings));
96+
assertSettingDeprecationsAndWarnings(new Setting<?>[] { ClusterManagerService.MASTER_SERVICE_SLOW_TASK_LOGGING_THRESHOLD_SETTING });
9797
}
9898

9999
}

test/framework/src/main/java/org/opensearch/test/ClusterServiceUtils.java

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@
4949
import org.opensearch.cluster.service.ClusterApplierService;
5050
import org.opensearch.cluster.service.ClusterManagerService;
5151
import org.opensearch.cluster.service.ClusterService;
52-
import org.opensearch.cluster.service.MasterService;
5352
import org.opensearch.common.settings.ClusterSettings;
5453
import org.opensearch.common.settings.Settings;
5554
import org.opensearch.node.Node;
@@ -92,13 +91,13 @@ public static ClusterManagerService createClusterManagerService(ThreadPool threa
9291

9392
/** @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #createClusterManagerService(ThreadPool, ClusterState)} */
9493
@Deprecated
95-
public static MasterService createMasterService(ThreadPool threadPool, ClusterState initialClusterState) {
94+
public static ClusterManagerService createMasterService(ThreadPool threadPool, ClusterState initialClusterState) {
9695
return createClusterManagerService(threadPool, initialClusterState);
9796
}
9897

9998
/** @deprecated As of 2.2, because supporting inclusive language, replaced by {@link #createClusterManagerService(ThreadPool, DiscoveryNode)} */
10099
@Deprecated
101-
public static MasterService createMasterService(ThreadPool threadPool, DiscoveryNode localNode) {
100+
public static ClusterManagerService createMasterService(ThreadPool threadPool, DiscoveryNode localNode) {
102101
return createClusterManagerService(threadPool, localNode);
103102
}
104103

0 commit comments

Comments
 (0)