Skip to content

Commit 36f6e54

Browse files
committed
Ignore ILM indices in the TerminalPolicyStep (#55184)
Prior to the change in #51631 indices were moved to the `TerminalPolicyStep` when their ILM actions had completed. Once we switched ILM to stop in the last policy configured, these steps because inaccessible from the policy's perspective. This meant that indices upgraded from ES prior to 7.7.0 could see the following error spammed in their logs every 10 minutes (by default) for every index in this state: ``` [2020-04-14T15:52:23,764][ERROR][o.e.x.i.IndexLifecycleRunner] [midgar] current step [{"phase":"completed","action":"completed","name":"completed"}] for index [foo] with policy [full] is not recognized ``` This changes the runner to ignore these steps, which is what is desired anyway since the index is already in the terminal phase.
1 parent 18dc2f7 commit 36f6e54

File tree

1 file changed

+24
-3
lines changed

1 file changed

+24
-3
lines changed

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

+24-3
Original file line numberDiff line numberDiff line change
@@ -134,8 +134,15 @@ void runPeriodicStep(String policy, IndexMetadata indexMetadata) {
134134
markPolicyDoesNotExist(policy, indexMetadata.getIndex(), lifecycleState);
135135
return;
136136
} else {
137+
Step.StepKey currentStepKey = LifecycleExecutionState.getCurrentStepKey(lifecycleState);
138+
if (TerminalPolicyStep.KEY.equals(currentStepKey)) {
139+
// This index is a leftover from before we halted execution on the final phase
140+
// instead of going to the completed phase, so it's okay to ignore this index
141+
// for now
142+
return;
143+
}
137144
logger.error("current step [{}] for index [{}] with policy [{}] is not recognized",
138-
LifecycleExecutionState.getCurrentStepKey(lifecycleState), index, policy);
145+
currentStepKey, index, policy);
139146
return;
140147
}
141148
}
@@ -263,8 +270,15 @@ void maybeRunAsyncAction(ClusterState currentState, IndexMetadata indexMetadata,
263270
return;
264271
}
265272
if (currentStep == null) {
273+
Step.StepKey currentStepKey = LifecycleExecutionState.getCurrentStepKey(lifecycleState);
274+
if (TerminalPolicyStep.KEY.equals(currentStepKey)) {
275+
// This index is a leftover from before we halted execution on the final phase
276+
// instead of going to the completed phase, so it's okay to ignore this index
277+
// for now
278+
return;
279+
}
266280
logger.warn("current step [{}] for index [{}] with policy [{}] is not recognized",
267-
LifecycleExecutionState.getCurrentStepKey(lifecycleState), index, policy);
281+
currentStepKey, index, policy);
268282
return;
269283
}
270284

@@ -323,8 +337,15 @@ void runPolicyAfterStateChange(String policy, IndexMetadata indexMetadata) {
323337
markPolicyDoesNotExist(policy, indexMetadata.getIndex(), lifecycleState);
324338
return;
325339
} else {
340+
Step.StepKey currentStepKey = LifecycleExecutionState.getCurrentStepKey(lifecycleState);
341+
if (TerminalPolicyStep.KEY.equals(currentStepKey)) {
342+
// This index is a leftover from before we halted execution on the final phase
343+
// instead of going to the completed phase, so it's okay to ignore this index
344+
// for now
345+
return;
346+
}
326347
logger.error("current step [{}] for index [{}] with policy [{}] is not recognized",
327-
LifecycleExecutionState.getCurrentStepKey(lifecycleState), index, policy);
348+
currentStepKey, index, policy);
328349
return;
329350
}
330351
}

0 commit comments

Comments
 (0)