Skip to content

Moving directly to copy_execution_state step in ILM causes NullPointerException #35567

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
dakrone opened this issue Nov 14, 2018 · 1 comment
Closed
Assignees
Labels
>bug :Data Management/ILM+SLM Index and Snapshot lifecycle management

Comments

@dakrone
Copy link
Member

dakrone commented Nov 14, 2018

When moving directly to the copy_execution_state step using move-to-step, a
NullPointerException shows up as the cause of the error step. Rather than
running into this, we should guard against this and return a more helpful
exception to the user to let them know how to fix it.

Reproduction:

PUT _ilm/policy/my_lifecycle3
{
  "policy": {
    "phases": {
      "hot": {
        "min_age": "20m",
        "actions": {
          "rollover": {
            "max_age": "5s"
          }
        }
      },
      "warm": {
        "min_age": "5s",
        "actions": {
          "forcemerge": {
            "max_num_segments": 1
          },
          "shrink": {
            "number_of_shards": 1
          },
          "allocate": {
            "include": {
              "type": ""
            },
            "exclude": {},
            "require": {}
          }
        }
      },
      "cold": {
        "min_age": "10s",
        "actions": {
          "allocate": {
            "number_of_replicas": 2,
            "include": {
              "type": "cold"
            },
            "exclude": {},
            "require": {}
          }
        }
      },
      "delete": {
        "min_age": "2m",
        "actions": {
          "delete": {}
        }
      }
    }
  }
}

PUT _template/my_template
{
  "index_patterns": ["test-*"],
  "settings": {
    "number_of_shards": 2,
    "number_of_replicas": 1,
    "index.lifecycle.name": "my_lifecycle3",
    "index.lifecycle.rollover_alias": "test-alias",
    "index.routing.allocation.include.type": "hot"
  }
}

PUT test-000001
{
  "aliases": {
    "test-alias":{
      "is_write_index": true
    }
  }
}

POST /_ilm/move/test-000001
{
  "current_step": {
    "phase": "new",
    "action": "complete",
    "name": "complete"
  },
  "next_step": {
    "phase": "warm",
    "action": "shrink",
    "name": "copy_execution_state"
  }
}

GET /*/_ilm/explain

Produces the following JSON:

{
  "indices" : {
    "test-000001" : {
      "index" : "test-000001",
      "managed" : true,
      "policy" : "my_lifecycle3",
      "lifecycle_date_millis" : 1542235008615,
      "phase" : "warm",
      "phase_time_millis" : 1542235010235,
      "action" : "shrink",
      "action_time_millis" : 1542235010235,
      "step" : "ERROR",
      "step_time_millis" : 1542235010250,
      "failed_step" : "copy_execution_state",
      "step_info" : {
        "type" : "null_pointer_exception",
        "reason" : null,
        "stack_trace" : "java.lang.NullPointerException\n\tat org.elasticsearch.cluster.metadata.IndexMetaData$Builder.<init>(IndexMetaData.java:858)\n\tat org.elasticsearch.cluster.metadata.IndexMetaData.builder(IndexMetaData.java:829)\n\tat org.elasticsearch.xpack.core.indexlifecycle.CopyExecutionStateStep.performAction(CopyExecutionStateStep.java:67)\n\tat org.elasticsearch.xpack.indexlifecycle.ExecuteStepsUpdateTask.execute(ExecuteStepsUpdateTask.java:96)\n\tat org.elasticsearch.cluster.ClusterStateUpdateTask.execute(ClusterStateUpdateTask.java:47)\n\tat org.elasticsearch.cluster.service.MasterService.executeTasks(MasterService.java:642)\n\tat org.elasticsearch.cluster.service.MasterService.calculateTaskOutputs(MasterService.java:271)\n\tat org.elasticsearch.cluster.service.MasterService.runTasks(MasterService.java:201)\n\tat org.elasticsearch.cluster.service.MasterService$Batcher.run(MasterService.java:136)\n\tat org.elasticsearch.cluster.service.TaskBatcher.runIfNotProcessed(TaskBatcher.java:150)\n\tat org.elasticsearch.cluster.service.TaskBatcher$BatchedTask.run(TaskBatcher.java:188)\n\tat org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:627)\n\tat org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.runAndClean(PrioritizedEsThreadPoolExecutor.java:244)\n\tat org.elasticsearch.common.util.concurrent.PrioritizedEsThreadPoolExecutor$TieBreakingPrioritizedRunnable.run(PrioritizedEsThreadPoolExecutor.java:207)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128)\n\tat java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628)\n\tat java.base/java.lang.Thread.run(Thread.java:834)\n"
      },
      "phase_execution" : {
        "policy" : "my_lifecycle3",
        "phase_definition" : {
          "min_age" : "5s",
          "actions" : {
            "allocate" : {
              "include" : {
                "type" : ""
              },
              "exclude" : { },
              "require" : { }
            },
            "shrink" : {
              "number_of_shards" : 1
            },
            "forcemerge" : {
              "max_num_segments" : 1
            }
          }
        },
        "version" : 1,
        "modified_date_in_millis" : 1542235004651
      }
    }
  }
}
@dakrone dakrone added >bug :Data Management/ILM+SLM Index and Snapshot lifecycle management labels Nov 14, 2018
@dakrone dakrone self-assigned this Nov 14, 2018
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-infra

dakrone added a commit to dakrone/elasticsearch that referenced this issue Nov 14, 2018
In the event that the target index does not exist when `CopyExecutionStateStep`
executes, this avoids a `NullPointerException` and provides a more helpful error
to the ILM user.

Resolves elastic#35567
dakrone added a commit that referenced this issue Nov 15, 2018
In the event that the target index does not exist when `CopyExecutionStateStep`
executes, this avoids a `NullPointerException` and provides a more helpful error
to the ILM user.

Resolves #35567
dakrone added a commit that referenced this issue Nov 15, 2018
In the event that the target index does not exist when `CopyExecutionStateStep`
executes, this avoids a `NullPointerException` and provides a more helpful error
to the ILM user.

Resolves #35567
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
>bug :Data Management/ILM+SLM Index and Snapshot lifecycle management
Projects
None yet
Development

No branches or pull requests

5 participants