Skip to content

Commit 28530dd

Browse files
authored
Merge branch 'opensearch-project:main' into main-bulkIndexFindings
2 parents e7ba6d7 + ffc183f commit 28530dd

File tree

11 files changed

+50
-29
lines changed

11 files changed

+50
-29
lines changed

.github/workflows/security-test-workflow.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
build:
1313
strategy:
1414
matrix:
15-
java: [ 11, 17 ]
15+
java: [ 11, 17, 21 ]
1616
# Job name
1717
name: Build and test Alerting
1818
# This job runs on Linux

.github/workflows/test-workflow.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ jobs:
2121
WORKING_DIR: ${{ matrix.working_directory }}.
2222
strategy:
2323
matrix:
24-
java: [11, 17]
24+
java: [11, 17, 21]
2525
# Job name
2626
name: Build Alerting with JDK ${{ matrix.java }} on Linux
2727
# This job runs on Linux
@@ -69,7 +69,7 @@ jobs:
6969
WORKING_DIR: ${{ matrix.working_directory }}.
7070
strategy:
7171
matrix:
72-
java: [11, 17]
72+
java: [11, 17, 21]
7373
os: [ windows-latest, macos-latest ]
7474
include:
7575
- os: windows-latest

alerting/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ apply plugin: 'jacoco'
1616

1717
def usingRemoteCluster = System.properties.containsKey('tests.rest.cluster') || System.properties.containsKey('tests.cluster')
1818
def usingMultiNode = project.properties.containsKey('numNodes')
19-
String bwcVersion = "2.10.0.0"
19+
String bwcVersion = "2.12.0.0"
2020

