From 500b5e109769d430c2521f52db91debdd35aed39 Mon Sep 17 00:00:00 2001 From: Amit Galitzky Date: Fri, 24 Jun 2022 06:11:34 +0000 Subject: [PATCH 1/4] Revert "2.1 version bump and Gradle bump (#582)" This reverts commit 0e7079e31ffab5439ff386fbd1a52e734a5d6500. Signed-off-by: Amit Galitzky --- build.gradle | 5 ++--- gradle/wrapper/gradle-wrapper.properties | 2 +- .../ad/cluster/ClusterManagerEventListener.java | 4 ++-- .../opensearch/ad/indices/AnomalyDetectionIndices.java | 4 ++-- src/test/java/org/opensearch/ad/ODFERestTestCase.java | 2 +- .../ad/cluster/ClusterManagerEventListenerTests.java | 8 ++++---- 6 files changed, 12 insertions(+), 13 deletions(-) diff --git a/build.gradle b/build.gradle index abbaad643..613a6beec 100644 --- a/build.gradle +++ b/build.gradle @@ -17,9 +17,9 @@ buildscript { ext { opensearch_group = "org.opensearch" isSnapshot = "true" == System.getProperty("build.snapshot", "true") - opensearch_version = System.getProperty("opensearch.version", "2.1.0-SNAPSHOT") + opensearch_version = System.getProperty("opensearch.version", "2.0.0-SNAPSHOT") buildVersionQualifier = System.getProperty("build.version_qualifier", "") - // 2.1.0-SNAPSHOT -> 2.1.0.0-SNAPSHOT + // 2.0.0-SNAPSHOT -> 2.0.0.0-SNAPSHOT version_tokens = opensearch_version.tokenize('-') opensearch_build = version_tokens[0] + '.0' plugin_no_snapshot = opensearch_build @@ -80,7 +80,6 @@ repositories { maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" } mavenCentral() maven { url "https://plugins.gradle.org/m2/" } - maven { url "https://d1nvenhzbhpy0q.cloudfront.net/snapshots/lucene/" } } apply plugin: 'java' diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index aa991fcea..2e6e5897b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/main/java/org/opensearch/ad/cluster/ClusterManagerEventListener.java b/src/main/java/org/opensearch/ad/cluster/ClusterManagerEventListener.java index 353a7ad14..505cbf888 100644 --- a/src/main/java/org/opensearch/ad/cluster/ClusterManagerEventListener.java +++ b/src/main/java/org/opensearch/ad/cluster/ClusterManagerEventListener.java @@ -57,7 +57,7 @@ public ClusterManagerEventListener( } @Override - public void onClusterManager() { + public void onMaster() { if (hourlyCron == null) { hourlyCron = threadPool.scheduleWithFixedDelay(new HourlyCron(client, nodeFilter), TimeValue.timeValueHours(1), executorName()); clusterService.addLifecycleListener(new LifecycleListener() { @@ -88,7 +88,7 @@ public void beforeStop() { } @Override - public void offClusterManager() { + public void offMaster() { cancel(hourlyCron); cancel(checkpointIndexRetentionCron); hourlyCron = null; diff --git a/src/main/java/org/opensearch/ad/indices/AnomalyDetectionIndices.java b/src/main/java/org/opensearch/ad/indices/AnomalyDetectionIndices.java index 2320e1c2c..266a5ece4 100644 --- a/src/main/java/org/opensearch/ad/indices/AnomalyDetectionIndices.java +++ b/src/main/java/org/opensearch/ad/indices/AnomalyDetectionIndices.java @@ -677,7 +677,7 @@ public void initCheckpointIndex(ActionListener actionListen } @Override - public void onClusterManager() { + public void onMaster() { try { // try to rollover immediately as we might be restarting the cluster rolloverAndDeleteHistoryIndex(); @@ -692,7 +692,7 @@ public void onClusterManager() { } @Override - public void offClusterManager() { + public void offMaster() { if (scheduledRollover != null) { scheduledRollover.cancel(); } diff --git a/src/test/java/org/opensearch/ad/ODFERestTestCase.java b/src/test/java/org/opensearch/ad/ODFERestTestCase.java index 6de204584..8d729688e 100644 --- a/src/test/java/org/opensearch/ad/ODFERestTestCase.java +++ b/src/test/java/org/opensearch/ad/ODFERestTestCase.java @@ -139,7 +139,7 @@ protected RestClient buildClient(Settings settings, HttpHost[] hosts) throws IOE @After protected void wipeAllODFEIndices() throws IOException { Response response = adminClient().performRequest(new Request("GET", "/_cat/indices?format=json&expand_wildcards=all")); - XContentType xContentType = XContentType.fromMediaType(response.getEntity().getContentType().getValue()); + XContentType xContentType = XContentType.fromMediaTypeOrFormat(response.getEntity().getContentType().getValue()); try ( XContentParser parser = xContentType .xContent() diff --git a/src/test/java/org/opensearch/ad/cluster/ClusterManagerEventListenerTests.java b/src/test/java/org/opensearch/ad/cluster/ClusterManagerEventListenerTests.java index eccf67de8..39146c90b 100644 --- a/src/test/java/org/opensearch/ad/cluster/ClusterManagerEventListenerTests.java +++ b/src/test/java/org/opensearch/ad/cluster/ClusterManagerEventListenerTests.java @@ -71,12 +71,12 @@ public void setUp() throws Exception { } public void testOnOffMaster() { - clusterManagerService.onClusterManager(); + clusterManagerService.onMaster(); assertThat(hourlyCancellable, is(notNullValue())); assertThat(checkpointIndexRetentionCancellable, is(notNullValue())); assertTrue(!clusterManagerService.getHourlyCron().isCancelled()); assertTrue(!clusterManagerService.getCheckpointIndexRetentionCron().isCancelled()); - clusterManagerService.offClusterManager(); + clusterManagerService.offMaster(); assertThat(clusterManagerService.getCheckpointIndexRetentionCron(), is(nullValue())); assertThat(clusterManagerService.getHourlyCron(), is(nullValue())); } @@ -100,10 +100,10 @@ public void testBeforeStop() { return null; }).when(clusterService).addLifecycleListener(any()); - clusterManagerService.onClusterManager(); + clusterManagerService.onMaster(); assertThat(clusterManagerService.getCheckpointIndexRetentionCron(), is(nullValue())); assertThat(clusterManagerService.getHourlyCron(), is(nullValue())); - clusterManagerService.offClusterManager(); + clusterManagerService.offMaster(); assertThat(clusterManagerService.getCheckpointIndexRetentionCron(), is(nullValue())); assertThat(clusterManagerService.getHourlyCron(), is(nullValue())); } From 2dddccf2343b7a4592d6d3b1082d5fc0745e141d Mon Sep 17 00:00:00 2001 From: Amit Galitzky Date: Fri, 24 Jun 2022 17:14:00 +0000 Subject: [PATCH 2/4] adds back gradle and OS version bump Signed-off-by: Amit Galitzky --- build.gradle | 6 ++++-- gradle/wrapper/gradle-wrapper.properties | 2 +- src/test/java/org/opensearch/ad/ODFERestTestCase.java | 2 +- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/build.gradle b/build.gradle index 613a6beec..46c74680f 100644 --- a/build.gradle +++ b/build.gradle @@ -17,9 +17,9 @@ buildscript { ext { opensearch_group = "org.opensearch" isSnapshot = "true" == System.getProperty("build.snapshot", "true") - opensearch_version = System.getProperty("opensearch.version", "2.0.0-SNAPSHOT") + opensearch_version = System.getProperty("opensearch.version", "2.1.0-SNAPSHOT") buildVersionQualifier = System.getProperty("build.version_qualifier", "") - // 2.0.0-SNAPSHOT -> 2.0.0.0-SNAPSHOT + // 2.0.0-SNAPSHOT -> 2.0.1.0-SNAPSHOT version_tokens = opensearch_version.tokenize('-') opensearch_build = version_tokens[0] + '.0' plugin_no_snapshot = opensearch_build @@ -49,6 +49,8 @@ buildscript { maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" } mavenCentral() maven { url "https://plugins.gradle.org/m2/" } + maven { url "https://d1nvenhzbhpy0q.cloudfront.net/snapshots/lucene/" } + } dependencies { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 2e6e5897b..aa991fcea 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/src/test/java/org/opensearch/ad/ODFERestTestCase.java b/src/test/java/org/opensearch/ad/ODFERestTestCase.java index 8d729688e..6de204584 100644 --- a/src/test/java/org/opensearch/ad/ODFERestTestCase.java +++ b/src/test/java/org/opensearch/ad/ODFERestTestCase.java @@ -139,7 +139,7 @@ protected RestClient buildClient(Settings settings, HttpHost[] hosts) throws IOE @After protected void wipeAllODFEIndices() throws IOException { Response response = adminClient().performRequest(new Request("GET", "/_cat/indices?format=json&expand_wildcards=all")); - XContentType xContentType = XContentType.fromMediaTypeOrFormat(response.getEntity().getContentType().getValue()); + XContentType xContentType = XContentType.fromMediaType(response.getEntity().getContentType().getValue()); try ( XContentParser parser = xContentType .xContent() From 0e73ceadfa7e7daec402e086d1a59433cca1ece7 Mon Sep 17 00:00:00 2001 From: Amit Galitzky Date: Fri, 24 Jun 2022 17:17:01 +0000 Subject: [PATCH 3/4] fix comment and spacing Signed-off-by: Amit Galitzky --- build.gradle | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 46c74680f..9132e6f93 100644 --- a/build.gradle +++ b/build.gradle @@ -19,7 +19,7 @@ buildscript { isSnapshot = "true" == System.getProperty("build.snapshot", "true") opensearch_version = System.getProperty("opensearch.version", "2.1.0-SNAPSHOT") buildVersionQualifier = System.getProperty("build.version_qualifier", "") - // 2.0.0-SNAPSHOT -> 2.0.1.0-SNAPSHOT + // 2.1.0-SNAPSHOT -> 2.1.0.0-SNAPSHOT version_tokens = opensearch_version.tokenize('-') opensearch_build = version_tokens[0] + '.0' plugin_no_snapshot = opensearch_build @@ -50,7 +50,6 @@ buildscript { mavenCentral() maven { url "https://plugins.gradle.org/m2/" } maven { url "https://d1nvenhzbhpy0q.cloudfront.net/snapshots/lucene/" } - } dependencies { From c86a272167931151dcf6cc26bfc617bb5c91fbec Mon Sep 17 00:00:00 2001 From: Amit Galitzky Date: Fri, 24 Jun 2022 17:19:30 +0000 Subject: [PATCH 4/4] fixed location of lucene dependency Signed-off-by: Amit Galitzky --- build.gradle | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 9132e6f93..abbaad643 100644 --- a/build.gradle +++ b/build.gradle @@ -49,7 +49,6 @@ buildscript { maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" } mavenCentral() maven { url "https://plugins.gradle.org/m2/" } - maven { url "https://d1nvenhzbhpy0q.cloudfront.net/snapshots/lucene/" } } dependencies { @@ -81,6 +80,7 @@ repositories { maven { url "https://aws.oss.sonatype.org/content/repositories/snapshots" } mavenCentral() maven { url "https://plugins.gradle.org/m2/" } + maven { url "https://d1nvenhzbhpy0q.cloudfront.net/snapshots/lucene/" } } apply plugin: 'java'