From 1e40249ec7f63025e7b8c1fc4c28ca5518fe236f Mon Sep 17 00:00:00 2001 From: pingqiu Date: Wed, 25 Nov 2026 16:28:22 -0800 Subject: [PATCH] durable: a kick stays pending across busy passes; the kick is in M8's model and ledger Review: a second busy refusal lost the kick and fell back to the hourly interval, so a snapshot session longer than the 30 s retry defeated it. The kick now stays pending until a pass the volume does not refuse as busy; every busy retry comes after the short delay. KickMaintenance reports only a running loop (not a stopped one, nor one that ended on a fence or lineage change). Tests: busy -> busy -> success, then back on the interval; kicks during a held pass coalesce into exactly one follow-up; the running-loop check; the cut-cancels-cleaning regression bounds every wait and cancels and joins its cleaning on failure. Protocol contract (M8 timing change): MaintenanceOwner.tla gains the kick, the session that makes a pass busy, and NoLostKick, with a negative config (lost_kick: a busy pass drops the kick) that violates it; the four existing configs keep their results. The design diagram gains the kick and busy-retry edges; the ledger gains INV-MAINT-KICK-001 and INV-MAINT-KICK-RETRY-001; the spec README records the run. Co-Authored-By: Claude Opus 5.5 --- .../cmd/blockvolume/cleaning_default_test.go | 33 ++++- .../frontend/durable/maintenance_kick_test.go | 125 +++++++++++++----- .../core/frontend/durable/provider_chunk.go | 27 ++-- .../docs/design/agent-workspace-design.md | 4 +- seaweed-block/docs/design/invariants.md | 2 + seaweed-block/docs/spec/MaintenanceOwner.tla | 49 +++++-- .../spec/MaintenanceOwner_early_release.cfg | 3 +- .../docs/spec/MaintenanceOwner_lost_kick.cfg | 7 + .../docs/spec/MaintenanceOwner_overlap.cfg | 3 +- .../docs/spec/MaintenanceOwner_safe.cfg | 3 +- .../spec/MaintenanceOwner_stale_rearm.cfg | 3 +- seaweed-block/docs/spec/README.md | 8 ++ 12 files changed, 205 insertions(+), 62 deletions(-) create mode 100644 seaweed-block/docs/spec/MaintenanceOwner_lost_kick.cfg diff --git a/seaweed-block/cmd/blockvolume/cleaning_default_test.go b/seaweed-block/cmd/blockvolume/cleaning_default_test.go index 833f736010..693cff3e9e 100644 --- a/seaweed-block/cmd/blockvolume/cleaning_default_test.go +++ b/seaweed-block/cmd/blockvolume/cleaning_default_test.go @@ -137,17 +137,35 @@ func TestCutDuringTheHoldersCleaningCancelsIt(t *testing.T) { 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 := make(chan error, 1) + cleaned, joined := make(chan error, 1), make(chan struct{}) go func() { - cleaned <- cleaner.Clean(ctx, func(ctx context.Context, _ layout.HolderID, _ string) error { + 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() }) }() - <-started + 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() @@ -160,8 +178,13 @@ func TestCutDuringTheHoldersCleaningCancelsIt(t *testing.T) { case <-time.After(5 * time.Second): t.Fatal("the cut did not cancel the cleaning") } - if err := <-cleaned; err != nil { - t.Fatalf("the cancelled cleaning ended with %v; want a clean end", err) + 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 { diff --git a/seaweed-block/core/frontend/durable/maintenance_kick_test.go b/seaweed-block/core/frontend/durable/maintenance_kick_test.go index 6828235432..2e7106f8ac 100644 --- a/seaweed-block/core/frontend/durable/maintenance_kick_test.go +++ b/seaweed-block/core/frontend/durable/maintenance_kick_test.go @@ -3,24 +3,34 @@ 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. +// 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++ - c.n <- 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(c.seen) + return c.fail(n) } return nil } @@ -45,16 +55,31 @@ func (c *countingPass) none(t *testing.T, for_ time.Duration) { } } +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; a pass is not repeated until the next kick or -// interval, and kicks given while one is pending coalesce. +// 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) - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - go p.chunkMaintenanceLoop(ctx, "v1", maintenanceStubLayer{}, func() bool { return true }, kick) + 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 { @@ -62,54 +87,92 @@ func TestMaintenanceKickRunsAPassNow(t *testing.T) { } c.none(t, 200*time.Millisecond) kick <- struct{}{} - select { - case kick <- struct{}{}: // the loop may not have taken the first yet - default: - } 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) is tried again after the short retry, -// not an interval later. +// 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 == 1 { + 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) - ctx, cancel := context.WithCancel(context.Background()) - defer cancel() - go p.chunkMaintenanceLoop(ctx, "v1", maintenanceStubLayer{}, func() bool { return true }, kick) + runLoop(t, p, kick) kick <- struct{}{} - if n := c.next(t, 5*time.Second); n != 1 { - t.Fatalf("pass %d; want 1", n) + 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) + } } - if n := c.next(t, 5*time.Second); n != 2 { - t.Fatalf("pass %d after the busy refusal; want the retry (2)", n) - } - c.none(t, 300*time.Millisecond) // the retry succeeded: back to the interval + c.none(t, 300*time.Millisecond) // the kick is served: back to the interval } -// KickMaintenance reaches only a volume whose maintenance loop runs. +// 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) { - kick := make(chan struct{}, 1) - p := &DurableProvider{volumes: map[string]*volHandle{"on": {maintKick: kick}, "off": {}}} - if !p.KickMaintenance("on") || len(kick) != 1 { + 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("on") || len(kick) != 1 { + if !p.KickMaintenance("running") || len(kicks["running"]) != 1 { t.Fatal("a second kick before the pass did not coalesce") } - if p.KickMaintenance("off") || p.KickMaintenance("absent") { - t.Fatal("a kick reported success with no maintenance loop") + 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") } } diff --git a/seaweed-block/core/frontend/durable/provider_chunk.go b/seaweed-block/core/frontend/durable/provider_chunk.go index 937231bec9..ffef719184 100644 --- a/seaweed-block/core/frontend/durable/provider_chunk.go +++ b/seaweed-block/core/frontend/durable/provider_chunk.go @@ -941,16 +941,22 @@ func (p *DurableProvider) maintenanceCurrent(volumeID string, h *volHandle, laye 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 loop was there to ask; kicks -// coalesce, and the pass is the same bounded pass the timer runs. +// 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 { + 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 } @@ -1002,13 +1008,18 @@ func (p *DurableProvider) chunkMaintenanceLoop(ctx context.Context, volumeID str _ = obs.ObserveRemoteError(err) } // Completion-relative reset coalesces all elapsed ticks; no catch-up queue. - // A kicked pass refused because a cut session was open is tried again - // soon, not a whole interval later. + // 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) && maintenanceKickRetry < next { - next = maintenanceKickRetry + if kicked && errors.Is(err, layout.ErrBusy) { + if maintenanceKickRetry < next { + next = maintenanceKickRetry + } + } else { + kicked = false } - kicked = false timer.Reset(next) } } diff --git a/seaweed-block/docs/design/agent-workspace-design.md b/seaweed-block/docs/design/agent-workspace-design.md index 5850a7c6ba..67bba67690 100644 --- a/seaweed-block/docs/design/agent-workspace-design.md +++ b/seaweed-block/docs/design/agent-workspace-design.md @@ -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 diff --git a/seaweed-block/docs/design/invariants.md b/seaweed-block/docs/design/invariants.md index 9d6333353d..ee1cfe92e0 100644 --- a/seaweed-block/docs/design/invariants.md +++ b/seaweed-block/docs/design/invariants.md @@ -909,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 | diff --git a/seaweed-block/docs/spec/MaintenanceOwner.tla b/seaweed-block/docs/spec/MaintenanceOwner.tla index b389264468..99b769c216 100644 --- a/seaweed-block/docs/spec/MaintenanceOwner.tla +++ b/seaweed-block/docs/spec/MaintenanceOwner.tla @@ -1,37 +1,60 @@ ------------------------- MODULE MaintenanceOwner ------------------------- EXTENDS Naturals, TLC -CONSTANT AllowOverlap, ReleaseBeforeJoin, AllowStaleRearm -VARIABLES state, due, workers, released, owner, current, arms, closing -vars == <> +\* 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 == <> 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 <> + /\ UNCHANGED <> Tick == /\ state = "armed" /\ due' = TRUE - /\ UNCHANGED <> + /\ UNCHANGED <> +Kick == /\ state = "armed" /\ due' = TRUE /\ kicked' = TRUE + /\ UNCHANGED <> Start == /\ state = "armed" /\ due /\ (workers = 0 \/ AllowOverlap) /\ workers < 2 /\ workers' = workers+1 /\ due' = FALSE - /\ UNCHANGED <> + /\ UNCHANGED <> +\* 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 <> + /\ 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 <> +OpenSession == /\ ~session /\ session' = TRUE + /\ UNCHANGED <> +CloseSession == /\ session /\ session' = FALSE + /\ UNCHANGED <> Stop == /\ state = "armed" /\ state' = "draining" /\ due' = FALSE - /\ closing' \in BOOLEAN /\ UNCHANGED <> + /\ closing' \in BOOLEAN /\ UNCHANGED <> Join == /\ state = "draining" /\ (workers = 0 \/ ReleaseBeforeJoin) /\ state' = IF closing THEN "closed" ELSE "idle" - /\ released' = TRUE /\ UNCHANGED <> + /\ released' = TRUE /\ UNCHANGED <> Rearm == /\ state = "idle" /\ arms < 3 /\ (owner = current \/ AllowStaleRearm) /\ state' = "armed" /\ released' = FALSE /\ arms' = arms+1 - /\ UNCHANGED <> + /\ UNCHANGED <> ReplaceHandle == /\ state = "idle" /\ workers = 0 /\ current = 1 /\ current' = 2 - /\ UNCHANGED <> + /\ UNCHANGED <> AttachCurrent == /\ state = "idle" /\ workers = 0 /\ owner # current /\ arms < 3 /\ owner' = current /\ state' = "armed" /\ released' = FALSE - /\ arms' = arms+1 /\ UNCHANGED <> -Next == Attach \/ Tick \/ Start \/ Finish \/ Stop \/ Join \/ Rearm \/ ReplaceHandle \/ AttachCurrent + /\ arms' = arms+1 /\ UNCHANGED <> +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 ============================================================================= diff --git a/seaweed-block/docs/spec/MaintenanceOwner_early_release.cfg b/seaweed-block/docs/spec/MaintenanceOwner_early_release.cfg index a9eb05e357..60a87d71c7 100644 --- a/seaweed-block/docs/spec/MaintenanceOwner_early_release.cfg +++ b/seaweed-block/docs/spec/MaintenanceOwner_early_release.cfg @@ -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 diff --git a/seaweed-block/docs/spec/MaintenanceOwner_lost_kick.cfg b/seaweed-block/docs/spec/MaintenanceOwner_lost_kick.cfg new file mode 100644 index 0000000000..e141c32fc8 --- /dev/null +++ b/seaweed-block/docs/spec/MaintenanceOwner_lost_kick.cfg @@ -0,0 +1,7 @@ +SPECIFICATION Spec +CONSTANTS AllowOverlap = FALSE + ReleaseBeforeJoin = FALSE + AllowStaleRearm = FALSE + LoseKickOnBusy = TRUE +INVARIANTS OneOwner JoinedBeforeRelease NoCatchupQueue CurrentHandleAtAdmission NoLostKick +CHECK_DEADLOCK FALSE diff --git a/seaweed-block/docs/spec/MaintenanceOwner_overlap.cfg b/seaweed-block/docs/spec/MaintenanceOwner_overlap.cfg index 6984971b3a..7d3e173d5b 100644 --- a/seaweed-block/docs/spec/MaintenanceOwner_overlap.cfg +++ b/seaweed-block/docs/spec/MaintenanceOwner_overlap.cfg @@ -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 diff --git a/seaweed-block/docs/spec/MaintenanceOwner_safe.cfg b/seaweed-block/docs/spec/MaintenanceOwner_safe.cfg index deb0ac7c68..83fad5b7d6 100644 --- a/seaweed-block/docs/spec/MaintenanceOwner_safe.cfg +++ b/seaweed-block/docs/spec/MaintenanceOwner_safe.cfg @@ -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 diff --git a/seaweed-block/docs/spec/MaintenanceOwner_stale_rearm.cfg b/seaweed-block/docs/spec/MaintenanceOwner_stale_rearm.cfg index 46925d6f86..432730f5f1 100644 --- a/seaweed-block/docs/spec/MaintenanceOwner_stale_rearm.cfg +++ b/seaweed-block/docs/spec/MaintenanceOwner_stale_rearm.cfg @@ -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 diff --git a/seaweed-block/docs/spec/README.md b/seaweed-block/docs/spec/README.md index 47a951391d..5324452ef9 100644 --- a/seaweed-block/docs/spec/README.md +++ b/seaweed-block/docs/spec/README.md @@ -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,