Skip to content

Commit e759e97

Browse files
committed
[ILM] Move WaitUntilTimeSeriesEndTimePassesStep before WaitForFollowShardTasksStep
1 parent 731d62b commit e759e97

File tree

2 files changed

+14
-12
lines changed

2 files changed

+14
-12
lines changed

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

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ private UnfollowAction() {}
4545
public List<Step> toSteps(Client client, String phase, StepKey nextStepKey) {
4646
StepKey preUnfollowKey = new StepKey(phase, NAME, CONDITIONAL_UNFOLLOW_STEP);
4747
StepKey indexingComplete = new StepKey(phase, NAME, WaitForIndexingCompleteStep.NAME);
48-
StepKey waitForFollowShardTasks = new StepKey(phase, NAME, WaitForFollowShardTasksStep.NAME);
4948
StepKey waitUntilTimeSeriesEndTimePassesStep = new StepKey(phase, NAME, WaitUntilTimeSeriesEndTimePassesStep.NAME);
49+
StepKey waitForFollowShardTasks = new StepKey(phase, NAME, WaitForFollowShardTasksStep.NAME);
5050
StepKey pauseFollowerIndex = new StepKey(phase, NAME, PauseFollowerIndexStep.NAME);
5151
StepKey closeFollowerIndex = new StepKey(phase, NAME, CloseFollowerIndexStep.NAME);
5252
StepKey unfollowFollowerIndex = new StepKey(phase, NAME, UnfollowFollowerIndexStep.NAME);
@@ -61,16 +61,18 @@ public List<Step> toSteps(Client client, String phase, StepKey nextStepKey) {
6161
// if the index has no CCR metadata we'll skip the unfollow action completely
6262
return customIndexMetadata == null;
6363
});
64-
WaitForIndexingCompleteStep step1 = new WaitForIndexingCompleteStep(indexingComplete, waitForFollowShardTasks);
65-
WaitForFollowShardTasksStep step2 = new WaitForFollowShardTasksStep(
66-
waitForFollowShardTasks,
64+
WaitForIndexingCompleteStep step1 = new WaitForIndexingCompleteStep(indexingComplete, waitUntilTimeSeriesEndTimePassesStep);
65+
66+
WaitUntilTimeSeriesEndTimePassesStep step2 = new WaitUntilTimeSeriesEndTimePassesStep(
6767
waitUntilTimeSeriesEndTimePassesStep,
68-
client
68+
waitForFollowShardTasks,
69+
Instant::now
6970
);
70-
WaitUntilTimeSeriesEndTimePassesStep step3 = new WaitUntilTimeSeriesEndTimePassesStep(
71-
waitUntilTimeSeriesEndTimePassesStep,
71+
72+
WaitForFollowShardTasksStep step3 = new WaitForFollowShardTasksStep(
73+
waitForFollowShardTasks,
7274
pauseFollowerIndex,
73-
Instant::now
75+
client
7476
);
7577
PauseFollowerIndexStep step4 = new PauseFollowerIndexStep(pauseFollowerIndex, closeFollowerIndex, client);
7678
CloseFollowerIndexStep step5 = new CloseFollowerIndexStep(closeFollowerIndex, unfollowFollowerIndex, client);

x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/ilm/UnfollowActionTests.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ public void testToSteps() {
5555

5656
StepKey expectedFirstStepKey = new StepKey(phase, UnfollowAction.NAME, UnfollowAction.CONDITIONAL_UNFOLLOW_STEP);
5757
StepKey expectedSecondStepKey = new StepKey(phase, UnfollowAction.NAME, WaitForIndexingCompleteStep.NAME);
58-
StepKey expectedThirdStepKey = new StepKey(phase, UnfollowAction.NAME, WaitForFollowShardTasksStep.NAME);
59-
StepKey expectedFourthStepKey = new StepKey(phase, UnfollowAction.NAME, WaitUntilTimeSeriesEndTimePassesStep.NAME);
58+
StepKey expectedThirdStepKey = new StepKey(phase, UnfollowAction.NAME, WaitUntilTimeSeriesEndTimePassesStep.NAME);
59+
StepKey expectedFourthStepKey = new StepKey(phase, UnfollowAction.NAME, WaitForFollowShardTasksStep.NAME);
6060
StepKey expectedFifthStepKey = new StepKey(phase, UnfollowAction.NAME, PauseFollowerIndexStep.NAME);
6161
StepKey expectedSixthStepKey = new StepKey(phase, UnfollowAction.NAME, CloseFollowerIndexStep.NAME);
6262
StepKey expectedSeventhStepKey = new StepKey(phase, UnfollowAction.NAME, UnfollowFollowerIndexStep.NAME);
@@ -70,11 +70,11 @@ public void testToSteps() {
7070
assertThat(secondStep.getKey(), equalTo(expectedSecondStepKey));
7171
assertThat(secondStep.getNextStepKey(), equalTo(expectedThirdStepKey));
7272

73-
WaitForFollowShardTasksStep thirdStep = (WaitForFollowShardTasksStep) steps.get(2);
73+
WaitUntilTimeSeriesEndTimePassesStep thirdStep = (WaitUntilTimeSeriesEndTimePassesStep) steps.get(2);
7474
assertThat(thirdStep.getKey(), equalTo(expectedThirdStepKey));
7575
assertThat(thirdStep.getNextStepKey(), equalTo(expectedFourthStepKey));
7676

77-
WaitUntilTimeSeriesEndTimePassesStep fourthStep = (WaitUntilTimeSeriesEndTimePassesStep) steps.get(3);
77+
WaitForFollowShardTasksStep fourthStep = (WaitForFollowShardTasksStep) steps.get(3);
7878
assertThat(fourthStep.getKey(), equalTo(expectedFourthStepKey));
7979
assertThat(fourthStep.getNextStepKey(), equalTo(expectedFifthStepKey));
8080

0 commit comments

Comments
 (0)