Skip to content

Commit

Permalink
Update inclusive terms
Browse files Browse the repository at this point in the history
Signed-off-by: Peter Zhu <zhujiaxi@amazon.com>
  • Loading branch information
peterzhuamazon committed Feb 26, 2025
1 parent ad4e0f0 commit f30f70e
Show file tree
Hide file tree
Showing 11 changed files with 26 additions and 24 deletions.
1 change: 1 addition & 0 deletions alerting/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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()))}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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()
Expand All @@ -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()
}
Expand All @@ -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()
}
}

Expand All @@ -238,15 +238,15 @@ class AlertIndices(
}

private fun rescheduleAlertRollover() {
if (clusterService.state().nodes.isLocalNodeElectedMaster) {
if (clusterService.state().nodes.isLocalNodeElectedClusterManager) {
scheduledAlertRollover?.cancel()
scheduledAlertRollover = threadPool
.scheduleWithFixedDelay({ rolloverAndDeleteAlertHistoryIndices() }, alertHistoryRolloverPeriod, executorName())
}
}

private fun rescheduleFindingRollover() {
if (clusterService.state().nodes.isLocalNodeElectedMaster) {
if (clusterService.state().nodes.isLocalNodeElectedClusterManager) {
scheduledFindingRollover?.cancel()
scheduledFindingRollover = threadPool
.scheduleWithFixedDelay({ rolloverAndDeleteFindingHistoryIndices() }, findingHistoryRolloverPeriod, executorName())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
)
}
Expand All @@ -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) {
Expand All @@ -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())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ class DestinationMigrationCoordinator(
return
}

if (!clusterService.state().nodes().isLocalNodeElectedMaster) {
if (!clusterService.state().nodes().isLocalNodeElectedClusterManager) {
scheduledMigration?.cancel()
return
}
Expand Down
1 change: 1 addition & 0 deletions settings.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"]

0 comments on commit f30f70e

Please sign in to comment.