Skip to content

Updating ILM policy for an index while in the same phase does not respect new policy's same phase's min_age #35356

Closed
@dakrone

Description

@dakrone

If I have two competing policies:

PUT _ilm/policy/my_lifecycle3
{
  "policy": {
    "phases": {
      "warm": {
        "min_age": "30s",
        "actions": {
          "forcemerge": {
            "max_num_segments": 1
          },
          "shrink": {
            "number_of_shards": 1
          },
          "allocate": {
            "include": {
              "type": ""
            },
            "exclude": {},
            "require": {}
          }
        }
      },
      "cold": {
        "min_age": "60s",
        "actions": {
          "allocate": {
            "number_of_replicas": 2,
            "include": {
              "type": "cold"
            },
            "exclude": {},
            "require": {}
          }
        }
      },
      "delete": {
        "min_age": "2m",
        "actions": {
          "delete": {}
        }
      }
    }
  }
}

And an alternate policy:

PUT _ilm/policy/newpolicy
{
  "policy": {
    "phases": {
      "warm": {
        "min_age": "100m",
        "actions": {
          "forcemerge": {
            "max_num_segments": 1
          },
          "allocate": {
            "number_of_replicas": 2,
            "include": {
              "type": "cold"
            },
            "exclude": {},
            "require": {}
          }
        }
      },
      "delete": {
        "min_age": "200m",
        "actions": {
          "delete": {}
        }
      }
    }
  }
}

And I create an index with the first policy (where the "warm phase kicks in at
30 seconds"):

PUT /foo
{
  "settings": {
    "index.lifecycle.name": "my_lifecycle3",
    "index.number_of_shards": 2
  }
}

Then wait at least 30 seconds until the "foo" index is in the
warm/complete/complete action (meaning everything in the warm phase has
finished, the index is between 30 and 60 seconds old)

Next, I update the policy for the "foo" index to use the "newpolicy", which has
a "warm" phase with a min_age of 100 minutes:

PUT /foo/_settings
{
  "index.lifecycle.name": "newpolicy"
}

The step info for the foo index is still at warm/complete/complete, meaning
that it has now skipped the steps that would normally occur in the newpolicy
"warm" phase, even though the index is not old enough yet to transition into the
"warm" phase with the new policy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    :Data Management/ILM+SLMIndex and Snapshot lifecycle management>docsGeneral docs changes

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions