Skip to content

Watcher attempts to use ILM when ILM is disabled #41042

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
gwbrown opened this issue Apr 9, 2019 · 1 comment · Fixed by #41087
Closed

Watcher attempts to use ILM when ILM is disabled #41042

gwbrown opened this issue Apr 9, 2019 · 1 comment · Fixed by #41087

Comments

@gwbrown
Copy link
Contributor

gwbrown commented Apr 9, 2019

Found in 7.0.0 (BC2), I think this impacts 6.7 as well.

To reproduce

Start a node with a trial license and xpack.ilm.enabled: false.

During startup, this message will appear in the logs:

java.lang.IllegalStateException: failed to find action [org.elasticsearch.xpack.core.indexlifecycle.action.PutLifecycleAction@d06806ea] to execute
	at org.elasticsearch.client.node.NodeClient.transportAction(NodeClient.java:116) ~[elasticsearch-7.0.0.jar:7.0.0]
	at org.elasticsearch.client.node.NodeClient.executeLocally(NodeClient.java:83) ~[elasticsearch-7.0.0.jar:7.0.0]
	at org.elasticsearch.client.node.NodeClient.doExecute(NodeClient.java:72) ~[elasticsearch-7.0.0.jar:7.0.0]
	at org.elasticsearch.client.support.AbstractClient.execute(AbstractClient.java:393) ~[elasticsearch-7.0.0.jar:7.0.0]
	at org.elasticsearch.xpack.core.indexlifecycle.client.ILMClient.putLifecyclePolicy(ILMClient.java:42) ~[?:?]
	at org.elasticsearch.xpack.watcher.support.WatcherIndexTemplateRegistry.lambda$putPolicy$3(WatcherIndexTemplateRegistry.java:195) ~[?:?]
	at org.elasticsearch.xpack.core.ClientHelper.executeAsyncWithOrigin(ClientHelper.java:82) ~[?:?]
	at org.elasticsearch.xpack.watcher.support.WatcherIndexTemplateRegistry.lambda$putPolicy$4(WatcherIndexTemplateRegistry.java:178) ~[?:?]
	at org.elasticsearch.common.util.concurrent.ThreadContext$ContextPreservingRunnable.run(ThreadContext.java:681) ~[elasticsearch-7.0.0.jar:7.0.0]
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) ~[?:?]
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) ~[?:?]
	at java.lang.Thread.run(Thread.java:835) [?:?]

Additionally, the index template will contain index.lfiecycle.name:

GET _template/.watch-history-9

{
  ".watch-history-9": {
    "order": 2147483647,
    "index_patterns": [
      ".watcher-history-9*"
    ],
    "settings": {
      "index": {
        "format": "6",
        "lifecycle": {
          "name": "watch-history-ilm-policy"
        },
        "number_of_shards": "1",
        "auto_expand_replicas": "0-1",
        "number_of_replicas": "0"
      }
    },
    "mappings": {[...elided for brevity...]},
    "aliases": {}
  }
}

The watch history index is created and records history just fine, although it too has index.lifecycle.name set (even though ILM is disabled):

GET .watcher-history-*

{
  ".watcher-history-9-2019.04.09": {
    "aliases": {},
    "mappings": {[...elided for brevity...]},
    "settings": {
      "index": {
        "lifecycle": {
          "name": "watch-history-ilm-policy"
        },
        "number_of_shards": "1",
        "auto_expand_replicas": "0-1",
        "provided_name": ".watcher-history-9-2019.04.09",
        "format": "6",
        "creation_date": "1554852639758",
        "number_of_replicas": "0",
        "uuid": "b4Mj6GgkQHSP77kyxH2DHA",
        "version": {
          "created": "7000099"
        }
      }
    }
  }
}

Root cause

I believe this is caused by the same root cause as #40803 - we check this setting via the cluster state:

boolean ilmSupported = XPackSettings.INDEX_LIFECYCLE_ENABLED.get(state.metaData().settings());

