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

[BUG] Shrink and delete policy with single shard index deletes all data #1274

Open
lockwooddev opened this issue Oct 13, 2024 · 1 comment
Open
Labels
bug Something isn't working

Comments

@lockwooddev
Copy link

What is the bug?

A policy with a shrink and consecutive delete on a single sharded index will not shrink, but immediately run the delete action an therefore remove all original data without warning.

How can one reproduce the bug?

{
    "policy": {
        "policy_id": "my-policy",
        "description": "",
        "default_state": "rollover",
        "states": [
            {
                "name": "rollover",
                "actions": [
                    {
                        "rollover": {
                            "min_size": "20gb",
                            "min_index_age": "1d"
                        }
                    }
                ],
                "transitions": [
                    {
                        "state_name": "merge"
                    }
                ]
            },
            {
                "name": "merge",
                "actions": [
                    {
                        "shrink": {
                            "num_new_shards": 1
                        }
                    }
                ],
                "transitions": [
                    {
                        "state_name": "delete"
                    }
                ]
            },
            {
                "name": "delete",
                "actions": [
                    {
                        "delete": {}
                    }
                ]
            }
        ],
        "ism_template": [
            {
                "index_patterns": [
                    "my-index*"
                ],
                "priority": 100
            }
        ]
    }
}

What is the expected behavior?

I would expect it to block the delete as this combination would cause data loss

What is your host/environment?

OpenSearch 2.9.0

@bharath-techie
Copy link

[ Triage attendees - 1 2 3 4]

Would you like to open a PR for the same issue to handle the race condition ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Todo
Development

No branches or pull requests

2 participants