Skip to content

Allow updating cached rollover criteria when ILM policy changes #129800

Open
@dakrone

Description

@dakrone

Description

We currently cache the phase definition for an ILM policy, only updating it if the policy itself changes to something where we can safely refresh the JSON without losing our place. However, if an entirely new ILM policy is used (i.e., the index.lifecycle.name setting is changed), then we do not update the cached phase JSON, and rollover will continue to use the "old" criteria.

Reproduction:

# create datastream, issue this a few times
POST logs-bar-baz2/_doc
{
  "message": "hello world"
}
# check ilm policy, will be default "logs" with 30d / 50GB
GET logs-bar-baz2?filter_path=*.settings.index.lifecycle
# create ILM plicy that rolls at 2 docs
PUT _ilm/policy/test1
{
  "policy": {
    "phases": {
      "hot": {
        "min_age": "1d",
        "actions": {
          "set_priority": {
            "priority": 100
          },
          "rollover": {
            "max_docs": 2
          }
        }
      }
    }
  }
}
PUT _data_stream/logs-bar-baz2/_settings
{
    "index.lifecycle.name" : "test1"
}
GET logs-bar-baz2/_ilm/explain?human=true

Ideally, we would try to refresh the cached phase JSON in this case, so that the rollover step can use the most recent criteria for determining when to roll over.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions