diff --git a/docs/changelog/126605.yaml b/docs/changelog/126605.yaml new file mode 100644 index 0000000000000..44031f5d51616 --- /dev/null +++ b/docs/changelog/126605.yaml @@ -0,0 +1,5 @@ +pr: 126605 +summary: Fix equality bug in `WaitForIndexColorStep` +area: ILM+SLM +type: bug +issues: [] diff --git a/muted-tests.yml b/muted-tests.yml index d1c342b0493a2..a94106fcf4bfe 100644 --- a/muted-tests.yml +++ b/muted-tests.yml @@ -306,9 +306,6 @@ tests: - class: org.elasticsearch.packaging.test.DockerTests method: test010Install issue: https://github.com/elastic/elasticsearch/issues/125680 -- class: org.elasticsearch.xpack.ilm.actions.SearchableSnapshotActionIT - method: testSearchableSnapshotsInHotPhasePinnedToHotNodes - issue: https://github.com/elastic/elasticsearch/issues/125683 - class: org.elasticsearch.xpack.test.rest.XPackRestIT method: test {p0=transform/transforms_start_stop/Test schedule_now on an already started transform} issue: https://github.com/elastic/elasticsearch/issues/120720 @@ -321,9 +318,6 @@ tests: - class: org.elasticsearch.xpack.core.common.notifications.AbstractAuditorTests method: testRecreateTemplateWhenDeleted issue: https://github.com/elastic/elasticsearch/issues/123232 -- class: org.elasticsearch.xpack.ilm.TimeSeriesDataStreamsIT - method: testSearchableSnapshotAction - issue: https://github.com/elastic/elasticsearch/issues/125867 - class: org.elasticsearch.xpack.downsample.DataStreamLifecycleDownsampleDisruptionIT method: testDataStreamLifecycleDownsampleRollingRestart issue: https://github.com/elastic/elasticsearch/issues/123769 @@ -333,9 +327,6 @@ tests: - class: org.elasticsearch.indices.stats.IndexStatsIT method: testThrottleStats issue: https://github.com/elastic/elasticsearch/issues/125910 -- class: org.elasticsearch.xpack.ilm.actions.SearchableSnapshotActionIT - method: testResumingSearchableSnapshotFromPartialToFull - issue: https://github.com/elastic/elasticsearch/issues/125789 - class: org.elasticsearch.xpack.test.rest.XPackRestIT method: test {p0=transform/transforms_stats/Test get transform stats with timeout} issue: https://github.com/elastic/elasticsearch/issues/125975 @@ -390,9 +381,6 @@ tests: - class: org.elasticsearch.xpack.ilm.ClusterStateWaitThresholdBreachTests method: testWaitInShrunkShardsAllocatedExceedsThreshold issue: https://github.com/elastic/elasticsearch/issues/126348 -- class: org.elasticsearch.xpack.ilm.actions.SearchableSnapshotActionIT - method: testSearchableSnapshotTotalShardsPerNode - issue: https://github.com/elastic/elasticsearch/issues/126354 - class: org.elasticsearch.backwards.MixedClusterClientYamlTestSuiteIT method: test {p0=search.vectors/42_knn_search_bbq_flat/Vector rescoring has same scoring as exact search for kNN section} issue: https://github.com/elastic/elasticsearch/issues/126368 diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/WaitForIndexColorStep.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/WaitForIndexColorStep.java index 79850236222a4..defe094c7ec63 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/WaitForIndexColorStep.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/WaitForIndexColorStep.java @@ -65,7 +65,7 @@ BiFunction getIndexNameSupplier() { @Override public int hashCode() { - return Objects.hash(super.hashCode(), this.color, this.indexNameSupplier); + return Objects.hash(super.hashCode(), this.color); } @Override @@ -77,9 +77,7 @@ public boolean equals(Object obj) { return false; } WaitForIndexColorStep other = (WaitForIndexColorStep) obj; - return super.equals(obj) - && Objects.equals(this.color, other.color) - && Objects.equals(this.indexNameSupplier, other.indexNameSupplier); + return super.equals(obj) && Objects.equals(this.color, other.color); } @Override diff --git a/x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/actions/SearchableSnapshotActionIT.java b/x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/actions/SearchableSnapshotActionIT.java index 4fe3a075ec03c..b95ea9b2745cb 100644 --- a/x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/actions/SearchableSnapshotActionIT.java +++ b/x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/actions/SearchableSnapshotActionIT.java @@ -114,10 +114,11 @@ public void testSearchableSnapshotAction() throws Exception { } }, 30, TimeUnit.SECONDS)); - assertBusy(() -> { - triggerStateChange(); - assertThat(explainIndex(client(), restoredIndexName).get("step"), is(PhaseCompleteStep.NAME)); - }, 30, TimeUnit.SECONDS); + assertBusy( + () -> { assertThat(explainIndex(client(), restoredIndexName).get("step"), is(PhaseCompleteStep.NAME)); }, + 30, + TimeUnit.SECONDS + ); } public void testSearchableSnapshotForceMergesIndexToOneSegment() throws Exception { @@ -174,10 +175,11 @@ public void testSearchableSnapshotForceMergesIndexToOneSegment() throws Exceptio } }, 60, TimeUnit.SECONDS)); - assertBusy(() -> { - triggerStateChange(); - assertThat(explainIndex(client(), restoredIndexName).get("step"), is(PhaseCompleteStep.NAME)); - }, 30, TimeUnit.SECONDS); + assertBusy( + () -> { assertThat(explainIndex(client(), restoredIndexName).get("step"), is(PhaseCompleteStep.NAME)); }, + 30, + TimeUnit.SECONDS + ); } @SuppressWarnings("unchecked") @@ -315,7 +317,6 @@ public void testUpdatePolicyToAddPhasesYieldsInvalidActionsToBeSkipped() throws }, 30, TimeUnit.SECONDS)); assertBusy(() -> { - triggerStateChange(); Step.StepKey stepKeyForIndex = getStepKeyForIndex(client(), restoredIndexName); assertThat(stepKeyForIndex.phase(), is("hot")); assertThat(stepKeyForIndex.name(), is(PhaseCompleteStep.NAME)); @@ -338,7 +339,6 @@ public void testUpdatePolicyToAddPhasesYieldsInvalidActionsToBeSkipped() throws // even though the index is now mounted as a searchable snapshot, the actions that can't operate on it should // skip and ILM should not be blocked (not should the managed index move into the ERROR step) assertBusy(() -> { - triggerStateChange(); Step.StepKey stepKeyForIndex = getStepKeyForIndex(client(), restoredIndexName); assertThat(stepKeyForIndex.phase(), is("cold")); assertThat(stepKeyForIndex.name(), is(PhaseCompleteStep.NAME)); @@ -394,7 +394,6 @@ public void testRestoredIndexManagedByLocalPolicySkipsIllegalActions() throws Ex }, 30, TimeUnit.SECONDS)); assertBusy(() -> { - triggerStateChange(); Step.StepKey stepKeyForIndex = getStepKeyForIndex(client(), searchableSnapMountedIndexName); assertThat(stepKeyForIndex.phase(), is("hot")); assertThat(stepKeyForIndex.name(), is(PhaseCompleteStep.NAME)); @@ -499,7 +498,6 @@ public void testIdenticalSearchableSnapshotActionIsNoop() throws Exception { }, 30, TimeUnit.SECONDS); assertBusy(() -> { - triggerStateChange(); Step.StepKey stepKeyForIndex = getStepKeyForIndex(client(), searchableSnapMountedIndexName); assertThat(stepKeyForIndex.phase(), is("cold")); assertThat(stepKeyForIndex.name(), is(PhaseCompleteStep.NAME)); @@ -561,7 +559,6 @@ public void testConvertingSearchableSnapshotFromFullToPartial() throws Exception }, 30, TimeUnit.SECONDS); assertBusy(() -> { - triggerStateChange(); Step.StepKey stepKeyForIndex = getStepKeyForIndex(client(), searchableSnapMountedIndexName); assertThat(stepKeyForIndex.phase(), is("frozen")); assertThat(stepKeyForIndex.name(), is(PhaseCompleteStep.NAME)); @@ -644,7 +641,6 @@ public void testResumingSearchableSnapshotFromFullToPartial() throws Exception { }, 30, TimeUnit.SECONDS); assertBusy(() -> { - triggerStateChange(); Step.StepKey stepKeyForIndex = getStepKeyForIndex(client(), fullMountedIndexName); assertThat(stepKeyForIndex.phase(), is("cold")); assertThat(stepKeyForIndex.name(), is(PhaseCompleteStep.NAME)); @@ -665,7 +661,6 @@ public void testResumingSearchableSnapshotFromFullToPartial() throws Exception { }, 30, TimeUnit.SECONDS); assertBusy(() -> { - triggerStateChange(); Step.StepKey stepKeyForIndex = getStepKeyForIndex(client(), partiallyMountedIndexName); assertThat(stepKeyForIndex.phase(), is("frozen")); assertThat(stepKeyForIndex.name(), is(PhaseCompleteStep.NAME)); @@ -755,7 +750,6 @@ public void testResumingSearchableSnapshotFromPartialToFull() throws Exception { }, 30, TimeUnit.SECONDS); assertBusy(() -> { - triggerStateChange(); Step.StepKey stepKeyForIndex = getStepKeyForIndex(client(), partialMountedIndexName); assertThat(stepKeyForIndex.phase(), is("frozen")); assertThat(stepKeyForIndex.name(), is(PhaseCompleteStep.NAME)); @@ -776,7 +770,6 @@ public void testResumingSearchableSnapshotFromPartialToFull() throws Exception { }, 30, TimeUnit.SECONDS); assertBusy(() -> { - triggerStateChange(); Step.StepKey stepKeyForIndex = getStepKeyForIndex(client(), restoredPartiallyMountedIndexName); assertThat(stepKeyForIndex.phase(), is("cold")); assertThat(stepKeyForIndex.name(), is(PhaseCompleteStep.NAME)); @@ -936,10 +929,11 @@ public void testSearchableSnapshotInvokesAsyncActionOnNewIndex() throws Exceptio } }, 30, TimeUnit.SECONDS)); - assertBusy(() -> { - triggerStateChange(); - assertThat(explainIndex(client(), restoredIndexName).get("step"), is(PhaseCompleteStep.NAME)); - }, 30, TimeUnit.SECONDS); + assertBusy( + () -> { assertThat(explainIndex(client(), restoredIndexName).get("step"), is(PhaseCompleteStep.NAME)); }, + 30, + TimeUnit.SECONDS + ); } public void testSearchableSnapshotTotalShardsPerNode() throws Exception { @@ -980,7 +974,6 @@ public void testSearchableSnapshotTotalShardsPerNode() throws Exception { assertTrue(indexExists(searchableSnapMountedIndexName)); }, 30, TimeUnit.SECONDS); assertBusy(() -> { - triggerStateChange(); Step.StepKey stepKeyForIndex = getStepKeyForIndex(client(), searchableSnapMountedIndexName); assertThat(stepKeyForIndex.phase(), is("frozen")); assertThat(stepKeyForIndex.name(), is(PhaseCompleteStep.NAME)); @@ -1044,7 +1037,6 @@ public void testSearchableSnapshotReplicateFor() throws Exception { // check that the index is in the expected step and has the expected step_info.message assertBusy(() -> { - triggerStateChange(); Map explainResponse = explainIndex(client(), restoredIndexName); assertThat(explainResponse.get("step"), is(WaitUntilReplicateForTimePassesStep.NAME)); @SuppressWarnings("unchecked") @@ -1082,7 +1074,6 @@ public void testSearchableSnapshotReplicateFor() throws Exception { // check that the index has progressed because enough time has passed now that the policy is different assertBusy(() -> { - triggerStateChange(); Map explainResponse = explainIndex(client(), restoredIndexName); assertThat(explainResponse.get("phase"), is("cold")); assertThat(explainResponse.get("step"), is(PhaseCompleteStep.NAME)); @@ -1097,15 +1088,6 @@ public void testSearchableSnapshotReplicateFor() throws Exception { } } - /** - * Cause a bit of cluster activity using an empty reroute call in case the `wait-for-index-colour` ILM step missed the - * notification that partial-index is now GREEN. - */ - private void triggerStateChange() throws IOException { - Request rerouteRequest = new Request("POST", "/_cluster/reroute"); - client().performRequest(rerouteRequest); - } - private Step.StepKey getKeyForIndex(Response response, String indexName) throws IOException { Map responseMap; try (InputStream is = response.getEntity().getContent()) {