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

v2 migration algorithm docs for rewriting saved object id's #93002

Merged
merged 8 commits into from
Apr 29, 2021

Conversation

rudolf
Copy link
Contributor

@rudolf rudolf commented Mar 1, 2021

Summary

The saved object migrations RFC had documentation for the v2 migrations algorithm, but when implementing it some steps were divided into two so it's no longer straightforward to compare the documentation with the implementation. This PR adds documentation that uses the same control state names as the source code to make it easier to compare.

beb6b57 changes the current algorithm to support rewriting saved object id's to address #86247

Checklist

Delete any items that are not applicable to this PR.

For maintainers

@rudolf rudolf added Feature:Saved Objects project:ResilientSavedObjectMigrations Reduce Kibana upgrade failures by making saved object migrations more resilient labels Mar 1, 2021
@rudolf rudolf added the release_note:skip Skip the PR/issue when compiling release notes label Mar 1, 2021
@rudolf rudolf changed the title Document v2 migration algorithm using control state names v2 migration algorithm docs for rewriting saved object id's Mar 1, 2021
@rudolf rudolf marked this pull request as ready for review March 1, 2021 11:09
@rudolf rudolf requested a review from a team as a code owner March 1, 2021 11:09
rfcs/text/0013_saved_object_migrations.md Outdated Show resolved Hide resolved
src/core/server/saved_objects/migrationsv2/README.md Outdated Show resolved Hide resolved
src/core/server/saved_objects/migrationsv2/README.md Outdated Show resolved Hide resolved
to the same index. This version's migration has already been completed. Since
the same version could have plugins enabled at any time that would introduce
new transforms or mappings.
→ `OUTDATED_DOCUMENTS_SEARCH`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we should add a diagram of transitions between states?


Atomically apply the `versionIndexReadyActions` using the _alias actions API. By performing the following actions we guarantee that if multiple versions of Kibana started the upgrade in parallel, only one version will succeed.

1. verify that the current alias is still pointing to the source index
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mind adding examples for this section?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

noticed I got UPDATE_TARGET_MAPPINGS_WAIT_FOR_TASK mixed up with MARK_VERSION_INDEX_READY will revisit this section


## REINDEX_SOURCE_TO_TEMP_INDEX
### Next action
`transformRawDocs` + `bulkIndexTransformedDocuments`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a directly related question: Is space a part of SO id still?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes it is, but in 8.x all saved objects will become "share-aware" (I think that's the terminology we're using) which means we will use this algorithm plus the work in #80945 to rewrite their id's and remove the space out of the id.


## OUTDATED_DOCUMENTS_TRANSFORM
### Next action
`transformRawDocs` + `bulkOverwriteTransformedDocuments`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On the REINDEX_SOURCE_TO_TEMP_INDEX step, we transform all the known SO types. On this step, we transform outdated docs that haven't been processed on REINDEX_SOURCE_TO_TEMP_INDEX. Is that correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes 👍

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I had a brief description under CLONE_TEMP_TO_TARGET but I expanded that a little bit and moved it under OUTDATED_DOCUMENTS_SEARCH


## OUTDATED_DOCUMENTS_TRANSFORM
### Next action
`transformRawDocs` + `bulkOverwriteTransformedDocuments`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These are broken down into two separate steps to handle #90279

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we will need to update the docs either in #90279 or right after

@spalger spalger added v7.14.0 and removed v7.13.0 labels Apr 21, 2021
@mshustov mshustov enabled auto-merge (squash) April 29, 2021 12:13
@mshustov mshustov added auto-backport Deprecated - use backport:version if exact versions are needed backport:skip This commit does not require backporting and removed auto-backport Deprecated - use backport:version if exact versions are needed labels Apr 29, 2021
@mshustov mshustov merged commit c03a830 into elastic:master Apr 29, 2021
madirey pushed a commit to madirey/kibana that referenced this pull request May 11, 2021
…93002)

* Document v2 migration algorithm using control state names from source code

* v2 migrations support for rewriting document _id's

* Minor edits and clarifications

* Fix markdown formatting

* Review comments: improve algorithm description

* add WAIT_FOR_YELLOW_SOURCE step

Co-authored-by: restrry <[email protected]>
rudolf added a commit to rudolf/kibana that referenced this pull request Aug 20, 2021
…93002)

* Document v2 migration algorithm using control state names from source code

* v2 migrations support for rewriting document _id's

* Minor edits and clarifications

* Fix markdown formatting

* Review comments: improve algorithm description

* add WAIT_FOR_YELLOW_SOURCE step

Co-authored-by: restrry <[email protected]>
# Conflicts:
#	rfcs/text/0013_saved_object_migrations.md
rudolf added a commit that referenced this pull request Aug 20, 2021
…109472)

* Document v2 migration algorithm using control state names from source code

* v2 migrations support for rewriting document _id's

* Minor edits and clarifications

* Fix markdown formatting

* Review comments: improve algorithm description

* add WAIT_FOR_YELLOW_SOURCE step

Co-authored-by: restrry <[email protected]>
# Conflicts:
#	rfcs/text/0013_saved_object_migrations.md
rudolf added a commit to rudolf/kibana that referenced this pull request Aug 20, 2021
…93002)

* Document v2 migration algorithm using control state names from source code

* v2 migrations support for rewriting document _id's

* Minor edits and clarifications

* Fix markdown formatting

* Review comments: improve algorithm description

* add WAIT_FOR_YELLOW_SOURCE step

Co-authored-by: restrry <[email protected]>
# Conflicts:
#	rfcs/text/0013_saved_object_migrations.md
rudolf added a commit that referenced this pull request Aug 20, 2021
…109475)

* Document v2 migration algorithm using control state names from source code

* v2 migrations support for rewriting document _id's

* Minor edits and clarifications

* Fix markdown formatting

* Review comments: improve algorithm description

* add WAIT_FOR_YELLOW_SOURCE step

Co-authored-by: restrry <[email protected]>
# Conflicts:
#	rfcs/text/0013_saved_object_migrations.md
@rudolf rudolf deleted the v2-migrations-docs branch August 20, 2021 19:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport:skip This commit does not require backporting Feature:Saved Objects project:ResilientSavedObjectMigrations Reduce Kibana upgrade failures by making saved object migrations more resilient release_note:skip Skip the PR/issue when compiling release notes v7.14.0 v8.0.0
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants