Stuck in "Attempting to transition"

I’ve been trying out managed indexes. Setup and getting the initial state seem fine, however all my indexes show an action of “Transition” with info listed as “Attempting to Transition”.

Is this expected behavior? Are there instructions for where I can go to debug/diagnose further?

Hi @tschaible,

The “transition” action is the internal action used for transitioning between states. It means your managed index has finished the actions in its current state and is attempting to transition to a new one which will happen once the condition is true.

Can you post an example of your policy and an index status so we can see what it’s waiting for?

Sure, the index policy is meant to manage indexes auto-created by fluentd. Fluentd creates them with a date-key automatically. The example is below, but it’s intended to simply start them as “hot”, move them to “cold” (read-only) after the day is done, and then delete them after 30 days.

{
    "policy": {
        "policy_id": "hot-cold-delete",
        "description": "A simple default policy that changes the replica count between hot and cold states.",
        "last_updated_time": 1581629650252,
        "schema_version": 1,
        "error_notification": null,
        "default_state": "hot",
        "states": [
            {
                "name": "hot",
                "actions": [
                    {
                        "replica_count": {
                            "number_of_replicas": 1
                        }
                    }
                ],
                "transitions": [
                    {
                        "state_name": "cold",
                        "conditions": {
                            "min_index_age": "7d"
                        }
                    }
                ]
            },
            {
                "name": "cold",
                "actions": [
                    {
                        "read_only": {}
                    }
                ],
                "transitions": [
                    {
                        "state_name": "delete",
                        "conditions": {
                            "min_index_age": "30d"
                        }
                    }
                ]
            },
            {
                "name": "delete",
                "actions": [
                    {
                        "delete": {}
                    }
                ],
                "transitions": []
            }
        ]
    }
}

I currently have 2 indexes (yesterdays and todays) in the “hot” state, with the status attempting to transition.

If I read your description correctly, this is actually expected behavior. It is “attempting to transition” as it is waiting for the minimum index age to reach 7 days to transition to “cold”, and it should actually transition when the minimum index age is reached.

If that’s all correct, I understand better. The “Attempting to transition” description through me off. If it’s helpful at all, a description of “Waiting for condition” or even documentation describing the normal workflow would be helpful. If there’s anything I can help to document to make that clearer for others, please just point me in the right direction.

Yep, that’s the correct behavior. It’s now waiting for the condition to be met before it transitions to the specified state.

Agree, we can better document and give better messages. Possibly listing the different conditions checked and the current values might be helpful. Will create a GitHub issue for this.

This alone is very helpful, and any time you run in to things that seem confusing or you don’t understand, please reach out. Helps us better solidify the plugin :slight_smile:

Thanks!

3 Likes

Hello, it doesn’t work in my case and stuck in this state.
My index is actually older than 7 days, but it is still in the hot phase.
What should I do?

{
    "id": "opensearch_prod_app_logs_delete_after_90d",
    "seqNo": 50341,
    "primaryTerm": 1,
    "policy": {
        "policy_id": "opensearch_prod_app_logs_delete_after_90d",
        "description": "A policy that changes the replica count between hot and warm states, and delete indexes after 90 days",
        "last_updated_time": 1647604204361,
        "schema_version": 12,
        "error_notification": null,
        "default_state": "hot",
        "states": [
            {
                "name": "hot",
                "actions": [
                    {
                        "replica_count": {
                            "number_of_replicas": 1
                        }
                    }
                ],
                "transitions": [
                    {
                        "state_name": "warm",
                        "conditions": {
                            "min_index_age": "7d"
                        }
                    }
                ]
            },
            {
                "name": "warm",
                "actions": [
                    {
                        "replica_count": {
                            "number_of_replicas": 0
                        }
                    },
                    {
                        "warm_migration": {}
                    }
                ],
                "transitions": [
                    {
                        "state_name": "delete",
                        "conditions": {
                            "min_index_age": "90d"
                        }
                    }
                ]
            },
            {
                "name": "delete",
                "actions": [
                    {
                        "delete": {}
                    }
                ],
                "transitions": []
            }
        ],
        "ism_template": [
            {
                "index_patterns": [
                    "prod-app-*"
                ],
                "priority": 100,
                "last_updated_time": 1647604204361
            }
        ]
    }
}

Hi @okapko,

How long has it been in the Evaluating transitions phase? If it just moved into that then it can take up to 30-48 minutes to actually trigger the transition.

Otherwise can you post the response of these two API calls (and redact anything you need to):

GET _opendistro/_ism/explain/<INDEX_THAT_IS_STUCK>
GET <INDEX_THAT_IS_STUCK>/_settings

Actually, I recently updated the State management policy and decreased the transition period for the hot → warm phase from 26 days to 7 days to check how it works and how quick search works over warm indexes.
So at this moment, I’ve got a few dozens of indexes that are older than 7 days, but they are still in the hot phase. I updated the State management policy a few hours ago, but still, no one index is moved to the warm phase.
I’m using Amazon OpenSearch Service (successor to Amazon Elasticsearch Service) v1.1 (latest).

When you make changes to a policy, it does not retroactively apply to existing indices that are using that policy. This is to ensure that those existing indices don’t enter a bad state depending on what the change to the policy was. So from the sounds of it, those indices are still using the policy with the 26 days condition, and you need to use the Change Policy API on them to have them change their attached policy to the updated one.

Something like:

POST _opendistro/_ism/change_policy/<YOUR_INDEX>
{
  "policy_id": "opensearch_prod_app_logs_delete_after_90d"
}

And then on the next execution for that index it should swap the policy to the new one (and I forget off the top of my head, but it might then need a second execution before it actually starts executing it, i.e. checking the updated transition condition).

2 Likes

Thanks, @dbbaughe Got it. Will try to do it using Change Policy API.

POST _opendistro/_ism/change_policy/prod-app-blah-blah-2022.03.09
{
  "policy_id": "opensearch_prod_app_logs_delete_after_90d"
}

GET _opendistro/_ism/explain/prod-app-blah-blah-api-2022.03.09

{
  "prod-app-worldpac-api-2022.03.09" : {
    "index.plugins.index_state_management.policy_id" : "opensearch_prod_app_logs_delete_after_90d",
    "index.opendistro.index_state_management.policy_id" : "opensearch_prod_app_logs_delete_after_90d",
    "index" : "prod-app-blah-blah-api-2022.03.09",
    "index_uuid" : "ZgKNtpXYRHGzRrpSBwX3CA",
    "policy_id" : "opensearch_prod_app_logs_delete_after_90d",
    "policy_seq_no" : -2,
    "policy_primary_term" : 0,
    "index_creation_date" : 1646784009914,
    "state" : {
      "name" : "hot",
      "start_time" : 1646786778866
    },
    "action" : {
      "name" : "transition",
      "start_time" : 1646789696534,
      "index" : -1,
      "failed" : false,
      "consumed_retries" : 0,
      "last_retry_time" : 0
    },
    "step" : {
      "name" : "attempt_transition",
      "start_time" : 1646789696842,
      "step_status" : "condition_not_met"
    },
    "retry_info" : {
      "failed" : false,
      "consumed_retries" : 0
    },
    "info" : {
      "message" : "Evaluating transition conditions [index=prod-app-blah-blah-api-2022.03.09]"
    },
    "enabled" : true
  },
  "total_managed_indices" : 1
}
1 Like


UPDATE
It’s working, thanks a lot @dbbaughe

2 Likes