Skip to content

Commit 60b89a8

Browse files
authored
Increase timeout for searchable snapshots in ILM tests (#137514)
As of #133954, we clone indices before performing the force-merge step in the `searchable_snapshot` action. On slow CI servers, 10 seconds for the index to go through the whole `searchable_snapshot` action isn't enough, so we bump the timeout to 20 seconds. I looked at the logs of a few test failures, and ILM was clearly still progressing when the test timed out. I didn't identify any particular step that was taking extraordinarily long; there were always just a few steps that took a bit longer. I would love to make these tests faster rather than bumping the timeout, but the `searchable_snapshot` action is simply one of the largest ILM actions and ILM itself isn't particularly fast. That being said, if a timeout of 20 seconds proves to be insufficient (i.e. test failures come back), I do think it's worth having a look at reducing the runtime of the tests somehow first before we increase the timeout further. Closes #137149 Closes #137151 Closes #137152 Closes #137153 Closes #137156 Closes #137166 Closes #137167 Closes #137192
1 parent ec0efaf commit 60b89a8

File tree

3 files changed

+19
-22
lines changed

3 files changed

+19
-22
lines changed

muted-tests.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -492,9 +492,6 @@ tests:
492492
- class: org.elasticsearch.readiness.ReadinessClusterIT
493493
method: testReadinessDuringRestartsNormalOrder
494494
issue: https://github.com/elastic/elasticsearch/issues/136955
495-
- class: org.elasticsearch.xpack.ilm.TimeSeriesDataStreamsIT
496-
method: testSearchableSnapshotAction
497-
issue: https://github.com/elastic/elasticsearch/issues/137167
498495
- class: org.elasticsearch.xpack.security.CoreWithSecurityClientYamlTestSuiteIT
499496
method: test {yaml=indices.validate_query/20_query_string/validate_query with query_string parameters}
500497
issue: https://github.com/elastic/elasticsearch/issues/137391

x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/TimeSeriesDataStreamsIT.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -184,8 +184,8 @@ public void testSearchableSnapshotAction() throws Exception {
184184
// Manual rollover the original index such that it's not the write index in the data stream anymore
185185
rolloverMaxOneDocCondition(client(), dataStream);
186186

187-
awaitIndexExists(restoredIndexName);
188-
awaitIndexDoesNotExist(backingIndexName, TimeValue.timeValueSeconds(60));
187+
awaitIndexExists(restoredIndexName, TimeValue.timeValueSeconds(20));
188+
awaitIndexDoesNotExist(backingIndexName);
189189
assertBusy(
190190
() -> assertThat(explainIndex(client(), restoredIndexName).get("step"), is(PhaseCompleteStep.NAME)),
191191
30,

x-pack/plugin/ilm/qa/multi-node/src/javaRestTest/java/org/elasticsearch/xpack/ilm/actions/SearchableSnapshotActionIT.java

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -111,7 +111,7 @@ public void testSearchableSnapshotAction() throws Exception {
111111
assertThat(backingIndices.size(), equalTo(2));
112112
String backingIndexName = backingIndices.getFirst();
113113
String restoredIndexName = SearchableSnapshotAction.FULL_RESTORED_INDEX_PREFIX + backingIndexName;
114-
awaitIndexExists(restoredIndexName);
114+
awaitIndexExists(restoredIndexName, TimeValue.timeValueSeconds(20));
115115

116116
TimeSeriesRestDriver.awaitStepKey(client(), restoredIndexName, null, null, PhaseCompleteStep.NAME);
117117
// Wait for the original index to be deleted, to ensure ILM has finished
@@ -233,7 +233,7 @@ public void testDeleteActionDeletesSearchableSnapshot() throws Exception {
233233
Map<String, LifecycleAction> coldActions = Map.of(SearchableSnapshotAction.NAME, new SearchableSnapshotAction(snapshotRepo));
234234
Map<String, Phase> phases = new HashMap<>();
235235
phases.put("cold", new Phase("cold", TimeValue.ZERO, coldActions));
236-
phases.put("delete", new Phase("delete", TimeValue.timeValueMillis(10000), Map.of(DeleteAction.NAME, WITH_SNAPSHOT_DELETE)));
236+
phases.put("delete", new Phase("delete", TimeValue.ZERO, Map.of(DeleteAction.NAME, WITH_SNAPSHOT_DELETE)));
237237
LifecyclePolicy lifecyclePolicy = new LifecyclePolicy(policy, phases);
238238
// PUT policy
239239
XContentBuilder builder = jsonBuilder();
@@ -261,7 +261,7 @@ public void testDeleteActionDeletesSearchableSnapshot() throws Exception {
261261
String restoredIndexName = SearchableSnapshotAction.FULL_RESTORED_INDEX_PREFIX + backingIndexName;
262262

263263
// let's wait for ILM to finish
264-
awaitIndexDoesNotExist(backingIndexName);
264+
awaitIndexDoesNotExist(backingIndexName, TimeValue.timeValueSeconds(20));
265265
awaitIndexDoesNotExist(restoredIndexName);
266266

267267
List<Map<String, Object>> snapshots = getSnapshots();
@@ -347,7 +347,7 @@ public void testUpdatePolicyToAddPhasesYieldsInvalidActionsToBeSkipped() throws
347347

348348
String backingIndexName = backingIndices.getFirst();
349349
String restoredIndexName = SearchableSnapshotAction.FULL_RESTORED_INDEX_PREFIX + backingIndexName;
350-
awaitIndexExists(restoredIndexName);
350+
awaitIndexExists(restoredIndexName, TimeValue.timeValueSeconds(20));
351351
TimeSeriesRestDriver.awaitStepKey(client(), restoredIndexName, "hot", null, PhaseCompleteStep.NAME);
352352
// Wait for the original index to be deleted, to ensure ILM has finished
353353
awaitIndexDoesNotExist(backingIndexName);
@@ -417,7 +417,7 @@ public void testRestoredIndexManagedByLocalPolicySkipsIllegalActions() throws Ex
417417

418418
String backingIndexName = backingIndices.getFirst();
419419
String searchableSnapMountedIndexName = SearchableSnapshotAction.FULL_RESTORED_INDEX_PREFIX + backingIndexName;
420-
awaitIndexExists(searchableSnapMountedIndexName);
420+
awaitIndexExists(searchableSnapMountedIndexName, TimeValue.timeValueSeconds(20));
421421
TimeSeriesRestDriver.awaitStepKey(client(), searchableSnapMountedIndexName, "hot", null, PhaseCompleteStep.NAME);
422422
// Wait for the original index to be deleted, to ensure ILM has finished
423423
awaitIndexDoesNotExist(backingIndexName);
@@ -459,7 +459,7 @@ public void testRestoredIndexManagedByLocalPolicySkipsIllegalActions() throws Ex
459459
restoreSnapshot.setJsonEntity("{\"indices\": \"" + dataStream + "\", \"include_global_state\": false}");
460460
assertOK(client().performRequest(restoreSnapshot));
461461

462-
assertThat(indexExists(searchableSnapMountedIndexName), is(true));
462+
awaitIndexExists(searchableSnapMountedIndexName);
463463
ensureGreen(searchableSnapMountedIndexName);
464464

465465
// the restored index is now managed by the now updated ILM policy and needs to go through the warm and cold phase
@@ -523,7 +523,7 @@ public void testIdenticalSearchableSnapshotActionIsNoop() throws Exception {
523523
final String searchableSnapMountedIndexName = SearchableSnapshotAction.FULL_RESTORED_INDEX_PREFIX + index;
524524

525525
logger.info("--> waiting for [{}] to exist...", searchableSnapMountedIndexName);
526-
awaitIndexExists(searchableSnapMountedIndexName);
526+
awaitIndexExists(searchableSnapMountedIndexName, TimeValue.timeValueSeconds(20));
527527
TimeSeriesRestDriver.awaitStepKey(client(), searchableSnapMountedIndexName, "cold", null, PhaseCompleteStep.NAME);
528528
// Wait for the original index to be deleted, to ensure ILM has finished
529529
awaitIndexDoesNotExist(index);
@@ -569,7 +569,7 @@ public void testConvertingSearchableSnapshotFromFullToPartial() throws Exception
569569
+ SearchableSnapshotAction.FULL_RESTORED_INDEX_PREFIX + index;
570570

571571
logger.info("--> waiting for [{}] to exist...", searchableSnapMountedIndexName);
572-
awaitIndexExists(searchableSnapMountedIndexName);
572+
awaitIndexExists(searchableSnapMountedIndexName, TimeValue.timeValueSeconds(20));
573573
TimeSeriesRestDriver.awaitStepKey(client(), searchableSnapMountedIndexName, "frozen", null, PhaseCompleteStep.NAME);
574574
// Wait for the original index to be deleted, to ensure ILM has finished
575575
awaitIndexDoesNotExist(index);
@@ -635,7 +635,7 @@ public void testResumingSearchableSnapshotFromFullToPartial() throws Exception {
635635

636636
final String fullMountedIndexName = SearchableSnapshotAction.FULL_RESTORED_INDEX_PREFIX + index;
637637
logger.info("--> waiting for [{}] to exist...", fullMountedIndexName);
638-
awaitIndexExists(fullMountedIndexName);
638+
awaitIndexExists(fullMountedIndexName, TimeValue.timeValueSeconds(20));
639639
TimeSeriesRestDriver.awaitStepKey(client(), fullMountedIndexName, "cold", null, PhaseCompleteStep.NAME);
640640
// Wait for the original index to be deleted, to ensure ILM has finished
641641
awaitIndexDoesNotExist(index);
@@ -651,7 +651,7 @@ public void testResumingSearchableSnapshotFromFullToPartial() throws Exception {
651651

652652
String partiallyMountedIndexName = SearchableSnapshotAction.PARTIAL_RESTORED_INDEX_PREFIX + fullMountedIndexName;
653653
logger.info("--> waiting for [{}] to exist...", partiallyMountedIndexName);
654-
awaitIndexExists(partiallyMountedIndexName);
654+
awaitIndexExists(partiallyMountedIndexName, TimeValue.timeValueSeconds(20));
655655
TimeSeriesRestDriver.awaitStepKey(client(), partiallyMountedIndexName, "frozen", null, PhaseCompleteStep.NAME);
656656

657657
// Ensure the searchable snapshot is not deleted when the index was deleted because it was not created by this
@@ -727,7 +727,7 @@ public void testResumingSearchableSnapshotFromPartialToFull() throws Exception {
727727
final String fullMountedIndexName = SearchableSnapshotAction.FULL_RESTORED_INDEX_PREFIX + index;
728728
final String partialMountedIndexName = SearchableSnapshotAction.PARTIAL_RESTORED_INDEX_PREFIX + fullMountedIndexName;
729729
logger.info("--> waiting for [{}] to exist...", partialMountedIndexName);
730-
awaitIndexExists(partialMountedIndexName);
730+
awaitIndexExists(partialMountedIndexName, TimeValue.timeValueSeconds(20));
731731
TimeSeriesRestDriver.awaitStepKey(client(), partialMountedIndexName, "frozen", null, PhaseCompleteStep.NAME);
732732
// Wait for the original index to be deleted, to ensure ILM has finished
733733
awaitIndexDoesNotExist(index);
@@ -743,7 +743,7 @@ public void testResumingSearchableSnapshotFromPartialToFull() throws Exception {
743743

744744
String restoredPartiallyMountedIndexName = SearchableSnapshotAction.FULL_RESTORED_INDEX_PREFIX + partialMountedIndexName;
745745
logger.info("--> waiting for [{}] to exist...", restoredPartiallyMountedIndexName);
746-
awaitIndexExists(restoredPartiallyMountedIndexName);
746+
awaitIndexExists(restoredPartiallyMountedIndexName, TimeValue.timeValueSeconds(20));
747747
TimeSeriesRestDriver.awaitStepKey(client(), restoredPartiallyMountedIndexName, "cold", null, PhaseCompleteStep.NAME);
748748

749749
// Ensure the searchable snapshot is not deleted when the index was deleted because it was not created by this
@@ -848,7 +848,7 @@ public void testSearchableSnapshotsInHotPhasePinnedToHotNodes() throws Exception
848848

849849
final String restoredIndex = SearchableSnapshotAction.FULL_RESTORED_INDEX_PREFIX + firstGenIndex;
850850
logger.info("--> waiting for [{}] to exist...", restoredIndex);
851-
awaitIndexExists(restoredIndex);
851+
awaitIndexExists(restoredIndex, TimeValue.timeValueSeconds(20));
852852
TimeSeriesRestDriver.awaitStepKey(client(), restoredIndex, "hot", PhaseCompleteStep.NAME, PhaseCompleteStep.NAME);
853853

854854
Map<String, Object> hotIndexSettings = getIndexSettingsAsMap(restoredIndex);
@@ -887,7 +887,7 @@ public void testSearchableSnapshotInvokesAsyncActionOnNewIndex() throws Exceptio
887887
assertThat(backingIndices.size(), equalTo(2));
888888
String backingIndexName = backingIndices.getFirst();
889889
String restoredIndexName = SearchableSnapshotAction.FULL_RESTORED_INDEX_PREFIX + backingIndexName;
890-
awaitIndexExists(restoredIndexName);
890+
awaitIndexExists(restoredIndexName, TimeValue.timeValueSeconds(20));
891891

892892
TimeSeriesRestDriver.awaitStepKey(client(), restoredIndexName, null, null, PhaseCompleteStep.NAME);
893893
// Wait for the original index to be deleted, to ensure ILM has finished
@@ -931,7 +931,7 @@ public void testSearchableSnapshotTotalShardsPerNode() throws Exception {
931931
final String searchableSnapMountedIndexName = SearchableSnapshotAction.PARTIAL_RESTORED_INDEX_PREFIX
932932
+ SearchableSnapshotAction.FULL_RESTORED_INDEX_PREFIX + index;
933933
logger.info("--> waiting for [{}] to exist...", searchableSnapMountedIndexName);
934-
awaitIndexExists(searchableSnapMountedIndexName);
934+
awaitIndexExists(searchableSnapMountedIndexName, TimeValue.timeValueSeconds(20));
935935
TimeSeriesRestDriver.awaitStepKey(client(), searchableSnapMountedIndexName, "frozen", null, PhaseCompleteStep.NAME);
936936
// Wait for the original index to be deleted, to ensure ILM has finished
937937
awaitIndexDoesNotExist(index);
@@ -984,7 +984,7 @@ public void testSearchableSnapshotReplicateFor() throws Exception {
984984
assertThat(backingIndices.size(), equalTo(2));
985985
String backingIndexName = backingIndices.getFirst();
986986
String restoredIndexName = SearchableSnapshotAction.FULL_RESTORED_INDEX_PREFIX + backingIndexName;
987-
awaitIndexExists(restoredIndexName);
987+
awaitIndexExists(restoredIndexName, TimeValue.timeValueSeconds(20));
988988

989989
// check that the index is in the expected step and has the expected step_info.message
990990
assertBusy(() -> {
@@ -1133,7 +1133,7 @@ private void assertForceMergedSnapshotDone(String phase, String backingIndexName
11331133
? SearchableSnapshotAction.FULL_RESTORED_INDEX_PREFIX
11341134
: SearchableSnapshotAction.PARTIAL_RESTORED_INDEX_PREFIX;
11351135
final String restoredIndexName = prefix + backingIndexName;
1136-
awaitIndexExists(restoredIndexName);
1136+
awaitIndexExists(restoredIndexName, TimeValue.timeValueSeconds(20));
11371137

11381138
assertBusy(() -> assertThat(explainIndex(client(), restoredIndexName).get("step"), is(PhaseCompleteStep.NAME)));
11391139
// Wait for the original index to be deleted, to ensure ILM has finished

0 commit comments

Comments
 (0)