Skip to content
Merged
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,10 +28,8 @@
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.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 @@ -207,22 +205,19 @@ public void testMoveToRolloverStep() throws Exception {
assertBusy(() -> assertFalse(indexExists(shrunkenOriginalIndex)));
}

@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/53738")
public void testRetryFailedDeleteAction() throws Exception {
createNewSingletonPolicy("delete", new DeleteAction());
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));
.put(IndexMetadata.SETTING_READ_ONLY, true)
.put("index.lifecycle.name", policy));

assertBusy(() -> assertThat(getFailedStepForIndex(index), equalTo(DeleteStep.NAME)));
assertBusy(() -> assertThat((Integer) explainIndex(index).get(FAILED_STEP_RETRY_COUNT_FIELD), greaterThanOrEqualTo(1)), 30,
TimeUnit.SECONDS);
assertTrue(indexExists(index));

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

Expand All @@ -238,7 +233,8 @@ public void testRetryFreezeDeleteAction() throws Exception {
.put(IndexMetadata.SETTING_READ_ONLY, true)
.put("index.lifecycle.name", policy));

assertBusy(() -> assertThat(getFailedStepForIndex(index), equalTo(FreezeStep.NAME)));
assertBusy(() -> assertThat((Integer) explainIndex(index).get(FAILED_STEP_RETRY_COUNT_FIELD), greaterThanOrEqualTo(1)), 30,
TimeUnit.SECONDS);
assertFalse(getOnlyIndexSettings(index).containsKey("index.frozen"));

Request request = new Request("PUT", index + "/_settings");
Expand Down Expand Up @@ -283,7 +279,6 @@ public void testRetryFailedShrinkAction() throws Exception {
expectThrows(ResponseException.class, this::indexDocument);
}

@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/53738")
public void testRolloverAction() throws Exception {
String originalIndex = index + "-000001";
String secondIndex = index + "-000002";
Expand All @@ -302,7 +297,6 @@ public void testRolloverAction() throws Exception {
assertBusy(() -> assertEquals("true", getOnlyIndexSettings(originalIndex).get(LifecycleSettings.LIFECYCLE_INDEXING_COMPLETE)));
}

@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/53738")
public void testRolloverActionWithIndexingComplete() throws Exception {
String originalIndex = index + "-000001";
String secondIndex = index + "-000002";
Expand Down Expand Up @@ -755,7 +749,6 @@ public void testFreezeDuringSnapshot() throws Exception {
assertOK(client().performRequest(new Request("DELETE", "/_snapshot/repo/snapshot")));
}

@AwaitsFix(bugUrl = "https://github.com/elastic/elasticsearch/issues/53738")
public void testSetPriority() throws Exception {
createIndexWithSettings(index, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1)
.put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0).put(IndexMetadata.INDEX_PRIORITY_SETTING.getKey(), 100));
Expand Down Expand Up @@ -1754,6 +1747,7 @@ private static StepKey getStepKey(Map<String, Object> explainIndexResponse) {
return new StepKey(phase, action, step);
}

@Nullable
private String getFailedStepForIndex(String indexName) throws IOException {
Map<String, Object> indexResponse = explainIndex(indexName);
if (indexResponse == null) {
Expand Down