Repository navigation
volume: fix the 3x duplication and failure modes - #18
Merged
Merged
Conversation
Single-host setups stored every volume byte three times (live image + volumes/chunks cache copy + volume-remote copy): 21G for 7G of data. This also fixes the failure modes found on that host. - Local backend reads straight through to the remote dir instead of copying into the cache; the legacy cache copy is removed on first use. Footprint drops from 3x to ~2x (live + one backend copy). Real remotes get a bounded cache (4 GiB, oldest-first) instead of an unbounded one. - EnsureLocal compares every manifest chunk against the disk first and skips identical ranges: create on an up-to-date image performs zero chunk writes. A sidecar (.applied.json) records the last materialized manifest plus size/mtime, so the fully-up-to-date case skips even the comparison. - Cache hits are hash-verified and cache writes are atomic (temp + rename), so a torn file from a killed run is re-fetched, never served. Fetched bytes are verified before reaching the disk image. - `warmbox volume gc [--dry-run]` (POST /api/volumes/gc) deletes remote chunks no volume, snapshot, or base manifest references. A 1h grace window spares in-flight commits; only unreferenced chunks are ever deleted, so it is safe with a desktop attached. - A lease conflict against an owner with no live desktop is reclaimed and retried on every create path, not just at daemon startup. - `warmbox destroy` gets a 150s timeout (was 30s): the server commits the volume before answering, and a slow commit used to make the CLI report failure for an operation that then succeeded.
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.
What
Single-host setups stored every volume byte 3x (live
disk.img+volumes/chunkscache copy +volume-remotecopy): 21G consumed for 7G of data, on a 38G disk. This fixes that and the failure modes found on that host.The six fixes
EnsureLocalrewrote the whole image every create.applied.jsonsidecar (manifest digest + size/mtime) skips even the comparison when fully up to date.disk.img. Kill -9 mid-apply heals on next create.warmbox volume gc [--dry-run](POST /api/volumes/gc): collects hashes from all volume + snapshot + base manifests, deletes the rest. 1h grace window spares in-flight commits. Safe with a desktop attached (only unreferenced chunks die).Test plan
go build ./...,go vet, fullgo test ./...pass.internal/volume+internal/cloudstore: zero-write secondEnsureLocal(+ sidecar fast path), crash-heal (poisoned cache + corrupt disk → manifest-exact), GC dry-run lists exactly the orphan / real run reclaims / snapshot-pinned chunks survive / grace window holds, local-backend never populates the cache.LastApplystats + tests, (3) corrupt-cache test, (4) dry-run + delete tests, (5) reconcile on conflict, (6) 150s timeout + reconcile as backstop.Notes
POST /api/volumes/gcreturns the report as JSON (orphans,reclaimed_bytes,deleted,dry_run).