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

[7.x] Implement framework for migrating system indices (#78951) #79525

Merged
merged 9 commits into from
Oct 20, 2021

Conversation

gwbrown
Copy link
Contributor

@gwbrown gwbrown commented Oct 20, 2021

Backport of #78951.


This PR adds a framework for migrating system indices as necessary prior
to Elasticsearch upgrades. This framework uses REST APIs added in
another commit:

  • GET _migration/system_features

This API, which gets the status of "features" (plugins which own system
indices) with regards to whether they need to be upgraded or not. As of
this PR, this API also reports errors encountered while migrating system
indices alongside the index that was being processed when this occurred.

As an example of this error reporting:

{
    "feature_name": "logstash_management",
    "minimum_index_version": "8.0.0",
    "upgrade_status": "ERROR",
    "indices": [
        {
            "index": ".logstash",
            "version": "8.0.0",
            "failure_cause": {
                "error": {
                    "root_cause": [
                        {
                            "type": "runtime_exception",
                            "reason": "whoopsie",
                            "stack_trace": "<omitted for brevity>"
                        }
                    ],
                    "type": "runtime_exception",
                    "reason": "whoopsie",
                    "stack_trace": "<omitted for brevity>"
                }
            }
        }
    ]
}
  • POST _migration/system_features

This API starts the migration process. The API for this has no changes,
but when called, any system indices which need to be migrated will be
migrated, with status information stored in the cluster state for later
use by the GET _migration/system_features API.

    This PR adds a framework for migrating system indices as necessary prior
    to Elasticsearch upgrades. This framework uses REST APIs added in
    another commit:
    - GET _migration/system_features

    This API, which gets the status of "features" (plugins which own system
    indices) with regards to whether they need to be upgraded or not. As of
    this PR, this API also reports errors encountered while migrating system
    indices alongside the index that was being processed when this occurred.

    As an example of this error reporting:

    ```json
    {
        "feature_name": "logstash_management",
        "minimum_index_version": "8.0.0",
        "upgrade_status": "ERROR",
        "indices": [
            {
                "index": ".logstash",
                "version": "8.0.0",
                "failure_cause": {
                    "error": {
                        "root_cause": [
                            {
                                "type": "runtime_exception",
                                "reason": "whoopsie",
                                "stack_trace": "<omitted for brevity>"
                            }
                        ],
                        "type": "runtime_exception",
                        "reason": "whoopsie",
                        "stack_trace": "<omitted for brevity>"
                    }
                }
            }
        ]
    }
    ```

    - POST _migration/system_features

    This API starts the migration process. The API for this has no changes,
    but when called, any system indices which need to be migrated will be
    migrated, with status information stored in the cluster state for later
    use by the GET _migration/system_features API.
@gwbrown gwbrown added auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) and removed auto-merge-without-approval Automatically merge pull request when CI checks pass (NB doesn't wait for reviews!) labels Oct 20, 2021
@gwbrown gwbrown merged commit 35dc030 into elastic:7.x Oct 20, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants