diff --git a/alerting/build.gradle b/alerting/build.gradle index 1626b090c..afa0e1510 100644 --- a/alerting/build.gradle +++ b/alerting/build.gradle @@ -148,6 +148,7 @@ task integTest(type: RestIntegTestTask) { classpath = sourceSets.test.runtimeClasspath } tasks.named("check").configure { dependsOn(integTest) } +tasks.named("generatePomFileForShadowPublication").configure { dependsOn "compileKotlin" } Zip bundle = (Zip) project.getTasks().getByName("bundlePlugin"); integTest.dependsOn(bundle) integTest.getClusters().forEach{c -> c.plugin(project.getObjects().fileProperty().value(bundle.getArchiveFile()))} diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/MonitorRunnerService.kt b/alerting/src/main/kotlin/org/opensearch/alerting/MonitorRunnerService.kt index 7731a7d7f..152db1a8d 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/MonitorRunnerService.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/MonitorRunnerService.kt @@ -14,7 +14,7 @@ import org.apache.logging.log4j.LogManager import org.opensearch.OpenSearchStatusException import org.opensearch.action.bulk.BackoffPolicy import org.opensearch.action.search.TransportSearchAction.SEARCH_CANCEL_AFTER_TIME_INTERVAL_SETTING -import org.opensearch.action.support.master.AcknowledgedResponse +import org.opensearch.action.support.clustermanager.AcknowledgedResponse import org.opensearch.alerting.action.ExecuteMonitorAction import org.opensearch.alerting.action.ExecuteMonitorRequest import org.opensearch.alerting.action.ExecuteMonitorResponse 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 7749d0ec8..11671ce5b 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/alerts/AlertIndices.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/alerts/AlertIndices.kt @@ -25,7 +25,7 @@ import org.opensearch.action.admin.indices.rollover.RolloverResponse import org.opensearch.action.search.SearchRequest import org.opensearch.action.search.SearchResponse import org.opensearch.action.support.IndicesOptions -import org.opensearch.action.support.master.AcknowledgedResponse +import org.opensearch.action.support.clustermanager.AcknowledgedResponse import org.opensearch.alerting.alerts.AlertIndices.Companion.ALERT_HISTORY_WRITE_INDEX import org.opensearch.alerting.alerts.AlertIndices.Companion.ALERT_INDEX import org.opensearch.alerting.opensearchapi.suspendUntil @@ -189,7 +189,7 @@ class AlertIndices( private var scheduledFindingRollover: Cancellable? = null - fun onMaster() { + fun onClusterManager() { try { // try to rollover immediately as we might be restarting the cluster rolloverAlertHistoryIndex() @@ -203,13 +203,13 @@ class AlertIndices( // This should be run on cluster startup logger.error( "Error creating alert/finding indices. " + - "Alerts/Findings can't be recorded until master node is restarted.", + "Alerts/Findings can't be recorded until clustermanager node is restarted.", e ) } } - fun offMaster() { + fun offClusterManager() { scheduledAlertRollover?.cancel() scheduledFindingRollover?.cancel() } @@ -219,15 +219,15 @@ class AlertIndices( } override fun clusterChanged(event: ClusterChangedEvent) { - // 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 + // Instead of using a LocalNodeClusterManagerListener to track clustermanager changes, this service will + // track them here to avoid conditions where clustermanager listener events run after other + // listeners that depend on what happened in the clustermanager listener if (this.isClusterManager != event.localNodeClusterManager()) { this.isClusterManager = event.localNodeClusterManager() if (this.isClusterManager) { - onMaster() + onClusterManager() } else { - offMaster() + offClusterManager() } } @@ -238,7 +238,7 @@ class AlertIndices( } private fun rescheduleAlertRollover() { - if (clusterService.state().nodes.isLocalNodeElectedMaster) { + if (clusterService.state().nodes.isLocalNodeElectedClusterManager) { scheduledAlertRollover?.cancel() scheduledAlertRollover = threadPool .scheduleWithFixedDelay({ rolloverAndDeleteAlertHistoryIndices() }, alertHistoryRolloverPeriod, executorName()) @@ -246,7 +246,7 @@ class AlertIndices( } private fun rescheduleFindingRollover() { - if (clusterService.state().nodes.isLocalNodeElectedMaster) { + if (clusterService.state().nodes.isLocalNodeElectedClusterManager) { scheduledFindingRollover?.cancel() scheduledFindingRollover = threadPool .scheduleWithFixedDelay({ rolloverAndDeleteFindingHistoryIndices() }, findingHistoryRolloverPeriod, executorName()) diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/comments/CommentsIndices.kt b/alerting/src/main/kotlin/org/opensearch/alerting/comments/CommentsIndices.kt index f65199ebe..d12e45639 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/comments/CommentsIndices.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/comments/CommentsIndices.kt @@ -20,7 +20,7 @@ import org.opensearch.action.admin.indices.mapping.put.PutMappingRequest import org.opensearch.action.admin.indices.rollover.RolloverRequest import org.opensearch.action.admin.indices.rollover.RolloverResponse import org.opensearch.action.support.IndicesOptions -import org.opensearch.action.support.master.AcknowledgedResponse +import org.opensearch.action.support.clustermanager.AcknowledgedResponse import org.opensearch.alerting.alerts.AlertIndices import org.opensearch.alerting.opensearchapi.suspendUntil import org.opensearch.alerting.settings.AlertingSettings @@ -117,7 +117,7 @@ class CommentsIndices( } catch (e: Exception) { // This should be run on cluster startup logger.error( - "Error creating comments indices. Comments can't be recorded until master node is restarted.", + "Error creating comments indices. Comments can't be recorded until clustermanager node is restarted.", e ) } @@ -132,9 +132,9 @@ class CommentsIndices( } override fun clusterChanged(event: ClusterChangedEvent) { - // 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 + // Instead of using a LocalNodeClusterManagerListener to track clustermanager changes, this service will + // track them here to avoid conditions where clustermanager listener events run after other + // listeners that depend on what happened in the clustermanager listener if (this.isClusterManager != event.localNodeClusterManager()) { this.isClusterManager = event.localNodeClusterManager() if (this.isClusterManager) { @@ -149,7 +149,7 @@ class CommentsIndices( } private fun rescheduleCommentsRollover() { - if (clusterService.state().nodes.isLocalNodeElectedMaster) { + if (clusterService.state().nodes.isLocalNodeElectedClusterManager) { scheduledCommentsRollover?.cancel() scheduledCommentsRollover = threadPool .scheduleWithFixedDelay({ rolloverAndDeleteCommentsHistoryIndices() }, commentsHistoryRolloverPeriod, executorName()) diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/service/DeleteMonitorService.kt b/alerting/src/main/kotlin/org/opensearch/alerting/service/DeleteMonitorService.kt index f2cc34f58..fbc655543 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/service/DeleteMonitorService.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/service/DeleteMonitorService.kt @@ -20,7 +20,7 @@ import org.opensearch.action.search.SearchRequest import org.opensearch.action.search.SearchResponse import org.opensearch.action.support.IndicesOptions import org.opensearch.action.support.WriteRequest.RefreshPolicy -import org.opensearch.action.support.master.AcknowledgedResponse +import org.opensearch.action.support.clustermanager.AcknowledgedResponse import org.opensearch.alerting.MonitorMetadataService import org.opensearch.alerting.core.lock.LockModel import org.opensearch.alerting.core.lock.LockService diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexMonitorAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexMonitorAction.kt index ae87c101d..a5b849a67 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexMonitorAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexMonitorAction.kt @@ -28,7 +28,7 @@ import org.opensearch.action.search.SearchResponse import org.opensearch.action.support.ActionFilters import org.opensearch.action.support.HandledTransportAction import org.opensearch.action.support.WriteRequest.RefreshPolicy -import org.opensearch.action.support.master.AcknowledgedResponse +import org.opensearch.action.support.clustermanager.AcknowledgedResponse import org.opensearch.alerting.MonitorMetadataService import org.opensearch.alerting.core.ScheduledJobIndices import org.opensearch.alerting.opensearchapi.suspendUntil diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexWorkflowAction.kt b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexWorkflowAction.kt index 91a9f66e6..b83183c07 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexWorkflowAction.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportIndexWorkflowAction.kt @@ -26,7 +26,7 @@ import org.opensearch.action.search.SearchRequest import org.opensearch.action.search.SearchResponse import org.opensearch.action.support.ActionFilters import org.opensearch.action.support.HandledTransportAction -import org.opensearch.action.support.master.AcknowledgedResponse +import org.opensearch.action.support.clustermanager.AcknowledgedResponse import org.opensearch.alerting.MonitorMetadataService import org.opensearch.alerting.MonitorRunnerService.monitorCtx import org.opensearch.alerting.WorkflowMetadataService diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/util/DocLevelMonitorQueries.kt b/alerting/src/main/kotlin/org/opensearch/alerting/util/DocLevelMonitorQueries.kt index 55c8e682c..5173ff897 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/util/DocLevelMonitorQueries.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/util/DocLevelMonitorQueries.kt @@ -26,7 +26,7 @@ import org.opensearch.action.bulk.BulkResponse import org.opensearch.action.index.IndexRequest import org.opensearch.action.support.IndicesOptions import org.opensearch.action.support.WriteRequest.RefreshPolicy -import org.opensearch.action.support.master.AcknowledgedResponse +import org.opensearch.action.support.clustermanager.AcknowledgedResponse import org.opensearch.alerting.MonitorRunnerService.monitorCtx import org.opensearch.alerting.opensearchapi.suspendUntil import org.opensearch.cluster.ClusterState diff --git a/alerting/src/main/kotlin/org/opensearch/alerting/util/IndexUtils.kt b/alerting/src/main/kotlin/org/opensearch/alerting/util/IndexUtils.kt index 90d85c436..383b85d6f 100644 --- a/alerting/src/main/kotlin/org/opensearch/alerting/util/IndexUtils.kt +++ b/alerting/src/main/kotlin/org/opensearch/alerting/util/IndexUtils.kt @@ -7,7 +7,7 @@ package org.opensearch.alerting.util import org.opensearch.action.admin.indices.mapping.put.PutMappingRequest import org.opensearch.action.support.IndicesOptions -import org.opensearch.action.support.master.AcknowledgedResponse +import org.opensearch.action.support.clustermanager.AcknowledgedResponse import org.opensearch.alerting.alerts.AlertIndices import org.opensearch.alerting.comments.CommentsIndices import org.opensearch.alerting.core.ScheduledJobIndices 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 9ef0aea37..9cee3f893 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 @@ -74,7 +74,7 @@ class DestinationMigrationCoordinator( return } - if (!clusterService.state().nodes().isLocalNodeElectedMaster) { + if (!clusterService.state().nodes().isLocalNodeElectedClusterManager) { scheduledMigration?.cancel() return } diff --git a/settings.gradle b/settings.gradle index e6d7bcbdd..1d5c717af 100644 --- a/settings.gradle +++ b/settings.gradle @@ -13,3 +13,4 @@ project(":spi").name = 'alerting-spi' include 'sample-remote-monitor-plugin' project(":sample-remote-monitor-plugin").name = "alerting-sample-remote-monitor-plugin" +// startParameter.excludedTaskNames=["generatePomFileForShadowPublication"]