Soft-delete volumes in a transaction, not CTE#6623
Merged
jmpesp merged 1 commit intoSep 20, 2024
Conversation
smklein
approved these changes
Sep 20, 2024
| } else { | ||
| // The volume was hard-deleted | ||
| return Ok(CrucibleResources::V1( | ||
| CrucibleResourcesV1::default(), |
Collaborator
There was a problem hiding this comment.
Nitpick: Not sure this matters, but why return the oldest format here?
Contributor
Author
There was a problem hiding this comment.
Yeah, I don't know, I imagine this was a holdover from the first time this code was written. If nothing else this helps us maintain the condition of "must always be able to deserialize this struct" :)
Comment on lines
+906
to
+911
| // Even volumes with nothing to clean up should have a | ||
| // serialized CrucibleResources that contains empty | ||
| // vectors instead of None. Instead of panicing here | ||
| // though, just return the default (nothing to clean | ||
| // up). | ||
| CrucibleResources::V1(CrucibleResourcesV1::default()) |
Collaborator
There was a problem hiding this comment.
For this and the case above where we make a default crucible resource, should we just return an Option and bail out early?
Contributor
Author
There was a problem hiding this comment.
That's possible yeah. I'm inclined to pass around these empty vectors to avoid having to if let Some all over though.
Change the process of soft-deleting a volume from a CTE into a transaction. This is done to make changes easier to apply and review. One part of the CTE that remains is the query fragment that conditionally reduces volume references for region_snapshot rows, then returns only the rows updated. It was easier to keep this than figure out how to get it to work in diesel!
hawkw
pushed a commit
that referenced
this pull request
Sep 21, 2024
Change the process of soft-deleting a volume from a CTE into a transaction. This is done to make changes easier to apply and review. One part of the CTE that remains is the query fragment that conditionally reduces volume references for region_snapshot rows, then returns only the rows updated. It was easier to keep this than figure out how to get it to work in diesel!
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.
Change the process of soft-deleting a volume from a CTE into a transaction. This is done to make changes easier to apply and review.
One part of the CTE that remains is the query fragment that conditionally reduces volume references for region_snapshot rows, then returns only the rows updated. It was easier to keep this than figure out how to get it to work in diesel!