Skip to content

Commit 7d4c386

Browse files
committed
[ILM] Add null check to CopyExecutionStateStep (#34619)
Adds a null check for IndexMetaData similar to those in #33455.
1 parent 06b9ecf commit 7d4c386

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

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

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
package org.elasticsearch.xpack.core.indexlifecycle;
88

9+
import org.apache.logging.log4j.LogManager;
10+
import org.apache.logging.log4j.Logger;
911
import org.elasticsearch.cluster.ClusterState;
1012
import org.elasticsearch.cluster.metadata.IndexMetaData;
1113
import org.elasticsearch.cluster.metadata.MetaData;
@@ -21,8 +23,12 @@
2123
*/
2224
public class CopyExecutionStateStep extends ClusterStateActionStep {
2325
public static final String NAME = "copy_execution_state";
26+
27+
private static final Logger logger = LogManager.getLogger(CopyExecutionStateStep.class);
28+
2429
private String shrunkIndexPrefix;
2530

31+
2632
public CopyExecutionStateStep(StepKey key, StepKey nextStepKey, String shrunkIndexPrefix) {
2733
super(key, nextStepKey);
2834
this.shrunkIndexPrefix = shrunkIndexPrefix;
@@ -35,6 +41,11 @@ String getShrunkIndexPrefix() {
3541
@Override
3642
public ClusterState performAction(Index index, ClusterState clusterState) {
3743
IndexMetaData indexMetaData = clusterState.metaData().index(index);
44+
if (indexMetaData == null) {
45+
// Index must have been since deleted, ignore it
46+
logger.debug("[{}] lifecycle action for index [{}] executed but index no longer exists", getKey().getAction(), index.getName());
47+
return clusterState;
48+
}
3849
// get source index
3950
String indexName = indexMetaData.getIndex().getName();
4051
// get target shrink index

0 commit comments

Comments
 (0)