Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Removed additional non-inclusive terms #644

Merged
merged 2 commits into from
Sep 7, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
import org.opensearch.ad.util.DateUtils;
import org.opensearch.ad.util.DiscoveryNodeFilterer;
import org.opensearch.client.Client;
import org.opensearch.cluster.LocalNodeMasterListener;
import org.opensearch.cluster.LocalNodeClusterManagerListener;
import org.opensearch.cluster.service.ClusterService;
import org.opensearch.common.component.LifecycleListener;
import org.opensearch.common.settings.Setting;
Expand All @@ -31,7 +31,7 @@

import com.google.common.annotations.VisibleForTesting;

public class ClusterManagerEventListener implements LocalNodeMasterListener {
public class ClusterManagerEventListener implements LocalNodeClusterManagerListener {

private Cancellable checkpointIndexRetentionCron;
private Cancellable hourlyCron;
Expand All @@ -56,7 +56,7 @@ public ClusterManagerEventListener(
this.clusterService = clusterService;
this.threadPool = threadPool;
this.client = client;
this.clusterService.addLocalNodeMasterListener(this);
this.clusterService.addLocalNodeClusterManagerListener(this);
this.clock = clock;
this.clientUtil = clientUtil;
this.nodeFilter = nodeFilter;
Expand All @@ -77,7 +77,7 @@ public ClusterManagerEventListener(
}

@Override
public void onMaster() {
public void onClusterManager() {
if (hourlyCron == null) {
hourlyCron = threadPool.scheduleWithFixedDelay(new HourlyCron(client, nodeFilter), TimeValue.timeValueHours(1), executorName());
clusterService.addLifecycleListener(new LifecycleListener() {
Expand Down Expand Up @@ -108,7 +108,7 @@ public void beforeStop() {
}

@Override
public void offMaster() {
public void offClusterManager() {
cancel(hourlyCron);
cancel(checkpointIndexRetentionCron);
hourlyCron = null;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@
import org.opensearch.ad.util.DiscoveryNodeFilterer;
import org.opensearch.client.AdminClient;
import org.opensearch.client.Client;
import org.opensearch.cluster.LocalNodeMasterListener;
import org.opensearch.cluster.LocalNodeClusterManagerListener;
import org.opensearch.cluster.metadata.AliasMetadata;
import org.opensearch.cluster.metadata.IndexMetadata;
import org.opensearch.cluster.service.ClusterService;
Expand Down Expand Up @@ -99,7 +99,7 @@
/**
* This class provides utility methods for various anomaly detection indices.
*/
public class AnomalyDetectionIndices implements LocalNodeMasterListener {
public class AnomalyDetectionIndices implements LocalNodeClusterManagerListener {
private static final Logger logger = LogManager.getLogger(AnomalyDetectionIndices.class);

// The index name pattern to query all the AD result history indices
Expand Down Expand Up @@ -185,7 +185,7 @@ public AnomalyDetectionIndices(
this.adminClient = client.admin();
this.clusterService = clusterService;
this.threadPool = threadPool;
this.clusterService.addLocalNodeMasterListener(this);
this.clusterService.addLocalNodeClusterManagerListener(this);
this.historyRolloverPeriod = AD_RESULT_HISTORY_ROLLOVER_PERIOD.get(settings);
this.historyMaxDocs = AD_RESULT_HISTORY_MAX_DOCS_PER_SHARD.get(settings);
this.historyRetentionPeriod = AD_RESULT_HISTORY_RETENTION_PERIOD.get(settings);
Expand Down Expand Up @@ -677,7 +677,7 @@ public void initCheckpointIndex(ActionListener<CreateIndexResponse> actionListen
}

@Override
public void onMaster() {
public void onClusterManager() {
try {
// try to rollover immediately as we might be restarting the cluster
rolloverAndDeleteHistoryIndex();
Expand All @@ -692,7 +692,7 @@ public void onMaster() {
}

@Override
public void offMaster() {
public void offClusterManager() {
if (scheduledRollover != null) {
scheduledRollover.cancel();
}
Expand All @@ -703,7 +703,7 @@ private String executorName() {
}

private void rescheduleRollover() {
if (clusterService.state().getNodes().isLocalNodeElectedMaster()) {
if (clusterService.state().getNodes().isLocalNodeElectedClusterManager()) {
if (scheduledRollover != null) {
scheduledRollover.cancel();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,14 +81,17 @@ public void setUp() throws Exception {
oldClusterState = ClusterState
.builder(new ClusterName(clusterName))
.nodes(
new DiscoveryNodes.Builder().masterNodeId(clusterManagerNodeId).localNodeId(clusterManagerNodeId).add(clusterManagerNode)
new DiscoveryNodes.Builder()
.clusterManagerNodeId(clusterManagerNodeId)
.localNodeId(clusterManagerNodeId)
.add(clusterManagerNode)
)
.build();
newClusterState = ClusterState
.builder(new ClusterName(clusterName))
.nodes(
new DiscoveryNodes.Builder()
.masterNodeId(clusterManagerNodeId)
.clusterManagerNodeId(clusterManagerNodeId)
.localNodeId(dataNode1Id)
.add(clusterManagerNode)
.add(dataNode1)
Expand Down Expand Up @@ -123,7 +126,7 @@ public void testIsWarmNode() {
.builder(new ClusterName(clusterName))
.nodes(
new DiscoveryNodes.Builder()
.masterNodeId(clusterManagerNodeId)
.clusterManagerNodeId(clusterManagerNodeId)
.localNodeId(dataNode1Id)
.add(clusterManagerNode)
.add(dataNode1)
Expand All @@ -139,7 +142,7 @@ public void testNotRecovered() {
.builder(new ClusterName(clusterName))
.nodes(
new DiscoveryNodes.Builder()
.masterNodeId(clusterManagerNodeId)
.clusterManagerNodeId(clusterManagerNodeId)
.localNodeId(dataNode1Id)
.add(clusterManagerNode)
.add(dataNode1)
Expand Down Expand Up @@ -191,7 +194,7 @@ public void testNodeRemoved() {
.builder(new ClusterName(clusterName))
.nodes(
new DiscoveryNodes.Builder()
.masterNodeId(clusterManagerNodeId)
.clusterManagerNodeId(clusterManagerNodeId)
.localNodeId(dataNode1Id)
.add(new DiscoveryNode(clusterManagerNodeId, buildNewFakeTransportAddress(), emptyMap(), emptySet(), Version.CURRENT))
.add(dataNode1)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,13 +90,13 @@ public void setUp() throws Exception {
);
}

public void testOnOffMaster() {
clusterManagerService.onMaster();
public void testOnOffClusterManager() {
clusterManagerService.onClusterManager();
assertThat(hourlyCancellable, is(notNullValue()));
assertThat(checkpointIndexRetentionCancellable, is(notNullValue()));
assertTrue(!clusterManagerService.getHourlyCron().isCancelled());
assertTrue(!clusterManagerService.getCheckpointIndexRetentionCron().isCancelled());
clusterManagerService.offMaster();
clusterManagerService.offClusterManager();
assertThat(clusterManagerService.getCheckpointIndexRetentionCron(), is(nullValue()));
assertThat(clusterManagerService.getHourlyCron(), is(nullValue()));
}
Expand All @@ -120,10 +120,10 @@ public void testBeforeStop() {
return null;
}).when(clusterService).addLifecycleListener(any());

clusterManagerService.onMaster();
clusterManagerService.onClusterManager();
assertThat(clusterManagerService.getCheckpointIndexRetentionCron(), is(nullValue()));
assertThat(clusterManagerService.getHourlyCron(), is(nullValue()));
clusterManagerService.offMaster();
clusterManagerService.offClusterManager();
assertThat(clusterManagerService.getCheckpointIndexRetentionCron(), is(nullValue()));
assertThat(clusterManagerService.getHourlyCron(), is(nullValue()));
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public static ClusterState state(
discoBuilder.add(node);
}
if (clusterManagerNode != null) {
discoBuilder.masterNodeId(clusterManagerNode.getId());
discoBuilder.clusterManagerNodeId(clusterManagerNode.getId());
}
discoBuilder.localNodeId(localNode.getId());

Expand Down