Elasticsearch IndexLifecycleRunner part of source code, log level Setting is not appropriate?

Hi,
Recently, I've been reading the source code of the latest version (8.7.1) of Elasticsearch and I have a question about the log level settings that I can't figure out.
I noticed that the "current step [{}] for index [{}] with policy [{}] is not recognized" issue in runPolicyAfterStateChange function and runPeriodicStep function in Elasticsearch/xpack/ilm/IndexLifecycleRunner.java are logged as an error level:

if (currentStep == null) {
            if (stepRegistry.policyExists(policy) == false) {
                markPolicyDoesNotExist(policy, indexMetadata.getIndex(), lifecycleState);
                return;
            } else {
                Step.StepKey currentStepKey = Step.getCurrentStepKey(lifecycleState);
                if (TerminalPolicyStep.KEY.equals(currentStepKey)) {
                    // This index is a leftover from before we halted execution on the final phase
                    // instead of going to the completed phase, so it's okay to ignore this index
                    // for now
                    return;
                }
                logger.error("current step [{}] for index [{}] with policy [{}] is not recognized", currentStepKey, index, policy);
                return;
            }
        }

but in the same java file as above, the same issue in runPeriodicStep function is logged as a warn level:

 if (currentStep == null) {
            Step.StepKey currentStepKey = Step.getCurrentStepKey(lifecycleState);
            if (TerminalPolicyStep.KEY.equals(currentStepKey)) {
                // This index is a leftover from before we halted execution on the final phase
                // instead of going to the completed phase, so it's okay to ignore this index
                // for now
                return;
            }
            logger.warn("current step [{}] for index [{}] with policy [{}] is not recognized", currentStepKey, index, policy);
            return;
        }

After reading the context and comments, I found that the only difference in the code is "stepRegistry.policyExists(policy) == false" this condition, but I think the latter code snippet handles more cases than the former (it doesn't exclude the ==false case),so why is the log record level of the latter code snippet lower? Or does the use of warn have a different explanation here?
thanks

Does anyone have a comment?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.