Skip to content

Commit 882cd6e

Browse files
authored
[7.13] Fix SearchableSnapshotActionIT.testConvertingSearchableSnapshotFromFullToPartial (#73994)
This failure can happen if the after test logic in EsRestTestCase.wipeSearchableSnapshotsIndices() correctly found a searchable snapshot index to delete but that index was already deleted and converted to an alias in the meanwhile, by the last step of the ILM searchable snapshot action for frozen phase. This in-flight alias swap while the partially index has a completed ILM state is possible because of the CopyExecutionStateStep which updates the cluster state with completed in frozen phase and the alias swap request is executed after the updated cluster state is published. Backport of #73888 Closes #73706
1 parent 0b0f73b commit 882cd6e

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ public ClusterState performAction(Index index, ClusterState clusterState) {
7878
String phase = targetNextStepKey.getPhase();
7979
String action = targetNextStepKey.getAction();
8080
String step = targetNextStepKey.getName();
81-
long lifecycleDate = lifecycleState.getLifecycleDate();
8281

8382
LifecycleExecutionState.Builder relevantTargetCustomData = LifecycleExecutionState.builder(lifecycleState);
8483
// Override the phase, action, and step for the target next StepKey

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -453,6 +453,11 @@ public void testConvertingSearchableSnapshotFromFullToPartial() throws Exception
453453
Request hitCount = new Request("GET", "/" + searchableSnapMountedIndexName + "/_count");
454454
Map<String, Object> count = entityAsMap(client().performRequest(hitCount));
455455
assertThat("expected a single document but got: " + count, (int) count.get("count"), equalTo(1));
456+
457+
assertBusy(() -> assertTrue(
458+
"Expecting the mounted index to be deleted and to be converted to an alias",
459+
aliasExists(searchableSnapMountedIndexName, SearchableSnapshotAction.FULL_RESTORED_INDEX_PREFIX + index))
460+
);
456461
}
457462

458463
public void testSecondSearchableSnapshotUsingDifferentRepoThrows() throws Exception {

0 commit comments

Comments
 (0)