Skip to content

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

Open
@lockwooddev

Description

@lockwooddev

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    Todo

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions