From 9b24161657702d0bac2058091a5c66a16e60239b Mon Sep 17 00:00:00 2001 From: Subhobrata Dey Date: Thu, 8 Sep 2022 16:43:02 +0000 Subject: [PATCH] Deprecate the Master nomenclature Signed-off-by: Subhobrata Dey --- .../org/opensearch/alerting/alerts/AlertIndices.kt | 10 +++++----- .../DestinationMigrationCoordinator.kt | 4 ++-- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/alerts/AlertIndices.kt b/alerting/src/main/kotlin/org/opensearch/alerting/alerts/AlertIndices.kt index b72f6e437..cf0c57859 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/alerts/AlertIndices.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/alerts/AlertIndices.kt @@ -150,7 +150,7 @@ class AlertIndices( @Volatile private var requestTimeout = AlertingSettings.REQUEST_TIMEOUT.get(settings) - @Volatile private var isMaster = false + @Volatile private var isClusterManager = false // for JobsMonitor to report var lastRolloverTime: TimeValue? = null @@ -192,12 +192,12 @@ class AlertIndices( } override fun clusterChanged(event: ClusterChangedEvent) { - // Instead of using a LocalNodeMasterListener to track master changes, this service will + // Instead of using a LocalNodeClusterManagerListener to track master changes, this service will // track them here to avoid conditions where master listener events run after other // listeners that depend on what happened in the master listener - if (this.isMaster != event.localNodeMaster()) { - this.isMaster = event.localNodeMaster() - if (this.isMaster) { + if (this.isClusterManager != event.localNodeClusterManager()) { + this.isClusterManager = event.localNodeClusterManager() + if (this.isClusterManager) { onMaster() } else { offMaster() diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/util/destinationmigration/DestinationMigrationCoordinator.kt b/alerting/src/main/kotlin/org/opensearch/alerting/util/destinationmigration/DestinationMigrationCoordinator.kt index 5cb37c519..279a45b01 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/util/destinationmigration/DestinationMigrationCoordinator.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/util/destinationmigration/DestinationMigrationCoordinator.kt @@ -52,7 +52,7 @@ class DestinationMigrationCoordinator( DestinationMigrationUtilService.finishFlag = false } if ( - event.localNodeMaster() && + event.localNodeClusterManager() && !runningLock && (scheduledMigration == null || scheduledMigration!!.isCancelled) ) { @@ -62,7 +62,7 @@ class DestinationMigrationCoordinator( } finally { runningLock = false } - } else if (!event.localNodeMaster()) { + } else if (!event.localNodeClusterManager()) { scheduledMigration?.cancel() } }