@@ -62,6 +62,13 @@ class IndexLifecycleRunner {
62
62
*/
63
63
static Step getCurrentStep (PolicyStepsRegistry stepRegistry , String policy , IndexMetadata indexMetadata ) {
64
64
LifecycleExecutionState lifecycleState = LifecycleExecutionState .fromIndexMetadata (indexMetadata );
65
+ return getCurrentStep (stepRegistry , policy , indexMetadata , lifecycleState );
66
+ }
67
+
68
+ static Step getCurrentStep (PolicyStepsRegistry stepRegistry ,
69
+ String policy ,
70
+ IndexMetadata indexMetadata ,
71
+ LifecycleExecutionState lifecycleState ) {
65
72
StepKey currentStepKey = LifecycleExecutionState .getCurrentStepKey (lifecycleState );
66
73
logger .trace ("[{}] retrieved current step key: {}" , indexMetadata .getIndex ().getName (), currentStepKey );
67
74
if (currentStepKey == null ) {
@@ -126,7 +133,7 @@ void runPeriodicStep(String policy, Metadata metadata, IndexMetadata indexMetada
126
133
LifecycleExecutionState lifecycleState = LifecycleExecutionState .fromIndexMetadata (indexMetadata );
127
134
final Step currentStep ;
128
135
try {
129
- currentStep = getCurrentStep (stepRegistry , policy , indexMetadata );
136
+ currentStep = getCurrentStep (stepRegistry , policy , indexMetadata , lifecycleState );
130
137
} catch (Exception e ) {
131
138
markPolicyRetrievalError (policy , indexMetadata .getIndex (), lifecycleState , e );
132
139
return ;
@@ -261,7 +268,7 @@ void maybeRunAsyncAction(ClusterState currentState, IndexMetadata indexMetadata,
261
268
LifecycleExecutionState lifecycleState = LifecycleExecutionState .fromIndexMetadata (indexMetadata );
262
269
final Step currentStep ;
263
270
try {
264
- currentStep = getCurrentStep (stepRegistry , policy , indexMetadata );
271
+ currentStep = getCurrentStep (stepRegistry , policy , indexMetadata , lifecycleState );
265
272
} catch (Exception e ) {
266
273
markPolicyRetrievalError (policy , indexMetadata .getIndex (), lifecycleState , e );
267
274
return ;
@@ -322,7 +329,7 @@ void runPolicyAfterStateChange(String policy, IndexMetadata indexMetadata) {
322
329
LifecycleExecutionState lifecycleState = LifecycleExecutionState .fromIndexMetadata (indexMetadata );
323
330
final Step currentStep ;
324
331
try {
325
- currentStep = getCurrentStep (stepRegistry , policy , indexMetadata );
332
+ currentStep = getCurrentStep (stepRegistry , policy , indexMetadata , lifecycleState );
326
333
} catch (Exception e ) {
327
334
markPolicyRetrievalError (policy , indexMetadata .getIndex (), lifecycleState , e );
328
335
return ;
0 commit comments