opensearch-project / index-management

🗃 Automate periodic data operations, such as deleting indices at a certain age or performing a rollover at a certain size
https://opensearch.org/docs/latest/im-plugin/index/
Apache License 2.0
53 stars 108 forks source link

[BUG] Listing snapshot-management policies fails when the ism index is not yet created #1055

Closed aggarwalShivani closed 5 months ago

aggarwalShivani commented 7 months ago

What is the bug? Index-management plugin is installed in Opensearch. No policies are created yet, so the index .opendistro-ism-config does not exist yet.

Listing ism policies does not fail, and prints an empty list.

$ curl 127.0.0.1:9200/_plugins/_ism/policies
{"policies":[],"total_policies":0}

However, listing snapshot-management policies throws an exception due to absence of the index.

curl 127.0.0.1:9200/_plugins/_sm/policies
{"error":{"root_cause":[{"type":"status_exception","reason":"Snapshot management config index not found"}],"type":"status_exception","reason":"Snapshot management config index not found"},"status":404}

How can one reproduce the bug? Steps to reproduce the behavior:

  1. Install Opensearch with index-management plugin
  2. After the cluster is ready (healthy), run the above mentioned GET cmds to list ism and sm policies.
  3. See error while listing sm policies.

What is the expected behavior? Like ism policies, even the sm api could respond with an empty list, instead of an exception.

What is your host/environment?

aggarwalShivani commented 7 months ago

Hi The expectation is consistent behaviour between ism and sm policies. Either both APIs must throw similar exception when the index does not exist, or both should return an empty list. Request feedback from repo maitainers to decide next steps for this issue,

aggarwalShivani commented 7 months ago

Hi, Request feedback from maintainers on whether the requested change is valid/desirable from the plugin's design, and if yes, I would be interested to pick this item to contribute.

aggarwalShivani commented 6 months ago

Hi, Gentle reminder: Request feedback from maintainers on this issue. If this change is desirable, I would be interested to start working on the PR. I have already identified a potential fix.

aggarwalShivani commented 6 months ago

Hi, I have raised a PR for this change. Request maintainers for review and feedback.

aggarwalShivani commented 5 months ago

Issue fixed with https://github.com/opensearch-project/index-management/pull/1072