-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add instance ID column to migration table (#5909)
Currently, the `migration` table does not contain a way to directly associate migrations with instances. An `instance` row's `migration_id` is a foreign key into the `migration` table pointing at the currently active migration, if one exists, but past migrations cannot be easily associated with migrations. This is unfortunate, as it seems useful to be able to easily list completed/failed migrations for an instance. This is particularly important as we would like to change the behavior around marking migration records as deleted, so that deleting an instance also deletes any corresponding migration records. It may also be useful for debugging tools and UIs that expose a migration's history. This branch adds an instance ID column to the migration table. To avoid having `NULL`s in this column, I've added a migration[^1] that deletes the old `migration` table and creates a new one, rather than backfilling migration IDs by trying to figure them out using the `vmm` records for the migration records. This seemed fine, because (1) the `migration` table hasn't been released to customers yet, and (2), we don't actually use the data in that table for anything yet, so nuking it should be okay. I've also added a query for listing migration records by instance ID. Now, we no longer mark migrations as deleted when they complete or fail, and instead mark all migrations for an instance as deleted when the instance itself is deleted. Migration records are still marked as deleted when an `instance-migrate` saga unwinds. I'm on the fence as to whether this is the Right Thing or not, but I think it's fine, as those migration states won't be needed by the `instance-update` saga (AFAIK so far). If that doesn't end up being the case, we might consider adding a `SagaUnwound` state, similar to the one for VMMs, so that we can distinguish between migrations that failed because a VMM failed and migrations whose sagas unwound... [^1]: A database migration, not a live migration migration. :)
- Loading branch information
Showing
12 changed files
with
328 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.