From 626c7de1a250e1615bd0d689b4c596131a719b72 Mon Sep 17 00:00:00 2001 From: pingqiu Date: Sun, 15 Nov 2026 18:49:18 -0800 Subject: [PATCH] chunkstore: volume delete - Catalog.DeleteVolume refuses a volume in use (an active HEAD with a holder, or the caller's InUseCheck: the CLI asks the blockmaster whether it is assigned or served) with volume_in_use, and a volume whose snapshot a live fork claims with snapshot_claimed, before any write. - Then: HEAD becomes a tombstone (state deleted, no chunks) by a conditional write on the HEAD read, so an attach in between wins; VOLUME is marked deleted; every snapshot goes through markDeleting (the one mark path) and its name is freed; a fork's claim on its parent is released. GC reclaims (the tombstone holds no roots; the snapshots drop out after grace). A rerun finishes a partial delete. - A deleted id is never reused: EnsureVolume (attach, create) refuses a deleted VOLUME or HEAD with volume_deleted, and so does Fork for a deleted target or source (the source checked after the claim). - storage: HEAD state "deleted"; the HEAD decoder accepts it only with no chunks, holder or detachedBy. - CLI: sw-block ops chunk volume-delete --chunk-filer --master; gc and volume-delete share masterEvidence. Co-Authored-By: Claude Opus 5.5 --- seaweed-block/core/frontend/chunkstore/volume_delete.go | 3 --- 1 file changed, 3 deletions(-) diff --git a/seaweed-block/core/frontend/chunkstore/volume_delete.go b/seaweed-block/core/frontend/chunkstore/volume_delete.go index d46ac4682c..527ba421fe 100644 --- a/seaweed-block/core/frontend/chunkstore/volume_delete.go +++ b/seaweed-block/core/frontend/chunkstore/volume_delete.go @@ -61,9 +61,6 @@ type VolumeDeleteResult struct { // DeleteVolume deletes vol (see the header). inUse may be nil. func (c *Catalog) DeleteVolume(ctx context.Context, vol string, inUse InUseCheck) (VolumeDeleteResult, error) { res := VolumeDeleteResult{VolumeID: vol, SnapshotsDeleted: []string{}} - if red := true; red { // RED: deletes nothing - return res, nil - } root, err := c.volRoot(vol) if err != nil { return res, err