[nexus] Make snapshot-create saga unwind-safe#2093
Merged
Conversation
13 tasks
smklein
commented
Dec 26, 2022
|
|
||
| #[cfg(test)] | ||
| mod test { | ||
| pub(crate) mod test { |
Collaborator
Author
There was a problem hiding this comment.
I'm mostly modifying this so I can re-use some of the test functions which validates "disk creation doesn't leave detritus".
Most of these checks are identical for snapshot creation.
smklein
commented
Dec 26, 2022
Comment on lines
+1400
to
+1404
| // Unfortunately, for our idempotency checks, checking for a "clean | ||
| // slate" gets more expensive when we need to compare region allocations | ||
| // between the disk and the snapshot. If we can undo the snapshot | ||
| // provisioning AND delete the disk together, these checks are much | ||
| // simpler to write. |
Collaborator
Author
There was a problem hiding this comment.
This detail matters - basically, it's easy to check "nothing exists in the DB", and harder to check "the state which was provisioned for a disk exists and matches, but nothing else was added".
Unwinding the snapshot AND deleting the disk gets us back to the simpler "nothing should exist" state.
smklein
commented
Dec 27, 2022
Comment on lines
+777
to
+788
| // NOTE: If we later create a volume record and delete it, the | ||
| // running snapshot may be deleted (see: | ||
| // ssc_create_volume_record_undo). | ||
| // | ||
| // To cope, we treat "running snapshot not found" as "Ok", since it | ||
| // may just be the result of the volume deletion steps completing. | ||
| .or_else(|err| match err { | ||
| ErrorResponse(r) if r.status() == StatusCode::NOT_FOUND => { | ||
| Ok(()) | ||
| } | ||
| _ => Err(err), | ||
| })?; |
Collaborator
Author
There was a problem hiding this comment.
I found this a little quirky; figured I'd call it out.
- If we haven't run the later "volume creation" undo step, we need to cleanup this running snapshot.
- If we have run the later "volume creation" undo step, it's already gone
leftwo
approved these changes
Dec 28, 2022
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of #2052