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
52 stars 107 forks source link

[BUG] Get policies misses policy #1194

Open Jakob3xD opened 2 weeks ago

Jakob3xD commented 2 weeks ago

What is the bug? I one of my Opensearch Clusters I have 21 policies but the GET _plugins/_ism/policies counts 21 policies and only returns 20 policies. It omits one specific policy with the name shrink_delete. I can get, update, delete and recreate the policy. I can also use it but it wont show up in the reponse of the API get request. It seems like it is cached some where causing this issue. Even deleting the .opendistro-ism-config and recreating all policies did not help. A full cluster restart did not help. What I found odd, is the fact that the opensearch dashboard returns the policy when calling https://your-dashobard.exampley/api/ism/policies?from=0&size=100&search=&sortField=id&sortDirection=desc.

This issues i causing my custom tool to fail, as it does not expect the shrink_delete policy to exist and therefore does not habe a seq_no and primary_term.

How can one reproduce the bug? I don't think there is a way to reproduce it in a simple way.

What is the expected behavior? I would expect that 21 policies are getting returned.

What is your host/environment?

Do you have any screenshots?

{
  "policies": [
    {
      "_id": "archive-delete-365d",
      "_seq_no": 13907,
      "_primary_term": 4,
      "policy": {...}
    },
    {
      "_id": "archive-delete-365d-bmc",
      "_seq_no": 443,
      "_primary_term": 4,
      "policy": {...}
    },
    {
      "_id": "archive-delete-365d-gibber",
      "_seq_no": 444,
      "_primary_term": 4,
      "policy": {...}
    },
    {
      "_id": "archive-delete-365d-qemu-events",
      "_seq_no": 441,
      "_primary_term": 4,
      "policy": {...}
    },
    {
      "_id": "archive-delete-365d-qemu-instance",
      "_seq_no": 440,
      "_primary_term": 4,
      "policy": {...}
    },
    {
      "_id": "archive-delete-365d-trainman",
      "_seq_no": 442,
      "_primary_term": 4,
      "policy": {...}
    },
    {
      "_id": "cleanup_14d",
      "_seq_no": 13890,
      "_primary_term": 4,
      "policy": {...}
    },
    {
      "_id": "cleanup_2d",
      "_seq_no": 13891,
      "_primary_term": 4,
      "policy": {...}
    },
    {
      "_id": "cleanup_30d",
      "_seq_no": 13892,
      "_primary_term": 4,
      "policy": {...}
    },
    {
      "_id": "cleanup_365d",
      "_seq_no": 13893,
      "_primary_term": 4,
      "policy": {...}
    },
    {
      "_id": "cleanup_90d",
      "_seq_no": 13894,
      "_primary_term": 4,
      "policy": {...}
    },
    {
      "_id": "cleanup_9d",
      "_seq_no": 13895,
      "_primary_term": 4,
      "policy": {...}
    },
    {
      "_id": "datastream_14d",
      "_seq_no": 13902,
      "_primary_term": 4,
      "policy": {...}
    },
    {
      "_id": "datastream_30d",
      "_seq_no": 13901,
      "_primary_term": 4,
      "policy": {...}
    },
    {
      "_id": "datastream_60d",
      "_seq_no": 13903,
      "_primary_term": 4,
      "policy": {...}
    },
    {
      "_id": "datastream_8d",
      "_seq_no": 13900,
      "_primary_term": 4,
      "policy": {...}
    },
    {
      "_id": "datastream_90d",
      "_seq_no": 13904,
      "_primary_term": 4,
      "policy": {...}
    },
    {
      "_id": "datastream_snapshot",
      "_seq_no": 13905,
      "_primary_term": 4,
      "policy": {...}
    },
    {
      "_id": "rollover_delete",
      "_seq_no": 13896,
      "_primary_term": 4,
      "policy": {...}
    },
    {
      "_id": "rollover_merge",
      "_seq_no": 13898,
      "_primary_term": 4,
      "policy": {...}
    }
  ],
  "total_policies": 21
}