|
25 | 25 | import org.elasticsearch.search.aggregations.bucket.histogram.DateHistogramInterval; |
26 | 26 | import org.elasticsearch.test.ESIntegTestCase; |
27 | 27 | import org.elasticsearch.test.InternalTestCluster; |
28 | | -import org.elasticsearch.test.junit.annotations.TestIssueLogging; |
29 | 28 | import org.elasticsearch.xcontent.XContentBuilder; |
30 | 29 | import org.elasticsearch.xcontent.XContentFactory; |
31 | 30 | import org.elasticsearch.xpack.aggregatemetric.AggregateMetricMapperPlugin; |
|
34 | 33 | import org.elasticsearch.xpack.core.ilm.LifecyclePolicy; |
35 | 34 | import org.elasticsearch.xpack.core.ilm.LifecycleSettings; |
36 | 35 | import org.elasticsearch.xpack.core.ilm.Phase; |
| 36 | +import org.elasticsearch.xpack.core.ilm.PhaseCompleteStep; |
37 | 37 | import org.elasticsearch.xpack.core.ilm.action.ILMActions; |
38 | 38 | import org.elasticsearch.xpack.core.ilm.action.PutLifecycleRequest; |
39 | 39 | import org.elasticsearch.xpack.ilm.IndexLifecycle; |
|
48 | 48 | import java.util.List; |
49 | 49 | import java.util.Locale; |
50 | 50 | import java.util.Map; |
| 51 | +import java.util.Objects; |
51 | 52 | import java.util.concurrent.TimeUnit; |
52 | 53 | import java.util.function.Supplier; |
53 | 54 |
|
@@ -135,10 +136,6 @@ public void setup(final String sourceIndex, int numOfShards, int numOfReplicas, |
135 | 136 | assertAcked(client().execute(ILMActions.PUT, putLifecycleRequest).actionGet()); |
136 | 137 | } |
137 | 138 |
|
138 | | - @TestIssueLogging( |
139 | | - value = "org.elasticsearch.cluster.service.MasterService:TRACE", |
140 | | - issueUrl = "https://github.com/elastic/elasticsearch/issues/136585" |
141 | | - ) |
142 | 139 | public void testILMDownsampleRollingRestart() throws Exception { |
143 | 140 | final InternalTestCluster cluster = internalCluster(); |
144 | 141 | cluster.startMasterOnlyNodes(1); |
@@ -178,6 +175,13 @@ public void testILMDownsampleRollingRestart() throws Exception { |
178 | 175 | startDownsampleTaskViaIlm(sourceIndex, targetIndex); |
179 | 176 | assertBusy(() -> assertTargetIndex(cluster, targetIndex, indexedDocs, samplingMethod)); |
180 | 177 | ensureGreen(targetIndex); |
| 178 | + // We wait for ILM to successfully complete the phase |
| 179 | + logger.info("Waiting for ILM to complete the phase for index [{}]", targetIndex); |
| 180 | + awaitClusterState(clusterState -> { |
| 181 | + IndexMetadata indexMetadata = clusterState.metadata().getProject().index(targetIndex); |
| 182 | + return indexMetadata.getLifecycleExecutionState() != null |
| 183 | + && Objects.equals(indexMetadata.getLifecycleExecutionState().step(), PhaseCompleteStep.NAME); |
| 184 | + }); |
181 | 185 | } |
182 | 186 |
|
183 | 187 | private void startDownsampleTaskViaIlm(String sourceIndex, String targetIndex) throws Exception { |
|
0 commit comments