Skip to content

Commit 884573f

Browse files
authored
Removed additional non-inclusive terms (opensearch-project#644)
Signed-off-by: Amit Galitzky <amgalitz@amazon.com>
1 parent bd063bd commit 884573f

File tree

5 files changed

+25
-22
lines changed

5 files changed

+25
-22
lines changed

src/main/java/org/opensearch/ad/cluster/ClusterManagerEventListener.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
import org.opensearch.ad.util.DateUtils;
2121
import org.opensearch.ad.util.DiscoveryNodeFilterer;
2222
import org.opensearch.client.Client;
23-
import org.opensearch.cluster.LocalNodeMasterListener;
23+
import org.opensearch.cluster.LocalNodeClusterManagerListener;
2424
import org.opensearch.cluster.service.ClusterService;
2525
import org.opensearch.common.component.LifecycleListener;
2626
import org.opensearch.common.settings.Setting;
@@ -31,7 +31,7 @@
3131

3232
import com.google.common.annotations.VisibleForTesting;
3333

34-
public class ClusterManagerEventListener implements LocalNodeMasterListener {
34+
public class ClusterManagerEventListener implements LocalNodeClusterManagerListener {
3535

3636
private Cancellable checkpointIndexRetentionCron;
3737
private Cancellable hourlyCron;
@@ -56,7 +56,7 @@ public ClusterManagerEventListener(
5656
this.clusterService = clusterService;
5757
this.threadPool = threadPool;
5858
this.client = client;
59-
this.clusterService.addLocalNodeMasterListener(this);
59+
this.clusterService.addLocalNodeClusterManagerListener(this);
6060
this.clock = clock;
6161
this.clientUtil = clientUtil;
6262
this.nodeFilter = nodeFilter;
@@ -77,7 +77,7 @@ public ClusterManagerEventListener(
7777
}
7878

7979
@Override
80-
public void onMaster() {
80+
public void onClusterManager() {
8181
if (hourlyCron == null) {
8282
hourlyCron = threadPool.scheduleWithFixedDelay(new HourlyCron(client, nodeFilter), TimeValue.timeValueHours(1), executorName());
8383
clusterService.addLifecycleListener(new LifecycleListener() {
@@ -108,7 +108,7 @@ public void beforeStop() {
108108
}
109109

110110
@Override
111-
public void offMaster() {
111+
public void offClusterManager() {
112112
cancel(hourlyCron);
113113
cancel(checkpointIndexRetentionCron);
114114
hourlyCron = null;

src/main/java/org/opensearch/ad/indices/AnomalyDetectionIndices.java

+6-6
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@
7070
import org.opensearch.ad.util.DiscoveryNodeFilterer;
7171
import org.opensearch.client.AdminClient;
7272
import org.opensearch.client.Client;
73-
import org.opensearch.cluster.LocalNodeMasterListener;
73+
import org.opensearch.cluster.LocalNodeClusterManagerListener;
7474
import org.opensearch.cluster.metadata.AliasMetadata;
7575
import org.opensearch.cluster.metadata.IndexMetadata;
7676
import org.opensearch.cluster.service.ClusterService;
@@ -99,7 +99,7 @@
9999
/**
100100
* This class provides utility methods for various anomaly detection indices.
101101
*/
102-
public class AnomalyDetectionIndices implements LocalNodeMasterListener {
102+
public class AnomalyDetectionIndices implements LocalNodeClusterManagerListener {
103103
private static final Logger logger = LogManager.getLogger(AnomalyDetectionIndices.class);
104104

105105
// The index name pattern to query all the AD result history indices
@@ -185,7 +185,7 @@ public AnomalyDetectionIndices(
185185
this.adminClient = client.admin();
186186
this.clusterService = clusterService;
187187
this.threadPool = threadPool;
188-
this.clusterService.addLocalNodeMasterListener(this);
188+
this.clusterService.addLocalNodeClusterManagerListener(this);
189189
this.historyRolloverPeriod = AD_RESULT_HISTORY_ROLLOVER_PERIOD.get(settings);
190190
this.historyMaxDocs = AD_RESULT_HISTORY_MAX_DOCS_PER_SHARD.get(settings);
191191
this.historyRetentionPeriod = AD_RESULT_HISTORY_RETENTION_PERIOD.get(settings);
@@ -677,7 +677,7 @@ public void initCheckpointIndex(ActionListener<CreateIndexResponse> actionListen
677677
}
678678

679679
@Override
680-
public void onMaster() {
680+
public void onClusterManager() {
681681
try {
682682
// try to rollover immediately as we might be restarting the cluster
683683
rolloverAndDeleteHistoryIndex();
@@ -692,7 +692,7 @@ public void onMaster() {
692692
}
693693

694694
@Override
695-
public void offMaster() {
695+
public void offClusterManager() {
696696
if (scheduledRollover != null) {
697697
scheduledRollover.cancel();
698698
}
@@ -703,7 +703,7 @@ private String executorName() {
703703
}
704704

705705
private void rescheduleRollover() {
706-
if (clusterService.state().getNodes().isLocalNodeElectedMaster()) {
706+
if (clusterService.state().getNodes().isLocalNodeElectedClusterManager()) {
707707
if (scheduledRollover != null) {
708708
scheduledRollover.cancel();
709709
}

src/test/java/org/opensearch/ad/cluster/ADClusterEventListenerTests.java

+8-5
Original file line numberDiff line numberDiff line change
@@ -81,14 +81,17 @@ public void setUp() throws Exception {
8181
oldClusterState = ClusterState
8282
.builder(new ClusterName(clusterName))
8383
.nodes(
84-
new DiscoveryNodes.Builder().masterNodeId(clusterManagerNodeId).localNodeId(clusterManagerNodeId).add(clusterManagerNode)
84+
new DiscoveryNodes.Builder()
85+
.clusterManagerNodeId(clusterManagerNodeId)
86+
.localNodeId(clusterManagerNodeId)
87+
.add(clusterManagerNode)
8588
)
8689
.build();
8790
newClusterState = ClusterState
8891
.builder(new ClusterName(clusterName))
8992
.nodes(
9093
new DiscoveryNodes.Builder()
91-
.masterNodeId(clusterManagerNodeId)
94+
.clusterManagerNodeId(clusterManagerNodeId)
9295
.localNodeId(dataNode1Id)
9396
.add(clusterManagerNode)
9497
.add(dataNode1)
@@ -123,7 +126,7 @@ public void testIsWarmNode() {
123126
.builder(new ClusterName(clusterName))
124127
.nodes(
125128
new DiscoveryNodes.Builder()
126-
.masterNodeId(clusterManagerNodeId)
129+
.clusterManagerNodeId(clusterManagerNodeId)
127130
.localNodeId(dataNode1Id)
128131
.add(clusterManagerNode)
129132
.add(dataNode1)
@@ -139,7 +142,7 @@ public void testNotRecovered() {
139142
.builder(new ClusterName(clusterName))
140143
.nodes(
141144
new DiscoveryNodes.Builder()
142-
.masterNodeId(clusterManagerNodeId)
145+
.clusterManagerNodeId(clusterManagerNodeId)
143146
.localNodeId(dataNode1Id)
144147
.add(clusterManagerNode)
145148
.add(dataNode1)
@@ -191,7 +194,7 @@ public void testNodeRemoved() {
191194
.builder(new ClusterName(clusterName))
192195
.nodes(
193196
new DiscoveryNodes.Builder()
194-
.masterNodeId(clusterManagerNodeId)
197+
.clusterManagerNodeId(clusterManagerNodeId)
195198
.localNodeId(dataNode1Id)
196199
.add(new DiscoveryNode(clusterManagerNodeId, buildNewFakeTransportAddress(), emptyMap(), emptySet(), Version.CURRENT))
197200
.add(dataNode1)

src/test/java/org/opensearch/ad/cluster/ClusterManagerEventListenerTests.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -90,13 +90,13 @@ public void setUp() throws Exception {
9090
);
9191
}
9292

93-
public void testOnOffMaster() {
94-
clusterManagerService.onMaster();
93+
public void testOnOffClusterManager() {
94+
clusterManagerService.onClusterManager();
9595
assertThat(hourlyCancellable, is(notNullValue()));
9696
assertThat(checkpointIndexRetentionCancellable, is(notNullValue()));
9797
assertTrue(!clusterManagerService.getHourlyCron().isCancelled());
9898
assertTrue(!clusterManagerService.getCheckpointIndexRetentionCron().isCancelled());
99-
clusterManagerService.offMaster();
99+
clusterManagerService.offClusterManager();
100100
assertThat(clusterManagerService.getCheckpointIndexRetentionCron(), is(nullValue()));
101101
assertThat(clusterManagerService.getHourlyCron(), is(nullValue()));
102102
}
@@ -120,10 +120,10 @@ public void testBeforeStop() {
120120
return null;
121121
}).when(clusterService).addLifecycleListener(any());
122122

123-
clusterManagerService.onMaster();
123+
clusterManagerService.onClusterManager();
124124
assertThat(clusterManagerService.getCheckpointIndexRetentionCron(), is(nullValue()));
125125
assertThat(clusterManagerService.getHourlyCron(), is(nullValue()));
126-
clusterManagerService.offMaster();
126+
clusterManagerService.offClusterManager();
127127
assertThat(clusterManagerService.getCheckpointIndexRetentionCron(), is(nullValue()));
128128
assertThat(clusterManagerService.getHourlyCron(), is(nullValue()));
129129
}

src/test/java/test/org/opensearch/ad/util/ClusterCreation.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public static ClusterState state(
4949
discoBuilder.add(node);
5050
}
5151
if (clusterManagerNode != null) {
52-
discoBuilder.masterNodeId(clusterManagerNode.getId());
52+
discoBuilder.clusterManagerNodeId(clusterManagerNode.getId());
5353
}
5454
discoBuilder.localNodeId(localNode.getId());
5555

0 commit comments

Comments
 (0)