Skip to content

Commit aff693b

Browse files
Make FreezeStep retryable (#52540) (#52559)
* Make FreezeStep retryable This change marks `FreezeStep` as retryable and adds test to make sure we can really run it again. * refactor tests Co-authored-by: Elastic Machine <[email protected]>
1 parent 4bb780b commit aff693b

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

x-pack/plugin/core/src/main/java/org/elasticsearch/xpack/core/ilm/FreezeStep.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,4 +28,9 @@ public void performDuringNoSnapshot(IndexMetaData indexMetaData, ClusterState cu
2828
new FreezeRequest(indexMetaData.getIndex().getName()).masterNodeTimeout(getMasterTimeout(currentState)),
2929
ActionListener.wrap(response -> listener.onResponse(true), listener::onFailure));
3030
}
31+
32+
@Override
33+
public boolean isRetryable() {
34+
return true;
35+
}
3136
}

x-pack/plugin/ilm/qa/multi-node/src/test/java/org/elasticsearch/xpack/ilm/TimeSeriesLifecycleActionsIT.java

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
import org.elasticsearch.xpack.core.ilm.ErrorStep;
3333
import org.elasticsearch.xpack.core.ilm.ForceMergeAction;
3434
import org.elasticsearch.xpack.core.ilm.FreezeAction;
35+
import org.elasticsearch.xpack.core.ilm.FreezeStep;
3536
import org.elasticsearch.xpack.core.ilm.InitializePolicyContextStep;
3637
import org.elasticsearch.xpack.core.ilm.LifecycleAction;
3738
import org.elasticsearch.xpack.core.ilm.LifecyclePolicy;
@@ -228,6 +229,25 @@ public void testRetryFailedDeleteAction() throws Exception {
228229
assertBusy(() -> assertFalse(indexExists(index)));
229230
}
230231

232+
public void testRetryFreezeDeleteAction() throws Exception {
233+
createNewSingletonPolicy("cold", new FreezeAction());
234+
235+
createIndexWithSettings(index, Settings.builder()
236+
.put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1)
237+
.put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0)
238+
.put(IndexMetaData.SETTING_READ_ONLY, true)
239+
.put("index.lifecycle.name", policy));
240+
241+
assertBusy(() -> assertThat(getFailedStepForIndex(index), equalTo(FreezeStep.NAME)));
242+
assertFalse(getOnlyIndexSettings(index).containsKey("index.frozen"));
243+
244+
Request request = new Request("PUT", index + "/_settings");
245+
request.setJsonEntity("{\"index.blocks.read_only\":false}");
246+
assertOK(client().performRequest(request));
247+
248+
assertBusy(() -> assertThat(getOnlyIndexSettings(index).get("index.frozen"), equalTo("true")));
249+
}
250+
231251
public void testRetryFailedShrinkAction() throws Exception {
232252
int numShards = 4;
233253
int divisor = randomFrom(2, 4);

0 commit comments

Comments
 (0)