|
25 | 25 | import org.elasticsearch.core.CheckedRunnable; |
26 | 26 | import org.elasticsearch.core.Nullable; |
27 | 27 | import org.elasticsearch.core.TimeValue; |
28 | | -import org.elasticsearch.index.IndexSettings; |
29 | 28 | import org.elasticsearch.index.engine.EngineConfig; |
30 | 29 | import org.elasticsearch.rest.action.admin.indices.RestPutIndexTemplateAction; |
31 | 30 | import org.elasticsearch.snapshots.SnapshotState; |
@@ -143,24 +142,17 @@ public void testRetryFailedDeleteAction() throws Exception { |
143 | 142 | assertBusy(() -> assertFalse(indexExists(index))); |
144 | 143 | } |
145 | 144 |
|
146 | | - public void testRetryFreezeDeleteAction() throws Exception { |
| 145 | + public void testFreezeNoop() throws Exception { |
147 | 146 | createNewSingletonPolicy(client(), policy, "cold", new FreezeAction()); |
148 | 147 |
|
149 | 148 | createIndexWithSettings(client(), index, alias, Settings.builder() |
150 | 149 | .put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) |
151 | 150 | .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0) |
152 | | - .put(IndexMetadata.SETTING_READ_ONLY, true) |
153 | 151 | .put("index.lifecycle.name", policy)); |
154 | 152 |
|
155 | | - assertBusy(() -> assertThat((Integer) explainIndex(client(), index).get(FAILED_STEP_RETRY_COUNT_FIELD), greaterThanOrEqualTo(1)), |
| 153 | + assertBusy(() -> assertThat(getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep("cold").getKey())), |
156 | 154 | 30, TimeUnit.SECONDS); |
157 | 155 | assertFalse(getOnlyIndexSettings(client(), index).containsKey("index.frozen")); |
158 | | - |
159 | | - Request request = new Request("PUT", index + "/_settings"); |
160 | | - request.setJsonEntity("{\"index.blocks.read_only\":false}"); |
161 | | - assertOK(client().performRequest(request)); |
162 | | - |
163 | | - assertBusy(() -> assertThat(getOnlyIndexSettings(client(), index).get("index.frozen"), equalTo("true"))); |
164 | 156 | } |
165 | 157 |
|
166 | 158 |
|
@@ -416,61 +408,6 @@ public void testForceMergeActionWithCompressionCodec() throws Exception { |
416 | 408 | forceMergeActionWithCodec("best_compression"); |
417 | 409 | } |
418 | 410 |
|
419 | | - public void testFreezeAction() throws Exception { |
420 | | - createIndexWithSettings(client(), index, alias, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) |
421 | | - .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)); |
422 | | - createNewSingletonPolicy(client(), policy, "cold", new FreezeAction()); |
423 | | - updatePolicy(client(), index, policy); |
424 | | - assertBusy(() -> { |
425 | | - Map<String, Object> settings = getOnlyIndexSettings(client(), index); |
426 | | - assertThat(getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep("cold").getKey())); |
427 | | - assertThat(settings.get(IndexMetadata.INDEX_BLOCKS_WRITE_SETTING.getKey()), equalTo("true")); |
428 | | - assertThat(settings.get(IndexSettings.INDEX_SEARCH_THROTTLED.getKey()), equalTo("true")); |
429 | | - assertThat(settings.get("index.frozen"), equalTo("true")); |
430 | | - }); |
431 | | - } |
432 | | - |
433 | | - public void testFreezeDuringSnapshot() throws Exception { |
434 | | - // Create the repository before taking the snapshot. |
435 | | - Request request = new Request("PUT", "/_snapshot/repo"); |
436 | | - request.setJsonEntity(Strings |
437 | | - .toString(JsonXContent.contentBuilder() |
438 | | - .startObject() |
439 | | - .field("type", "fs") |
440 | | - .startObject("settings") |
441 | | - .field("compress", randomBoolean()) |
442 | | - .field("location", System.getProperty("tests.path.repo")) |
443 | | - .field("max_snapshot_bytes_per_sec", "256b") |
444 | | - .endObject() |
445 | | - .endObject())); |
446 | | - assertOK(client().performRequest(request)); |
447 | | - // create delete policy |
448 | | - createNewSingletonPolicy(client(), policy, "cold", new FreezeAction(), TimeValue.timeValueMillis(0)); |
449 | | - // create index without policy |
450 | | - createIndexWithSettings(client(), index, alias, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) |
451 | | - .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0)); |
452 | | - // index document so snapshot actually does something |
453 | | - indexDocument(client(), index); |
454 | | - // start snapshot |
455 | | - request = new Request("PUT", "/_snapshot/repo/snapshot"); |
456 | | - request.addParameter("wait_for_completion", "false"); |
457 | | - request.setJsonEntity("{\"indices\": \"" + index + "\"}"); |
458 | | - assertOK(client().performRequest(request)); |
459 | | - // add policy and expect it to trigger delete immediately (while snapshot in progress) |
460 | | - updatePolicy(client(), index, policy); |
461 | | - // assert that the index froze |
462 | | - assertBusy(() -> { |
463 | | - Map<String, Object> settings = getOnlyIndexSettings(client(), index); |
464 | | - assertThat(getStepKeyForIndex(client(), index), equalTo(PhaseCompleteStep.finalStep("cold").getKey())); |
465 | | - assertThat(settings.get(IndexMetadata.INDEX_BLOCKS_WRITE_SETTING.getKey()), equalTo("true")); |
466 | | - assertThat(settings.get(IndexSettings.INDEX_SEARCH_THROTTLED.getKey()), equalTo("true")); |
467 | | - assertThat(settings.get("index.frozen"), equalTo("true")); |
468 | | - }, 2, TimeUnit.MINUTES); |
469 | | - // assert that snapshot is still in progress and clean up |
470 | | - assertThat(getSnapshotState(client(), "snapshot"), equalTo("SUCCESS")); |
471 | | - assertOK(client().performRequest(new Request("DELETE", "/_snapshot/repo/snapshot"))); |
472 | | - } |
473 | | - |
474 | 411 | public void testSetPriority() throws Exception { |
475 | 412 | createIndexWithSettings(client(), index, alias, Settings.builder().put(IndexMetadata.SETTING_NUMBER_OF_SHARDS, 1) |
476 | 413 | .put(IndexMetadata.SETTING_NUMBER_OF_REPLICAS, 0).put(IndexMetadata.INDEX_PRIORITY_SETTING.getKey(), 100)); |
|
0 commit comments