2121
ext {
2222
projectSubstitutions = [:]
@@ -260,7 +260,7 @@ String baseName = "alertingBwcCluster"
260260
testClusters {
261261
"${baseName}$i" {
262262
testDistribution = "ARCHIVE"
263-
versions = ["2.10.0-SNAPSHOT", "3.0.0-SNAPSHOT"]
263+
versions = ["2.12.0-SNAPSHOT", "3.0.0-SNAPSHOT"]
264264
numberOfNodes = 3
265265
plugin(provider(new Callable<RegularFile>(){
266266
@Override

alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportDeleteWorkflowAction.kt

Lines changed: 18 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ class TransportDeleteWorkflowAction @Inject constructor(
119119
) {
120120
suspend fun resolveUserAndStart() {
121121
try {
122-
val workflow = getWorkflow()
122+
val workflow: Workflow = getWorkflow() ?: return
123123

124124
val canDelete = user == null ||
125125
!doFilterForUser(user) ||
@@ -296,17 +296,27 @@ class TransportDeleteWorkflowAction @Inject constructor(
296296
return deletableMonitors
297297
}
298298

299-
private suspend fun getWorkflow(): Workflow {
299+
private suspend fun getWorkflow(): Workflow? {
300300
val getRequest = GetRequest(ScheduledJob.SCHEDULED_JOBS_INDEX, workflowId)
301301

302302
val getResponse: GetResponse = client.suspendUntil { get(getRequest, it) }
303-
if (getResponse.isExists == false) {
304-
actionListener.onFailure(
305-
AlertingException.wrap(
306-
OpenSearchStatusException("Workflow not found.", RestStatus.NOT_FOUND)
307-
)
308-
)
303+
if (!getResponse.isExists) {
304+
handleWorkflowMissing()
305+
return null
309306
}
307+
308+
return parseWorkflow(getResponse)
309+
}
310+
311+
private fun handleWorkflowMissing() {
312+
actionListener.onFailure(
313+
AlertingException.wrap(
314+
OpenSearchStatusException("Workflow not found.", RestStatus.NOT_FOUND)
315+
)
316+
)
317+
}
318+
319+
private fun parseWorkflow(getResponse: GetResponse): Workflow {
310320
val xcp = XContentHelper.createParser(
311321
xContentRegistry, LoggingDeprecationHandler.INSTANCE,
312322
getResponse.sourceAsBytesRef, XContentType.JSON

alerting/src/main/kotlin/org/opensearch/alerting/transport/TransportSearchMonitorAction.kt

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,7 @@ import org.opensearch.commons.alerting.model.Workflow
2727
import org.opensearch.commons.authuser.User
2828
import org.opensearch.commons.utils.recreateObject
2929
import org.opensearch.core.action.ActionListener
30+
import org.opensearch.core.common.io.stream.NamedWriteableRegistry
3031
import org.opensearch.index.query.BoolQueryBuilder
3132
import org.opensearch.index.query.ExistsQueryBuilder
3233
import org.opensearch.index.query.MatchQueryBuilder
@@ -41,7 +42,8 @@ class TransportSearchMonitorAction @Inject constructor(
4142
val settings: Settings,
4243
val client: Client,
4344
clusterService: ClusterService,
44-
actionFilters: ActionFilters
45+
actionFilters: ActionFilters,
46+
val namedWriteableRegistry: NamedWriteableRegistry
4547
) : HandledTransportAction<ActionRequest, SearchResponse>(
4648
AlertingActions.SEARCH_MONITORS_ACTION_NAME, transportService, actionFilters, ::SearchMonitorRequest
4749
),
@@ -54,7 +56,7 @@ class TransportSearchMonitorAction @Inject constructor(
5456

5557
override fun doExecute(task: Task, request: ActionRequest, actionListener: ActionListener<SearchResponse>) {
5658
val transformedRequest = request as? SearchMonitorRequest
57-
?: recreateObject(request) {
59+
?: recreateObject(request, namedWriteableRegistry) {
5860
SearchMonitorRequest(it)
5961
}
6062

alerting/src/main/kotlin/org/opensearch/alerting/util/destinationmigration/DestinationMigrationCoordinator.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,6 @@ class DestinationMigrationCoordinator(
4545
}
4646

4747
override fun clusterChanged(event: ClusterChangedEvent) {
48-
logger.info("Detected cluster change event for destination migration")
4948
if (DestinationMigrationUtilService.finishFlag) {
5049
logger.info("Reset destination migration process.")
5150
scheduledMigration?.cancel()
@@ -63,6 +62,7 @@ class DestinationMigrationCoordinator(
6362
runningLock = false
6463
}
6564
} else if (!event.localNodeClusterManager()) {
65+
logger.info("Cancelling the migration process.")
6666
scheduledMigration?.cancel()
6767
}
6868
}

build-tools/merged-coverage.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
allprojects {
77
plugins.withId('jacoco') {
8-
jacoco.toolVersion = '0.8.7'
8+
jacoco.toolVersion = '0.8.11'
99
// For some reason this dependency isn't getting setup automatically by the jacoco plugin
1010
tasks.withType(JacocoReport) {
1111
dependsOn tasks.withType(Test)

build.gradle

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ buildscript {
3939
}
4040

4141
plugins {
42-
id 'com.netflix.nebula.ospackage' version "11.0.0"
42+
id 'com.netflix.nebula.ospackage' version "11.5.0"
4343
id "com.dorongold.task-tree" version "1.5"
4444
}
4545

@@ -48,7 +48,12 @@ apply plugin: 'jacoco'
4848
apply from: 'build-tools/merged-coverage.gradle'
4949

5050
configurations {
51-
ktlint
51+
ktlint {
52+
resolutionStrategy {
53+
force "ch.qos.logback:logback-classic:1.3.14"
54+
force "ch.qos.logback:logback-core:1.3.14"
55+
}
56+
}
5257
}
5358

5459
dependencies {

gradle/wrapper/gradle-wrapper.jar

-18.2 KB
Binary file not shown.
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-bin.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
44
networkTimeout=10000
55
zipStoreBase=GRADLE_USER_HOME
66
zipStorePath=wrapper/dists

0 commit comments

Comments
 (0)