But since xpack.ilm.enabled can only be set via elasticsearch.yml, reading it from the cluster state will always result in the default value - it must be read from the Settings object created from elasticsearch.yml at startup.

@elasticmachine
Copy link
Collaborator

Pinging @elastic/es-core-features

@dakrone dakrone self-assigned this Apr 10, 2019
dakrone added a commit to dakrone/elasticsearch that referenced this issue Apr 10, 2019
Prior to this we used the settings from cluster state to see whether ILM was
enabled of disabled, however, these settings don't accurately reflect the
`xpack.ilm.enabled` setting in `elasticsearch.yml`.

This commit changes to using the `Environment` settings, which correctly reflect
the ILM enabled setting.

Resolves elastic#41042
dakrone added a commit that referenced this issue Apr 12, 2019
…#41087)

* Use environment settings instead of state settings for Watcher config

Prior to this we used the settings from cluster state to see whether ILM was
enabled of disabled, however, these settings don't accurately reflect the
`xpack.ilm.enabled` setting in `elasticsearch.yml`.

This commit changes to using the `Environment` settings, which correctly reflect
the ILM enabled setting.

Resolves #41042

* Rename settings object to nodeSettings

* Use correct template list in WatcherRestIT

* Use correct template list in other tests
dakrone added a commit to dakrone/elasticsearch that referenced this issue Apr 12, 2019
…elastic#41087)

* Use environment settings instead of state settings for Watcher config

Prior to this we used the settings from cluster state to see whether ILM was
enabled of disabled, however, these settings don't accurately reflect the
`xpack.ilm.enabled` setting in `elasticsearch.yml`.

This commit changes to using the `Environment` settings, which correctly reflect
the ILM enabled setting.

Resolves elastic#41042

* Rename settings object to nodeSettings

* Use correct template list in WatcherRestIT

* Use correct template list in other tests
dakrone added a commit to dakrone/elasticsearch that referenced this issue Apr 12, 2019
…elastic#41087)

* Use environment settings instead of state settings for Watcher config

Prior to this we used the settings from cluster state to see whether ILM was
enabled of disabled, however, these settings don't accurately reflect the
`xpack.ilm.enabled` setting in `elasticsearch.yml`.

This commit changes to using the `Environment` settings, which correctly reflect
the ILM enabled setting.

Resolves elastic#41042

* Rename settings object to nodeSettings

* Use correct template list in WatcherRestIT

* Use correct template list in other tests
dakrone added a commit that referenced this issue Apr 12, 2019
…config (#41157)

Backport of (#41087)

* Use environment settings instead of state settings for Watcher config

Prior to this we used the settings from cluster state to see whether ILM was
enabled of disabled, however, these settings don't accurately reflect the
`xpack.ilm.enabled` setting in `elasticsearch.yml`.

This commit changes to using the `Environment` settings, which correctly reflect
the ILM enabled setting.

Resolves #41042
dakrone added a commit that referenced this issue Apr 12, 2019
…config (#41158)

Backport of (#41087)

* Use environment settings instead of state settings for Watcher config

Prior to this we used the settings from cluster state to see whether ILM was
enabled of disabled, however, these settings don't accurately reflect the
`xpack.ilm.enabled` setting in `elasticsearch.yml`.

This commit changes to using the `Environment` settings, which correctly reflect
the ILM enabled setting.

Resolves #41042
gurkankaymak pushed a commit to gurkankaymak/elasticsearch that referenced this issue May 27, 2019
…elastic#41087)

* Use environment settings instead of state settings for Watcher config

Prior to this we used the settings from cluster state to see whether ILM was
enabled of disabled, however, these settings don't accurately reflect the
`xpack.ilm.enabled` setting in `elasticsearch.yml`.

This commit changes to using the `Environment` settings, which correctly reflect
the ILM enabled setting.

Resolves elastic#41042

* Rename settings object to nodeSettings

* Use correct template list in WatcherRestIT

* Use correct template list in other tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants