Skip to content
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

Updating unchanged ILM policies is not idempotent. #82065

Closed
apollo13 opened this issue Dec 23, 2021 · 1 comment · Fixed by #82240
Closed

Updating unchanged ILM policies is not idempotent. #82065

apollo13 opened this issue Dec 23, 2021 · 1 comment · Fixed by #82240
Assignees
Labels
>bug :Data Management/ILM+SLM Index and Snapshot lifecycle management Team:Data Management Meta label for data/management team

Comments

@apollo13
Copy link

Elasticsearch version (bin/elasticsearch --version): docker.elastic.co/elasticsearch/elasticsearch:7.16.2-amd64

Plugins installed: Whatever the docker container ships

JVM version (java -version): Whatever the docker container ships

OS version (uname -a if on a Unix-like system): Whatever the docker container ships

Description of the problem including expected versus actual behavior:

Updating an ILM policy always increases the version of the stored policy. @DaveCTurner suggested to open an issue here. I did not check if other operations (updating index templates and mappings) are idempotent or not.

Steps to reproduce:

  1. docker run --rm -it -p 9200:9200 -e "discovery.type=single-node" -e "logger.org.elasticsearch=DEBUG" docker.elastic.co/elasticsearch/elasticsearch:7.16.2-amd64
  2. Execute:
curl -XPUT "http://localhost:9200/_ilm/policy/my_policy" -H 'Content-Type: application/json' -d'{    "policy" : {      "phases" : {        "warm" : {          "min_age" : "10d",          "actions" : {            "forcemerge" : {              "max_num_segments" : 1            }          }        },        "delete" : {          "min_age" : "30d",          "actions" : {            "delete" : {              "delete_searchable_snapshot" : true            }          }        }      }    }}'

multiple times
3. Check the ILM version: curl http://localhost:9200/_ilm/policy/my_policy
4. The returned version is greater than 1 even though nothing changed

Provide logs (if relevant):

{"type": "server", "timestamp": "2021-12-23T13:49:21,187Z", "level": "DEBUG", "component": "o.e.c.s.MasterService", "cluster.name": "docker-cluster", "node.name": "bf70a0fe0f7e", "message": "executing cluster state update for [put-lifecycle-my_policy]", "cluster.uuid": "aXsX_Ks1QpiwA-BiYs8kDQ", "node.id": "AgZJParzQPy5L6a5EMU0Lw"  }
{"type": "server", "timestamp": "2021-12-23T13:49:21,188Z", "level": "INFO", "component": "o.e.x.i.a.TransportPutLifecycleAction", "cluster.name": "docker-cluster", "node.name": "bf70a0fe0f7e", "message": "updating index lifecycle policy [my_policy]", "cluster.uuid": "aXsX_Ks1QpiwA-BiYs8kDQ", "node.id": "AgZJParzQPy5L6a5EMU0Lw"  }
{"type": "server", "timestamp": "2021-12-23T13:49:21,189Z", "level": "DEBUG", "component": "o.e.x.c.i.PhaseCacheManagement", "cluster.name": "docker-cluster", "node.name": "bf70a0fe0f7e", "message": "policy [my_policy] is unchanged and no phase definition refresh is needed", "cluster.uuid": "aXsX_Ks1QpiwA-BiYs8kDQ", "node.id": "AgZJParzQPy5L6a5EMU0Lw"  }
{"type": "server", "timestamp": "2021-12-23T13:49:21,189Z", "level": "DEBUG", "component": "o.e.c.s.MasterService", "cluster.name": "docker-cluster", "node.name": "bf70a0fe0f7e", "message": "took [1ms] to compute cluster state update for [put-lifecycle-my_policy]", "cluster.uuid": "aXsX_Ks1QpiwA-BiYs8kDQ", "node.id": "AgZJParzQPy5L6a5EMU0Lw"  }
{"type": "server", "timestamp": "2021-12-23T13:49:21,189Z", "level": "DEBUG", "component": "o.e.c.s.MasterService", "cluster.name": "docker-cluster", "node.name": "bf70a0fe0f7e", "message": "cluster state updated, version [65], source [put-lifecycle-my_policy]", "cluster.uuid": "aXsX_Ks1QpiwA-BiYs8kDQ", "node.id": "AgZJParzQPy5L6a5EMU0Lw"  }
@apollo13 apollo13 added >bug needs:triage Requires assignment of a team area label labels Dec 23, 2021
@DaveCTurner DaveCTurner added the :Data Management/ILM+SLM Index and Snapshot lifecycle management label Dec 23, 2021
@elasticmachine elasticmachine added the Team:Data Management Meta label for data/management team label Dec 23, 2021
@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-data-management (Team:Data Management)

@DaveCTurner DaveCTurner added Team:Data Management Meta label for data/management team and removed Team:Data Management Meta label for data/management team needs:triage Requires assignment of a team area label labels Dec 23, 2021
dakrone added a commit to dakrone/elasticsearch that referenced this issue Jan 5, 2022
This commit makes `PUT`-ing an ILM policy that does not change a no-op, neither incrementing the
version nor creating a new cluster state.

Resolves elastic#82065
@dakrone dakrone self-assigned this Jan 5, 2022
elasticsearchmachine pushed a commit that referenced this issue Jan 5, 2022
This commit makes `PUT`-ing an ILM policy that does not change a no-op,
neither incrementing the version nor creating a new cluster state.
Resolves #82065
dakrone added a commit to dakrone/elasticsearch that referenced this issue Jan 5, 2022
This commit makes `PUT`-ing an ILM policy that does not change a no-op,
neither incrementing the version nor creating a new cluster state.
Resolves elastic#82065
elasticsearchmachine pushed a commit that referenced this issue Jan 6, 2022
This commit makes `PUT`-ing an ILM policy that does not change a no-op,
neither incrementing the version nor creating a new cluster state.
Resolves #82065
astefan pushed a commit to astefan/elasticsearch that referenced this issue Jan 7, 2022
This commit makes `PUT`-ing an ILM policy that does not change a no-op,
neither incrementing the version nor creating a new cluster state.
Resolves elastic#82065
astefan pushed a commit to astefan/elasticsearch that referenced this issue Jan 7, 2022
This commit makes `PUT`-ing an ILM policy that does not change a no-op,
neither incrementing the version nor creating a new cluster state.
Resolves elastic#82065
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 Team:Data Management Meta label for data/management team
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants