Merge pull request #622 from seaweedfs/feat/cleaning-default-on

blockvolume, durable: the holder's cleaning is on by default and runs after each snapshot delete
This commit is contained in:
Ping Qiu authored and GitHub committed 2026-11-25 17:16:16 -08:00
commit 042b05980f
23 files changed
+600 -41

No files matched your search

@@ -29,6 +29,9 @@ const (
defaultChunkMaintenanceInterval = time.Hour
defaultChunkCutTimeout = 5 * time.Minute
defaultChunkMaintenanceTimeout = time.Minute
// The holder's cleaning (removal of chunks no root names) is on by
// default; --chunk-maintenance-gc=false turns it off.
defaultChunkMaintenanceGC = true
)
type chunkFlags struct {
@@ -63,7 +66,7 @@ func validateChunkFlags(f flags) error {
}
if f.durableImpl != "walstore-chunk" {
if c.filer != "" || c.collection != "" || c.replication != "" || c.path != defaultChunkPath ||
c.captureInterval != defaultChunkCaptureInterval || c.maintenanceInterval != defaultChunkMaintenanceInterval || c.snapshotSchedule != defaultSnapshotSchedule || c.automaticGC ||
c.captureInterval != defaultChunkCaptureInterval || c.maintenanceInterval != defaultChunkMaintenanceInterval || c.snapshotSchedule != defaultSnapshotSchedule || c.automaticGC != defaultChunkMaintenanceGC ||
c.uploadConcurrency != 8 || c.hydrationWorkers != 2 || c.hydrationQueueDepth != 64 || c.controlEndpoint || c.detachPrecopy || c.hostLimit.Directory != "" {
return errors.New("--chunk-* flags require --durable-impl=walstore-chunk")
}
@@ -35,8 +35,13 @@ func TestWALStoreChunkFlags(t *testing.T) {
if err != nil {
t.Fatal(err)
}
if d.chunk.captureInterval != 0 || d.chunk.maintenanceInterval != time.Hour || d.chunk.automaticGC {
t.Fatalf("scheduler defaults interval %s, want capture off (0), maintenance 1h and GC off", d.chunk.captureInterval)
if d.chunk.captureInterval != 0 || d.chunk.maintenanceInterval != time.Hour || !d.chunk.automaticGC {
t.Fatalf("scheduler defaults: capture %s, maintenance %s, cleaning %v; want capture off (0), maintenance 1h and the cleaning on", d.chunk.captureInterval, d.chunk.maintenanceInterval, d.chunk.automaticGC)
}
// The cleaning is on by default; the one way to turn it off is explicit.
noClean, err := parseFlags(base("--durable-root=/tmp/sw-block", "--durable-impl=walstore-chunk", "--chunk-filer=x:1", "--chunk-maintenance-gc=false"))
if err != nil || noClean.chunk.automaticGC || noClean.chunk.maintenanceInterval != time.Hour {
t.Fatalf("turning the cleaning off: %+v %v", noClean.chunk, err)
}
on, err := parseFlags(base("--durable-root=/tmp/sw-block", "--durable-impl=walstore-chunk", "--chunk-filer=x:1", "--chunk-capture-interval=15m"))
if err != nil || on.chunk.captureInterval != 15*time.Minute {
@@ -0,0 +1,193 @@
package main
import (
"bytes"
"context"
"fmt"
"path"
"testing"
"time"
"github.com/seaweedfs/seaweed-block/core/frontend"
"github.com/seaweedfs/seaweed-block/core/frontend/chunkstore/filerpb"
"github.com/seaweedfs/seaweed-block/core/frontend/chunkstore/layout"
"github.com/seaweedfs/seaweed-block/core/frontend/durable"
"github.com/seaweedfs/seaweed-block/core/frontend/durable/testutil"
"github.com/seaweedfs/seaweed-block/core/host/volume"
)
type cleaningView struct{}
func (cleaningView) Projection() frontend.Projection {
return frontend.Projection{VolumeID: "v1", ReplicaID: "r1", Epoch: 3, EndpointVersion: 1, Healthy: true}
}
// With the shipped defaults (no cleaning flag, the hour-long maintenance
// interval), rolling writes with one snapshot kept: after each snapshot
// delete through the holder's control route, the holder's cleaning removes
// the deleted snapshot's chunks, so the pool returns to the chunks the
// current root names and stops growing.
func TestDefaultConfigCleansAfterEachSnapshotDelete(t *testing.T) {
ctx := context.Background()
d, err := parseFlags(append(phase150RequiredBlockvolumeArgs(), "--durable-root=/tmp/sw-block", "--durable-impl=walstore-chunk", "--chunk-filer=x:1"))
if err != nil {
t.Fatal(err)
}
const blocks, chunkBlocks = 256, 16
const chunks = blocks / chunkBlocks
fixture := testutil.NewLayoutFixture(t, "v1", blocks, chunkBlocks)
pool := path.Join("/provider-test", fixture.Ref.Dir(), layout.PoolDir)
// A real filer lists the shard directory it created for the chunks; the
// in-memory filer keeps only the entries, so add it.
if err := fixture.Filer.CreateEntry(ctx, pool, &filerpb.Entry{Name: "0", IsDirectory: true}, false); err != nil {
t.Fatal(err)
}
cfg := durable.ProviderConfig{
Impl: durable.ImplWALStoreChunk, StorageRoot: t.TempDir(), BlockSize: 4096, NumBlocks: blocks, ChunkBlocks: chunkBlocks,
ChunkMaintenanceInterval: d.chunk.maintenanceInterval,
}
fixture.Configure(&cfg)
var dp *durable.DurableProvider
cfg.ChunkMaintenance = newChunkMaintenance(fixture.Catalog, fixture.Ref, func(ctx context.Context) (layoutCleaner, error) {
r, err := dp.LayoutRemote(ctx, "v1")
if err != nil {
return nil, err
}
return r.(layoutCleaner), nil
}, d.chunk.automaticGC, time.Now)
dp, err = durable.NewDurableProvider(cfg, cleaningView{})
if err != nil {
t.Fatal(err)
}
t.Cleanup(func() { _ = dp.Close() })
s, err := dp.EnsureStorage("v1")
if err != nil {
t.Fatal(err)
}
if _, err := dp.RecoverVolume(ctx, "v1"); err != nil {
t.Fatal(err)
}
ctl := volume.NewChunkControl(dp, fixture.Catalog, fixture.Ref)
poolObjects := func() int {
t.Helper()
es, err := fixture.Filer.ListEntries(ctx, pool+"/0", "", "", 100000)
if err != nil {
t.Fatal(err)
}
return len(es)
}
prev := ""
for round := 0; round < 4; round++ {
// Every chunk changes: the new snapshot names none of the old chunks.
for c := uint64(0); c < chunks; c++ {
if _, err := s.Write(uint32(c*chunkBlocks), bytes.Repeat([]byte{byte(round*chunks + int(c) + 1)}, 4096)); err != nil {
t.Fatal(err)
}
}
name := fmt.Sprintf("s%d", round)
if _, err := ctl.Snapshot(ctx, "v1", volume.ChunkSnapshotRequest{Name: name}); err != nil {
t.Fatalf("round %d: snapshot: %v", round, err)
}
if prev != "" {
// The kept snapshot and the current root name the new chunks;
// the one about to be deleted alone names the old ones.
if before := poolObjects(); before != 2*chunks {
t.Fatalf("round %d: %d pool objects before deleting %s; want %d (old and new chunks)", round, before, prev, 2*chunks)
}
if _, err := ctl.DeleteSnapshot(ctx, "v1", prev); err != nil {
t.Fatalf("round %d: delete %s: %v", round, prev, err)
}
deadline := time.Now().Add(10 * time.Second)
for poolObjects() != chunks && time.Now().Before(deadline) {
time.Sleep(20 * time.Millisecond)
}
if got := poolObjects(); got != chunks {
t.Fatalf("round %d: %d pool objects 10 s after deleting %s; want the %d the current root names", round, got, prev, chunks)
}
}
prev = name
}
}
// A cut through the holder's control route while the holder's cleaning runs
// on the same remote: the cut cancels the cleaning (its run sees its context
// end) and completes; HEAD carries the cut and no open cleaning.
func TestCutDuringTheHoldersCleaningCancelsIt(t *testing.T) {
ctx := context.Background()
fixture := testutil.NewLayoutFixture(t, "v1", 256, 16)
cfg := durable.ProviderConfig{Impl: durable.ImplWALStoreChunk, StorageRoot: t.TempDir(), BlockSize: 4096, NumBlocks: 256, ChunkBlocks: 16}
fixture.Configure(&cfg)
dp, err := durable.NewDurableProvider(cfg, cleaningView{})
if err != nil {
t.Fatal(err)
}
t.Cleanup(func() { _ = dp.Close() })
s, err := dp.EnsureStorage("v1")
if err != nil {
t.Fatal(err)
}
if _, err := dp.RecoverVolume(ctx, "v1"); err != nil {
t.Fatal(err)
}
if _, err := s.Write(1, bytes.Repeat([]byte{7}, 4096)); err != nil {
t.Fatal(err)
}
r, err := dp.LayoutRemote(ctx, "v1")
if err != nil {
t.Fatal(err)
}
cleaner := r.(layoutCleaner)
// The cleaning runs under its own context: cleanup cancels it and joins
// it, so a failure below never leaves it running.
cleanCtx, cleanCancel := context.WithCancel(ctx)
started, cancelled := make(chan struct{}), make(chan struct{})
cleaned, joined := make(chan error, 1), make(chan struct{})
go func() {
defer close(joined)
cleaned <- cleaner.Clean(cleanCtx, func(ctx context.Context, _ layout.HolderID, _ string) error {
close(started)
<-ctx.Done() // a cleaning pass in progress until the cut ends it
close(cancelled)
return ctx.Err()
})
}()
t.Cleanup(func() {
cleanCancel()
select {
case <-joined:
case <-time.After(5 * time.Second):
t.Error("the cleaning did not end after its context was cancelled")
}
})
select {
case <-started:
case err := <-cleaned:
t.Fatalf("the cleaning ended before it ran: %v", err)
case <-time.After(5 * time.Second):
t.Fatal("the cleaning did not start")
}
ctl := volume.NewChunkControl(dp, fixture.Catalog, fixture.Ref)
cutCtx, cancel := context.WithTimeout(ctx, 10*time.Second)
defer cancel()
res, err := ctl.Cut(cutCtx, "v1", 0)
if err != nil {
t.Fatalf("the cut during the cleaning: %v", err)
}
select {
case <-cancelled:
case <-time.After(5 * time.Second):
t.Fatal("the cut did not cancel the cleaning")
}
select {
case err := <-cleaned:
if err != nil {
t.Fatalf("the cancelled cleaning ended with %v; want a clean end", err)
}
case <-time.After(5 * time.Second):
t.Fatal("the cancelled cleaning did not return")
}
h, _, err := fixture.Catalog.ReadHead(ctx, fixture.Ref)
if err != nil || h.Activity.Kind != layout.ActIdle || h.Position < res.CutLSN {
t.Fatalf("HEAD after the cut: %+v (cut to %d) %v; want idle at the cut", h.Activity, res.CutLSN, err)
}
}
+2 -2
View File
@@ -229,8 +229,8 @@ func parseFlags(args []string) (flags, error) {
fs.DurationVar(&f.chunk.captureInterval, "chunk-capture-interval", defaultChunkCaptureInterval, "walstore-chunk: periodic HEAD capture interval (default 0: off; when set, at least "+durable.MinCaptureInterval.String()+")")
f.chunk.snapshotSchedule = defaultSnapshotSchedule
fs.Var(&f.chunk.snapshotSchedule, "chunk-snapshot-schedule", "walstore-chunk: scheduled snapshots, daily:N or weekly:N (once per period at a per-volume offset, the newest N kept) or off")
fs.DurationVar(&f.chunk.maintenanceInterval, "chunk-maintenance-interval", defaultChunkMaintenanceInterval, "walstore-chunk: retention and optional GC pass interval; 0 disables")
fs.BoolVar(&f.chunk.automaticGC, "chunk-maintenance-gc", false, "walstore-chunk: let the holder's maintenance pass remove chunks no root of the volume reaches (cleaning); off by default")
fs.DurationVar(&f.chunk.maintenanceInterval, "chunk-maintenance-interval", defaultChunkMaintenanceInterval, "walstore-chunk: interval of the holder's maintenance pass (retention, then the cleaning); 0 disables the whole pass")
fs.BoolVar(&f.chunk.automaticGC, "chunk-maintenance-gc", defaultChunkMaintenanceGC, "walstore-chunk: the holder's maintenance pass removes chunks no root of the volume reaches (cleaning), every --chunk-maintenance-interval and after each snapshot delete; on by default, =false turns the cleaning off")
fs.IntVar(&f.chunk.uploadConcurrency, "chunk-upload-concurrency", 8, "walstore-chunk: maximum concurrent dirty-chunk uploads (1..64)")
fs.IntVar(&f.chunk.hydrationWorkers, "chunk-hydration-workers", 2, "walstore-chunk: concurrent lazy chunk fetches per volume (1..64)")
fs.IntVar(&f.chunk.hydrationQueueDepth, "chunk-hydration-queue-depth", 64, "walstore-chunk: distinct queued/in-flight hydration chunks per volume (1..65536)")
@@ -0,0 +1,178 @@
package durable
import (
"context"
"fmt"
"sync"
"testing"
"time"
"github.com/seaweedfs/seaweed-block/core/frontend/chunkstore/layout"
)
// countingPass counts maintenance passes; fail(n) is pass n's result and
// hold(n), when set, blocks pass n until it returns.
type countingPass struct {
mu sync.Mutex
n chan int
seen int
fail func(n int) error
hold func(n int)
}
func (c *countingPass) run(context.Context, string) error {
c.mu.Lock()
c.seen++
n := c.seen
c.mu.Unlock()
c.n <- n
if c.hold != nil {
c.hold(n)
}
if c.fail != nil {
return c.fail(n)
}
return nil
}
func (c *countingPass) next(t *testing.T, within time.Duration) int {
t.Helper()
select {
case n := <-c.n:
return n
case <-time.After(within):
t.Fatalf("no maintenance pass within %s", within)
return 0
}
}
func (c *countingPass) none(t *testing.T, for_ time.Duration) {
t.Helper()
select {
case n := <-c.n:
t.Fatalf("unexpected maintenance pass %d", n)
case <-time.After(for_):
}
}
func runLoop(t *testing.T, p *DurableProvider, kick chan struct{}) {
t.Helper()
ctx, cancel := context.WithCancel(context.Background())
done := make(chan struct{})
go func() {
defer close(done)
p.chunkMaintenanceLoop(ctx, "v1", maintenanceStubLayer{}, func() bool { return true }, kick)
}()
t.Cleanup(func() {
cancel()
select {
case <-done:
case <-time.After(5 * time.Second):
t.Error("the maintenance loop did not stop")
}
})
}
// With the shipped hour-long interval, a kick (as after a snapshot delete)
// runs one pass at once, and a pass is not repeated until the next kick.
func TestMaintenanceKickRunsAPassNow(t *testing.T) {
c := &countingPass{n: make(chan int, 8)}
p := &DurableProvider{cfg: ProviderConfig{ChunkMaintenanceInterval: time.Hour, ChunkMaintenance: c.run}}
kick := make(chan struct{}, 1)
runLoop(t, p, kick)
c.none(t, 200*time.Millisecond) // the first periodic pass is an hour away
kick <- struct{}{}
if n := c.next(t, 5*time.Second); n != 1 {
t.Fatalf("pass %d after the kick; want 1", n)
}
c.none(t, 200*time.Millisecond)
kick <- struct{}{}
if n := c.next(t, 5*time.Second); n != 2 {
t.Fatalf("pass %d after the second kick; want 2", n)
}
c.none(t, 200*time.Millisecond)
}
// Kicks given while a pass runs coalesce into exactly one follow-up pass.
func TestMaintenanceKicksDuringAPassCoalesce(t *testing.T) {
release := make(chan struct{})
c := &countingPass{n: make(chan int, 8), hold: func(n int) {
if n == 1 {
<-release
}
}}
p := &DurableProvider{cfg: ProviderConfig{ChunkMaintenanceInterval: time.Hour, ChunkMaintenance: c.run}}
kick := make(chan struct{}, 1)
runLoop(t, p, kick)
kick <- struct{}{}
if n := c.next(t, 5*time.Second); n != 1 {
t.Fatalf("pass %d; want 1", n)
}
for i := 0; i < 5; i++ { // the pass is held: these coalesce into one token
select {
case kick <- struct{}{}:
default:
}
}
close(release)
if n := c.next(t, 5*time.Second); n != 2 {
t.Fatalf("pass %d after the held pass; want one follow-up (2)", n)
}
c.none(t, 300*time.Millisecond)
}
// A kicked pass the volume refused as busy (a cut session open: the
// cleaning never runs during one) keeps the kick pending: every retry comes
// after the short delay, however many times it is refused, until a pass is
// not refused; then the loop is back on the interval.
func TestMaintenanceKickedBusyPassRetriesSoon(t *testing.T) {
old := maintenanceKickRetry
maintenanceKickRetry = 50 * time.Millisecond
defer func() { maintenanceKickRetry = old }()
c := &countingPass{n: make(chan int, 8), fail: func(n int) error {
if n <= 2 {
return fmt.Errorf("cleaning: %w", layout.ErrBusy)
}
return nil
}}
p := &DurableProvider{cfg: ProviderConfig{ChunkMaintenanceInterval: time.Hour, ChunkMaintenance: c.run}}
kick := make(chan struct{}, 1)
runLoop(t, p, kick)
kick <- struct{}{}
for want := 1; want <= 3; want++ {
if n := c.next(t, 5*time.Second); n != want {
t.Fatalf("pass %d; want %d (busy, busy, then the pass that succeeds)", n, want)
}
}
c.none(t, 300*time.Millisecond) // the kick is served: back to the interval
}
// KickMaintenance reaches only a volume whose maintenance loop runs: not
// one without the loop, not one whose loop was stopped, not one whose loop
// ended (a fence or lineage change) without being re-armed.
func TestKickMaintenanceReachesOnlyARunningLoop(t *testing.T) {
running, ended := make(chan struct{}), make(chan struct{})
close(ended)
noop := func() {}
kicks := map[string]chan struct{}{"running": make(chan struct{}, 1), "stopped": make(chan struct{}, 1), "ended": make(chan struct{}, 1)}
p := &DurableProvider{volumes: map[string]*volHandle{
"running": {maintKick: kicks["running"], chunkStop: noop, chunkDone: running},
"stopped": {maintKick: kicks["stopped"]},
"ended": {maintKick: kicks["ended"], chunkStop: noop, chunkDone: ended},
"off": {chunkStop: noop, chunkDone: running},
}}
if !p.KickMaintenance("running") || len(kicks["running"]) != 1 {
t.Fatal("a kick did not reach the running loop")
}
if !p.KickMaintenance("running") || len(kicks["running"]) != 1 {
t.Fatal("a second kick before the pass did not coalesce")
}
for _, v := range []string{"stopped", "ended", "off", "absent"} {
if p.KickMaintenance(v) {
t.Fatalf("a kick to %q reported a running loop", v)
}
}
if len(kicks["stopped"]) != 0 || len(kicks["ended"]) != 0 {
t.Fatal("a kick was queued for a loop that is not running")
}
}
@@ -43,7 +43,7 @@ func TestMaintenanceRejectsForeignLineageBeforeAdmission(t *testing.T) {
p.cfg.ChunkMaintenance = func(context.Context, string) error { calls++; return nil }
ctx, cancel := context.WithTimeout(context.Background(), time.Second)
defer cancel()
p.chunkMaintenanceLoop(ctx, "v1", layer, func() bool { return p.maintenanceCurrent("v1", h, layer, lin) })
p.chunkMaintenanceLoop(ctx, "v1", layer, func() bool { return p.maintenanceCurrent("v1", h, layer, lin) }, nil)
if calls != 0 {
t.Fatalf("foreign attachment admitted %d passes", calls)
}
@@ -117,7 +117,7 @@ func TestMaintenanceRefusalReachesTheLayer(t *testing.T) {
}}}
ctx, cancel := context.WithTimeout(context.Background(), 2*time.Second)
defer cancel()
go p.chunkMaintenanceLoop(ctx, "v1", layer, func() bool { return true })
go p.chunkMaintenanceLoop(ctx, "v1", layer, func() bool { return true }, nil)
select {
case err := <-layer.seen:
if !errors.Is(err, storage.ErrChunkLayerFenced) {
@@ -347,6 +347,9 @@ type volHandle struct {
// cutWait is the automatic-cut timer's host slot waits, nil when the
// timer is off.
cutWait *cutWaitSlot
// maintKick asks the running maintenance loop for one pass now (one
// buffered token: kicks coalesce); nil when the loop is off.
maintKick chan struct{}
}
// VolumeStatus is a read-only diagnostic snapshot of one durable volume
@@ -439,9 +439,14 @@ func (p *DurableProvider) startChunkLoop(volumeID string, h *volHandle, layer st
} else if h.cutWait == nil {
h.cutWait = &cutWaitSlot{}
}
if p.cfg.ChunkMaintenanceInterval <= 0 || p.cfg.ChunkMaintenance == nil {
h.maintKick = nil
} else if h.maintKick == nil {
h.maintKick = make(chan struct{}, 1)
}
lin := h.chunkLineage
current := func() bool { return p.maintenanceCurrent(volumeID, h, layer, lin) }
go p.chunkBackground(loopCtx, cancel, volumeID, layer, h.chunkDone, current, h.snapshots, h.cutWait)
go p.chunkBackground(loopCtx, cancel, volumeID, layer, h.chunkDone, current, h.snapshots, h.cutWait, h.maintKick)
}
func (p *DurableProvider) newChunkLayer(ctx context.Context, volumeID string, h *volHandle) (storage.ChunkLayer, error) {
@@ -887,7 +892,7 @@ func (p *DurableProvider) chunkLoop(ctx context.Context, volumeID string, layer
// chunkBackground owns both workers and their cancellation. A fence is observed
// even while either worker is waiting on a cooperative remote call. INV-MAINT-JOIN:
// done closes only after every admitted worker has returned.
func (p *DurableProvider) chunkBackground(ctx context.Context, cancel context.CancelFunc, volumeID string, layer storage.ChunkLayer, done chan struct{}, current func() bool, snapshots *snapshotSlot, cutWait *cutWaitSlot) {
func (p *DurableProvider) chunkBackground(ctx context.Context, cancel context.CancelFunc, volumeID string, layer storage.ChunkLayer, done chan struct{}, current func() bool, snapshots *snapshotSlot, cutWait *cutWaitSlot, kick <-chan struct{}) {
defer close(done)
defer cancel()
var workers sync.WaitGroup
@@ -901,7 +906,7 @@ func (p *DurableProvider) chunkBackground(ctx context.Context, cancel context.Ca
}
if p.cfg.ChunkMaintenanceInterval > 0 && p.cfg.ChunkMaintenance != nil {
workers.Add(1)
go func() { defer workers.Done(); p.chunkMaintenanceLoop(ctx, volumeID, layer, current) }()
go func() { defer workers.Done(); p.chunkMaintenanceLoop(ctx, volumeID, layer, current, kick) }()
}
if snapshots != nil {
workers.Add(1)
@@ -931,7 +936,34 @@ func (p *DurableProvider) maintenanceCurrent(volumeID string, h *volHandle, laye
return active && chunkAuthority(cur, volumeID) && cur.VolumeID == lin.volumeID && cur.ReplicaID == lin.replicaID && cur.Epoch == lin.epoch && cur.EndpointVersion == lin.endpoint
}
func (p *DurableProvider) chunkMaintenanceLoop(ctx context.Context, volumeID string, layer storage.ChunkLayer, current func() bool) {
// maintenanceKickRetry is how soon a kicked pass that found the volume busy
// (a cut session open: the cleaning never runs during one) is tried again.
var maintenanceKickRetry = 30 * time.Second // a var only so tests can shorten it
// KickMaintenance asks the volume's maintenance loop for one pass now, as
// after a snapshot delete. It reports whether a running loop was there to
// ask (a stopped or ended loop is not); kicks coalesce, and the pass is the
// same bounded pass the timer runs.
func (p *DurableProvider) KickMaintenance(volumeID string) bool {
p.mu.Lock()
defer p.mu.Unlock()
h := p.volumes[volumeID]
if h == nil || h.maintKick == nil || h.chunkStop == nil || h.chunkDone == nil {
return false
}
select {
case <-h.chunkDone:
return false // the loop ended (fence, lineage change) and was not re-armed
default:
}
select {
case h.maintKick <- struct{}{}:
default: // a pass is already asked for
}
return true
}
func (p *DurableProvider) chunkMaintenanceLoop(ctx context.Context, volumeID string, layer storage.ChunkLayer, current func() bool, kick <-chan struct{}) {
interval := p.cfg.ChunkMaintenanceInterval
due := time.Now().Add(interval)
if p.cfg.ChunkStagger {
@@ -939,11 +971,20 @@ func (p *DurableProvider) chunkMaintenanceLoop(ctx context.Context, volumeID str
}
timer := time.NewTimer(time.Until(due))
defer timer.Stop()
kicked := false
for {
select {
case <-ctx.Done():
return
case <-timer.C:
case <-kick:
kicked = true
if !timer.Stop() {
select {
case <-timer.C:
default:
}
}
}
if ctx.Err() != nil || layer.Fenced() {
return
@@ -967,7 +1008,19 @@ func (p *DurableProvider) chunkMaintenanceLoop(ctx context.Context, volumeID str
_ = obs.ObserveRemoteError(err)
}
// Completion-relative reset coalesces all elapsed ticks; no catch-up queue.
timer.Reset(interval)
// A kick stays pending until a pass the volume did not refuse as busy:
// while a session is open, every retry comes after the short delay,
// not an interval later. The delay only paces the retries; whether a
// pass may clean is decided by HEAD's activity, never by this timer.
next := interval
if kicked && errors.Is(err, layout.ErrBusy) {
if maintenanceKickRetry < next {
next = maintenanceKickRetry
}
} else {
kicked = false
}
timer.Reset(next)
}
}
@@ -64,6 +64,9 @@ type LayoutFixture struct {
Catalog *chunkstore.BCatalog
Ref chunkstore.VolumeRef
Blobs *MemoryBlobs
// Filer is the in-memory filer under Catalog, for tests that count the
// entries a volume holds.
Filer *chunkstore.MemFiler
}
func NewLayoutFixture(t testing.TB, name string, blocks, chunkBlocks uint64) *LayoutFixture {
@@ -72,7 +75,8 @@ func NewLayoutFixture(t testing.TB, name string, blocks, chunkBlocks uint64) *La
t.Fatal("layout fixture requires nonzero geometry")
}
blobs := &MemoryBlobs{data: make(map[string][]byte)}
cat, err := chunkstore.NewBCatalog(chunkstore.NewMemFiler(), blobs, "/provider-test")
mf := chunkstore.NewMemFiler()
cat, err := chunkstore.NewBCatalog(mf, blobs, "/provider-test")
if err != nil {
t.Fatal(err)
}
@@ -84,7 +88,7 @@ func NewLayoutFixture(t testing.TB, name string, blocks, chunkBlocks uint64) *La
if _, err := cat.CreateVolume(context.Background(), ref, layout.Geometry{SizeBytes: blocks * 4096, BlockSize: 4096, ChunkBytes: chunkBlocks * 4096}); err != nil {
t.Fatal(err)
}
return &LayoutFixture{Catalog: cat, Ref: ref, Blobs: blobs}
return &LayoutFixture{Catalog: cat, Ref: ref, Blobs: blobs, Filer: mf}
}
func (f *LayoutFixture) Configure(cfg *durable.ProviderConfig) {
@@ -622,6 +622,9 @@ type ChunkProvider interface {
// DetachVolume stops the volume's I/O and periodic cuts and publishes
// the detached final cut; it also returns the last written LSN.
DetachVolume(ctx context.Context, volumeID string) (storage.ChunkCutResult, uint64, error)
// KickMaintenance asks the volume's maintenance loop for one pass now
// (its cleaning), as after a snapshot delete; false when no loop runs.
KickMaintenance(volumeID string) bool
}
var errFrozenDetachUnsupported = errors.New("frozen detach unsupported by provider")
@@ -722,6 +725,9 @@ func (c *chunkControl) DeleteSnapshot(ctx context.Context, volumeID, name string
if err != nil {
return "", err
}
// The deleted snapshot's chunks are removed by the holder's next
// cleaning: ask for it now rather than at the next interval.
c.p.KickMaintenance(volumeID)
return "deleted", nil
}
@@ -25,6 +25,12 @@ type fakeChunkProvider struct {
lastMin uint64
snapshotMeta layout.SnapshotMeta
snapshotName string
kicks []string
}
func (f *fakeChunkProvider) KickMaintenance(volumeID string) bool {
f.kicks = append(f.kicks, volumeID)
return true
}
type adapterManifestFiler struct {
@@ -0,0 +1,54 @@
package volume
import (
"context"
"errors"
"testing"
"github.com/seaweedfs/seaweed-block/core/frontend/chunkstore"
"github.com/seaweedfs/seaweed-block/core/frontend/chunkstore/layout"
)
// A snapshot deleted through the holder's control route asks the volume's
// maintenance loop for a pass (its cleaning) at once; a refused delete asks
// for nothing.
func TestChunkControlSnapshotDeleteKicksTheCleaning(t *testing.T) {
ctx := context.Background()
f := &adapterManifestFiler{Filer: chunkstore.NewMemFiler(), blobs: map[string][]byte{}}
cat, err := chunkstore.NewBCatalog(f, f, "/chunks")
if err != nil {
t.Fatal(err)
}
id, _ := layout.ParseVolumeID("00112233445566778899aabbccddeeff")
ref := chunkstore.VolumeRef{Name: "v1", ID: id}
if _, err := cat.CreateVolume(ctx, ref, layout.Geometry{SizeBytes: 64 * 4096, BlockSize: 4096, ChunkBytes: 4 * 4096}); err != nil {
t.Fatal(err)
}
h, _, err := cat.ReadHead(ctx, ref)
if err != nil {
t.Fatal(err)
}
r := layout.RootName{Hash: layout.Sum([]byte("root"))}
h.Snapshots = map[string]layout.Snapshot{"a": {Root: r}, "held": {Root: r, Dependents: []layout.Dependent{{Target: "t", TargetID: layout.VolumeID{9}, Root: r}}}}
s, _ := cat.Store(ref)
if err := s.UpdateHead(ctx, h.Gen, h); err != nil {
t.Fatal(err)
}
p := &fakeChunkProvider{}
ctl := NewChunkControl(p, cat, ref)
if _, err := ctl.DeleteSnapshot(ctx, "v1", "held"); !errors.Is(err, layout.ErrHasDependents) {
t.Fatalf("delete of a snapshot with a dependent: %v; want ErrHasDependents", err)
}
if _, err := ctl.DeleteSnapshot(ctx, "other", "a"); !errors.Is(err, layout.ErrIdentity) {
t.Fatalf("delete on another volume: %v; want ErrIdentity", err)
}
if len(p.kicks) != 0 {
t.Fatalf("refused deletes asked for maintenance: %v", p.kicks)
}
if _, err := ctl.DeleteSnapshot(ctx, "v1", "a"); err != nil {
t.Fatal(err)
}
if len(p.kicks) != 1 || p.kicks[0] != "v1" {
t.Fatalf("kicks after a snapshot delete: %v; want one for v1", p.kicks)
}
}
@@ -296,7 +296,9 @@ stateDiagram-v2
[*] --> PendingAttach
PendingAttach --> Armed: attached and healthy
Armed --> Running: staggered due event
Running --> Armed: retention and optional scoped GC settle
Armed --> Running: kick (a snapshot deleted through the holder)
Running --> Armed: retention and the cleaning settle
Running --> Armed: busy (a cut session open), kick kept, retry in 30 s
Running --> Draining: detach, fence, close
Armed --> Draining: detach, fence, close
Draining --> Closed: cancel and join every worker
+10 -3
View File
@@ -453,10 +453,15 @@ snapshot lifetime; local persistence does not bypass it.
### M8. Attached-volume maintenance
`PendingAttach -> Armed -> Due -> Running -> Armed`; elapsed ticks coalesce.
A stable volume phase staggers the one-hour retention schedule. GC is opt-in
pending density qualification. Detach/fence/Close cancels and joins before
A stable volume phase staggers the one-hour retention schedule. A kick (a
snapshot deleted through the holder's control route) also moves `Armed -> Due`;
kicks coalesce, and a kicked pass the volume refused as busy (a cut session
open) re-arms after 30 s instead of the interval. The cleaning is on by default
(owner decision, 2026-11-25; `--chunk-maintenance-gc=false` turns it off).
Tests: `TestMaintenanceKickRunsAPassNow`, `TestMaintenanceKickedBusyPassRetriesSoon`,
`TestDefaultConfigCleansAfterEachSnapshotDelete`. Detach/fence/Close cancels and joins before
catalog/storage release; only a still-current handle may re-arm after safe abort.
A pass has one minute for retention and optional GC; retention failure skips GC.
A pass has one minute for retention and the cleaning; retention failure skips the cleaning.
A scoped GC pass traces the whole catalog but mutates only its target volume,
with a separate scope/config-bound mark. Incomplete marks carry no coverage.
@@ -904,6 +909,8 @@ Notes:
| ID | Statement | Machine / transition | Enforced in | Test | TLA+ property | Status |
|---|---|---|---|---|---|---|
| `INV-MAINT-ONE-OWNER` | Only the current attached handle with matching replica/epoch/endpoint admits maintenance; one attached volume admits at most one pass; elapsed ticks coalesce and never enqueue catch-up work. | M8 Armed → Running | `provider_chunk.go` `chunkMaintenanceLoop` | `TestMaintenanceCoalescesWhileOnePassIsHeld`, `TestMaintenancePassHasOneDeadline`, `TestMaintenanceRejectsForeignLineageBeforeAdmission`, `TestMaintenanceSameHandleRearmsAfterJoinedStop` | `MaintenanceOwner` `OneOwner`, `CurrentHandleAtAdmission` | ACTIVE |
| `INV-MAINT-KICK-001` | A snapshot deleted through the holder's control route kicks one maintenance pass at once; kicks coalesce into one pending pass, and no kick is queued without a running loop. | M8 Armed → Due | `provider_chunk.go` `KickMaintenance`, `chunkMaintenanceLoop`; `chunk_control.go` `DeleteSnapshot` | `TestMaintenanceKickRunsAPassNow`, `TestMaintenanceKicksDuringAPassCoalesce`, `TestKickMaintenanceReachesOnlyARunningLoop`, `TestChunkControlSnapshotDeleteKicksTheCleaning`, `TestDefaultConfigCleansAfterEachSnapshotDelete` | `MaintenanceOwner` `OneOwner` | ACTIVE |
| `INV-MAINT-KICK-RETRY-001` | A kicked pass refused as busy keeps the kick and re-arms after 30 s; only a pass that is not refused clears it. The delay only paces retries: whether a pass may clean is decided by HEAD's activity, never by the timer. | M8 Running → Armed (busy) | `provider_chunk.go` `chunkMaintenanceLoop` | `TestMaintenanceKickedBusyPassRetriesSoon` | `MaintenanceOwner` `NoLostKick` | ACTIVE |
| `INV-MAINT-JOIN` | Detach/fence/Close cancels maintenance and the scheduled-snapshot worker and joins admitted workers before releasing its catalog/storage lifetime. | M8 Running → Draining → Closed | `provider_chunk.go` `chunkBackground`, `stopChunkLoop` | `TestMaintenanceStopJoinsBeforeRelease`, `TestMaintenanceCloseCancelsAndJoinsWithoutGuestLock`, `TestMaintenanceAuthorityLossCancelsHeldPass`, `TestMaintenanceHealthyLineageChangeCancelsHeldPass`, `TestScheduledSnapshotLoop_StopJoinsTheAttempt` | `MaintenanceOwner` `JoinedBeforeRelease` | ACTIVE |
| `INV-SNAP-SEAL-POINT-001` | A named snapshot request for a free name runs exactly one cut and stores the HEAD that cut installed as the snapshot; a retry of a recorded request replays that snapshot without cutting; if the cut fails (including a COW window abort) the request fails with that error and records no snapshot. | M5 Admit → Settled, then M6 snapshot: name held → published | `core/host/volume/chunk_control.go` `chunkControl.Snapshot`; `core/frontend/chunkstore/catalog.go` `CreateSnapshot` | `TestNamedSnapshotWindowAbortNeverSubstitutesPoint` (`core/host/volume/chunk_review271_test.go`) | — | ARCHIVED |
| `INV-SNAP-SEAL-DURABLE-001` | A named snapshot is reported done only after the commit naming it is confirmed (every object its root reaches written by the session first); an unknown outcome reports failure, settled by reading HEAD. | M5 CAS → Settled; M6 snapshot: name held → published | `core/host/volume/chunk_control.go` `chunkControl.Snapshot`; `core/storage/chunk_layer.go` `captureLocked`; `core/frontend/chunkstore/layout_remote.go` `LayoutRemote.CASHead`; `core/frontend/chunkstore/layout/commit.go` `RunCommit` | `TestLayoutRemote_CutCommitsThroughTheKernel` (`core/frontend/chunkstore/layout_remote_test.go`); `TestNamedSnapshotWindowAbortNeverSubstitutesPoint` (`core/host/volume/chunk_review271_test.go`) | — | ACTIVE |
+3 -1
View File
@@ -261,7 +261,9 @@ and the volume does not serve. A monitor that only watches for failed units does
- **One live process per volume per host.** The host lock keeps two processes for one volume apart only on one host;
two hosts are kept apart by the assignment and the lease. A container needs the host's `/run/sw-block/locks`
([one process per volume](releases/one-process-per-volume.md)).
- **Manual GC.** Automatic GC is off (`--chunk-maintenance-gc`): run GC passes yourself.
- **Cleaning is on by default.** The holder removes chunks no root names after each snapshot delete and every
`--chunk-maintenance-interval` (hourly by default); `--chunk-maintenance-gc=false` turns it off, and then nothing
removes them. The disk space returns when SeaweedFS vacuums its volumes.
- **Node reattach events under mutual TLS.** Node reattach events are not recorded in the cluster event log under
mutual TLS: a CSI node's certificate is `viewer`, so blockmaster refuses the event and the node logs one line per
reattach.
+36 -13
View File
@@ -1,37 +1,60 @@
------------------------- MODULE MaintenanceOwner -------------------------
EXTENDS Naturals, TLC
CONSTANT AllowOverlap, ReleaseBeforeJoin, AllowStaleRearm
VARIABLES state, due, workers, released, owner, current, arms, closing
vars == <<state,due,workers,released,owner,current,arms,closing>>
\* Kick (2026-11-25): a snapshot deleted through the holder kicks one pass
\* (Armed -> Due; kicks coalesce). A pass the volume refuses as busy (a cut
\* session open: the cleaning never runs during one) keeps the kick pending
\* and re-arms it soon; only a pass that is not refused serves the kick.
\* LoseKickOnBusy = TRUE: a busy pass drops the kick (must violate NoLostKick).
CONSTANT AllowOverlap, ReleaseBeforeJoin, AllowStaleRearm, LoseKickOnBusy
VARIABLES state, due, workers, released, owner, current, arms, closing, kicked, session, lostKick
vars == <<state,due,workers,released,owner,current,arms,closing,kicked,session,lostKick>>
Init == /\ state = "pending" /\ due = FALSE /\ workers = 0 /\ released = FALSE
/\ owner = 1 /\ current = 1 /\ arms = 0 /\ closing = FALSE
/\ kicked = FALSE /\ session = FALSE /\ lostKick = FALSE
Attach == /\ state = "pending" /\ state' = "armed" /\ arms' = arms+1
/\ UNCHANGED <<due,workers,released,owner,current,closing>>
/\ UNCHANGED <<due,workers,released,owner,current,closing,kicked,session,lostKick>>
Tick == /\ state = "armed" /\ due' = TRUE
/\ UNCHANGED <<state,workers,released,owner,current,arms,closing>>
/\ UNCHANGED <<state,workers,released,owner,current,arms,closing,kicked,session,lostKick>>
Kick == /\ state = "armed" /\ due' = TRUE /\ kicked' = TRUE
/\ UNCHANGED <<state,workers,released,owner,current,arms,closing,session,lostKick>>
Start == /\ state = "armed" /\ due /\ (workers = 0 \/ AllowOverlap)
/\ workers < 2 /\ workers' = workers+1 /\ due' = FALSE
/\ UNCHANGED <<state,released,owner,current,arms,closing>>
/\ UNCHANGED <<state,released,owner,current,arms,closing,kicked,session,lostKick>>
\* A pass ends; it was refused as busy iff a cut session was open. A served
\* (not busy) pass clears the kick; a busy pass keeps it and re-arms soon.
Finish == /\ workers > 0 /\ workers' = workers-1
/\ UNCHANGED <<state,due,released,owner,current,arms,closing>>
/\ IF session
THEN IF LoseKickOnBusy
THEN /\ kicked' = FALSE /\ lostKick' = (lostKick \/ kicked) /\ due' = due
ELSE /\ kicked' = kicked /\ lostKick' = lostKick
/\ due' = (due \/ (kicked /\ state = "armed"))
ELSE /\ kicked' = FALSE /\ lostKick' = lostKick /\ due' = due
/\ UNCHANGED <<state,released,owner,current,arms,closing,session>>
OpenSession == /\ ~session /\ session' = TRUE
/\ UNCHANGED <<state,due,workers,released,owner,current,arms,closing,kicked,lostKick>>
CloseSession == /\ session /\ session' = FALSE
/\ UNCHANGED <<state,due,workers,released,owner,current,arms,closing,kicked,lostKick>>
Stop == /\ state = "armed" /\ state' = "draining" /\ due' = FALSE
/\ closing' \in BOOLEAN /\ UNCHANGED <<workers,released,owner,current,arms>>
/\ closing' \in BOOLEAN /\ UNCHANGED <<workers,released,owner,current,arms,kicked,session,lostKick>>
Join == /\ state = "draining" /\ (workers = 0 \/ ReleaseBeforeJoin)
/\ state' = IF closing THEN "closed" ELSE "idle"
/\ released' = TRUE /\ UNCHANGED <<due,workers,owner,current,arms,closing>>
/\ released' = TRUE /\ UNCHANGED <<due,workers,owner,current,arms,closing,kicked,session,lostKick>>
Rearm == /\ state = "idle" /\ arms < 3 /\ (owner = current \/ AllowStaleRearm)
/\ state' = "armed" /\ released' = FALSE /\ arms' = arms+1
/\ UNCHANGED <<due,workers,owner,current,closing>>
/\ UNCHANGED <<due,workers,owner,current,closing,kicked,session,lostKick>>
ReplaceHandle == /\ state = "idle" /\ workers = 0 /\ current = 1
/\ current' = 2
/\ UNCHANGED <<state,due,workers,released,owner,arms,closing>>
/\ UNCHANGED <<state,due,workers,released,owner,arms,closing,kicked,session,lostKick>>
AttachCurrent == /\ state = "idle" /\ workers = 0 /\ owner # current /\ arms < 3
/\ owner' = current /\ state' = "armed" /\ released' = FALSE
/\ arms' = arms+1 /\ UNCHANGED <<due,workers,current,closing>>
Next == Attach \/ Tick \/ Start \/ Finish \/ Stop \/ Join \/ Rearm \/ ReplaceHandle \/ AttachCurrent
/\ arms' = arms+1 /\ UNCHANGED <<due,workers,current,closing,kicked,session,lostKick>>
Next == Attach \/ Tick \/ Kick \/ Start \/ Finish \/ OpenSession \/ CloseSession
\/ Stop \/ Join \/ Rearm \/ ReplaceHandle \/ AttachCurrent
Spec == Init /\ [][Next]_vars
OneOwner == workers <= 1
JoinedBeforeRelease == released => workers = 0
NoCatchupQueue == due \in BOOLEAN
CurrentHandleAtAdmission == workers > 0 => owner = current
\* A kick is never dropped by a busy pass: it stays until a pass serves it.
NoLostKick == ~lostKick
=============================================================================
@@ -2,5 +2,6 @@ SPECIFICATION Spec
CONSTANTS AllowOverlap = FALSE
ReleaseBeforeJoin = TRUE
AllowStaleRearm = FALSE
INVARIANTS OneOwner JoinedBeforeRelease NoCatchupQueue CurrentHandleAtAdmission
LoseKickOnBusy = FALSE
INVARIANTS OneOwner JoinedBeforeRelease NoCatchupQueue CurrentHandleAtAdmission NoLostKick
CHECK_DEADLOCK FALSE
@@ -0,0 +1,7 @@
SPECIFICATION Spec
CONSTANTS AllowOverlap = FALSE
ReleaseBeforeJoin = FALSE
AllowStaleRearm = FALSE
LoseKickOnBusy = TRUE
INVARIANTS OneOwner JoinedBeforeRelease NoCatchupQueue CurrentHandleAtAdmission NoLostKick
CHECK_DEADLOCK FALSE
@@ -2,5 +2,6 @@ SPECIFICATION Spec
CONSTANTS AllowOverlap = TRUE
ReleaseBeforeJoin = FALSE
AllowStaleRearm = FALSE
INVARIANTS OneOwner JoinedBeforeRelease NoCatchupQueue CurrentHandleAtAdmission
LoseKickOnBusy = FALSE
INVARIANTS OneOwner JoinedBeforeRelease NoCatchupQueue CurrentHandleAtAdmission NoLostKick
CHECK_DEADLOCK FALSE
@@ -2,5 +2,6 @@ SPECIFICATION Spec
CONSTANTS AllowOverlap = FALSE
ReleaseBeforeJoin = FALSE
AllowStaleRearm = FALSE
INVARIANTS OneOwner JoinedBeforeRelease NoCatchupQueue CurrentHandleAtAdmission
LoseKickOnBusy = FALSE
INVARIANTS OneOwner JoinedBeforeRelease NoCatchupQueue CurrentHandleAtAdmission NoLostKick
CHECK_DEADLOCK FALSE
@@ -2,5 +2,6 @@ SPECIFICATION Spec
CONSTANTS AllowOverlap = FALSE
ReleaseBeforeJoin = FALSE
AllowStaleRearm = TRUE
INVARIANTS OneOwner JoinedBeforeRelease NoCatchupQueue CurrentHandleAtAdmission
LoseKickOnBusy = FALSE
INVARIANTS OneOwner JoinedBeforeRelease NoCatchupQueue CurrentHandleAtAdmission NoLostKick
CHECK_DEADLOCK FALSE
+11 -2
View File
@@ -399,6 +399,14 @@ Native tests separately bind replica/epoch/endpoint and current handle/layer,
witness cancellation while held, and same-handle stop/join/re-arm. This finite
model does not establish physical-I/O cancellation or a fleet scheduling bound.
The kick (2026-11-25): a snapshot deleted through the holder moves `Armed -> Due`;
a pass refused as busy (a cut session open) keeps the kick and re-arms it, and
only a pass that is not refused clears it (`NoLostKick`). Run 2026-11-26 00:27 UTC,
same jar SHA256, OpenJDK 17: `safe` no error (699 generated / 212 distinct,
depth 13); `overlap`, `early_release` and `stale_rearm` violate OneOwner,
JoinedBeforeRelease and CurrentHandleAtAdmission as before; the new negative
`lost_kick` (a busy pass drops the kick) violates NoLostKick (92/39, depth 6).
`ScopedMaintenanceGC.tla` extends S9's scope correspondence: three keys across
two volumes, one foreign-only root, independent local coverage and crash/config
invalidation. `ScopedMaintenanceGC_safe.cfg` checks foreign-root preservation,
@@ -407,8 +415,9 @@ depth 9, with the same TLC/jar. Its three negative configs narrow
the root domain, widen reclamation or import namespace coverage. Native tests
exercise the persisted mark records and real catalog root traversal; the finite
model abstracts the complete mark and grace, whose timing remains in S9.
No 50/200-volume density or metadata-RPC qualification is claimed; automatic GC
remains opt-in, while periodic HEAD capture and retention are enabled by the CLI.
No 50/200-volume density or metadata-RPC qualification is claimed. Automatic
cleaning is on by default (owner decision, 2026-11-25), as are periodic HEAD capture
and retention in the CLI.
The unchanged S9 timing models were replayed with the same TLC/jar:
`cfg/S9_rule_G4.cfg` (`RetentionGCTiming`, D=2/G=4/MD=1/MaxT=10)
+3 -3
View File
@@ -504,13 +504,13 @@ sw-block ops chunk snapshot --volume v1 --name before-upgrade --status-addr STAT
Space comes back in two steps. Neither is immediate.
1. **The holder's cleaning deletes the chunks.**
- Cleaning runs only on the volume server that holds the volume, in its maintenance pass (`--chunk-maintenance-interval`, hourly by default), and only with `--chunk-maintenance-gc`. It is off by default. There is no operator command.
- Cleaning runs only on the volume server that holds the volume, in its maintenance pass: right after each snapshot delete through that server, and every `--chunk-maintenance-interval` (hourly by default). It is on by default; `--chunk-maintenance-gc=false` turns it off. There is no operator command.
- A pass removes the volume's own chunks that no root in HEAD names: not the current image, not a snapshot. A chunk that a restore target still names stays, because the source's snapshot keeps it while the target depends on it.
- A deleted snapshot's unshared chunks are therefore removed by the first pass after the delete. A pass waits while a snapshot is being taken, and a server that no longer holds the volume removes nothing.
- A deleted snapshot's unshared chunks are therefore removed by the first pass after the delete. A pass waits while a snapshot is being taken (it is tried again shortly), a cut cancels a pass in progress, and a server that no longer holds the volume removes nothing. A snapshot deleted with `sw-block ops chunk` (not through the holder) is cleaned at the next periodic pass.
```bash
sw-block ops chunk snapshot-delete --volume v1 --name sched-20261120T031204Z --chunk-filer FILER
# with --chunk-maintenance-gc on the holder, the next maintenance pass removes the chunks only it named;
# the holder's next maintenance pass removes the chunks only it named;
# each pass logs "maintenance volume=... removed=N"
```
2. **SeaweedFS vacuum compacts the volume files.** Reclaimed chunks are deleted needles.