70
70
import org .opensearch .ad .util .DiscoveryNodeFilterer ;
71
71
import org .opensearch .client .AdminClient ;
72
72
import org .opensearch .client .Client ;
73
- import org .opensearch .cluster .LocalNodeMasterListener ;
73
+ import org .opensearch .cluster .LocalNodeClusterManagerListener ;
74
74
import org .opensearch .cluster .metadata .AliasMetadata ;
75
75
import org .opensearch .cluster .metadata .IndexMetadata ;
76
76
import org .opensearch .cluster .service .ClusterService ;
99
99
/**
100
100
* This class provides utility methods for various anomaly detection indices.
101
101
*/
102
- public class AnomalyDetectionIndices implements LocalNodeMasterListener {
102
+ public class AnomalyDetectionIndices implements LocalNodeClusterManagerListener {
103
103
private static final Logger logger = LogManager .getLogger (AnomalyDetectionIndices .class );
104
104
105
105
// The index name pattern to query all the AD result history indices
@@ -185,7 +185,7 @@ public AnomalyDetectionIndices(
185
185
this .adminClient = client .admin ();
186
186
this .clusterService = clusterService ;
187
187
this .threadPool = threadPool ;
188
- this .clusterService .addLocalNodeMasterListener (this );
188
+ this .clusterService .addLocalNodeClusterManagerListener (this );
189
189
this .historyRolloverPeriod = AD_RESULT_HISTORY_ROLLOVER_PERIOD .get (settings );
190
190
this .historyMaxDocs = AD_RESULT_HISTORY_MAX_DOCS_PER_SHARD .get (settings );
191
191
this .historyRetentionPeriod = AD_RESULT_HISTORY_RETENTION_PERIOD .get (settings );
@@ -677,7 +677,7 @@ public void initCheckpointIndex(ActionListener<CreateIndexResponse> actionListen
677
677
}
678
678
679
679
@ Override
680
- public void onMaster () {
680
+ public void onClusterManager () {
681
681
try {
682
682
// try to rollover immediately as we might be restarting the cluster
683
683
rolloverAndDeleteHistoryIndex ();
@@ -692,7 +692,7 @@ public void onMaster() {
692
692
}
693
693
694
694
@ Override
695
- public void offMaster () {
695
+ public void offClusterManager () {
696
696
if (scheduledRollover != null ) {
697
697
scheduledRollover .cancel ();
698
698
}
@@ -703,7 +703,7 @@ private String executorName() {
703
703
}
704
704
705
705
private void rescheduleRollover () {
706
- if (clusterService .state ().getNodes ().isLocalNodeElectedMaster ()) {
706
+ if (clusterService .state ().getNodes ().isLocalNodeElectedClusterManager ()) {
707
707
if (scheduledRollover != null ) {
708
708
scheduledRollover .cancel ();
709
709
}
0 commit comments