-
Notifications
You must be signed in to change notification settings - Fork 39
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
Implement record based Crucible reference counting #6805
Open
jmpesp
wants to merge
10
commits into
oxidecomputer:main
Choose a base branch
from
jmpesp:read_only_regions_need_ref_counting_too
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Implement record based Crucible reference counting #6805
jmpesp
wants to merge
10
commits into
oxidecomputer:main
from
jmpesp:read_only_regions_need_ref_counting_too
Commits on Oct 9, 2024
-
Implement record based Crucible reference counting
Crucible volumes are created by layering read-write regions over a hierarchy of read-only resources. Originally only a region snapshot could be used as a read-only resource for a volume. With the introduction of read-only regions (created during the region snapshot replacement process) this is no longer true! Read-only resources can be used by many volumes, and because of this they need to have a reference count so they can be deleted when they're not referenced anymore. The region_snapshot table uses a `volume_references` column, which counts how many uses there are. The region table does not have this column, and more over a simple integer works for reference counting but does not tell you _what_ volume that use is from. This can be determined (see omdb's validate volume references command) but it's information that is tossed out, as Nexus knows what volumes use what resources! Instead, record what read-only resources a volume uses in a new table. As part of the schema change to add the new `volume_resource_usage` table, a migration is included that will create the appropriate records for all region snapshots. In testing, a few bugs were found: the worst being that read-only regions did not have their read_only column set to true. This would be a problem if read-only regions are created, but they're currently only created during region snapshot replacement. To detect if any of these regions were created, find all regions that were allocated for a snapshot volume: SELECT id FROM region WHERE volume_id IN (SELECT volume_id FROM snapshot); A similar bug was found in the simulated Crucible agent. This commit also reverts oxidecomputer#6728, enabling region snapshot replacement again - it was disabled due to a lack of read-only region reference counting, so it can be enabled once again.
Configuration menu - View commit details
-
Copy full SHA for ae4282a - Browse repository at this point
Copy the full SHA ae4282aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 66c6797 - Browse repository at this point
Copy the full SHA 66c6797View commit details -
Configuration menu - View commit details
-
Copy full SHA for 410c79d - Browse repository at this point
Copy the full SHA 410c79dView commit details
Commits on Oct 16, 2024
-
Explicitly separate region deletion code
The garbage collection of read/write regions must be separate from read-only regions: - read/write regions are garbage collected by either being deleted during a volume soft delete, or by appearing later during the "find deleted volume regions" section of the volume delete saga - read-only regions are garbage collected only in the volume soft delete code, when there are no more references to them `find_deleted_volume_regions` was changed to only operate on read/write regions, and no longer returns the optional RegionSnapshot object: that check was moved from the volume delete saga into the function, as it didn't make sense that it was separated. This commit also adds checks to validate that invariants related to volumes are not violated during tests. One invalid test was deleted (regions will never be deleted when they're in use!) In order to properly test the separate region deletion routines, the first part of the fixes for dealing with deleted volumes during region snapshot replacement were brought in from that branch: these are the changes to region_snapshot_replacement_step.rs and region_snapshot_replacement_start.rs.
Configuration menu - View commit details
-
Copy full SHA for 2ff34d5 - Browse repository at this point
Copy the full SHA 2ff34d5View commit details -
Configuration menu - View commit details
-
Copy full SHA for 221751a - Browse repository at this point
Copy the full SHA 221751aView commit details -
Configuration menu - View commit details
-
Copy full SHA for 00d9f38 - Browse repository at this point
Copy the full SHA 00d9f38View commit details -
Configuration menu - View commit details
-
Copy full SHA for 412d665 - Browse repository at this point
Copy the full SHA 412d665View commit details -
Configuration menu - View commit details
-
Copy full SHA for 0a45763 - Browse repository at this point
Copy the full SHA 0a45763View commit details -
Configuration menu - View commit details
-
Copy full SHA for 89744ea - Browse repository at this point
Copy the full SHA 89744eaView commit details -
add CONSTRAINT to volume_resource_usage table to separate two enum uses
add comment to table as well
Configuration menu - View commit details
-
Copy full SHA for bd2ef84 - Browse repository at this point
Copy the full SHA bd2ef84View commit details
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.