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

saved object migrations should support embeddable migrations #84907

Closed
rudolf opened this issue Dec 3, 2020 · 3 comments · Fixed by #88594
Closed

saved object migrations should support embeddable migrations #84907

rudolf opened this issue Dec 3, 2020 · 3 comments · Fixed by #88594
Assignees
Labels
Feature:Saved Objects Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc

Comments

@rudolf
Copy link
Contributor

rudolf commented Dec 3, 2020

The embeddable service would like to allow registrators to define migrations that persistor plugins should run on any embeddable state they store on behalf of the registrator.

See #67931 for a description of the problem and the terminology (note the design in the RFC wasn't implemented).

#74352 Implemented a solution to this problem, however, it required that migrations run on every version which is ineffective. For persistors to only migrate the embedded data when necessary, they need to know which migrations were added by registrators. However, new persistors can register new migrations any time during setup. So the registrator needs a way to get all migrations before migrations run, but after the setup lifecycle completes.

To enable this plugins should be able to specify a migrations function when registering their saved object type. This allows the plugin to lazily/dynamically create all the migrations they require just before the migrations run (which is one tick after the setup lifecycle).

// From:
SavedObjectType.migrations: SavedObjectMigrationMap
// To:
SavedObjectType.migrations: SavedObjectMigrationMap | () => SavedObjectMigrationMap
@rudolf rudolf added Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc Feature:Saved Objects labels Dec 3, 2020
@elasticmachine
Copy link
Contributor

Pinging @elastic/kibana-core (Team:Core)

@kobelb
Copy link
Contributor

kobelb commented Dec 3, 2020

@mikecote I believe this is what you and I were talking about potentially needing for Alerting's saved-object migrations as well

@mikecote
Copy link
Contributor

mikecote commented Dec 4, 2020

++ I think this would work perfectly for alerting as well. We have a similar use case to migrate per alert / action type which are registered on setup (#50216).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Feature:Saved Objects Team:Core Core services & architecture: plugins, logging, config, saved objects, http, ES client, i18n, etc
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants