diff --git a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/DeleteStep.java b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/DeleteStep.java index c19f8f3ef7fc5..7c086a52a4ea1 100644 --- a/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/DeleteStep.java +++ b/x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/DeleteStep.java @@ -32,4 +32,9 @@ public void performDuringNoSnapshot(IndexMetaData indexMetaData, ClusterState cu public boolean indexSurvives() { return false; } + + @Override + public boolean isRetryable() { + return true; + } } diff --git a/x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/ilm/TimeSeriesLifecycleActionsIT.java b/x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/ilm/TimeSeriesLifecycleActionsIT.java index 9b1abed6971f5..f967c3cc4325c 100644 --- a/x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/ilm/TimeSeriesLifecycleActionsIT.java +++ b/x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/ilm/TimeSeriesLifecycleActionsIT.java @@ -28,6 +28,7 @@ import org.elasticsearch.test.rest.ESRestTestCase; import org.elasticsearch.xpack.core.ilm.AllocateAction; import org.elasticsearch.xpack.core.ilm.DeleteAction; +import org.elasticsearch.xpack.core.ilm.DeleteStep; import org.elasticsearch.xpack.core.ilm.ErrorStep; import org.elasticsearch.xpack.core.ilm.ForceMergeAction; import org.elasticsearch.xpack.core.ilm.FreezeAction; @@ -206,6 +207,27 @@ public void testMoveToRolloverStep() throws Exception { assertBusy(() -> assertFalse(indexExists(shrunkenOriginalIndex))); } + public void testRetryFailedDeleteAction() throws Exception { + createIndexWithSettings(index, Settings.builder() + .put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1) + .put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0) + .put(IndexMetaData.SETTING_READ_ONLY_ALLOW_DELETE, false)); + + createNewSingletonPolicy("delete", new DeleteAction()); + + Request request = new Request("PUT", index + "/_settings"); + request.setJsonEntity("{\"index.blocks.read_only\": true, \"index.lifecycle.name\": \"" + policy + "\"}"); + assertOK(client().performRequest(request)); + + assertBusy(() -> assertThat(getFailedStepForIndex(index), equalTo(DeleteStep.NAME))); + assertTrue(indexExists(index)); + + request.setJsonEntity("{\"index.blocks.read_only\":false}"); + assertOK(client().performRequest(request)); + + assertBusy(() -> assertFalse(indexExists(index))); + } + public void testRetryFailedShrinkAction() throws Exception { int numShards = 4; int divisor = randomFrom(2, 4);