Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make FreezeStep retryable #52540

Merged
merged 2 commits into from
Feb 20, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,9 @@ public void performDuringNoSnapshot(IndexMetaData indexMetaData, ClusterState cu
new FreezeRequest(indexMetaData.getIndex().getName()).masterNodeTimeout(getMasterTimeout(currentState)),
ActionListener.wrap(response -> listener.onResponse(true), listener::onFailure));
}

@Override
public boolean isRetryable() {
return true;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
import org.elasticsearch.xpack.core.ilm.ErrorStep;
import org.elasticsearch.xpack.core.ilm.ForceMergeAction;
import org.elasticsearch.xpack.core.ilm.FreezeAction;
import org.elasticsearch.xpack.core.ilm.FreezeStep;
import org.elasticsearch.xpack.core.ilm.InitializePolicyContextStep;
import org.elasticsearch.xpack.core.ilm.LifecycleAction;
import org.elasticsearch.xpack.core.ilm.LifecyclePolicy;
Expand Down Expand Up @@ -228,6 +229,25 @@ public void testRetryFailedDeleteAction() throws Exception {
assertBusy(() -> assertFalse(indexExists(index)));
}

public void testRetryFreezeDeleteAction() throws Exception {
createNewSingletonPolicy("cold", new FreezeAction());

createIndexWithSettings(index, Settings.builder()
.put(IndexMetaData.SETTING_NUMBER_OF_SHARDS, 1)
.put(IndexMetaData.SETTING_NUMBER_OF_REPLICAS, 0)
.put(IndexMetaData.SETTING_READ_ONLY, true)
.put("index.lifecycle.name", policy));

assertBusy(() -> assertThat(getFailedStepForIndex(index), equalTo(FreezeStep.NAME)));
assertFalse(getOnlyIndexSettings(index).containsKey("index.frozen"));

Request request = new Request("PUT", index + "/_settings");
request.setJsonEntity("{\"index.blocks.read_only\":false}");
assertOK(client().performRequest(request));

assertBusy(() -> assertThat(getOnlyIndexSettings(index).get("index.frozen"), equalTo("true")));
}

public void testRetryFailedShrinkAction() throws Exception {
int numShards = 4;
int divisor = randomFrom(2, 4);
Expand Down