elastic / elasticsearch

Free and Open, Distributed, RESTful Search Engine
https://www.elastic.co/products/elasticsearch
Other
68.51k stars 24.33k forks source link

SLM acts as min_count =0 when Minimum number of snapshots is not specified #106584

Open hugh-tan opened 3 months ago

hugh-tan commented 3 months ago

Elasticsearch Version

8.12.2

Installed Plugins

No response

Java Version

bundled

OS Version

NA

Problem Description

SLM acts as min_count =0 when Minimum number of snapshots is not specified

When user doesn't specify the min_count in a SLM policy, SLM acts as min_count =0, which means the minimum number of snapshots to retain is zero. It will cause all snapshots to get deleted.

The questions in this issue

Steps to Reproduce

  1. create a test v8.12.2 environment on ESS

  2. generate some snapshots by manually running the default [cloud-snapshot-policy] SLM policy

  3. modify the default policy by removing the min_count e.g. API query

    PUT /_slm/policy/cloud-snapshot-policy?pretty
    {
    "retention": { 
    "expire_after": "5m", 
    "max_count": 1 
    }
    }

    # the expire_after is set to 5m to speed up the reproducing.

  4. Wait till the SLM snapshot retention executed, verify that all snapshots got deleted.

Logs (if relevant)

No response

elasticsearchmachine commented 3 months ago

Pinging @elastic/es-docs (Team:Docs)

elasticsearchmachine commented 3 months ago

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