From 8c9358bca080df92da1bae57bf8ae4d87e81cd55 Mon Sep 17 00:00:00 2001 From: pingqiu-cpu Date: Wed, 2 Dec 2026 20:53:59 -0800 Subject: [PATCH 01/66] storage: the cut's pause metric ends at the barrier's Unlock (#972) Interim merge note (spec trace workflow startup_failure since 22:45Z): metric-only change. go test (linux) and process-level tests (real binaries) passed on b197f5f7 (the first go test run died in an unrelated pre-existing test race in TestCutCOWV3_HeldFillIsCancelledByAbortAndDrained, fixed separately in #975; only the failed job was rerun); spec-trace-check.sh and public-text-check.sh run locally with the base branch's scripts against this head and body: both pass. Code reviews ACCEPT on b197f5f7 (two reviewers). --- .../core/host/volume/chunk_control.go | 2 + .../storage/chunk_cut_barrier_release_test.go | 127 ++++++++++++++++++ seaweed-block/core/storage/chunk_layer.go | 35 ++++- seaweed-block/core/storage/chunk_seam.go | 11 +- seaweed-block/docs/status-schema.md | 35 ++--- 5 files changed, 185 insertions(+), 25 deletions(-) create mode 100644 seaweed-block/core/storage/chunk_cut_barrier_release_test.go diff --git a/seaweed-block/core/host/volume/chunk_control.go b/seaweed-block/core/host/volume/chunk_control.go index df5ec37d04..0122b7283d 100644 --- a/seaweed-block/core/host/volume/chunk_control.go +++ b/seaweed-block/core/host/volume/chunk_control.go @@ -87,6 +87,7 @@ type ChunkCutStatsBody struct { COWSaveNs int64 `json:"cowSaveNs"` COWWaitNs int64 `json:"cowWaitNs"` BarrierPauseNs int64 `json:"barrierPauseNs"` + BarrierReleaseNs int64 `json:"barrierReleaseNs"` LockWaitNs int64 `json:"lockWaitNs"` DrainNs int64 `json:"drainNs"` CASWriteNs int64 `json:"casWriteNs"` @@ -141,6 +142,7 @@ func cutStatsBody(s storage.ChunkCutStats) ChunkCutStatsBody { COWWALReadAttempts: s.COWWALReadAttempts, COWLocalReadNs: s.COWLocalReadNs, BarrierPauseNs: s.BarrierPauseNs, + BarrierReleaseNs: s.BarrierReleaseNs, LockWaitNs: s.LockWaitNs, DrainNs: s.DrainNs, CASWriteNs: s.CASWriteNs, diff --git a/seaweed-block/core/storage/chunk_cut_barrier_release_test.go b/seaweed-block/core/storage/chunk_cut_barrier_release_test.go new file mode 100644 index 0000000000..32799511ca --- /dev/null +++ b/seaweed-block/core/storage/chunk_cut_barrier_release_test.go @@ -0,0 +1,127 @@ +package storage + +import ( + "errors" + "runtime" + "strings" + "testing" + "time" +) + +// parkedOnBarrier counts the guest writes waiting for the capture barrier's +// read side: blocked in RLock, or (a write with an admission deadline) +// retrying TryRLock in acquireWriteLock. These are the writes the barrier's +// release lets in. +func parkedOnBarrier() int { + buf := make([]byte, 1<<22) + buf = buf[:runtime.Stack(buf, true)] + n := 0 + for _, g := range strings.Split(string(buf), "\n\n") { + waiting := strings.Contains(g, "sync.(*RWMutex).RLock") || strings.Contains(g, "(*WALStore).acquireWriteLock") + if waiting && strings.Contains(g, "(*WALStore).WriteContext") { + n++ + } + } + return n +} + +// The guest pause ends where the capture barrier's Unlock starts. The Unlock +// itself (it wakes each reader blocked on the barrier before it returns), the +// flusher hold's release and the flusher's wake are reported apart in +// BarrierReleaseNs. With N writers seen parked on the barrier and the release +// step at the Unlock made slow (a stand-in for its wake work), the pause stays +// below that step for every N and the release time carries it. (A pause read +// after the Unlock carried the step: about 100 ms more.) +func TestTheBarrierPauseEndsAtUnlockAndItsReleaseIsReportedApart(t *testing.T) { + const slowRelease = 100 * time.Millisecond + for _, n := range []int{1, 64} { + s, _ := newChunkTestStore(t) + l := mustAttach(t, s, newFakeChunkRemote(), ctConfig(1)).(*chunkLayerImpl) + if _, err := l.Cut(ctTimeout(t)); err != nil { // the seed and an empty set + t.Fatal(err) + } + if _, err := s.Write(0, makeBlock(ctBlockSize, 0x41)); err != nil { + t.Fatal(err) + } + done := make(chan error, n) + parked := 0 + l.testAfterBarrierSyncHook = func(uint64) { // under the barrier: these writers park on it + l.testAfterBarrierSyncHook = nil + for i := 0; i < n; i++ { + go func(i int) { + _, err := s.Write(uint32(1+i%(ctNumBlocks-1)), makeBlock(ctBlockSize, byte(i))) + done <- err + }(i) + } + for deadline := time.Now().Add(ctLocalBound); parked < n && time.Now().Before(deadline); { + if parked = parkedOnBarrier(); parked < n { + time.Sleep(time.Millisecond) + } + } + } + l.testBarrierUnlockHook = func() { time.Sleep(slowRelease) } + r, err := l.Cut(ctTimeout(t)) + if err != nil { + t.Fatal(err) + } + for i := 0; i < n; i++ { // every parked writer finishes, bounded + select { + case werr := <-done: + if werr != nil { + t.Fatalf("a parked writer failed: %v", werr) + } + case <-time.After(ctLocalBound): + t.Fatalf("N=%d: a parked writer did not finish", n) + } + } + if parked < n { + t.Fatalf("setup: N=%d: only %d writers were seen parked on the barrier", n, parked) + } + st := r.Stats + pause, release := time.Duration(st.BarrierPauseNs), time.Duration(st.BarrierReleaseNs) + t.Logf("N=%d (%d parked): pause %v (window setup %v), release %v", n, parked, pause, time.Duration(st.WindowSetupNs), release) + if release < slowRelease { + t.Errorf("N=%d: release %v, want at least the slow release step %v", n, release, slowRelease) + } + if pause >= slowRelease { + t.Errorf("N=%d: pause %v includes the release step (%v): the pause must end where the Unlock starts", n, pause, slowRelease) + } + if time.Duration(st.WindowSetupNs) >= slowRelease { + t.Errorf("N=%d: window setup %v includes the release step", n, time.Duration(st.WindowSetupNs)) + } + } +} + +// A cut whose in-pause sync fails splits its pause and release the same way: +// the pause it reports ends where the barrier's Unlock starts, so a slow +// release step is not in it. (The failed exit read the pause after the whole +// release: about 100 ms more.) +func TestAFailedBarrierSyncSplitsItsPauseFromItsRelease(t *testing.T) { + const slowRelease = 100 * time.Millisecond + s, _ := newChunkTestStore(t) + l := mustAttach(t, s, newFakeChunkRemote(), ctConfig(1)).(*chunkLayerImpl) + if _, err := l.Cut(ctTimeout(t)); err != nil { // the seed and an empty set + t.Fatal(err) + } + if _, err := s.Write(0, makeBlock(ctBlockSize, 0x42)); err != nil { + t.Fatal(err) + } + injected := errors.New("injected in-pause sync failure") + s.testSyncCacheFault = func() error { + if l.paused { + return injected + } + return nil + } + t.Cleanup(func() { s.testSyncCacheFault = nil }) + pause, calls := time.Duration(-1), 0 + l.precopyPause = func(d time.Duration) { pause = d; calls++ } // the failed attempt's reported pause + l.testBarrierUnlockHook = func() { time.Sleep(slowRelease) } + if _, err := l.Cut(ctTimeout(t)); !errors.Is(err, injected) { + t.Fatalf("the cut's answer: %v, want the in-pause sync's failure", err) + } + t.Logf("failed cut's pause %v (%d observations)", pause, calls) + if calls != 1 || pause < 0 || pause >= slowRelease { + t.Fatalf("failed cut's pause %v: want it to end where the Unlock starts (below the %v release step)", pause, slowRelease) + } +} diff --git a/seaweed-block/core/storage/chunk_layer.go b/seaweed-block/core/storage/chunk_layer.go index 2c4ffb7384..967ef4d5a2 100644 --- a/seaweed-block/core/storage/chunk_layer.go +++ b/seaweed-block/core/storage/chunk_layer.go @@ -247,6 +247,7 @@ type chunkLayerImpl struct { testAfterStageReadHook func(idx uint64) // after a staging read, before its result is kept testAfterBarrierSyncHook func(h uint64) // under the capture barrier, right after Sync fixed H testBeforeBarrierLockHook func() // right before the capture barrier's Lock request + testBarrierUnlockHook func() // in the release span, right before the barrier's Unlock (a stand-in for its wake work) testBeforeRecordMarksHook func() // after a cut's compare, before it records its marks testAfterCompareHook func(idx uint64) // after a captured chunk is compared (and marked if equal) syncDirFn func(dir string) error // directory fsync after a rename; syncDir in production @@ -1773,14 +1774,31 @@ func (l *chunkLayerImpl) captureLocked(ctx context.Context, detach bool) (res ch return chunkCutResult{}, cause } // Resume rejected tentative admission before any ordinary COW upload. + // unlockBarrier reads the pause's end clock right before the barrier's + // Unlock: Unlock admits the parked readers and then wakes each of them + // before it returns, and that wake work belongs to the release + // (BarrierReleaseNs), not to the guest pause. + unlockBarrier := func() time.Time { + at := time.Now() + if hook := l.testBarrierUnlockHook; hook != nil { + hook() + } + l.s.captureMu.Unlock() + return at + } unlockCapture := func() { l.paused = false - l.s.captureMu.Unlock() + drainedHere := !detach && releasePrecopy != nil + at := unlockBarrier() releaseExtentHold() - if !detach && releasePrecopy != nil { + if drainedHere { releasePrecopy() releasePrecopy = nil + st.BarrierPauseNs = time.Since(pauseStart).Nanoseconds() // a drained guest is back only now + } else { + st.BarrierPauseNs = at.Sub(pauseStart).Nanoseconds() } + st.BarrierReleaseNs = time.Since(at).Nanoseconds() } if hook := l.testBeforeBarrierLockHook; hook != nil { hook() @@ -1811,7 +1829,6 @@ func (l *chunkLayerImpl) captureLocked(ctx context.Context, detach bool) (res ch } if err != nil { unlockCapture() - st.BarrierPauseNs = time.Since(pauseStart).Nanoseconds() return chunkCutResult{}, fmt.Errorf("storage: capture sync: %w", err) } l.cutPhase("candidates") @@ -1850,13 +1867,19 @@ func (l *chunkLayerImpl) captureLocked(ctx context.Context, detach bool) (res ch // guest pause runs to that release, as before. An ordinary cut's guest // is back now, and its pause did O(1) work. drained := releasePrecopy != nil - l.s.captureMu.Unlock() + // An ordinary cut's guest is back from the Unlock on: the pause ends there. + // The Unlock's own wakes, the hold's release and the flusher's wake are + // reported apart (BarrierReleaseNs). + unlocked := unlockBarrier() + st.WindowSetupNs += unlocked.Sub(windowStart).Nanoseconds() + if !drained { + st.BarrierPauseNs = unlocked.Sub(pauseStart).Nanoseconds() + } releaseExtentHold() - st.WindowSetupNs += time.Since(windowStart).Nanoseconds() if !drained { l.paused = false - st.BarrierPauseNs = time.Since(pauseStart).Nanoseconds() } + st.BarrierReleaseNs = time.Since(unlocked).Nanoseconds() releaseDrain := func() { if drained { if releasePrecopy != nil && !detach { diff --git a/seaweed-block/core/storage/chunk_seam.go b/seaweed-block/core/storage/chunk_seam.go index 0413f07996..4dde09f5a1 100644 --- a/seaweed-block/core/storage/chunk_seam.go +++ b/seaweed-block/core/storage/chunk_seam.go @@ -463,8 +463,9 @@ type chunkCutStats struct { COWSaveNs int64 COWWaitNs int64 // BarrierPauseNs is the guest pause: from the capture barrier's Lock - // request until it is released. LockWaitNs is its first part, the wait for - // writers already holding the capture barrier shared. + // request to the start of its Unlock (BarrierReleaseNs below is the rest). + // LockWaitNs is its first part, the wait for writers already holding the + // capture barrier shared. BarrierPauseNs int64 LockWaitNs int64 DrainNs int64 @@ -482,6 +483,12 @@ type chunkCutStats struct { MapPersistNs int64 CASResult string TotalNs int64 + + // BarrierReleaseNs is the barrier's release, outside the guest pause: the + // Unlock (which wakes each guest writer parked on the barrier), releasing + // the flusher hold and waking the flusher. A failed sync's exit splits the + // same way. + BarrierReleaseNs int64 // Pre-copy (staging by the copy-on-write side budget, M5 Stage): // StageRounds staging rounds staged StagedChunks chunks outside the // barrier; StagedChunksUsed of the uploads in HEAD came from staging. diff --git a/seaweed-block/docs/status-schema.md b/seaweed-block/docs/status-schema.md index dfd2ff0e98..8187841179 100644 --- a/seaweed-block/docs/status-schema.md +++ b/seaweed-block/docs/status-schema.md @@ -347,23 +347,24 @@ Durable store state of the served volume. Go type `volume.durableStatusBody`. | `Volumes[].Chunk.Stats.LastCut.COWSavedChunks` | int | (group of `COWWALReadAttempts`) Local validated WAL attempts and local copy duration, including savers. | | `Volumes[].Chunk.Stats.LastCut.COWSaveNs` | int64 | (group of `COWWALReadAttempts`) Local validated WAL attempts and local copy duration, including savers. | | `Volumes[].Chunk.Stats.LastCut.COWWaitNs` | int64 | (group of `COWWALReadAttempts`) Local validated WAL attempts and local copy duration, including savers. | -| `Volumes[].Chunk.Stats.LastCut.BarrierPauseNs` | int64 | BarrierPauseNs is the guest pause: from the capture barrier's Lock request until it is released. LockWaitNs is its first part, the wait for writers already holding the capture barrier shared. | -| `Volumes[].Chunk.Stats.LastCut.LockWaitNs` | int64 | (group of `BarrierPauseNs`) BarrierPauseNs is the guest pause: from the capture barrier's Lock request until it is released. LockWaitNs is its first part, the wait for writers already holding the capture barrier shared. | -| `Volumes[].Chunk.Stats.LastCut.DrainNs` | int64 | (group of `BarrierPauseNs`) BarrierPauseNs is the guest pause: from the capture barrier's Lock request until it is released. LockWaitNs is its first part, the wait for writers already holding the capture barrier shared. | -| `Volumes[].Chunk.Stats.LastCut.CASWriteNs` | int64 | (group of `BarrierPauseNs`) BarrierPauseNs is the guest pause: from the capture barrier's Lock request until it is released. LockWaitNs is its first part, the wait for writers already holding the capture barrier shared. | -| `Volumes[].Chunk.Stats.LastCut.HeadReadbackNs` | int64 | (group of `BarrierPauseNs`) BarrierPauseNs is the guest pause: from the capture barrier's Lock request until it is released. LockWaitNs is its first part, the wait for writers already holding the capture barrier shared. | -| `Volumes[].Chunk.Stats.LastCut.SyncNs` | int64 | (group of `BarrierPauseNs`) BarrierPauseNs is the guest pause: from the capture barrier's Lock request until it is released. LockWaitNs is its first part, the wait for writers already holding the capture barrier shared. | -| `Volumes[].Chunk.Stats.LastCut.CopyNs` | int64 | (group of `BarrierPauseNs`) BarrierPauseNs is the guest pause: from the capture barrier's Lock request until it is released. LockWaitNs is its first part, the wait for writers already holding the capture barrier shared. | -| `Volumes[].Chunk.Stats.LastCut.CandidateChunks` | int | (group of `BarrierPauseNs`) BarrierPauseNs is the guest pause: from the capture barrier's Lock request until it is released. LockWaitNs is its first part, the wait for writers already holding the capture barrier shared. | -| `Volumes[].Chunk.Stats.LastCut.UploadedChunks` | int | (group of `BarrierPauseNs`) BarrierPauseNs is the guest pause: from the capture barrier's Lock request until it is released. LockWaitNs is its first part, the wait for writers already holding the capture barrier shared. | -| `Volumes[].Chunk.Stats.LastCut.UploadedBytes` | int64 | (group of `BarrierPauseNs`) BarrierPauseNs is the guest pause: from the capture barrier's Lock request until it is released. LockWaitNs is its first part, the wait for writers already holding the capture barrier shared. | -| `Volumes[].Chunk.Stats.LastCut.ZeroedChunks` | int | (group of `BarrierPauseNs`) BarrierPauseNs is the guest pause: from the capture barrier's Lock request until it is released. LockWaitNs is its first part, the wait for writers already holding the capture barrier shared. | -| `Volumes[].Chunk.Stats.LastCut.UnchangedChunks` | int | (group of `BarrierPauseNs`) BarrierPauseNs is the guest pause: from the capture barrier's Lock request until it is released. LockWaitNs is its first part, the wait for writers already holding the capture barrier shared. | -| `Volumes[].Chunk.Stats.LastCut.UploadNs` | int64 | (group of `BarrierPauseNs`) BarrierPauseNs is the guest pause: from the capture barrier's Lock request until it is released. LockWaitNs is its first part, the wait for writers already holding the capture barrier shared. | -| `Volumes[].Chunk.Stats.LastCut.CASNs` | int64 | (group of `BarrierPauseNs`) BarrierPauseNs is the guest pause: from the capture barrier's Lock request until it is released. LockWaitNs is its first part, the wait for writers already holding the capture barrier shared. | -| `Volumes[].Chunk.Stats.LastCut.MapPersistNs` | int64 | (group of `BarrierPauseNs`) BarrierPauseNs is the guest pause: from the capture barrier's Lock request until it is released. LockWaitNs is its first part, the wait for writers already holding the capture barrier shared. | -| `Volumes[].Chunk.Stats.LastCut.CASResult` | string | (group of `BarrierPauseNs`) BarrierPauseNs is the guest pause: from the capture barrier's Lock request until it is released. LockWaitNs is its first part, the wait for writers already holding the capture barrier shared. | -| `Volumes[].Chunk.Stats.LastCut.TotalNs` | int64 | (group of `BarrierPauseNs`) BarrierPauseNs is the guest pause: from the capture barrier's Lock request until it is released. LockWaitNs is its first part, the wait for writers already holding the capture barrier shared. | +| `Volumes[].Chunk.Stats.LastCut.BarrierPauseNs` | int64 | BarrierPauseNs is the guest pause: from the capture barrier's Lock request to the start of its Unlock (BarrierReleaseNs below is the rest). LockWaitNs is its first part, the wait for writers already holding the capture barrier shared. | +| `Volumes[].Chunk.Stats.LastCut.LockWaitNs` | int64 | (group of `BarrierPauseNs`) BarrierPauseNs is the guest pause: from the capture barrier's Lock request to the start of its Unlock (BarrierReleaseNs below is the rest). LockWaitNs is its first part, the wait for writers already holding the capture barrier shared. | +| `Volumes[].Chunk.Stats.LastCut.DrainNs` | int64 | (group of `BarrierPauseNs`) BarrierPauseNs is the guest pause: from the capture barrier's Lock request to the start of its Unlock (BarrierReleaseNs below is the rest). LockWaitNs is its first part, the wait for writers already holding the capture barrier shared. | +| `Volumes[].Chunk.Stats.LastCut.CASWriteNs` | int64 | (group of `BarrierPauseNs`) BarrierPauseNs is the guest pause: from the capture barrier's Lock request to the start of its Unlock (BarrierReleaseNs below is the rest). LockWaitNs is its first part, the wait for writers already holding the capture barrier shared. | +| `Volumes[].Chunk.Stats.LastCut.HeadReadbackNs` | int64 | (group of `BarrierPauseNs`) BarrierPauseNs is the guest pause: from the capture barrier's Lock request to the start of its Unlock (BarrierReleaseNs below is the rest). LockWaitNs is its first part, the wait for writers already holding the capture barrier shared. | +| `Volumes[].Chunk.Stats.LastCut.SyncNs` | int64 | (group of `BarrierPauseNs`) BarrierPauseNs is the guest pause: from the capture barrier's Lock request to the start of its Unlock (BarrierReleaseNs below is the rest). LockWaitNs is its first part, the wait for writers already holding the capture barrier shared. | +| `Volumes[].Chunk.Stats.LastCut.CopyNs` | int64 | (group of `BarrierPauseNs`) BarrierPauseNs is the guest pause: from the capture barrier's Lock request to the start of its Unlock (BarrierReleaseNs below is the rest). LockWaitNs is its first part, the wait for writers already holding the capture barrier shared. | +| `Volumes[].Chunk.Stats.LastCut.CandidateChunks` | int | (group of `BarrierPauseNs`) BarrierPauseNs is the guest pause: from the capture barrier's Lock request to the start of its Unlock (BarrierReleaseNs below is the rest). LockWaitNs is its first part, the wait for writers already holding the capture barrier shared. | +| `Volumes[].Chunk.Stats.LastCut.UploadedChunks` | int | (group of `BarrierPauseNs`) BarrierPauseNs is the guest pause: from the capture barrier's Lock request to the start of its Unlock (BarrierReleaseNs below is the rest). LockWaitNs is its first part, the wait for writers already holding the capture barrier shared. | +| `Volumes[].Chunk.Stats.LastCut.UploadedBytes` | int64 | (group of `BarrierPauseNs`) BarrierPauseNs is the guest pause: from the capture barrier's Lock request to the start of its Unlock (BarrierReleaseNs below is the rest). LockWaitNs is its first part, the wait for writers already holding the capture barrier shared. | +| `Volumes[].Chunk.Stats.LastCut.ZeroedChunks` | int | (group of `BarrierPauseNs`) BarrierPauseNs is the guest pause: from the capture barrier's Lock request to the start of its Unlock (BarrierReleaseNs below is the rest). LockWaitNs is its first part, the wait for writers already holding the capture barrier shared. | +| `Volumes[].Chunk.Stats.LastCut.UnchangedChunks` | int | (group of `BarrierPauseNs`) BarrierPauseNs is the guest pause: from the capture barrier's Lock request to the start of its Unlock (BarrierReleaseNs below is the rest). LockWaitNs is its first part, the wait for writers already holding the capture barrier shared. | +| `Volumes[].Chunk.Stats.LastCut.UploadNs` | int64 | (group of `BarrierPauseNs`) BarrierPauseNs is the guest pause: from the capture barrier's Lock request to the start of its Unlock (BarrierReleaseNs below is the rest). LockWaitNs is its first part, the wait for writers already holding the capture barrier shared. | +| `Volumes[].Chunk.Stats.LastCut.CASNs` | int64 | (group of `BarrierPauseNs`) BarrierPauseNs is the guest pause: from the capture barrier's Lock request to the start of its Unlock (BarrierReleaseNs below is the rest). LockWaitNs is its first part, the wait for writers already holding the capture barrier shared. | +| `Volumes[].Chunk.Stats.LastCut.MapPersistNs` | int64 | (group of `BarrierPauseNs`) BarrierPauseNs is the guest pause: from the capture barrier's Lock request to the start of its Unlock (BarrierReleaseNs below is the rest). LockWaitNs is its first part, the wait for writers already holding the capture barrier shared. | +| `Volumes[].Chunk.Stats.LastCut.CASResult` | string | (group of `BarrierPauseNs`) BarrierPauseNs is the guest pause: from the capture barrier's Lock request to the start of its Unlock (BarrierReleaseNs below is the rest). LockWaitNs is its first part, the wait for writers already holding the capture barrier shared. | +| `Volumes[].Chunk.Stats.LastCut.TotalNs` | int64 | (group of `BarrierPauseNs`) BarrierPauseNs is the guest pause: from the capture barrier's Lock request to the start of its Unlock (BarrierReleaseNs below is the rest). LockWaitNs is its first part, the wait for writers already holding the capture barrier shared. | +| `Volumes[].Chunk.Stats.LastCut.BarrierReleaseNs` | int64 | BarrierReleaseNs is the barrier's release, outside the guest pause: the Unlock (which wakes each guest writer parked on the barrier), releasing the flusher hold and waking the flusher. A failed sync's exit splits the same way. | | `Volumes[].Chunk.Stats.LastCut.StageRounds` | int | Pre-copy (staging by the copy-on-write side budget, M5 Stage): StageRounds staging rounds staged StagedChunks chunks outside the barrier; StagedChunksUsed of the uploads in HEAD came from staging. BarrierCopyChunks were copied under the barrier. BarrierOverBound: more than the legacy fixture BarrierBound; always false in production, where that bound is zero. | | `Volumes[].Chunk.Stats.LastCut.StagedChunks` | int | (group of `StageRounds`) Pre-copy (staging by the copy-on-write side budget, M5 Stage): StageRounds staging rounds staged StagedChunks chunks outside the barrier; StagedChunksUsed of the uploads in HEAD came from staging. BarrierCopyChunks were copied under the barrier. BarrierOverBound: more than the legacy fixture BarrierBound; always false in production, where that bound is zero. | | `Volumes[].Chunk.Stats.LastCut.StagedChunksUsed` | int | (group of `StageRounds`) Pre-copy (staging by the copy-on-write side budget, M5 Stage): StageRounds staging rounds staged StagedChunks chunks outside the barrier; StagedChunksUsed of the uploads in HEAD came from staging. BarrierCopyChunks were copied under the barrier. BarrierOverBound: more than the legacy fixture BarrierBound; always false in production, where that bound is zero. | From 9d61cd13ddee2f15b256e6328a46540f2e757f8e Mon Sep 17 00:00:00 2001 From: pingqiu-cpu Date: Wed, 2 Dec 2026 22:13:24 -0800 Subject: [PATCH 02/66] storage: read the COW window entry under its lock in a held-fill test (#975) Interim merge note (spec trace workflow startup_failure since 22:45Z): test-only fix. go test (linux) and process-level tests (real binaries) passed on 274872a6; spec-trace-check.sh and public-text-check.sh run locally with the base branch's scripts: both pass. Race evidence on a Linux host: go test -race -count=50 of TestCutCOWV3_HeldFillIsCancelledByAbortAndDrained reports one data race and a concurrent map fatal on main a6304c21, and none on 274872a6. Code review ACCEPT on 274872a6. --- seaweed-block/core/storage/chunk_cut_cow_fill_test.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/seaweed-block/core/storage/chunk_cut_cow_fill_test.go b/seaweed-block/core/storage/chunk_cut_cow_fill_test.go index 4beadda9e9..8162a59095 100644 --- a/seaweed-block/core/storage/chunk_cut_cow_fill_test.go +++ b/seaweed-block/core/storage/chunk_cut_cow_fill_test.go @@ -51,7 +51,12 @@ func TestCutCOWV3_HeldFillIsCancelledByAbortAndDrained(t *testing.T) { if w == nil { t.Fatal("missing active window") } + w.mu.Lock() // the copier adds entries under the window's lock e := w.entries[2] + w.mu.Unlock() + if e == nil { + t.Fatal("no window entry for chunk 2") + } e.mu.Lock() state := e.state e.mu.Unlock() From 124e505964f7ebac92bf0c2d3cee09cb3713a7af Mon Sep 17 00:00:00 2001 From: pingqiu-cpu Date: Wed, 2 Dec 2026 23:52:06 -0800 Subject: [PATCH 03/66] Fix volume-delete list-page cleanup and report legacy residue (#976) Interim merge note (spec trace workflow startup_failure since 22:45Z): go test (linux) and process-level tests (real binaries) passed on 8cf77831; spec-trace-check.sh and public-text-check.sh run locally with the base branch's scripts against this head and body: both pass. Linux qualification at 8cf77831: vet clean, -short of chunkstore and layout pass, targeted -race -count=2 finds no race. Code review ACCEPT (8cf77831) and model review PASS. --- seaweed-block/.github/model-code-trace.tsv | 4 + .../core/frontend/chunkstore/catalog_b.go | 4 +- .../chunkstore/catalog_delete_list_test.go | 122 ++++++++ .../frontend/chunkstore/delete_sites_test.go | 2 +- .../core/frontend/chunkstore/layout/delete.go | 8 +- .../chunkstore/layout/delete_intent.go | 61 ++-- .../frontend/chunkstore/layout/delete_test.go | 2 +- .../frontend/chunkstore/layout/list_chain.go | 8 + .../layout/list_stage_deadline_test.go | 265 ++++++++++++++++++ .../core/frontend/chunkstore/layout/verify.go | 20 +- .../chunkstore/verify_deleted_lists_test.go | 144 ++++++++++ .../docs/design/immutable-list-pages.md | 12 + seaweed-block/docs/design/invariants.md | 7 +- .../docs/releases/verify-production-layout.md | 40 +++ 14 files changed, 660 insertions(+), 39 deletions(-) create mode 100644 seaweed-block/core/frontend/chunkstore/catalog_delete_list_test.go create mode 100644 seaweed-block/core/frontend/chunkstore/layout/list_stage_deadline_test.go create mode 100644 seaweed-block/core/frontend/chunkstore/verify_deleted_lists_test.go diff --git a/seaweed-block/.github/model-code-trace.tsv b/seaweed-block/.github/model-code-trace.tsv index 15a49d44f8..773b9877a7 100644 --- a/seaweed-block/.github/model-code-trace.tsv +++ b/seaweed-block/.github/model-code-trace.tsv @@ -206,3 +206,7 @@ core/frontend/chunkstore/layout/list_chain.go QueueCap.Produce core/frontend/chunkstore/layout/delete_intent.go QueueCap.Consume core/frontend/chunkstore/clean_intent_b.go QueueCap.Consume core/frontend/chunkstore/layout/commit.go QueueCap.TakeBack +core/frontend/chunkstore/layout/delete_intent.go VolDelSweep.Stage +core/frontend/chunkstore/layout/delete_intent.go VolDelSweep.Land +core/frontend/chunkstore/layout/list_chain.go VolDelSweep.Stage +core/frontend/chunkstore/layout/list_chain.go VolDelSweep.Land diff --git a/seaweed-block/core/frontend/chunkstore/catalog_b.go b/seaweed-block/core/frontend/chunkstore/catalog_b.go index 11310bb97a..e93efc235a 100644 --- a/seaweed-block/core/frontend/chunkstore/catalog_b.go +++ b/seaweed-block/core/frontend/chunkstore/catalog_b.go @@ -283,7 +283,7 @@ func rootRefs(ctx context.Context, r *layout.Reader, rn layout.RootName) ([]layo return out, err } -// listObjects lists the volume's pool, segment and root entries. +// listObjects lists the volume's pool, segment, root and immutable list entries. func (c *BCatalog) listObjects(ctx context.Context, v VolumeRef) ([]string, error) { dir := path.Join(c.base, v.Dir()) var out []string @@ -300,7 +300,7 @@ func (c *BCatalog) listObjects(ctx context.Context, v VolumeRef) ([]string, erro out = append(out, path.Join(layout.PoolDir, b, n)) } } - for _, sub := range []string{layout.SegDir, layout.RootDir} { + for _, sub := range []string{layout.SegDir, layout.RootDir, layout.ListDir} { names, err := c.listAll(ctx, path.Join(dir, sub)) if err != nil { return nil, err diff --git a/seaweed-block/core/frontend/chunkstore/catalog_delete_list_test.go b/seaweed-block/core/frontend/chunkstore/catalog_delete_list_test.go new file mode 100644 index 0000000000..aacc3c409b --- /dev/null +++ b/seaweed-block/core/frontend/chunkstore/catalog_delete_list_test.go @@ -0,0 +1,122 @@ +package chunkstore + +import ( + "bytes" + "context" + "errors" + "fmt" + "path" + "testing" + + "github.com/seaweedfs/seaweed-block/core/frontend/chunkstore/layout" +) + +type volumeListDeleteProbe struct { + Filer + store *LayoutStore + fail bool + calls int +} + +func (f *volumeListDeleteProbe) DeleteEntry(ctx context.Context, dir, name string, expected map[string][]byte) error { + if path.Base(dir) == layout.ListDir { + h, found, err := f.store.ReadHead(ctx) + if err != nil || !found || h.State != layout.StateDeleting && h.State != layout.StateDeleted { + return fmt.Errorf("list page removed outside delete ordering: state=%s found=%v err=%v", h.State, found, err) + } + if string(expected[layoutVolume]) != f.store.id.String() { + return errors.New("list page delete omitted full volume identity") + } + f.calls++ + if f.fail { + f.fail = false + return errors.New("interrupted list page removal") + } + } + return f.Filer.DeleteEntry(ctx, dir, name, expected) +} + +// C7: a catalog delete must leave no list objects, including unfinished snapshot +// intent pages, and its rerun must also collect a late page in that incarnation. +func TestBCatalogVolumeDeleteRemovesIntentListPages(t *testing.T) { + for _, interrupt := range []bool{false, true} { + t.Run(fmt.Sprintf("interrupted=%t", interrupt), func(t *testing.T) { + ctx := context.Background() + c, v, s, orphans := pendingIntentCatalog(t) + dir := path.Join(c.base, v.Dir(), layout.ListDir) + names, err := c.listAll(ctx, dir) + if err != nil || len(names) != 2 { + t.Fatalf("intent fixture pages=%v err=%v", names, err) + } + lateRel := path.Join(layout.ListDir, names[0]) + lateRaw, found, err := s.Fetch(ctx, path.Join(s.root, lateRel)) + if err != nil || !found { + t.Fatalf("capture late page: %v %v", found, err) + } + // A different full identity under the same volume name is a keeper. + keeper := newRef(t, v.Name) + if _, err := c.CreateVolume(ctx, keeper, layout.Geometry{SizeBytes: 64 * 4096, BlockSize: 4096, ChunkBytes: 4 * 4096}); err != nil { + t.Fatal(err) + } + ks, err := c.Store(keeper) + if err != nil { + t.Fatal(err) + } + page := layout.ListPage{VolumeID: keeper.ID, Kind: layout.ListDrop, Producer: "keeper", Generation: 1, Pages: 1, Entries: []string{orphans[0].Path()}} + raw, err := page.Encode() + if err != nil { + t.Fatal(err) + } + ref, err := page.Ref() + if err != nil { + t.Fatal(err) + } + keeperRel, err := ref.Path() + if err != nil { + t.Fatal(err) + } + if err := ks.Create(ctx, keeperRel, raw, "keeper"); err != nil { + t.Fatal(err) + } + probe := &volumeListDeleteProbe{Filer: c.f, store: s, fail: interrupt} + c.f = probe + _, err = c.DeleteVolume(ctx, v, okDeleteAuthority{}) + if interrupt { + if err == nil { + t.Fatal("list-removal interruption was ignored") + } + h, _, readErr := s.ReadHead(ctx) + if readErr != nil || h.State != layout.StateDeleting { + t.Fatalf("failed list removal marked deleted: %s %v", h.State, readErr) + } + _, err = c.DeleteVolume(ctx, v, okDeleteAuthority{}) + } + if err != nil { + t.Fatal(err) + } + if probe.calls < 2 { + t.Fatalf("no actual intent page removal: %d", probe.calls) + } + if names, err := c.listAll(ctx, dir); err != nil || len(names) != 0 { + t.Fatalf("C7 objects left after delete: %v err=%v", names, err) + } + h, _, err := s.ReadHead(ctx) + if err != nil || h.State != layout.StateDeleted { + t.Fatalf("final HEAD: %s %v", h.State, err) + } + if err := s.Create(ctx, lateRel, lateRaw, "late-dead-holder"); err != nil { + t.Fatal(err) + } + if _, err := c.DeleteVolume(ctx, v, okDeleteAuthority{}); err != nil { + t.Fatal(err) + } + if names, err := c.listAll(ctx, dir); err != nil || len(names) != 0 { + t.Fatalf("late list page escaped rerun: %v %v", names, err) + } + got, found, err := ks.Fetch(ctx, path.Join(ks.root, keeperRel)) + if err != nil || !found || !bytes.Equal(got, raw) { + t.Fatalf("same-name keeper changed: found=%v err=%v", found, err) + } + }) + } +} diff --git a/seaweed-block/core/frontend/chunkstore/delete_sites_test.go b/seaweed-block/core/frontend/chunkstore/delete_sites_test.go index fad68c7d23..4f3203aab9 100644 --- a/seaweed-block/core/frontend/chunkstore/delete_sites_test.go +++ b/seaweed-block/core/frontend/chunkstore/delete_sites_test.go @@ -36,7 +36,7 @@ var deleteSites = map[string]string{ "core/frontend/chunkstore/swfs.go SWFS.DeleteEntry -> DeleteEntry": "the filer client itself", "cmd/sw-block/chunk_b.go chunkSnapshots -> VolumeDir": "prints a dependent's directory from HEAD's dependent record (its name and id); nothing is read or written there", "core/frontend/chunkstore/catalog_b.go VolumeRef.Dir -> VolumeDir": "a VolumeRef is the master's record (name, layout id) or a reference's owner name and id (foreignOwners)", - "core/frontend/chunkstore/layout_store.go LayoutStore.deleteObject -> DeleteEntry": "only canonical pool, segment or root files under the configured volume root; HEAD, VOLUME and directory paths refused (TestLayoutStoreDeleteNeverRemovesControlRecords)", + "core/frontend/chunkstore/layout_store.go LayoutStore.deleteObject -> DeleteEntry": "only canonical pool, segment, root or list-page files under the configured volume root; HEAD, VOLUME and directory paths refused (TestLayoutStoreDeleteNeverRemovesControlRecords)", "core/frontend/chunkstore/layout/read.go Reader.ReadRef -> VolumeDir": "a foreign chunk's directory from the reference's owner name and id", } diff --git a/seaweed-block/core/frontend/chunkstore/layout/delete.go b/seaweed-block/core/frontend/chunkstore/layout/delete.go index 7ca718b567..21c4cd1c0d 100644 --- a/seaweed-block/core/frontend/chunkstore/layout/delete.go +++ b/seaweed-block/core/frontend/chunkstore/layout/delete.go @@ -164,7 +164,7 @@ type DeleteProgress struct { // any line holds a live lease, checked between the HEAD read and its // conditional update, or while a snapshot has dependents; no holder // transition, claim or removal applies from here), then this volume released from every source it depends on, -// then every object of its pool, segments and roots deleted, each +// then every object of its pool, segments, roots and immutable lists deleted, each // conditional on belonging to this volume (a late delete of this run never // removes the object of a volume created again under the name), then HEAD // deleted. A source left out keeps an extra dependent, which over-protects @@ -195,7 +195,7 @@ func DeleteVolume(ctx context.Context, st HeadStore, auth DeleteAuthority, id Vo } for _, rel := range objects { if !isObjectPath(rel) { - return fmt.Errorf("%w: %q is not a pool, segment or root object; HEAD, VOLUME and the directory stay", ErrMalformed, rel) + return fmt.Errorf("%w: %q is not a pool, segment, root or list object; HEAD, VOLUME and the directory stay", ErrMalformed, rel) } } report := func(p DeleteProgress) { @@ -290,10 +290,10 @@ func namesVolume(ctx context.Context, r *Reader, h Head, owner VolumeID) (bool, } // isObjectPath reports whether rel names a content-named object of the -// volume (a chunk, a segment or a root): the only entries a volume delete +// volume (a chunk, segment, root or immutable list page): the only entries a volume delete // removes. HEAD (which stays, deleted), VOLUME and the directory are not. func isObjectPath(rel string) bool { - for _, dir := range []string{PoolDir + "/", SegDir + "/", RootDir + "/"} { + for _, dir := range []string{PoolDir + "/", SegDir + "/", RootDir + "/", ListDir + "/"} { if strings.HasPrefix(rel, dir) && len(rel) > len(dir) && !strings.Contains(rel, "..") { return true } diff --git a/seaweed-block/core/frontend/chunkstore/layout/delete_intent.go b/seaweed-block/core/frontend/chunkstore/layout/delete_intent.go index 8709867f4b..60781ae348 100644 --- a/seaweed-block/core/frontend/chunkstore/layout/delete_intent.go +++ b/seaweed-block/core/frontend/chunkstore/layout/delete_intent.go @@ -38,6 +38,8 @@ func StageSnapshotDeletePage(ctx context.Context, st ListChainStore, base uint64 if err != nil { return ListRef{}, err } + ctx, cancel := context.WithTimeout(ctx, ListStageRequestTimeout) + defer cancel() h, found, err := st.ReadHead(ctx) if err != nil { return ListRef{}, err @@ -81,38 +83,43 @@ func adoptDeleteIntentPage(ctx context.Context, st ListChainStore, volume Volume } writer := deleteIntentWriter(base, ref) for round := 0; round < maxEnsureRounds; round++ { - meta, found, err := st.Stat(ctx, rel) - if err != nil { - return err - } - if !found { - return ErrListPageMissing - } - if meta.Volume != volume { - return ErrIdentity - } - h, exists, err := st.ReadHead(ctx) - if err != nil { - return err - } - if !exists { - return ErrHeadAbsent - } - if h.VolumeID != volume { - return ErrIdentity - } - if err := deleteIntentWindow(h, base); err != nil { - return err - } - if meta.Session == writer && meta.Mark == "" { - return nil - } - err = st.Reuse(ctx, rel, meta, writer) + err := func() error { + ctx, cancel := context.WithTimeout(ctx, ListStageRequestTimeout) + defer cancel() + meta, found, err := st.Stat(ctx, rel) + if err != nil { + return err + } + if !found { + return ErrListPageMissing + } + if meta.Volume != volume { + return ErrIdentity + } + h, exists, err := st.ReadHead(ctx) + if err != nil { + return err + } + if !exists { + return ErrHeadAbsent + } + if h.VolumeID != volume { + return ErrIdentity + } + if err := deleteIntentWindow(h, base); err != nil { + return err + } + if meta.Session == writer && meta.Mark == "" { + return nil + } + return st.Reuse(ctx, rel, meta, writer) + }() if errors.Is(err, ErrPrecondition) { continue } return err } + return fmt.Errorf("%w: delete intent page kept moving during adoption", ErrPrecondition) } diff --git a/seaweed-block/core/frontend/chunkstore/layout/delete_test.go b/seaweed-block/core/frontend/chunkstore/layout/delete_test.go index 1af28259c6..d03cc5be13 100644 --- a/seaweed-block/core/frontend/chunkstore/layout/delete_test.go +++ b/seaweed-block/core/frontend/chunkstore/layout/delete_test.go @@ -423,7 +423,7 @@ func (r *raceTarget) CreateDeletedHead(ctx context.Context, h Head, cause HeadWr // names HEAD (which stays, deleted), VOLUME or the directory is refused // before any object is deleted. func TestDeleteVolume_RemovesOnlyObjects(t *testing.T) { - for _, bad := range []string{HeadName, VolumeName, "", "pool/", "pool/../HEAD", "other/x"} { + for _, bad := range []string{HeadName, VolumeName, "", "pool/", "pool/../HEAD", "lists/", "lists/../HEAD", "other/x"} { w := newDeleteWorld() o := w.objects() if err := DeleteVolume(context.Background(), w.t, &fakeMaster{}, idFor("t"), []HeadStore{w.src}, o, fixed(append(append([]string(nil), w.rels...), bad))); !errors.Is(err, ErrMalformed) || len(o.writes) != 0 { diff --git a/seaweed-block/core/frontend/chunkstore/layout/list_chain.go b/seaweed-block/core/frontend/chunkstore/layout/list_chain.go index e090596a58..69aec39bdb 100644 --- a/seaweed-block/core/frontend/chunkstore/layout/list_chain.go +++ b/seaweed-block/core/frontend/chunkstore/layout/list_chain.go @@ -4,6 +4,7 @@ import ( "context" "errors" "fmt" + "time" ) // ListCursor is HEAD's bounded continuation. Generation identifies the @@ -114,6 +115,11 @@ func listSession(h Head, me HolderID, session, kind string) error { return nil } +// ListStageRequestTimeout is VolDelSweep r3's RT: each staging attempt starts +// its own deadline before HEAD is read, including its subsequent object write. +// This bounds client waiting; it cannot cancel an already queued server apply. +const ListStageRequestTimeout = 30 * time.Second + // StageListPage writes a bounded page in the already-open snap session. // Ending the session during I/O may leave an orphan, but cannot authorize // its later publication: that CAS checks the original generation/session. @@ -121,6 +127,8 @@ func StageListPage(ctx context.Context, st ListChainStore, me HolderID, session if p.Kind == ListSnapshotDeleteIntent { return ListRef{}, fmt.Errorf("%w: use non-retagging snapshot-delete staging", ErrIdentity) } + ctx, cancel := context.WithTimeout(ctx, ListStageRequestTimeout) + defer cancel() h, found, err := st.ReadHead(ctx) if err != nil { return ListRef{}, err diff --git a/seaweed-block/core/frontend/chunkstore/layout/list_stage_deadline_test.go b/seaweed-block/core/frontend/chunkstore/layout/list_stage_deadline_test.go new file mode 100644 index 0000000000..a8a8638b66 --- /dev/null +++ b/seaweed-block/core/frontend/chunkstore/layout/list_stage_deadline_test.go @@ -0,0 +1,265 @@ +package layout + +import ( + "context" + "errors" + "fmt" + "testing" + "testing/synctest" + "time" +) + +// VolDelSweep r3 pins RT at 30 s. These controls require a staging-owned deadline, +// established at HEAD check and unchanged through the actual write. +type stageDeadlineProbe struct { + *chainStore + parentDeadline time.Time + allowParentDeadline bool + headBudget time.Duration + checkedDeadline time.Time + writes int +} + +func (s *stageDeadlineProbe) ReadHead(ctx context.Context) (Head, bool, error) { + deadline, ok := ctx.Deadline() + if !ok || !deadline.Before(s.parentDeadline) && !(s.allowParentDeadline && deadline.Equal(s.parentDeadline)) { + return Head{}, false, errors.New("staging HEAD check has no request-owned RT deadline") + } + s.headBudget = time.Until(deadline) + s.checkedDeadline = deadline + return s.chainStore.ReadHead(ctx) +} + +func (s *stageDeadlineProbe) Stat(ctx context.Context, rel string) (ObjectMeta, bool, error) { + if !s.checkedDeadline.IsZero() { + // Consume part of the interval after HEAD check but before the write. + delay := time.Until(s.checkedDeadline) / 2 + timer := time.NewTimer(delay) + defer timer.Stop() + select { + case <-timer.C: + case <-ctx.Done(): + return ObjectMeta{}, false, ctx.Err() + } + } + return s.chainStore.Stat(ctx, rel) +} + +func (s *stageDeadlineProbe) waitWrite(ctx context.Context) error { + s.writes++ + deadline, ok := ctx.Deadline() + if !ok || !deadline.Equal(s.checkedDeadline) { + return fmt.Errorf("staging write renewed RT after its HEAD check: head=%v write=%v", s.checkedDeadline, deadline) + } + <-ctx.Done() + return ctx.Err() // A context-aware backend never applies the expired write. +} +func (s *stageDeadlineProbe) Create(ctx context.Context, _ string, _ []byte, _ string) error { + return s.waitWrite(ctx) +} +func (s *stageDeadlineProbe) Reuse(ctx context.Context, _ string, _ ObjectMeta, _ string) error { + return s.waitWrite(ctx) +} + +func TestListStagingWriteDeadlineStartsAtItsOwnHeadCheck(t *testing.T) { + for _, kind := range []string{"snapshot-create", "holder-create", "adopt-reuse"} { + t.Run(kind, func(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + parent, cancel := context.WithTimeout(context.Background(), 24*time.Hour) + defer cancel() + parentDeadline, _ := parent.Deadline() + var st *chainStore + var p ListPage + if kind == "holder-create" { + st, _, p = chainFixture(t) + } else { + st, _, p = deleteIntentFixture(t) + } + ref, err := p.Ref() + if err != nil { + t.Fatal(err) + } + rel, _ := ref.Path() + if kind == "adopt-reuse" { + if _, err := StageSnapshotDeletePage(parent, st, st.h.Gen, p); err != nil { + t.Fatal(err) + } + } + probe := &stageDeadlineProbe{chainStore: st, parentDeadline: parentDeadline} + switch kind { + case "snapshot-create": + _, err = StageSnapshotDeletePage(parent, probe, st.h.Gen, p) + case "holder-create": + _, err = StageListPage(parent, probe, me, "s1", p) + case "adopt-reuse": + err = adoptDeleteIntentPage(parent, probe, st.volume, st.h.Gen, ref) + } + if !errors.Is(err, context.DeadlineExceeded) || probe.writes != 1 { + t.Fatalf("staging must expire from HEAD check, not parent/write start: writes=%d err=%v", probe.writes, err) + } + if probe.headBudget != 30*time.Second { + t.Fatalf("RT at HEAD check = %v, want 30s", probe.headBudget) + } + if parent.Err() != nil { + t.Fatal("staging used up the parent operation deadline") + } + if kind == "adopt-reuse" { + meta, _, err := st.Stat(parent, rel) + if err != nil || meta.Session != p.Producer { + t.Fatalf("expired reuse changed tags: %+v %v", meta, err) + } + } else if _, found, err := st.Stat(parent, rel); err != nil || found { + t.Fatalf("expired create landed: found=%v err=%v", found, err) + } + }) + }) + } +} + +func TestListStagingHonorsEarlierParentDeadline(t *testing.T) { + for _, kind := range []string{"snapshot-create", "holder-create", "adopt-reuse"} { + t.Run(kind, func(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + parent, cancel := context.WithTimeout(context.Background(), 10*time.Second) + defer cancel() + deadline, _ := parent.Deadline() + var st *chainStore + var p ListPage + if kind == "holder-create" { + st, _, p = chainFixture(t) + } else { + st, _, p = deleteIntentFixture(t) + } + ref, _ := p.Ref() + if kind == "adopt-reuse" { + if _, err := StageSnapshotDeletePage(parent, st, st.h.Gen, p); err != nil { + t.Fatal(err) + } + } + probe := &stageDeadlineProbe{chainStore: st, parentDeadline: deadline, allowParentDeadline: true} + var err error + switch kind { + case "snapshot-create": + _, err = StageSnapshotDeletePage(parent, probe, st.h.Gen, p) + case "holder-create": + _, err = StageListPage(parent, probe, me, "s1", p) + case "adopt-reuse": + err = adoptDeleteIntentPage(parent, probe, st.volume, st.h.Gen, ref) + } + if !errors.Is(err, context.DeadlineExceeded) || parent.Err() != context.DeadlineExceeded || probe.headBudget != 10*time.Second || probe.writes != 1 { + t.Fatalf("parent deadline changed: budget=%v writes=%d parent=%v err=%v", probe.headBudget, probe.writes, parent.Err(), err) + } + }) + }) + } +} + +type retryStageDeadlineStore struct { + *chainStore + checks int + writes int + deadlines []time.Time +} + +func (s *retryStageDeadlineStore) ReadHead(ctx context.Context) (Head, bool, error) { + deadline, ok := ctx.Deadline() + if !ok || time.Until(deadline) != 30*time.Second { + return Head{}, false, errors.New("retry did not acquire its own 30s check") + } + s.deadlines = append(s.deadlines, deadline) + s.checks++ + return s.chainStore.ReadHead(ctx) +} +func (s *retryStageDeadlineStore) Reuse(ctx context.Context, rel string, meta ObjectMeta, session string) error { + s.writes++ + if s.checks != s.writes { + return errors.New("retry wrote without a fresh HEAD check") + } + timer := time.NewTimer(20 * time.Second) + defer timer.Stop() + select { + case <-timer.C: + case <-ctx.Done(): + return ctx.Err() + } + if s.writes == 1 { + return ErrPrecondition + } + return s.chainStore.Reuse(ctx, rel, meta, session) +} +func TestListStagingAdoptionRetryGetsFreshCheckAndDeadline(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + ctx := context.Background() + st, ref, page := deleteIntentFixture(t) + if _, err := StageSnapshotDeletePage(ctx, st, st.h.Gen, page); err != nil { + t.Fatal(err) + } + probe := &retryStageDeadlineStore{chainStore: st} + started := time.Now() + if err := adoptDeleteIntentPage(ctx, probe, st.volume, st.h.Gen, ref.Ref); err != nil { + t.Fatal(err) + } + if probe.checks != 2 || probe.writes != 2 || time.Since(started) != 40*time.Second || !probe.deadlines[1].After(probe.deadlines[0]) { + t.Fatalf("retry shared an old check/deadline: checks=%d writes=%d elapsed=%v deadlines=%v", probe.checks, probe.writes, time.Since(started), probe.deadlines) + } + }) +} + +type stageStatDeadlineStore struct { + *chainStore + stats int + checks int +} + +func (s *stageStatDeadlineStore) Stat(ctx context.Context, _ string) (ObjectMeta, bool, error) { + s.stats++ + d, ok := ctx.Deadline() + if !ok || time.Until(d) > 30*time.Second { + return ObjectMeta{}, false, errors.New("staging Stat lacks the attempt's RT deadline") + } + <-ctx.Done() + return ObjectMeta{}, false, ctx.Err() +} +func (s *stageStatDeadlineStore) ReadHead(ctx context.Context) (Head, bool, error) { + s.checks++ + return s.chainStore.ReadHead(ctx) +} +func TestListStagingBoundsStatBeforeAnyWrite(t *testing.T) { + for _, kind := range []string{"snapshot-create", "holder-create", "adopt-reuse"} { + t.Run(kind, func(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + var st *chainStore + var p ListPage + if kind == "holder-create" { + st, _, p = chainFixture(t) + } else { + st, _, p = deleteIntentFixture(t) + } + ref, _ := p.Ref() + if kind == "adopt-reuse" { + if _, err := StageSnapshotDeletePage(context.Background(), st, st.h.Gen, p); err != nil { + t.Fatal(err) + } + } + probe := &stageStatDeadlineStore{chainStore: st} + started := time.Now() + var err error + switch kind { + case "snapshot-create": + _, err = StageSnapshotDeletePage(context.Background(), probe, st.h.Gen, p) + case "holder-create": + _, err = StageListPage(context.Background(), probe, me, "s1", p) + case "adopt-reuse": + err = adoptDeleteIntentPage(context.Background(), probe, st.volume, st.h.Gen, ref) + } + wantChecks := 1 + if kind == "adopt-reuse" { + wantChecks = 0 + } + if !errors.Is(err, context.DeadlineExceeded) || time.Since(started) != 30*time.Second || probe.stats != 1 || probe.checks != wantChecks { + t.Fatalf("Stat exceeded attempt: elapsed=%v stats=%d checks=%d err=%v", time.Since(started), probe.stats, probe.checks, err) + } + }) + }) + } +} diff --git a/seaweed-block/core/frontend/chunkstore/layout/verify.go b/seaweed-block/core/frontend/chunkstore/layout/verify.go index c80eb9dbc4..a9fe0f31b9 100644 --- a/seaweed-block/core/frontend/chunkstore/layout/verify.go +++ b/seaweed-block/core/frontend/chunkstore/layout/verify.go @@ -13,7 +13,8 @@ import ( // segments and the chunks they name. It never writes or deletes. With // Orphans it also lists the volume's own pool, seg and root names that no // reachable root names (removal 7' deletes those inside the lease; Verify -// only reports them). +// only reports them). For a deleted volume it also reports leftover lists/ +// pages; live or deleting volumes can still have pending list work. // Verify depths. const ( @@ -442,6 +443,23 @@ func (v *verifier) orphans(ctx context.Context, h Head) error { return nil } var found []Finding + // A deleted incarnation has no remaining list consumer. Do not infer + // reachability for list pages of a live/deleting volume: pending work and + // in-flight staging can legitimately keep them outside a root graph. + if h.State == StateDeleted { + names, err := v.opts.List(ctx, path.Join(v.base, v.vol, ListDir)) + if err != nil { + return fmt.Errorf("layout: list %s: %w", path.Join(v.vol, ListDir), err) + } + for _, n := range names { + rel, err := (ListRef{Hash: n, Pages: 1}).Path() + if err != nil { + found = append(found, Finding{FindMalformed, path.Join(v.vol, ListDir, n), err.Error()}) + } else { + found = append(found, Finding{FindOrphan, path.Join(v.vol, rel), "list page remains in a deleted volume directory; report only"}) + } + } + } for _, dir := range []string{RootDir, SegDir} { names, err := v.opts.List(ctx, path.Join(v.base, v.vol, dir)) if err != nil { diff --git a/seaweed-block/core/frontend/chunkstore/verify_deleted_lists_test.go b/seaweed-block/core/frontend/chunkstore/verify_deleted_lists_test.go new file mode 100644 index 0000000000..4f176e4ce0 --- /dev/null +++ b/seaweed-block/core/frontend/chunkstore/verify_deleted_lists_test.go @@ -0,0 +1,144 @@ +package chunkstore + +import ( + "context" + "path" + "strings" + "testing" + + "github.com/seaweedfs/seaweed-block/core/frontend/chunkstore/layout" +) + +// Old deletes left list pages behind. Only a confirmed deleted incarnation +// makes those names reportable; active/pending work is not inferred orphaned. +func TestVerifyReportsDeletedVolumeListPagesWithoutMutation(t *testing.T) { + for _, state := range []string{layout.StateLive, layout.StateDeleting, layout.StateDeleted} { + for _, orphans := range []bool{false, true} { + t.Run(state+"/orphans="+map[bool]string{true: "yes", false: "no"}[orphans], func(t *testing.T) { + fb, id := verifyFixtureVolume(t) + dir := layout.VolumeDir("v", id) + hp := path.Join("/blocks", dir, layout.HeadName) + h, err := layout.DecodeHead(fb.fakeFiler.entries[hp].Content, 1, id) + if err != nil { + t.Fatal(err) + } + h.State = state + raw, err := h.Encode() + if err != nil { + t.Fatal(err) + } + fb.fakeFiler.entries[hp].Content = raw + hash := strings.Repeat("a", 64) + rel := path.Join(dir, layout.ListDir, hash) + putFile(t, fb.fakeFiler, path.Join("/blocks", rel), []byte("old list page")) + // Another full identity under the same name is outside this pass. + other, err := layout.NewVolumeID() + if err != nil { + t.Fatal(err) + } + putFile(t, fb.fakeFiler, path.Join("/blocks", layout.VolumeDir("v", other), layout.ListDir, hash), []byte("keeper")) + before := snapshotStore(fb) + r, err := VerifyLayout(context.Background(), fb, "/blocks", dir, layout.VerifyOptions{Orphans: orphans}) + if err != nil || !r.Complete { + t.Fatalf("verify: %+v %v", r, err) + } + want := 0 + if state == layout.StateDeleted && orphans { + want = 1 + } + if len(r.Findings) != want { + t.Fatalf("findings=%+v want %d", r.Findings, want) + } + if want == 1 && (r.Findings[0].Class != layout.FindOrphan || r.Findings[0].Path != rel) { + t.Fatalf("wrong report: %+v", r.Findings) + } + if snapshotStore(fb) != before { + t.Fatal("report changed filer entries or blobs") + } + }) + } + } +} + +func TestVerifyDeletedListPagesRequireStableHead(t *testing.T) { + for _, mode := range []string{"stable", "advance", "absent", "error", "unknown", "initial-unknown"} { + t.Run(mode, func(t *testing.T) { + fb, id := verifyFixtureVolume(t) + dir := layout.VolumeDir("v", id) + hp := path.Join("/blocks", dir, layout.HeadName) + h, err := layout.DecodeHead(fb.fakeFiler.entries[hp].Content, 1, id) + if err != nil { + t.Fatal(err) + } + h.State = layout.StateDeleted + raw, err := h.Encode() + if err != nil { + t.Fatal(err) + } + fb.fakeFiler.entries[hp].Content = raw + putFile(t, fb.fakeFiler, path.Join("/blocks", dir, layout.ListDir, strings.Repeat("a", 64)), []byte("leftover")) + f := &verifyChangingHead{filerBlobs: fb, mode: mode} + r, err := VerifyLayout(context.Background(), f, "/blocks", dir, layout.VerifyOptions{Orphans: true}) + if err != nil { + t.Fatal(err) + } + if mode == "stable" { + if !r.Complete || !r.OrphansChecked || len(r.Findings) != 1 || r.Findings[0].Class != layout.FindOrphan { + t.Fatalf("stable report: %+v", r) + } + } else if r.Complete || r.OrphansChecked || len(r.Findings) != 0 { + t.Fatalf("unstable report: %+v", r) + } + }) + } +} + +// Recreate the actual v1.1 residue: valid intent pages left in a directory +// whose volume-delete has finished, including the now-absent root objects. +func TestVerifyReportsListResidueAfterCatalogDelete(t *testing.T) { + ctx := context.Background() + c, v, st, _ := pendingIntentCatalog(t) + names, err := c.listAll(ctx, path.Join(st.root, layout.ListDir)) + if err != nil || len(names) != 2 { + t.Fatalf("pages=%v err=%v", names, err) + } + pages := map[string][]byte{} + for _, n := range names { + raw, found, err := st.Fetch(ctx, path.Join(st.root, layout.ListDir, n)) + if err != nil || !found { + t.Fatalf("capture page: %v %v", found, err) + } + pages[n] = raw + } + if _, err := c.DeleteVolume(ctx, v, okDeleteAuthority{}); err != nil { + t.Fatal(err) + } + for n, raw := range pages { + if err := st.Create(ctx, path.Join(layout.ListDir, n), raw, "legacy-leftover"); err != nil { + t.Fatal(err) + } + } + backend := struct { + Filer + Blobs + }{c.f, c.b} + r, err := VerifyLayout(ctx, backend, c.base, v.Dir(), layout.VerifyOptions{Orphans: true, ExpectedID: v.ID}) + if err != nil || !r.Complete || !r.OrphansChecked || !r.MasterIdentityChecked { + t.Fatalf("verify deleted: %+v %v", r, err) + } + reported := map[string]bool{} + for _, f := range r.Findings { + if f.Class == layout.FindOrphan && strings.HasPrefix(f.Path, path.Join(v.Dir(), layout.ListDir)+"/") { + reported[path.Base(f.Path)] = true + } + } + if len(reported) != len(pages) { + t.Fatalf("pages not reported: %+v", r) + } + for n, raw := range pages { + got, found, err := st.Fetch(ctx, path.Join(st.root, layout.ListDir, n)) + if err != nil || !found || string(got) != string(raw) { + t.Fatalf("report changed page %s: %v %v", n, found, err) + } + } +} diff --git a/seaweed-block/docs/design/immutable-list-pages.md b/seaweed-block/docs/design/immutable-list-pages.md index 33ccb78897..4add62b143 100644 --- a/seaweed-block/docs/design/immutable-list-pages.md +++ b/seaweed-block/docs/design/immutable-list-pages.md @@ -246,3 +246,15 @@ are 114452, 1119764, 1119764 and 1119764. Root bytes remain the separate size-dependent term: 126, 225, 2700 and 10422. The by-change segment index and two-level root are deferred; these measurements do not remove the compatibility full sweep's namespace cost. + + +### Staging request bound + +Each staging attempt starts a 30 s deadline before its HEAD read and passes it +through the object write; an earlier caller deadline wins. This covers snapshot +intent creation, generic list-page staging, and adoption's Stat, HEAD check and +conditional Reuse. A new adoption attempt gets a fresh check and deadline; +EnsureObject retries within an attempt do not renew that attempt's deadline. +The bound limits client waiting, not a queued server apply. A volume-delete +rerun collects a late page; durable scheduled resweep and its window starting +at the deleting mark remain separate work. diff --git a/seaweed-block/docs/design/invariants.md b/seaweed-block/docs/design/invariants.md index 5dc80a3e43..f6d5d87d95 100644 --- a/seaweed-block/docs/design/invariants.md +++ b/seaweed-block/docs/design/invariants.md @@ -1216,7 +1216,7 @@ Notes: | `INV-VERIFY-NOTFOUND-001` | Verify reports `MISSING` only when the store answers that the object does not exist; any other read failure ends the pass as incomplete with that error, and is never a finding. | M6 (reader; no transition) | `core/frontend/chunkstore/layout/verify.go` `Verify`; `core/frontend/chunkstore/layout_verify.go` `VerifyLayout` | `TestVerifyReadErrorIsReturned`, `TestVerifyFindsMissingAndCorrupt` (`core/frontend/chunkstore/layout/verify_test.go`); `TestOpsChunk_VerifyReadErrorIsIncomplete` (`cmd/sw-block/chunk_verify_test.go`) | — | ACTIVE | | `INV-VERIFY-REACH-001` | A complete pass checks every object the current root and every snapshot root name (roots, segments, chunks): an absent one is `MISSING`; one whose bytes do not hash to its name, at depth full, is `CORRUPT`. | M6 (reader; no transition) | `core/frontend/chunkstore/layout/verify.go` `Verify`; `core/frontend/chunkstore/layout_verify.go` `VerifyLayout` | `TestVerifyCleanVolume`, `TestVerifyFindsMissingAndCorrupt`, `TestVerifyWalksSnapshotRoots` (`core/frontend/chunkstore/layout/verify_test.go`) | — | ACTIVE | | `INV-VERIFY-INCOMPLETE-001` | A volume whose VOLUME or HEAD is absent or does not decode is never reported clean: the pass is incomplete and says which object. | M6 (reader; no transition) | `core/frontend/chunkstore/layout/verify.go` `Verify`; `core/frontend/chunkstore/layout_verify.go` `VerifyLayout` | `TestVerifyHeadMissingOrMalformedIsIncomplete` (`core/frontend/chunkstore/layout/verify_test.go`) | — | ACTIVE | -| `INV-VERIFY-ORPHAN-001` | With orphans on, only this volume's own full-id names that no root or live restore target names are ORPHAN. Owner/target paths use VolumeDir(name,id); an unreadable live target suppresses orphan findings. Verify deletes nothing. | M6 (reader; no transition) | `core/frontend/chunkstore/layout/verify.go` `Verify`; `core/frontend/chunkstore/layout_verify.go` `VerifyLayout` | `TestVerifyOrphans`, `TestVerifyDependentReachIsNotOrphanAndUnreadableDependentSuppresses` (`core/frontend/chunkstore/layout/verify_test.go`) ; `TestVerifyProductionLayoutCurrentAndRestored` (`core/frontend/chunkstore/verify_production_layout_test.go`) | — | ACTIVE | +| `INV-VERIFY-ORPHAN-001` | With orphans on, unreachable own full-id names are ORPHAN; a deleted volume's leftover list pages are also reported. Live/deleting list work is not judged orphaned. Unreadable live targets suppress orphan findings. Verify deletes nothing. | M6 (reader; no transition) | `core/frontend/chunkstore/layout/verify.go` `Verify`; `core/frontend/chunkstore/layout_verify.go` `VerifyLayout` | `TestVerifyReportsDeletedVolumeListPagesWithoutMutation`, `TestVerifyDeletedListPagesRequireStableHead`, `TestVerifyReportsListResidueAfterCatalogDelete`; `TestVerifyOrphans`, `TestVerifyDependentReachIsNotOrphanAndUnreadableDependentSuppresses` (`core/frontend/chunkstore/layout/verify_test.go`) ; `TestVerifyProductionLayoutCurrentAndRestored` (`core/frontend/chunkstore/verify_production_layout_test.go`) | — | ACTIVE | | `INV-VERIFY-IDENTITY-001` | Verify reads canonical VolumeDir(name,id) directories. VOLUME must match its directory, HEAD must match VOLUME, and a master-resolved id must match in full. A mismatched chunk-owner VOLUME is IDENTITY, never clean. | M6 (reader; no transition) | `core/frontend/chunkstore/layout/verify.go` `Verify`; `core/frontend/chunkstore/layout_verify.go` `VerifyLayout` | `TestVerifyVolumeRecordAndHeadID`, `TestVerifyChunkOwnerIdentity` (`core/frontend/chunkstore/layout/verify_test.go`), `TestVerifyDeduplicationNeverSkipsFullOwnerIdentity` (`core/frontend/chunkstore/verify_bindings_stat_test.go`) ; `TestVerifyProductionLayoutCurrentAndRestored` (`core/frontend/chunkstore/verify_production_layout_test.go`); `TestOpsChunk_VerifyProductionLayoutNameAndDirectory`, `TestOpsChunk_VerifyBindsMasterFullIDDespiteDirectoryPrefixCollision` (`cmd/sw-block/chunk_verify_production_test.go`) | — | ACTIVE | | `INV-RESTORE-HYDRATE-001` | The background hydrate walker fetches a chunk only through that chunk's shared fill flight: at most one fetch per chunk absence, and a fetched block is never installed over a block written locally. | M4 Holder (background hydrate) | `core/storage/chunk_hydrate_all.go` `HydrateAll`, `HydrateAllAt`, `startWalkerFill`, `nextHydrateTarget`, `admitFill`; `core/storage/chunk_hydration.go` `hydrationFlightLocked`; `core/storage/chunk_layer.go` `fillOnce` | `TestHydrateAll_FillsEveryChunkOnceAndReadsTheHeadImage`, `TestHydrateAll_YieldsToGuestReadsAndNeverFetchesTwice`, `TestHydrateAll_NeverOverwritesALocalWrite`, `TestHydrateAll_AdmitsEachFillThroughTheLimiterWithTheCallersClass`, `TestHydrateAll_RealBackgroundFillLimiterAdmitsEveryFill`, `TestHydrateAll_PermitIsHeldUntilTheOwnedFetchSettles`, `TestHydrateAll_RevocationStopsTheWalker`, `TestHydrateAll_CancelReturnsWhileTheFetchIsHeld`, `TestHydrateAll_PacedByByteRate` (`core/storage/chunk_hydrate_all_test.go`) | — | DORMANT | | `INV-RESTORE-OWN-BATCH-001` | A batch cut re-uploads at most N local chunks whose HEAD keys name another volume under new own keys, even when their bytes equal HEAD's, in one ordinary cut (one intent, one HEAD CAS); it never fetches an absent chunk. | M6.Restore.Owning>Owning | `core/storage/chunk_own.go` `OwnBatch`; `core/storage/chunk_cut_payload.go` `streamCutPayloads` | `TestOwnBatch_BoundedBatchesReplaceEveryForeignKey`, `TestOwnBatch_SkipsChunksNotLocal`, `TestOwnBatch_CarriesGuestWrites` (`core/storage/chunk_own_test.go`) | `RestoreIndependence` `NoGap` | DORMANT | @@ -1356,8 +1356,8 @@ Notes: | `INV-SNAPK-REF-ID-001` | Every chunk reference in a segment carries its owner's volume id; a read checks it against the owner's VOLUME before fetching (another id is ErrIdentity), and the remover tells its own chunks by its VOLUME id. | Content-named layout | `core/frontend/chunkstore/layout` `layout.go` `Segment.Encode`; `read.go` `Image.Chunk`; `remove.go` | `TestSegment_EncodeRefusals`, `TestRead_ForeignChunkNeedsTheOwnersVolumeID`, `TestRemoveUnreachable_NeedsItsOwnVolumeID` | — (the snapshot kernel model is not in this repository) | ACTIVE | | `INV-SNAPK-DEP-ID-001` | Every dependent records the target's volume id and the root of the snapshot it depends on; a dependent without the id, or of another root, is refused. | M9 snapshots and dependents | `core/frontend/chunkstore/layout` `head.go` `Head.check` | `TestHead_Refusals`, `TestHead_GoldenEncodingRoundTrip` | — (the snapshot kernel model is not in this repository) | ACTIVE | | `INV-SNAPK-CLAIM-ID-001` | A holder is its epoch, its server and the claim id its claim wrote into HEAD; every transition refuses the same server at the same epoch with another claim id. | M9 every transition | `core/frontend/chunkstore/layout` `head.go` `heldBy`; `claim.go` `Head.Claim` | `TestClaim_WritesItsClaimID`, `TestTransitions_RefuseAStaleHolder`, `TestHolderFunctions_RefuseAStaleHolder` | — (the snapshot kernel model is not in this repository) | ACTIVE | -| `INV-SNAPK-DELETE-ORDER-001` | A volume delete runs in its order, each prefix safe and the whole re-runnable: HEAD deleting, this volume released from every source, its objects deleted, HEAD deleted. | M9 idle → deleting → deleted | `core/frontend/chunkstore/layout` `delete.go` `DeleteVolume`; `core/frontend/chunkstore/catalog_b.go` `BCatalog.DeleteVolume`, `foreignOwners` | `TestDeleteVolume`, `TestDeleteVolume_InterruptAtEveryStep`, `TestRunMarkDeleting_InterruptAtEveryStep`, `TestRunMarkDeleted_InterruptAtEveryStep`; `TestBCatalog_DeleteRerunOnADeletedVolumeSucceeds`, `TestBCatalog_DeleteInterruptedAtEachStepCompletesOnRerun`, `TestBCatalog_DeleteRerunSkipsOnlyMissingRootsOfADeletingVolume` (`core/frontend/chunkstore/catalog_delete_rerun_test.go`); also in `core/frontend/chunkstore/layout/delete_test.go` | — (the snapshot kernel model is not in this repository) | ACTIVE | -| `INV-SNAPK-DELETE-OWNED-001` | Every object entry carries the id of its volume; a volume delete removes an object only if it carries that id, so a late delete of a finished run never removes the object of a volume created again under the name. | M9 deleting → deleted | `core/frontend/chunkstore/layout` `delete.go` `DeleteVolume`; `objects.go` `ObjectStore.DeleteOfVolume` | `TestDeleteVolume_ALateDeleteSparesTheNameReused`, `TestDeleteVolume` | — (the snapshot kernel model is not in this repository) | ACTIVE | +| `INV-SNAPK-DELETE-ORDER-001` | A volume delete runs in its order, each prefix safe and the whole re-runnable: HEAD deleting, this volume released from every source, its objects deleted, HEAD deleted. | M9 idle → deleting → deleted | `core/frontend/chunkstore/layout` `delete.go` `DeleteVolume`; `core/frontend/chunkstore/catalog_b.go` `BCatalog.DeleteVolume`, `foreignOwners` | `TestBCatalogVolumeDeleteRemovesIntentListPages` (including interrupted and late-page rerun); `TestDeleteVolume`, `TestDeleteVolume_InterruptAtEveryStep`, `TestRunMarkDeleting_InterruptAtEveryStep`, `TestRunMarkDeleted_InterruptAtEveryStep`; `TestBCatalog_DeleteRerunOnADeletedVolumeSucceeds`, `TestBCatalog_DeleteInterruptedAtEachStepCompletesOnRerun`, `TestBCatalog_DeleteRerunSkipsOnlyMissingRootsOfADeletingVolume` (`core/frontend/chunkstore/catalog_delete_rerun_test.go`); also in `core/frontend/chunkstore/layout/delete_test.go` | — (the snapshot kernel model is not in this repository) | ACTIVE | +| `INV-SNAPK-DELETE-OWNED-001` | Every object entry carries the id of its volume; a volume delete removes an object only if it carries that id, so a late delete of a finished run never removes the object of a volume created again under the name. | M9 deleting → deleted | `core/frontend/chunkstore/layout` `delete.go` `DeleteVolume`; `objects.go` `ObjectStore.DeleteOfVolume` | `TestBCatalogVolumeDeleteRemovesIntentListPages` (same-name keeper); `TestDeleteVolume_ALateDeleteSparesTheNameReused`, `TestDeleteVolume` | — (the snapshot kernel model is not in this repository) | ACTIVE | | `INV-SNAPK-DELETE-GATE-001` | HEAD becomes deleting only with a committed deletion reservation, no live lease (unclaimed grants included), no open activity and no snapshot with dependents; from deleting on, no holder transition, claim or removal applies. | M2 any → DeleteReserved; M9 idle → deleting | `core/frontend/chunkstore/layout` `delete.go` `Head.MarkDeleting`; `head.go` `holderErr`; `core/authority/workspace_delete_reservation.go`; `core/host/master/volume_delete_authority.go` `ReserveVolumeDeletion`, `CheckVolumeNoLiveLease`; `cmd/sw-block/chunk_volume_delete.go` `masterAuthority` | `TestMarkDeleting_Closure`, `TestMarkDeleted_Closure`, `TestDeleting_RefusesEveryHolderStep`, `TestDeleteVolume`; `TestCommittedDeleteStopsGrantsAndWaitsForTheWholeLease`, `TestDeleteReservationClosesPausedGrantWriters`, `TestDeleteReservationMustBeDurableBeforeItCanProveNoLease`, `TestDeleteReservationContextAndPersistenceFailuresStayUnknown`, `TestDeleteOfALiveVolumeIsRefusedBeforePersisting`, `TestDeleteReservationReplayAndRestart`, `TestDeletionReservationGuardSites` (`core/authority`); `TestVolumeDeleteAuthorityReservationSurvivesRestart`, `TestVolumeDeleteAuthorityRPCs` (`core/host/master`; durable RPC/restart probes run on Linux); `TestOpsChunkVolumeDeleteRequiresTheMastersLeaseProof`, `TestOpsChunkVolumeDeleteClosesAPausedFirstGrant`, `TestChunkVolumeDeleteAuthorityRPCSites` (`cmd/sw-block`) | The reservation makes no-live-lease stable; a claim racing the conditional HEAD update still fails its generation check. The snapshot kernel model is external; composed model review pending. | ACTIVE | | `INV-WS-DELETE-WITHOUT-ACK-001` | A delete without the holder's acknowledgement is admitted only while the master's record still awaits a replica store (stage 1), marked durably first; the mark freezes the wait, so the primary never serves. Past stage 1 the live-lease refusal stays. | M2 any authority line, stores still awaited → DeleteReserved without the holder's acknowledgement | `core/host/master/volume_delete_authority.go` `Reserve`; `core/host/master/store_attestation.go` `markDeleteWithoutAck`, `awaited` | `TestANeverCreatedVolumeIsDeletedWithoutItsHolder`, `TestAnEstablishedVolumeIsNotDeletedUnderALiveLease` (`core/host/master/workspace_delete_never_created_test.go`); `TestAStage2VolumeKeepsTheLiveLeaseRefusal`, `TestTheDeleteMarkFreezesTheStoreWait`, `TestAStage2VolumeIsNotMarkedForADeleteWithoutAck` (`core/host/master/workspace_delete_proof_test.go`); `TestDeleteMarkWriterCensus`, `TestDeleteMarkWriterCensusControls` (`core/host/master/store_attestation_census_test.go`) | CreateEvid2 model rows `mut_delete_on_flag_only`, `mut_no_horizon` | ACTIVE | | `INV-CLI-DELETE-PROGRESS-001` | Volume deletion bounds each sweep, continues across transient filer failures while objects are removed, reports on stderr while a sweep makes no progress (how long, the object it waits on, the count), and returns a retryable unavailable answer with progress after a no-progress window. | M9 deleting → deleted | `cmd/sw-block/chunk_volume_delete.go` `deleteVolumeWithProgress` | `TestVolumeDeleteContinuesAcrossTransientObjectFailures`, `TestVolumeDeleteReportsAStalledStoreWhileItWaits` (`cmd/sw-block/chunk_volume_delete_progress_test.go`) | Existing ordered delete; no new persisted state. | ACTIVE | @@ -1392,6 +1392,7 @@ Notes: | `INV-SNAP-DELETE-EXECUTOR-001` | A catalog delete attempt reads its issued handle before work, takes ownership by receipt CAS, and persists uncertain work as stalled. It never infers terminal success from a callback return; terminal replay reads the same incarnation. | M9 delete attempt transport | `BCatalog.RunSnapshotDeleteOperation`; CLI execution seam | `TestSnapshotDeleteCatalogResumesDurableIntentOnAnotherExecutor`, `TestSnapshotDeleteCatalogRefusesWrongIntentBeforeWork`, `TestSnapshotDeleteCatalogCannotInferSuccessFromWorkReturn`, `TestSnapshotDeleteOfflineCLILeavesProgressInFiler` | SnapDelete retained target; SnapOps owner/state refinement; V8 completion adapter and public command activation owed | STUB | | `INV-SNAP-OP-ADMISSION-CLOSE-001` | Admission checks HEAD after receipt publication and refuses a deleting/deleted or absent volume. Closed incarnations cannot answer retained operation queries; their terminal receipt bytes are not rewritten by closing. | M9 admission and observation | `checkSnapshotOperationAdmission`, `readOperationIndex`, create/delete admission | `TestSnapshotOperationAdmissionRechecksHeadAfterPublication`, `TestSnapshotOperationClosedVolumeRefusesReceipts`, `TestSnapshotOperationTerminalReadmissionRechecksHeadAfterFlag` | SnapVolDel rows 257-260 (per-incarnation) | STUB | | `INV-SNAP-OP-END-001` | Operation metadata is scoped to full VolumeID and creation generation. Late writes in a closed incarnation grant no authority. Dead-incarnation GC is idempotent and cannot affect a replacement; it does not promise no later writes. | M9 live incarnation to dead and GC | `operationDirectory`, `readOperationIndex`, `deleteSnapshotOperations` | `TestSnapshotOperationDeleteFencesPausedPublications`, `TestSnapshotOperationVolumeDeleteCleanupReruns`, `TestSnapshotOperationVolumeDeleteSparesForeignReceipt`, `TestSnapshotOperationDeadGCSparesUnobservedIncarnation` | SnapVolDel rows 257-260 (per-incarnation) | STUB | +| `INV-LIST-STAGE-RT-001` | Each list staging attempt gives its Stat, HEAD check and object write one 30 s deadline established before reading HEAD. An earlier caller deadline wins; a renewed attempt requires a fresh HEAD check. | VolDelSweep r3 Stage / Land, RT = 30 s | `layout/list_chain.go` `StageListPage`; `layout/delete_intent.go` `StageSnapshotDeletePage`, `adoptDeleteIntentPage` | `TestListStagingWriteDeadlineStartsAtItsOwnHeadCheck`, `TestListStagingHonorsEarlierParentDeadline`, `TestListStagingAdoptionRetryGetsFreshCheckAndDeadline`, `TestListStagingBoundsStatBeforeAnyWrite` | Client waiting only: an already queued server apply may still land late; delete rerun collects it. VolDelSweep r3 11/11 on az1 per model owner. Native controls pass; Linux qualification pending. | STUB | | `INV-SNAP-OP-CRASH-001` | A durable snapshot intent survives holder SIGKILL before publication and completes once after restart; after publication, restart settles its original receipt without another cut. | M9 operation recovery (planned) | Process-owned create executor; native crash qualification pending | `TestSnapshotOperationIntentAndPublicationCrashBoundaries`, `TestSnapshotOperationKillReceiptRejectsOrdinaryExit` (`cmd/blockvolume/snapshot_operation_crash_integration_test.go`) | SnapOps.Start/Publish/Settle; rows 211–219 (native red receipt owed) | STUB | | `INV-SNAPK-RETAIN-META-001` | Reachability, removal and the volume delete never read a snapshot's retention facts (source guard); the policy entry beside VOLUME changes by one conditional update and is read only by retain. | M9 snap → idle | `core/frontend/chunkstore/layout` `head.go` `SnapshotMeta`; `core/frontend/chunkstore` `retain_b.go` | `TestSnapshotMeta_WrittenOnceByTheCommit`, `TestGuard_SafetyIgnoresSnapshotMeta`, `TestBCatalog_RetainKeepsTheOldBehaviour`, `TestBCatalog_RetentionPolicyIsConditional` | — (the snapshot kernel model is not in this repository) | ACTIVE | | `INV-SNAPK-HEAD-BOUND-001` | HEAD stays inline: at most 10 snapshots, names at most 64 bytes, 4 labels, 4 dependents per snapshot and 16 per HEAD, refused where they enter with the cure; Encode refuses a HEAD above 64 KiB. A snapshot past 10 is refused before its cut: nothing is written. | M9 every transition | `core/frontend/chunkstore/layout` `head.go` `check`, `Encode`; `snapshots.go` `AddDependent`; `commit.go` `Commit`; `core/frontend/durable/provider_layout_snapshot.go` `SnapshotVolume`; `core/host/volume/chunk_control.go` `chunkErrorCode`; `core/host/volume/chunk_scheduled_snapshot.go` `ScheduledSnapshot` | `TestHead_SizeAtTheSnapshotCap`, `TestHead_BoundsRefused`, `TestChunkSnapshotPastTheLimitIsRefusedWithHEADUnchanged`, `TestScheduledSnapshotAtTheLimitStillPublishes`, `TestChunkSnapshotRefusalsAreTyped`, `TestLayoutProviderSnapshotVolume` | — (the snapshot kernel model is not in this repository) | ACTIVE | diff --git a/seaweed-block/docs/releases/verify-production-layout.md b/seaweed-block/docs/releases/verify-production-layout.md index 64da02b298..1b56f9e171 100644 --- a/seaweed-block/docs/releases/verify-production-layout.md +++ b/seaweed-block/docs/releases/verify-production-layout.md @@ -1,3 +1,43 @@ # Read-only verification on the production layout For v1.0.1, this replaces v1.0.0's warning not to use `ops chunk verify` on the production layout. Resolve a logical name with `--master MASTER --volume NAME`, or inspect an explicit `-` directory without the master. The full owner identity selects each referenced store, including borrowed restore chunks. `MasterIdentityChecked` discloses whether the full identity was compared with the master. With `--master`, an unresolved logical name leaves verification incomplete and exits 1. Without `--master`, an offline directory with no VOLUME record is a usage error and exits 2 without a missing-object finding. Uncertain dependent records suppress orphan conclusions. Verification remains read-only, including when it reports findings. + + +## List pages left by a v1.1 volume delete + +v1.1 omitted `lists/` pages when deleting a volume. In v1.1.1, +`ops chunk verify --orphans` reports these names as `ORPHAN` only when the +same directory's authenticated HEAD says `deleted` and its generation is stable +through the final confirmation. Live or deleting volumes may have pending list +work and are not reported by this check. A listing/confirmation failure is not +permission to remove anything. The report reads names, not page payloads, and +never deletes objects. Exit 3 means findings, not automatic repair. + +Inspect the exact old directory, rather than a logical name that may now name +a replacement: + +```text +sw-block ops chunk verify --chunk-filer FILER --chunk-path /blocks --volume NAME-ID8 --orphans +``` + +For manual cleanup, first retain the report and the old directory's VOLUME and +HEAD records. Check the full VOLUME ID against the deleted volume's recorded ID, +the canonical `NAME-ID8` directory, and HEAD's `deleted` state. Ensure that no +holder or operator is still writing this incarnation. If any identity or state +is uncertain, leave the objects and investigate. A replacement with the same +logical name has a different full ID and must be left intact. + +Using an administrator's `weed shell` connected to the same filer, remove only +the individual `lists/` leaf paths printed in that complete, stable report: + +```text +fs.rm /blocks/NAME-ID8/lists/EXACT_REPORTED_HASH +``` + +Substitute the configured base and the exact reported directory/hash; repeat +for each reported page. Do not use recursion, a wildcard, or a logical-name +prefix. Do not remove HEAD, VOLUME, pool, root or segment objects as part of this +procedure. Run the same read-only verification again and retain its output. +Previously deleted roots can also appear as `MISSING`; this procedure authorizes +only the reported list-page leaves. A page landing later is reported on the next +scan; this cleanup makes no terminal-write-fence or scheduled-resweep promise. From 91e6f4dfc42ec0c127a6e833d01cf13d2a722a77 Mon Sep 17 00:00:00 2001 From: pingqiu-cpu Date: Thu, 3 Dec 2026 00:24:37 -0800 Subject: [PATCH 04/66] Let progressing maintenance passes finish beyond one minute (#969) Interim merge note (spec trace workflow startup_failure since 22:45Z): go test (linux) and process-level tests (real binaries) passed on 53d87521; spec-trace-check.sh and public-text-check.sh run locally with the base branch's scripts against this head and body: both pass. Linux qualification at 2def4a14 (53d87521 is its conflict-only rebase): vet clean, -short of the six touched packages pass, targeted -race -count=2 finds no race. Code review ACCEPT carried to 53d87521; model review PASS. --- seaweed-block/.github/model-code-trace.tsv | 41 + .../blockvolume/maintenance_progress_test.go | 158 ++++ .../blockvolume/maintenance_status_test.go | 8 +- .../testdata/maintenance-retention-only.json | 1 + .../sw-block/catalog_snapshot_operation.go | 27 + seaweed-block/cmd/sw-block/chunk.go | 2 +- seaweed-block/cmd/sw-block/chunk_b.go | 1 + .../cmd/sw-block/chunk_layout_busy_test.go | 79 ++ .../core/frontend/chunkstore/catalog_b.go | 14 +- .../chunkstore/catalog_snapshot_operation.go | 1 + .../frontend/chunkstore/clean_admission.go | 162 ++++ .../chunkstore/clean_admission_test.go | 721 ++++++++++++++++++ .../core/frontend/chunkstore/clean_b.go | 230 +++++- .../chunkstore/clean_batch_release_test.go | 340 +++++++++ .../chunkstore/clean_batch_time_test.go | 447 +++++++++++ .../frontend/chunkstore/clean_intent_b.go | 5 + .../chunkstore/clean_progress_test.go | 35 + .../frontend/chunkstore/head_readers_test.go | 2 + .../frontend/chunkstore/layout/clean_batch.go | 50 ++ .../chunkstore/layout/delete_intent.go | 1 + .../frontend/chunkstore/layout/guard_test.go | 24 + .../core/frontend/chunkstore/layout/head.go | 12 + .../head_generation_source_guard_test.go | 5 +- .../frontend/chunkstore/layout/list_chain.go | 1 + .../chunkstore/layout/list_chain_test.go | 99 +++ .../chunkstore/layout/maintenance_progress.go | 98 +++ .../layout/maintenance_progress_test.go | 61 ++ .../core/frontend/chunkstore/layout/read.go | 2 + .../core/frontend/chunkstore/layout/remove.go | 112 ++- .../core/frontend/chunkstore/layout_remote.go | 49 +- .../chunkstore/layout_remote_intent_test.go | 25 + .../core/frontend/chunkstore/layout_store.go | 11 +- .../chunkstore/maintenance_request.go | 54 ++ .../chunkstore/maintenance_request_test.go | 162 ++++ .../core/frontend/chunkstore/retain_b.go | 17 +- .../core/frontend/chunkstore/swfs.go | 292 +++---- .../frontend/durable/maintenance_progress.go | 101 +++ .../durable/maintenance_progress_test.go | 212 +++++ .../frontend/durable/maintenance_status.go | 7 + .../core/frontend/durable/provider.go | 5 +- .../core/frontend/durable/provider_chunk.go | 34 +- .../durable/provider_maintenance_test.go | 6 +- .../core/host/volume/chunk_control.go | 2 + .../host/volume/chunk_layout_busy_test.go | 37 + seaweed-block/docs/design/invariants.md | 9 +- seaweed-block/docs/maintenance-admission.md | 94 +++ seaweed-block/docs/operator-guide.md | 2 +- seaweed-block/docs/releases/v1.1.md | 2 + seaweed-block/docs/status-schema.md | 2 + 49 files changed, 3632 insertions(+), 230 deletions(-) create mode 100644 seaweed-block/cmd/blockvolume/maintenance_progress_test.go create mode 100644 seaweed-block/cmd/sw-block/chunk_layout_busy_test.go create mode 100644 seaweed-block/core/frontend/chunkstore/clean_admission.go create mode 100644 seaweed-block/core/frontend/chunkstore/clean_admission_test.go create mode 100644 seaweed-block/core/frontend/chunkstore/clean_batch_release_test.go create mode 100644 seaweed-block/core/frontend/chunkstore/clean_batch_time_test.go create mode 100644 seaweed-block/core/frontend/chunkstore/clean_progress_test.go create mode 100644 seaweed-block/core/frontend/chunkstore/layout/clean_batch.go create mode 100644 seaweed-block/core/frontend/chunkstore/layout/maintenance_progress.go create mode 100644 seaweed-block/core/frontend/chunkstore/layout/maintenance_progress_test.go create mode 100644 seaweed-block/core/frontend/chunkstore/maintenance_request.go create mode 100644 seaweed-block/core/frontend/chunkstore/maintenance_request_test.go create mode 100644 seaweed-block/core/frontend/durable/maintenance_progress.go create mode 100644 seaweed-block/core/frontend/durable/maintenance_progress_test.go create mode 100644 seaweed-block/core/host/volume/chunk_layout_busy_test.go create mode 100644 seaweed-block/docs/maintenance-admission.md diff --git a/seaweed-block/.github/model-code-trace.tsv b/seaweed-block/.github/model-code-trace.tsv index 773b9877a7..7d58c62940 100644 --- a/seaweed-block/.github/model-code-trace.tsv +++ b/seaweed-block/.github/model-code-trace.tsv @@ -210,3 +210,44 @@ core/frontend/chunkstore/layout/delete_intent.go VolDelSweep.Stage core/frontend/chunkstore/layout/delete_intent.go VolDelSweep.Land core/frontend/chunkstore/layout/list_chain.go VolDelSweep.Stage core/frontend/chunkstore/layout/list_chain.go VolDelSweep.Land +core/frontend/durable/maintenance_progress.go CutTime.Complete +core/frontend/durable/maintenance_progress.go CutTime.Fail +core/frontend/durable/maintenance_progress.go CutTime.Tick +core/frontend/chunkstore/maintenance_request.go CutTime.CallTimeout +core/frontend/chunkstore/layout/maintenance_progress.go CutTime.Complete +core/frontend/chunkstore/layout/remove.go CutTime.Complete +core/frontend/chunkstore/retain_b.go CutTime.Complete +core/frontend/chunkstore/layout/read.go CutTime.Complete +core/frontend/chunkstore/layout/list_chain.go CutTime.Complete +core/frontend/chunkstore/clean_b.go CutTime.Complete +core/frontend/chunkstore/layout/delete_intent.go CutTime.Complete +core/frontend/chunkstore/layout_remote.go CutTime.Complete +core/frontend/chunkstore/clean_b.go SnapshotRemoval.BeginClean +core/frontend/chunkstore/clean_b.go SnapshotRemoval.EndClean +core/frontend/chunkstore/clean_b.go StaleClean.HeadRead +core/frontend/chunkstore/layout/clean_batch.go SnapshotRemoval.Validate +core/frontend/chunkstore/layout/clean_batch.go SnapshotRemoval.EndClean +core/frontend/chunkstore/clean_b.go CleanBatch.PrepOut +core/frontend/chunkstore/clean_b.go CleanBatch.Close +core/frontend/chunkstore/clean_b.go CleanBatch.Effects +core/frontend/chunkstore/clean_admission.go CleanBatch.Request +core/frontend/chunkstore/clean_admission.go CleanBatch.Begin +core/frontend/chunkstore/catalog_snapshot_operation.go CleanBatch.Publish +core/frontend/chunkstore/layout_remote.go CleanBatch.Publish +core/frontend/chunkstore/layout/clean_batch.go CleanBatch.PrepOut +core/frontend/chunkstore/layout/remove.go CleanBatch.Effects +core/frontend/chunkstore/clean_b.go CleanBatch.BeginIn +core/frontend/chunkstore/clean_b.go CleanBatch.PrepIn +core/frontend/chunkstore/layout/clean_batch.go CleanBatch.PrepIn +core/frontend/chunkstore/catalog_b.go CleanBatch.Request +core/frontend/chunkstore/catalog_b.go CleanBatch.Publish +core/frontend/chunkstore/retain_b.go CleanBatch.Request +core/frontend/chunkstore/retain_b.go CleanBatch.Publish +core/frontend/chunkstore/clean_intent_b.go CleanBatch.Request +core/frontend/chunkstore/clean_intent_b.go CleanBatch.Publish +core/frontend/chunkstore/layout_remote.go CleanBatch.Begin +core/frontend/chunkstore/clean_admission.go CleanBatch.Close +core/frontend/chunkstore/layout_store.go CleanBatch.Request +core/frontend/chunkstore/layout_store.go CleanBatch.Publish +core/frontend/chunkstore/layout/head.go CleanBatch.Request +core/frontend/chunkstore/layout/head.go CleanBatch.Publish diff --git a/seaweed-block/cmd/blockvolume/maintenance_progress_test.go b/seaweed-block/cmd/blockvolume/maintenance_progress_test.go new file mode 100644 index 0000000000..c394fa98e6 --- /dev/null +++ b/seaweed-block/cmd/blockvolume/maintenance_progress_test.go @@ -0,0 +1,158 @@ +package main + +import ( + "bytes" + "context" + "path" + "strings" + "sync" + "testing" + "testing/synctest" + "time" + + "github.com/seaweedfs/seaweed-block/core/frontend/chunkstore" + "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" +) + +type progressingPreparationFiler struct { + chunkstore.Filer + mu sync.Mutex + enabled bool + seen map[string]bool + removeDelay time.Duration + prepStart, prepEnd, removeStart, removeEnd time.Time +} + +func (f *progressingPreparationFiler) LookupEntry(ctx context.Context, dir, name string) (*filerpb.Entry, error) { + f.mu.Lock() + key := path.Join(dir, name) + delay := f.enabled && strings.Contains(dir, "/pool/") && !f.seen[key] + if delay { + f.seen[key] = true + if f.prepStart.IsZero() { + f.prepStart = time.Now() + } + } + f.mu.Unlock() + if delay { + select { + case <-ctx.Done(): + return nil, ctx.Err() + case <-time.After(15 * time.Second): + } + } + entry, err := f.Filer.LookupEntry(ctx, dir, name) + if delay && err == nil { + f.mu.Lock() + f.prepEnd = time.Now() + f.mu.Unlock() + } + return entry, err +} + +func (f *progressingPreparationFiler) DeleteEntry(ctx context.Context, dir, name string, expected map[string][]byte) error { + delay := f.removeDelay + slow := delay > 0 && strings.Contains(dir, "/pool/") + if slow { + f.mu.Lock() + if f.removeStart.IsZero() { + f.removeStart = time.Now() + } + f.mu.Unlock() + select { + case <-ctx.Done(): + return ctx.Err() + case <-time.After(delay): + } + } + err := f.Filer.DeleteEntry(ctx, dir, name, expected) + if slow && err == nil { + f.mu.Lock() + f.removeEnd = time.Now() + f.mu.Unlock() + } + return err +} + +// A real callback, catalog sweep and provider status cross the old total bound. +func TestRealMaintenanceProgressingPastOneMinuteCompletes(t *testing.T) { + testRealMaintenanceProgress(t, 0) +} + +func TestRealMaintenancePreparationAndRemovalEachOutliveWindow(t *testing.T) { + testRealMaintenanceProgress(t, 500*time.Millisecond) +} + +func testRealMaintenanceProgress(t *testing.T, removeDelay time.Duration) { + t.Helper() + synctest.Test(t, func(t *testing.T) { + ctx := context.Background() + fixture := testutil.NewLayoutFixture(t, "v1", 4096, 16) + cfg := durable.ProviderConfig{Impl: durable.ImplWALStoreChunk, StorageRoot: t.TempDir(), BlockSize: 4096, NumBlocks: 4096, ChunkBlocks: 16, ChunkMaintenanceInterval: time.Hour, ChunkMaintenanceTimeout: time.Minute, ChunkStagger: true} + fixture.Configure(&cfg) + slow := &progressingPreparationFiler{Filer: fixture.Filer, seen: map[string]bool{}, removeDelay: removeDelay} + cat, err := chunkstore.NewBCatalog(slow, fixture.Blobs, "/provider-test") + if err != nil { + t.Fatal(err) + } + var p *durable.DurableProvider + cfg.ChunkMaintenance = newChunkMaintenance(cat, fixture.Ref, func(ctx context.Context) (layoutCleaner, error) { + r, e := p.LayoutRemote(ctx, "v1") + if e != nil { + return nil, e + } + return r.(layoutCleaner), nil + }, true, time.Now) + p, err = durable.NewDurableProvider(cfg, cleaningView{}) + if err != nil { + t.Fatal(err) + } + defer p.Close() + if _, err = p.EnsureStorage("v1"); err != nil { + t.Fatal(err) + } + if _, err = p.RecoverVolume(ctx, "v1"); err != nil { + t.Fatal(err) + } + st, err := cat.Store(fixture.Ref) + if err != nil { + t.Fatal(err) + } + if err = fixture.Filer.CreateEntry(ctx, path.Join("/provider-test", fixture.Ref.Dir(), layout.PoolDir), &filerpb.Entry{Name: "0", IsDirectory: true}, false); err != nil { + t.Fatal(err) + } + for i := uint64(0); i < 192; i++ { + data := bytes.Repeat([]byte{byte(i + 1)}, 4096) + n := layout.NameChunk(i, data) + if err = layout.EnsureObject(ctx, st, n.Path(), data, "ended"); err != nil { + t.Fatal(err) + } + } + slow.mu.Lock() + slow.enabled = true + slow.mu.Unlock() + if !p.KickMaintenance("v1") { + t.Fatal("kick refused") + } + time.Sleep(95*time.Second + 192*removeDelay) + synctest.Wait() + m := maintenanceJSON(t, p) + if m["passesOk"] != float64(1) { + t.Fatalf("real progressing sweep failed to complete: %v", m) + } + slow.mu.Lock() + prep, removal := slow.prepEnd.Sub(slow.prepStart), slow.removeEnd.Sub(slow.removeStart) + slow.mu.Unlock() + t.Logf("completed phases: preparation=%v removal=%v window=1m", prep, removal) + if prep <= time.Minute || removeDelay > 0 && removal <= time.Minute { + t.Fatalf("fixture did not cross both phase windows: preparation=%v removal=%v", prep, removal) + } + last := m["lastPass"].(map[string]any) + if last["removedChunks"] != float64(192) || last["processed"].(float64) < 192 || last["error"] != "" { + t.Fatalf("real sweep counts: %v", last) + } + }) +} diff --git a/seaweed-block/cmd/blockvolume/maintenance_status_test.go b/seaweed-block/cmd/blockvolume/maintenance_status_test.go index f20edbd6e6..63f2518bf3 100644 --- a/seaweed-block/cmd/blockvolume/maintenance_status_test.go +++ b/seaweed-block/cmd/blockvolume/maintenance_status_test.go @@ -280,7 +280,13 @@ func TestMaintenanceStatusRealPassAndTimeout(t *testing.T) { } else if last["error"] != "" || last["headGenError"] != "" { t.Fatalf("unexpected error: %v", last) } - if after.Gen != before.Gen+2 || m["passesOk"] != float64(1) || last["headGen"].(float64) != float64(expectedGen) { + // Initial admission closes before enumeration, then roots, segments + // and (unless metadata-only) chunks each have their own begin/end. + pages := uint64(3) + if kind == "metadata-only" { + pages = 2 + } + if after.Gen != before.Gen+2+2*pages || m["passesOk"] != float64(1) || last["headGen"].(float64) != float64(expectedGen) { t.Fatalf("before=%d after=%d status=%v", before.Gen, after.Gen, m) } total, chunks := float64(3), float64(1) diff --git a/seaweed-block/cmd/blockvolume/testdata/maintenance-retention-only.json b/seaweed-block/cmd/blockvolume/testdata/maintenance-retention-only.json index cd61734030..3f0ed5c11f 100644 --- a/seaweed-block/cmd/blockvolume/testdata/maintenance-retention-only.json +++ b/seaweed-block/cmd/blockvolume/testdata/maintenance-retention-only.json @@ -4,6 +4,7 @@ "currentStartNs": 0, "lastPass": { "atNs": 1, + "processed": 0, "planned": 0, "removed": 0, "plannedChunks": 0, diff --git a/seaweed-block/cmd/sw-block/catalog_snapshot_operation.go b/seaweed-block/cmd/sw-block/catalog_snapshot_operation.go index 36bc322ce0..eb0e033dc9 100644 --- a/seaweed-block/cmd/sw-block/catalog_snapshot_operation.go +++ b/seaweed-block/cmd/sw-block/catalog_snapshot_operation.go @@ -6,8 +6,10 @@ import ( "errors" "fmt" "io" + "time" "github.com/seaweedfs/seaweed-block/core/frontend/chunkstore" + "github.com/seaweedfs/seaweed-block/core/frontend/chunkstore/layout" ) // chunkRunCatalogSnapshotDelete is the CLI-owned execution/observation seam. @@ -37,6 +39,31 @@ func chunkCatalogSnapshotDeleteAnswer(ctx context.Context, cat *chunkstore.BCata return map[string]any{"operation_id": op.ID, "volume_id": op.VolumeID.String(), "incarnation": snapshotIncarnation(op), "instance": op.Instance, "sequence": op.Sequence, "state": op.State}, nil } answer, err := cat.RunSnapshotDeleteOperation(ctx, volume, op, work) + _, bounded := ctx.Deadline() + for bounded && errors.Is(err, layout.ErrBusy) { + // Resume the captured incarnation, never re-admit the snapshot name. + // The enclosing command's window bounds both pauses and attempts. + select { + case <-ctx.Done(): + return nil, err + case <-time.After(100 * time.Millisecond): + } + if ctx.Err() != nil { + return nil, err + } + st, readErr := cat.Store(volume) + if readErr != nil { + return nil, readErr + } + op, readErr = st.ReadSnapshotOperationHandle(ctx, op.ID, op.Verb, op.Instance, op.Sequence) + if readErr != nil { + return nil, readErr + } + answer, err = cat.RunSnapshotDeleteOperation(ctx, volume, op, work) + } + if errors.Is(err, layout.ErrBusy) { + return nil, err // A caller without a window must not start endless retries. + } if err != nil { return nil, &chunkstore.CatalogError{Code: "no_progress", Message: err.Error() + "; resume with --request-id " + op.ID, Retryable: true, Err: err} } diff --git a/seaweed-block/cmd/sw-block/chunk.go b/seaweed-block/cmd/sw-block/chunk.go index 34a29a6d89..631ac9a735 100644 --- a/seaweed-block/cmd/sw-block/chunk.go +++ b/seaweed-block/cmd/sw-block/chunk.go @@ -345,7 +345,7 @@ func chunkResult(name string, v any, err error, stdout, stderr io.Writer) int { case errors.Is(err, context.DeadlineExceeded): return chunkFail(name, stdout, stderr, chunkExitFailed, chunkstore.CodeDeadlineExceeded, err.Error(), true) case layoutCode(err) != "": - return chunkFail(name, stdout, stderr, chunkExitFailed, layoutCode(err), err.Error(), errors.Is(err, layout.ErrPrecondition) || errors.Is(err, layout.ErrQueueFull)) + return chunkFail(name, stdout, stderr, chunkExitFailed, layoutCode(err), err.Error(), errors.Is(err, layout.ErrPrecondition) || errors.Is(err, layout.ErrBusy)) default: return chunkFail(name, stdout, stderr, chunkExitFailed, codeInternalCLI, err.Error(), false) } diff --git a/seaweed-block/cmd/sw-block/chunk_b.go b/seaweed-block/cmd/sw-block/chunk_b.go index de258378ca..4cd765bc66 100644 --- a/seaweed-block/cmd/sw-block/chunk_b.go +++ b/seaweed-block/cmd/sw-block/chunk_b.go @@ -439,6 +439,7 @@ func layoutCode(err error) string { code string }{ {layout.ErrQueueFull, chunkstore.CodeQueueFull}, + {layout.ErrBusy, "layout_busy"}, {layout.ErrNoSnapshot, "snapshot_not_found"}, {layout.ErrSnapshotDeleteNeedsOperation, "snapshot_delete_requires_operation"}, {layout.ErrHasDependents, "snapshot_has_dependents"}, diff --git a/seaweed-block/cmd/sw-block/chunk_layout_busy_test.go b/seaweed-block/cmd/sw-block/chunk_layout_busy_test.go new file mode 100644 index 0000000000..f087fa3e6a --- /dev/null +++ b/seaweed-block/cmd/sw-block/chunk_layout_busy_test.go @@ -0,0 +1,79 @@ +package main + +import ( + "bytes" + "context" + "encoding/json" + "errors" + "fmt" + "testing" + "testing/synctest" + "time" + + "github.com/seaweedfs/seaweed-block/core/frontend/chunkstore" + "github.com/seaweedfs/seaweed-block/core/frontend/chunkstore/layout" +) + +func TestSnapshotDeleteCLILayoutBusyIsTypedRetryable(t *testing.T) { + for _, tc := range []struct { + name string + err error + code string + }{ + {"open clean transaction", fmt.Errorf("delete: %w", layout.ErrBusy), "layout_busy"}, + {"queue full remains specific", layout.ErrQueueFull, "queue_full"}, + } { + t.Run(tc.name, func(t *testing.T) { + if got := layoutCode(tc.err); got != tc.code { + t.Errorf("layoutCode: %q; want %q", got, tc.code) + } + var out, diag bytes.Buffer + exit := chunkResult("snapshot-delete", nil, tc.err, &out, &diag) + answer := chunkErrorOut(t, out.String()) + if exit != chunkExitFailed || answer.Code != tc.code || !answer.Retryable { + t.Fatalf("CLI delete: exit=%d answer=%+v; want failure with %s retryable", exit, answer, tc.code) + } + }) + } +} + +func TestSnapshotDeleteCLIRetriesBusyWithSameIdentityWithinWindow(t *testing.T) { + for _, neverReady := range []bool{false, true} { + t.Run(fmt.Sprintf("neverReady=%v", neverReady), func(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + mem := newMemChunkStore() + useMemChunkStore(t, mem) + v := cliVolume(t, mem, "v1", "daily") + cat, _ := chunkstore.NewBCatalog(mem, mem, defaultChunkPathCLI) + st, _ := cat.Store(v) + ctx, cancel := context.WithTimeout(context.Background(), 350*time.Millisecond) + defer cancel() + op, err := st.AdmitSnapshotDeleteOperation(ctx, "same-delete", "daily", func(context.Context) (uint64, error) { return 19, nil }) + if err != nil { + t.Fatal(err) + } + calls := 0 + work := func(ctx context.Context, st *chunkstore.LayoutStore, running chunkstore.SnapshotOperation) error { + calls++ + if running.ID != op.ID || running.Instance != op.Instance || running.Sequence != op.Sequence || *running.TargetGeneration != 19 { + t.Fatal("busy retry changed the admitted target or identity") + } + if neverReady || calls < 3 { + return layout.ErrBusy + } + _, err := st.AdvanceSnapshotOperation(ctx, running, "succeeded", json.RawMessage(`{"state":"deleted"}`), "") + return err + } + var diag bytes.Buffer + _, err = chunkCatalogSnapshotDeleteAnswer(ctx, cat, v, op, work, false, &diag) + if neverReady { + if !errors.Is(err, layout.ErrBusy) || ctx.Err() == nil || calls < 2 || calls > 4 { + t.Fatalf("busy window: calls=%d ctx=%v err=%v", calls, ctx.Err(), err) + } + } else if err != nil || calls != 3 { + t.Fatalf("retry after release: calls=%d err=%v", calls, err) + } + }) + }) + } +} diff --git a/seaweed-block/core/frontend/chunkstore/catalog_b.go b/seaweed-block/core/frontend/chunkstore/catalog_b.go index e93efc235a..ac2a1f73de 100644 --- a/seaweed-block/core/frontend/chunkstore/catalog_b.go +++ b/seaweed-block/core/frontend/chunkstore/catalog_b.go @@ -112,6 +112,12 @@ func (c *BCatalog) ReadHeadObserved(ctx context.Context, v VolumeRef) (layout.He // DeleteSnapshot removes the named snapshot; refused while it has // dependents. func (c *BCatalog) DeleteSnapshot(ctx context.Context, v VolumeRef, name string) (layout.Head, error) { + done, err := c.acquirePublishers(ctx, v) + if err != nil { + return layout.Head{}, err + } + defer done() + s, err := c.Store(v) if err != nil { return layout.Head{}, err @@ -160,7 +166,7 @@ func (c *BCatalog) Restore(ctx context.Context, src VolumeRef, snapshot string, if !found { return layout.Head{}, layout.ErrMissing } - return layout.CreateTarget(ctx, ss, sr, snapshot, ts, layout.Volume{ID: target.ID, Name: target.Name, Format: layout.VolumeFormat, Geometry: source.Geometry}, copyRoot) + return layout.CreateTarget(ctx, c.publishingStore(src, ss), sr, snapshot, c.publishingStore(target, ts), layout.Volume{ID: target.ID, Name: target.Name, Format: layout.VolumeFormat, Geometry: source.Geometry}, copyRoot) } func (c *BCatalog) fetchVerified(ctx context.Context, s *LayoutStore, v VolumeRef, rel string, want layout.Hash) ([]byte, error) { @@ -190,7 +196,7 @@ func (c *BCatalog) ReleaseTarget(ctx context.Context, src, target VolumeRef) (la if err != nil { return layout.Head{}, err } - return layout.OperatorReleaseDependent(ctx, ss, ts, tr, target.ID) + return layout.OperatorReleaseDependent(ctx, c.publishingStore(src, ss), c.publishingStore(target, ts), tr, target.ID) } // DeleteVolume deletes the volume in the kernel's order. The sources it is @@ -223,10 +229,10 @@ func (c *BCatalog) DeleteVolume(ctx context.Context, v VolumeRef, auth layout.De if err != nil { return nil, err } - sources = append(sources, ss) + sources = append(sources, c.publishingStore(o, ss)) } list := func(ctx context.Context) ([]string, error) { return c.listObjects(ctx, v) } - if err := layout.DeleteVolume(ctx, s, auth, v.ID, sources, s, list, progress...); err != nil { + if err := layout.DeleteVolume(ctx, c.publishingStore(v, s), auth, v.ID, sources, s, list, progress...); err != nil { return skipped, err } return skipped, s.deleteSnapshotOperations(ctx) diff --git a/seaweed-block/core/frontend/chunkstore/catalog_snapshot_operation.go b/seaweed-block/core/frontend/chunkstore/catalog_snapshot_operation.go index c6ea439723..de4301cf29 100644 --- a/seaweed-block/core/frontend/chunkstore/catalog_snapshot_operation.go +++ b/seaweed-block/core/frontend/chunkstore/catalog_snapshot_operation.go @@ -28,6 +28,7 @@ func (c *BCatalog) RunSnapshotDeleteOperation(ctx context.Context, v VolumeRef, if err != nil { return SnapshotOperation{}, err } + st = c.publishingStore(v, st) op, err := st.ReadSnapshotOperationHandle(ctx, expected.ID, expected.Verb, expected.Instance, expected.Sequence) if err != nil { return SnapshotOperation{}, err diff --git a/seaweed-block/core/frontend/chunkstore/clean_admission.go b/seaweed-block/core/frontend/chunkstore/clean_admission.go new file mode 100644 index 0000000000..551acf4734 --- /dev/null +++ b/seaweed-block/core/frontend/chunkstore/clean_admission.go @@ -0,0 +1,162 @@ +package chunkstore + +import ( + "context" + "sync" + "sync/atomic" + + "github.com/seaweedfs/seaweed-block/core/frontend/chunkstore/layout" +) + +// cleanAdmission is process-local scheduling, never layout authority. It is +// shared by one catalog's stores/remotes for the same full volume identity. +// No storage call is made with mu held. Publishers register before waiting; +// their cancellation always withdraws the mark, so cleaning cannot be orphaned. +type cleanAdmission struct { + mu sync.Mutex + changed chan struct{} + cleaning bool + publishers uint64 +} + +func (g *cleanAdmission) signal() { + if g.changed != nil { + close(g.changed) + } + g.changed = make(chan struct{}) +} + +func (g *cleanAdmission) publisher(ctx context.Context) (func(), error) { + // Scheduling never changes the kernel's activity guards. A3 excludes + // synchronous reference-removing publications from registration inside + // their own live batch, preserving SnapshotRemoval semantics. + owned, _ := ctx.Value(heldCleanAdmissionKey{}).(*cleanAdmissionLease) + g.mu.Lock() + // Do not form a cross-volume wait cycle while a callback holds a clean + // lease elsewhere. The caller can retry after releasing that activity. + if owned != nil && !owned.released.Load() && owned.gate != g && g.cleaning { + g.mu.Unlock() + return nil, layout.ErrBusy + } + // A3: a synchronous reference-removing callback inside this batch is + // unregistered. Its original kernel guards and held-generation check + // still apply; scheduling never grants it layout authority. + if owned != nil && !owned.released.Load() && owned.gate == g { + g.mu.Unlock() + return func() {}, nil + } + g.publishers++ + g.signal() + done := func() { g.mu.Lock(); g.publishers--; g.signal(); g.mu.Unlock() } + for { + if err := ctx.Err(); err != nil { + g.mu.Unlock() + done() + return nil, err + } + if !g.cleaning { + g.mu.Unlock() + return done, nil + } + changed := g.changed + g.mu.Unlock() + select { + case <-ctx.Done(): + g.mu.Lock() + g.publishers-- + g.signal() + g.mu.Unlock() + return nil, ctx.Err() + case <-changed: + } + g.mu.Lock() + } +} + +func (g *cleanAdmission) batch(ctx context.Context) (func(), error) { + g.mu.Lock() + for { + if err := ctx.Err(); err != nil { + g.mu.Unlock() + return nil, err + } + if !g.cleaning && g.publishers == 0 { + g.cleaning = true + g.mu.Unlock() + return func() { g.mu.Lock(); g.cleaning = false; g.signal(); g.mu.Unlock() }, nil + } + if g.changed == nil { + g.signal() + } + changed := g.changed + g.mu.Unlock() + select { + case <-ctx.Done(): + return nil, ctx.Err() + case <-changed: + } + g.mu.Lock() + } +} + +// acquirePublishers marks every HEAD this catalog operation can publish. These +// are interests, not exclusive writer locks: nested/duplicate volume interests +// can coexist and never wait on each other. Only a held cleaner delays them. +// The operation's existing HEAD CAS/session remains the publication authority. +func (c *BCatalog) acquirePublishers(ctx context.Context, volumes ...VolumeRef) (func(), error) { + releases := make([]func(), 0, len(volumes)) + done := func() { + for i := len(releases) - 1; i >= 0; i-- { + releases[i]() + } + } + for _, volume := range volumes { + release, err := c.cleaningCursor(volume).admission.publisher(ctx) + if err != nil { + done() + return nil, err + } + releases = append(releases, release) + } + return done, nil +} + +type initialCleanAdmissionKey struct{} +type heldCleanAdmissionKey struct{} +type cleanAdmissionLease struct { + once sync.Once + done func() + gate *cleanAdmission + released atomic.Bool +} + +func (a *cleanAdmissionLease) release() { a.once.Do(func() { a.released.Store(true); a.done() }) } + +// The initial remote activity transfers admission at its first durable close, +// before the catalog acquires per-page admission. The remote also defers the +// same idempotent release for an error or a callback that is not the catalog. +func releaseInitialCleanAdmission(ctx context.Context) { + if a, ok := ctx.Value(initialCleanAdmissionKey{}).(*cleanAdmissionLease); ok { + a.release() + } +} + +// publishingStore scopes admission to each read/compute/CAS transition, never the +// surrounding enumeration, object copying, receipt settlement, or delete loop. +// The clone shares counters/backends; the plain Store remains a low-level view. +func (c *BCatalog) publishingStore(v VolumeRef, s *LayoutStore) *LayoutStore { + view := *s + view.publicationAdmission = &c.cleaningCursor(v).admission + return &view +} + +// BeginHeadPublication is the kernel's optional scheduling hook, called before +// reading the HEAD of one transition and released after its CAS/no-op/error. +// Plain low-level and authority stores do not register. UpdateHead itself must +// not acquire: runTransition already owns the interest and prepared generation. +func (s *LayoutStore) BeginHeadPublication(ctx context.Context) (func(), error) { + if s.publicationAdmission == nil { + return func() {}, nil + } + return s.publicationAdmission.publisher(ctx) +} diff --git a/seaweed-block/core/frontend/chunkstore/clean_admission_test.go b/seaweed-block/core/frontend/chunkstore/clean_admission_test.go new file mode 100644 index 0000000000..e6116f70c6 --- /dev/null +++ b/seaweed-block/core/frontend/chunkstore/clean_admission_test.go @@ -0,0 +1,721 @@ +package chunkstore + +import ( + "context" + "errors" + "fmt" + "testing" + "testing/synctest" + "time" + + "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/chunkstore/retain" + "github.com/seaweedfs/seaweed-block/core/storage" +) + +type publicationProbeKey struct{} + +type publicationBackendFiler struct { + Filer + beforeCAS func(context.Context) error +} + +func (f *publicationBackendFiler) UpdateEntry(ctx context.Context, dir string, e *filerpb.Entry, expected map[string][]byte) error { + if e.Name == layout.HeadName && ctx.Value(publicationProbeKey{}) == true { + if err := f.beforeCAS(ctx); err != nil { + return err + } + } + return f.Filer.UpdateEntry(ctx, dir, e, expected) +} + +type publisherDelayKey struct{} +type pausedPublisherFiler struct { + Filer + paused bool + skip int +} + +func (f *pausedPublisherFiler) LookupEntry(ctx context.Context, dir, name string) (*filerpb.Entry, error) { + if ctx.Value(publisherDelayKey{}) == true && name == layout.HeadName && !f.paused { + if f.skip > 0 { + f.skip-- + return f.Filer.LookupEntry(ctx, dir, name) + } + f.paused = true + select { + case <-ctx.Done(): + return nil, ctx.Err() + case <-time.After(time.Second): + } + } + return f.Filer.LookupEntry(ctx, dir, name) +} + +func TestMaintenanceWaitingPublisherRunsBeforeNextBatch(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + ctx, cancel := context.WithTimeout(context.Background(), time.Minute) + defer cancel() + cat, ref, st, _ := cleanFixture(t) + cat.f = &pausedPublisherFiler{Filer: cat.f} + remote, err := NewLayoutRemote(cat, ref, cleanHolder) + if err != nil { + t.Fatal(err) + } + g := &cat.cleaningCursor(ref).admission + release, err := g.batch(ctx) + if err != nil { + t.Fatal(err) + } + if _, err := layout.RunBeginClean(ctx, st, cleanHolder, "first-batch"); err != nil { + release() + t.Fatal(err) + } + publisher := make(chan error, 1) + go func() { + remote.mu.Lock() + _, err := remote.beginSessionLocked(context.WithValue(ctx, publisherDelayKey{}, true)) + remote.mu.Unlock() + publisher <- err + }() + synctest.Wait() // The cut has registered its mark while the first batch holds. + g.mu.Lock() + waiting := g.publishers + g.mu.Unlock() + if waiting != 1 { + release() + t.Fatalf("publisher mark=%d; want 1", waiting) + } + next := make(chan error, 1) + go func() { + done, err := g.batch(ctx) + if err != nil { + next <- err + return + } + defer done() + _, err = layout.RunBeginClean(ctx, st, cleanHolder, "second-batch") + next <- err + }() + synctest.Wait() + if _, err := layout.RunEndClean(ctx, st, cleanHolder, "first-batch", layout.CauseCleanEnd); err != nil { + release() + t.Fatal(err) + } + release() + // The publisher is deliberately slow AFTER admission, before its HEAD write. + // A pause/chance is insufficient: no second batch may enter during this gap. + time.Sleep(10 * time.Millisecond) + select { + case err := <-next: + t.Fatalf("second batch passed waiting publisher before its write: %v", err) + default: + } + if err := <-publisher; err != nil { + t.Fatal(err) + } + if err := <-next; !errors.Is(err, layout.ErrBusy) { + t.Fatalf("next begin did not observe publisher's open snapshot: %v", err) + } + h, _, err := st.ReadHead(ctx) + if err != nil || h.Activity != (layout.Activity{Kind: layout.ActSnap, Session: remote.session}) { + t.Fatalf("publisher did not win: %+v err=%v", h.Activity, err) + } + if _, err := layout.RunAbort(ctx, st, cleanHolder, remote.session, layout.CauseSessionRollback); err != nil { + t.Fatal(err) + } + t.Log("waiting same-catalog cut wrote HEAD before the next batch could begin") + }) +} + +func TestMaintenanceCancelledPublisherWithdrawsItsMark(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + var g cleanAdmission + release, err := g.batch(context.Background()) + if err != nil { + t.Fatal(err) + } + ctx, cancel := context.WithCancel(context.Background()) + result := make(chan error, 1) + go func() { + done, err := g.publisher(ctx) + if done != nil { + done() + } + result <- err + }() + synctest.Wait() + cancel() + if err := <-result; !errors.Is(err, context.Canceled) { + t.Fatalf("cancelled publisher: %v", err) + } + release() + done, err := g.batch(context.Background()) + if err != nil { + t.Fatal(err) + } + done() + g.mu.Lock() + defer g.mu.Unlock() + if g.publishers != 0 || g.cleaning { + t.Fatalf("orphaned admission: publishers=%d cleaning=%v", g.publishers, g.cleaning) + } + }) +} + +func TestMaintenancePublisherWaitKeepsRemoteDeadlineClassification(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + cat, ref, st, _ := cleanFixture(t) + remote, err := NewLayoutRemote(cat, ref, cleanHolder) + if err != nil { + t.Fatal(err) + } + before, _, err := st.ReadHead(context.Background()) + if err != nil { + t.Fatal(err) + } + g := &cat.cleaningCursor(ref).admission + release, err := g.batch(context.Background()) + if err != nil { + t.Fatal(err) + } + ctx, cancel := context.WithTimeout(context.Background(), time.Second) + defer cancel() + _, err = remote.Begin(ctx) + if !errors.Is(err, storage.ErrChunkRemoteUnavailable) || !errors.Is(err, context.DeadlineExceeded) { + release() + t.Fatalf("admission wait changed caller classification: %v", err) + } + after, _, err := st.ReadHead(context.Background()) + if err != nil || before.Gen != after.Gen { + release() + t.Fatalf("cancelled waiter wrote HEAD: err=%v", err) + } + g.mu.Lock() + pending := g.publishers + g.mu.Unlock() + release() + if pending != 0 { + t.Fatalf("cancelled remote left %d publisher marks", pending) + } + session, err := remote.Begin(context.Background()) + if err != nil { + t.Fatalf("fresh publisher after cancellation: %v", err) + } + if _, err := layout.RunAbort(context.Background(), st, cleanHolder, session, layout.CauseSessionRollback); err != nil { + t.Fatal(err) + } + }) +} + +func TestMaintenanceOwnCutStillCancelsAndJoinsItsCleanerBeforeAdmission(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + cat, ref, st, _ := cleanFixture(t) + remote, err := NewLayoutRemote(cat, ref, cleanHolder) + if err != nil { + t.Fatal(err) + } + release, err := remote.admission.batch(context.Background()) + if err != nil { + t.Fatal(err) + } + cleanCtx, cleanCancel := context.WithCancel(context.Background()) + defer cleanCancel() + remote.cleaning, remote.cleanCancel, remote.cleanDone = "own-cleaner", cleanCancel, make(chan struct{}) + joined := make(chan struct{}) + go func() { + <-cleanCtx.Done() + release() + remote.mu.Lock() + remote.cleaning = "" + close(remote.cleanDone) + remote.mu.Unlock() + close(joined) + }() + ctx, cancel := context.WithTimeout(context.Background(), time.Second) + defer cancel() + session, err := remote.Begin(ctx) + if err != nil { + t.Fatalf("own cut waited on admission without cancelling/joining cleaner: %v", err) + } + <-joined + if cleanCtx.Err() != context.Canceled { + t.Fatal("own cleaner was not cancelled") + } + if _, err := layout.RunAbort(context.Background(), st, cleanHolder, session, layout.CauseSessionRollback); err != nil { + t.Fatal(err) + } + }) +} + +func TestMaintenanceRetainPublisherPrecedesANewCleanPass(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + ctx, cancel := context.WithTimeout(context.Background(), 30*time.Second) + defer cancel() + cat, ref, st, _ := cleanFixture(t) + now := time.Now() + snapshotWithMeta(t, cat, ref, "expired", layout.SnapshotMeta{Class: layout.ClassSemantic, CreatedNs: now.Add(-2 * time.Hour).UnixNano(), ExpiresNs: now.Add(-time.Hour).UnixNano()}, "expiration", 2) + if err := cat.SetRetention(ctx, ref, retain.Policy{}); err != nil { + t.Fatal(err) + } + cat.f = &pausedPublisherFiler{Filer: cat.f, skip: 1} + remote, err := NewLayoutRemote(cat, ref, cleanHolder) + if err != nil { + t.Fatal(err) + } + g := &cat.cleaningCursor(ref).admission + release, err := g.batch(ctx) + if err != nil { + t.Fatal(err) + } + retained := make(chan error, 1) + go func() { + result, err := cat.Retain(context.WithValue(ctx, publisherDelayKey{}, true), ref, now, false) + expired := false + for _, name := range result.Deleted { + expired = expired || name == "expired" + } + if err == nil && !expired { + err = fmt.Errorf("retention did not publish: deleted=%v", result.Deleted) + } + retained <- err + }() + synctest.Wait() + g.mu.Lock() + marked := g.publishers + g.mu.Unlock() + if marked != 1 { + release() + t.Fatalf("Retain did not register while batch held: publishers=%d", marked) + } + release() + synctest.Wait() // Retain is paused before its first HEAD read, with mark held. + entered := make(chan struct{}) + cleaned := make(chan error, 1) + go func() { + cleaned <- remote.Clean(ctx, func(ctx context.Context, me layout.HolderID, session string) error { + close(entered) + h, found, err := st.ReadHead(ctx) + if err != nil || !found { + return fmt.Errorf("clean entry HEAD: found=%v err=%v", found, err) + } + if _, present := h.Snapshots["expired"]; present { + return fmt.Errorf("new clean pass overtook Retain publication") + } + _, err = cat.RemoveUnreachableAll(ctx, ref, me, session) + return err + }) + }() + time.Sleep(10 * time.Millisecond) + select { + case <-entered: + t.Fatal("new clean pass entered before marked Retain published") + default: + } + if err := <-retained; err != nil { + t.Fatal(err) + } + if err := <-cleaned; err != nil { + t.Fatalf("initial admission was not handed to catalog batches: %v", err) + } + g.mu.Lock() + defer g.mu.Unlock() + if g.cleaning || g.publishers != 0 { + t.Fatalf("nested initial/batch gate leaked: cleaning=%v publishers=%d", g.cleaning, g.publishers) + } + }) +} + +func TestMaintenanceNestedCatalogPublishersDoNotSelfDeadlock(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + ctx, cancel := context.WithTimeout(context.Background(), time.Second) + defer cancel() + cat, ref, _, _ := cleanFixture(t) + done, err := cat.acquirePublishers(ctx, ref, ref) + if err != nil { + t.Fatal(err) + } + if _, err := cat.DeleteSnapshot(ctx, ref, "s"); err != nil { + done() + t.Fatalf("nested direct writer deadlocked/refused: %v", err) + } + done() + g := &cat.cleaningCursor(ref).admission + g.mu.Lock() + defer g.mu.Unlock() + if g.publishers != 0 { + t.Fatalf("nested publisher marks leaked: %d", g.publishers) + } + }) +} + +func TestMaintenancePartialMultiVolumeAdmissionUnwindsOnCancellation(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + cat, first, _, _ := cleanFixture(t) + second := newRef(t, "second") + secondGate := &cat.cleaningCursor(second).admission + release, err := secondGate.batch(context.Background()) + if err != nil { + t.Fatal(err) + } + ctx, cancel := context.WithTimeout(context.Background(), time.Second) + defer cancel() + done, err := cat.acquirePublishers(ctx, first, second) + if done != nil { + done() + } + release() + if !errors.Is(err, context.DeadlineExceeded) { + t.Fatalf("multi-volume wait did not honour context: %v", err) + } + for _, ref := range []VolumeRef{first, second} { + g := &cat.cleaningCursor(ref).admission + g.mu.Lock() + pending, held := g.publishers, g.cleaning + g.mu.Unlock() + if pending != 0 || held { + t.Fatalf("partial acquisition leaked for %s: publishers=%d held=%v", ref.Name, pending, held) + } + } + }) +} + +func TestMaintenanceNestedWriterInsideInitialCleanKeepsKernelSemantics(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + ctx, cancel := context.WithTimeout(context.Background(), time.Second) + defer cancel() + cat, ref, st, _ := cleanFixture(t) + insideCAS := 0 + cat.f = &publicationBackendFiler{Filer: cat.f, beforeCAS: func(context.Context) error { + insideCAS++ + g := &cat.cleaningCursor(ref).admission + g.mu.Lock() + pending := g.publishers + g.mu.Unlock() + if pending != 0 { + return fmt.Errorf("A3 publication transiently registered INSIDE backend CAS: %d", pending) + } + return nil + }} + remote, err := NewLayoutRemote(cat, ref, cleanHolder) + if err != nil { + t.Fatal(err) + } + started := time.Now() + err = remote.Clean(ctx, func(ctx context.Context, _ layout.HolderID, session string) error { + h, err := cat.DeleteSnapshot(context.WithValue(ctx, publicationProbeKey{}, true), ref, "s") + if err == nil && h.Activity != (layout.Activity{Kind: layout.ActClean, Session: session}) { + return fmt.Errorf("nested publisher changed activity: %+v", h.Activity) + } + g := &cat.cleaningCursor(ref).admission + g.mu.Lock() + pending := g.publishers + g.mu.Unlock() + if pending != 0 { + return fmt.Errorf("A3 removal nested publisher registration: %d", pending) + } + return err + }) + if err != nil || time.Since(started) != 0 { + t.Fatalf("nested initial writer waited or changed kernel semantics: elapsed=%v err=%v", time.Since(started), err) + } + if insideCAS != 1 { + t.Fatalf("A3 proof did not observe its backend CAS: %d", insideCAS) + } + h, _, err := st.ReadHead(ctx) + if err != nil || h.Activity.Kind != layout.ActIdle { + t.Fatalf("nested publication left activity: %+v err=%v", h.Activity, err) + } + if _, found := h.Snapshots["s"]; found { + t.Fatal("nested kernel-authorized delete was lost") + } + }) +} + +func TestMaintenanceReleasedBatchContextCannotBypassANewBatch(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + var g cleanAdmission + first, err := g.batch(context.Background()) + if err != nil { + t.Fatal(err) + } + lease := &cleanAdmissionLease{done: first, gate: &g} + oldCtx := context.WithValue(context.Background(), heldCleanAdmissionKey{}, lease) + lease.release() + second, err := g.batch(context.Background()) + if err != nil { + t.Fatal(err) + } + ctx, cancel := context.WithTimeout(oldCtx, time.Second) + defer cancel() + done, err := g.publisher(ctx) + if done != nil { + done() + } + second() + if !errors.Is(err, context.DeadlineExceeded) { + t.Fatalf("released batch context bypassed a later batch: %v", err) + } + }) +} + +func TestMaintenanceCrossVolumeCallbackDoesNotWaitWhileHoldingAClean(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + cat, first, _, _ := cleanFixture(t) + second := newRef(t, "second") + firstGate := &cat.cleaningCursor(first).admission + secondGate := &cat.cleaningCursor(second).admission + releaseFirst, err := firstGate.batch(context.Background()) + if err != nil { + t.Fatal(err) + } + lease := &cleanAdmissionLease{done: releaseFirst, gate: firstGate} + defer lease.release() + releaseSecond, err := secondGate.batch(context.Background()) + if err != nil { + t.Fatal(err) + } + defer releaseSecond() + ctx, cancel := context.WithTimeout(context.WithValue(context.Background(), heldCleanAdmissionKey{}, lease), time.Second) + defer cancel() + started := time.Now() + done, err := cat.acquirePublishers(ctx, first, second) + if done != nil { + done() + } + if !errors.Is(err, layout.ErrBusy) || time.Since(started) != 0 { + t.Fatalf("cross-volume callback held clean while waiting: elapsed=%v err=%v", time.Since(started), err) + } + for _, g := range []*cleanAdmission{firstGate, secondGate} { + g.mu.Lock() + pending := g.publishers + g.mu.Unlock() + if pending != 0 { + t.Fatalf("partial nested interest remained: %d", pending) + } + } + }) +} + +func TestMaintenanceRetainPlanningDoesNotRegister(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) + defer cancel() + cat, ref, _, _ := cleanFixture(t) + cat.f = &pausedPublisherFiler{Filer: cat.f} + result := make(chan error, 1) + go func() { + _, err := cat.Retain(context.WithValue(ctx, publisherDelayKey{}, true), ref, time.Now(), false) + result <- err + }() + synctest.Wait() // Planning is paused in its first HEAD read. + g := &cat.cleaningCursor(ref).admission + g.mu.Lock() + pending := g.publishers + g.mu.Unlock() + if pending != 0 { + t.Fatalf("planning holds publisher interest: %d", pending) + } + release, err := g.batch(ctx) + if err != nil { + t.Fatal(err) + } + release() + if err := <-result; err != nil { + t.Fatal(err) + } + }) +} + +func TestMaintenancePublishingStoreScopesOneConditionalWrite(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) + defer cancel() + cat, ref, plain, _ := cleanFixture(t) + view := cat.publishingStore(ref, plain) + g := &cat.cleaningCursor(ref).admission + release, err := g.batch(ctx) + if err != nil { + t.Fatal(err) + } + _, found, err := view.ReadHead(ctx) + if err != nil || !found { + t.Fatalf("read: %v %v", found, err) + } + g.mu.Lock() + pending := g.publishers + g.mu.Unlock() + if pending != 0 || plain.publicationAdmission != nil { + t.Fatal("read or plain low-level store registered") + } + result := make(chan error, 1) + go func() { + done, err := view.BeginHeadPublication(ctx) + if err != nil { + result <- err + return + } + defer done() + fresh, _, err := view.ReadHead(ctx) + if err == nil { + err = view.UpdateHead(ctx, fresh.Gen, fresh, layout.CauseDependentRelease) + } + result <- err + }() + synctest.Wait() + g.mu.Lock() + pending = g.publishers + g.mu.Unlock() + if pending != 1 { + t.Fatalf("conditional publication did not register: %d", pending) + } + release() + if err := <-result; err != nil { + t.Fatal(err) + } + g.mu.Lock() + pending = g.publishers + g.mu.Unlock() + if pending != 0 { + t.Fatal("publication retained interest after return") + } + }) +} + +func TestMaintenanceRetainReleasesBetweenRetirements(t *testing.T) { + cat, ref, _, _ := cleanFixture(t) + now := time.Now() + snapshotWithMeta(t, cat, ref, "expired", layout.SnapshotMeta{Class: layout.ClassSemantic, CreatedNs: now.Add(-2 * time.Hour).UnixNano(), ExpiresNs: now.Add(-time.Hour).UnixNano()}, "expiration", 2) + if err := cat.SetRetention(context.Background(), ref, retain.Policy{}); err != nil { + t.Fatal(err) + } + reports := 0 + ctx := layout.WithMaintenanceProgress(context.Background(), func(layout.MaintenancePosition) { + reports++ + g := &cat.cleaningCursor(ref).admission + g.mu.Lock() + pending := g.publishers + g.mu.Unlock() + if pending != 0 { + t.Errorf("retirement completion retained interest across decisions: %d", pending) + } + }) + result, err := cat.Retain(ctx, ref, now, false) + if err != nil || len(result.Deleted) != 2 || reports != 2 { + t.Fatalf("retirements: %+v reports=%d err=%v", result, reports, err) + } +} + +func TestMaintenanceReleasePublicationReadsAfterBatchClose(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) + defer cancel() + cat, ref, st, _ := cleanFixture(t) + target := newRef(t, "dependent") + h, _, err := st.ReadHead(ctx) + if err != nil { + t.Fatal(err) + } + sn := h.Snapshots["s"] + sn.Dependents = []layout.Dependent{{Target: target.Name, TargetID: target.ID, Root: sn.Root}} + h.Snapshots["s"] = sn + if err := st.UpdateHead(ctx, h.Gen, h, layout.CauseDependentAdd); err != nil { + t.Fatal(err) + } + g := &cat.cleaningCursor(ref).admission + release, err := g.batch(ctx) + if err != nil { + t.Fatal(err) + } + if _, err := layout.RunBeginClean(ctx, st, cleanHolder, "publication-wait"); err != nil { + t.Fatal(err) + } + result := make(chan error, 1) + go func() { + _, err := layout.RunReleaseDependent(ctx, cat.publishingStore(ref, st), target.ID) + result <- err + }() + synctest.Wait() + g.mu.Lock() + pending := g.publishers + g.mu.Unlock() + if pending != 1 { + t.Fatalf("release did not register: %d", pending) + } + if _, err := layout.RunEndClean(ctx, st, cleanHolder, "publication-wait", layout.CauseCleanEnd); err != nil { + t.Fatal(err) + } + release() + if err := <-result; err != nil { + t.Fatalf("release prepared against batch generation instead of waiting before its read: %v", err) + } + h, _, err = st.ReadHead(ctx) + if err != nil || h.Activity.Kind != layout.ActIdle || len(h.Snapshots["s"].Dependents) != 0 { + t.Fatalf("release did not publish after batch close: %+v %v", h, err) + } + }) +} + +func TestMaintenancePublisherInterestHeldThroughBackendCAS(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) + defer cancel() + cat, ref, _, _ := cleanFixture(t) + entered, finish := make(chan struct{}), make(chan struct{}) + cat.f = &publicationBackendFiler{Filer: cat.f, beforeCAS: func(ctx context.Context) error { + close(entered) + select { + case <-finish: + return nil + case <-ctx.Done(): + return ctx.Err() + } + }} + st, err := cat.Store(ref) + if err != nil { + t.Fatal(err) + } + published := make(chan error, 1) + go func() { + _, err := layout.RunDeleteSnapshot(context.WithValue(ctx, publicationProbeKey{}, true), cat.publishingStore(ref, st), "s") + published <- err + }() + <-entered // The actual backend HEAD CAS has not returned. + next := make(chan error, 1) + g := &cat.cleaningCursor(ref).admission + go func() { + done, err := g.batch(ctx) + if err == nil { + done() + } + next <- err + }() + synctest.Wait() + select { + case err := <-next: + t.Fatalf("clean batch entered before backend CAS returned: %v", err) + default: + } + g.mu.Lock() + pending := g.publishers + g.mu.Unlock() + if pending != 1 { + t.Fatalf("backend CAS lost publication interest: %d", pending) + } + close(finish) + if err := <-published; err != nil { + t.Fatal(err) + } + if err := <-next; err != nil { + t.Fatal(err) + } + h, _, err := st.ReadHead(ctx) + if err != nil { + t.Fatal(err) + } + if _, present := h.Snapshots["s"]; present { + t.Fatal("backend CAS did not remove snapshot") + } + }) +} diff --git a/seaweed-block/core/frontend/chunkstore/clean_b.go b/seaweed-block/core/frontend/chunkstore/clean_b.go index 41275b8783..cb6536ba44 100644 --- a/seaweed-block/core/frontend/chunkstore/clean_b.go +++ b/seaweed-block/core/frontend/chunkstore/clean_b.go @@ -7,12 +7,15 @@ import ( "sort" "strconv" "sync" + "time" "github.com/seaweedfs/seaweed-block/core/frontend/chunkstore/layout" ) var cleanPage uint32 = 1000 +const cleanSessionHold = 5 * time.Second + // CleanResult counts names examined/deleted by this bounded pass, all kinds. type CleanResult struct { Shards int @@ -27,10 +30,31 @@ type CleanResult struct { Lists int } -// The cursor is scheduling only: after a timeout a new session re-plans tags -// and validates HEAD; no cached safety decision survives the pass. Completing -// the last shard wraps to roots so earlier/new names are revisited next time. +// cleanPosition orders the finite sweep without retaining object identities. +type cleanPosition struct { + phase int + shard uint64 + after string +} + +func (p cleanPosition) before(q cleanPosition) bool { + if p.phase != q.phase { + return p.phase < q.phase + } + if p.shard != q.shard { + return p.shard < q.shard + } + return p.after < q.after +} + +// The cursor is scheduling only: a new pass re-plans tags and validates HEAD; +// no cached safety decision survives it. The single stuck position and refusal +// count survive earlier revisits, but reset when that work position advances. type cleanCursor struct { + admission cleanAdmission + refusals uint8 // saturates at K; spans passes, including refused revisits + stuck cleanPosition + mu sync.Mutex phase int // roots, segments, chunks shard string @@ -59,6 +83,7 @@ func (c *BCatalog) cleaningCursor(v VolumeRef) *cleanCursor { // to the namespace, not the number of changes; interruptions leave unnamed // content for a later pass. func (c *BCatalog) RemoveUnreachableAll(ctx context.Context, v VolumeRef, me layout.HolderID, session string) (res CleanResult, err error) { + ctx = layout.WithMaintenancePhase(ctx, layout.MaintenanceSweep) cur := c.cleaningCursor(v) if !cur.mu.TryLock() { return res, layout.ErrBusy @@ -69,6 +94,134 @@ func (c *BCatalog) RemoveUnreachableAll(ctx context.Context, v VolumeRef, me lay return res, err } cleaner := layout.NewCleaner(s, r, s, me, session) + // Clean entered with this pass's activity. Release it before enumeration; + // each bounded candidate page below acquires its own activity and fresh view. + closed, err := endCleanBatch(ctx, s, me, session) + if err != nil { + return res, err + } + releaseInitialCleanAdmission(ctx) + page := func(kind string, shard uint64, names []string) (out layout.RemovalResult, err error) { + if len(names) == 0 { + return out, nil + } + if err = ctx.Err(); err != nil { + return out, err + } + fresh, found, err := s.ReadHead(ctx) + if err != nil { + return out, err + } + if !found { + return out, layout.ErrHeadAbsent + } + if fresh.Gen != closed.Gen { + cleaner.ResetReachability() + } + position := cleanPosition{shard: shard, after: cur.after} + switch kind { + case layout.RootDir: + position.phase = 0 + case layout.SegDir: + position.phase = 1 + case layout.PoolDir: + position.phase, position.after = 2, cur.poolAfter + case layout.ListDir: + position.phase, position.after = 3, cur.listAfter + } + // Once armed, revisits must also prepare under activity; otherwise a + // busy root revisit could prevent reaching the stuck pool page forever. + if cur.refusals >= 3 { + release, err := cur.admission.batch(ctx) + if err != nil { + return out, err + } + lease := &cleanAdmissionLease{done: release, gate: &cur.admission} + defer lease.release() + held := context.WithValue(ctx, heldCleanAdmissionKey{}, lease) + started := time.Now() + opened, err := layout.RunBeginClean(held, s, me, session) + if err != nil { + return out, err + } + cleaner.ResetReachability() + prepCtx, cancel := context.WithDeadline(held, started.Add(cleanSessionHold)) + heldCtx := layout.WithHeldCleanerBatch(prepCtx, opened, func(_ context.Context, _ layout.Head, effects func(context.Context) error) error { + // Only read-only preparation carries the session deadline. + // Never cancel an in-flight mutation at the hold timer. + return effects(layout.WithCleanBatchEnd(held, started.Add(cleanSessionHold))) + }) + out, err = cleaner.Page(heldCtx, kind, shard, names) + cancel() + var closeErr error + closed, closeErr = endCleanBatch(held, s, me, session) + if closeErr != nil { + return layout.RemovalResult{}, errors.Join(err, closeErr) + } + if out.After != "" && !position.before(cur.stuck) { + cur.refusals = 0 + } + return out, err + } + refused := false + applied := false + settled := true + batchCtx := layout.WithCleanerBatch(ctx, fresh, func(ctx context.Context, base layout.Head, effects func(context.Context) error) error { + release, err := cur.admission.batch(ctx) + if err != nil { + return err + } + lease := &cleanAdmissionLease{done: release, gate: &cur.admission} + defer lease.release() + ctx = context.WithValue(ctx, heldCleanAdmissionKey{}, lease) + started := time.Now() + opened, err := layout.RunBeginClean(ctx, s, me, session) + if err != nil { + return err + } + var effectErr error + if opened.Gen != base.Gen+1 { + // Preparation overlapped another publication: no prepared decision + // is allowed to run at the new generation. + cleaner.ResetReachability() + refused = true + effectErr = layout.ErrPrecondition + } else { + applied = true + effectErr = effects(layout.WithCleanBatchEnd(ctx, started.Add(cleanSessionHold))) + } + var closeErr error + closed, closeErr = endCleanBatch(ctx, s, me, session) + if closeErr != nil { + settled = false + } + return errors.Join(effectErr, closeErr) + }) + out, err = cleaner.Page(batchCtx, kind, shard, names) + if !settled { + return layout.RemovalResult{}, err + } + if refused { + if cur.refusals == 0 || cur.stuck.before(position) { + cur.stuck = position + } + if cur.refusals < 3 { + cur.refusals++ + } + } else if applied && out.After != "" && !position.before(cur.stuck) { + cur.refusals = 0 + } + if out.More && err == nil { + // Give callers already retrying layout_busy a handoff opportunity. + // This pause is outside the session and earns no pass progress. + select { + case <-ctx.Done(): + return out, ctx.Err() + case <-time.After(100 * time.Millisecond): + } + } + return out, err + } // Every new session starts at the first root: between sessions an operator // may un-name one whose segments this session would otherwise remove first. // Preserve segment/chunk progress, but never carry a root-phase view forward. @@ -101,7 +254,7 @@ func (c *BCatalog) RemoveUnreachableAll(ctx context.Context, v VolumeRef, me lay } else { res.PlannedSegments += len(names) } - out, err := cleaner.Page(ctx, kind, 0, names) + out, err := page(kind, 0, names) res.Removed += len(out.Names) if kind == layout.RootDir { res.Roots += len(out.Names) @@ -114,6 +267,9 @@ func (c *BCatalog) RemoveUnreachableAll(ctx context.Context, v VolumeRef, me lay if err != nil { return res, err } + if out.More { + continue + } if uint32(len(names)) < cleanPage { cur.phase++ cur.after = "" @@ -146,17 +302,17 @@ func (c *BCatalog) RemoveUnreachableAll(ctx context.Context, v VolumeRef, me lay if err := ctx.Err(); err != nil { return res, err } - page, err := s.ListChunkCandidates(ctx, shard, cur.poolAfter, cleanPage) + candidates, err := s.ListChunkCandidates(ctx, shard, cur.poolAfter, cleanPage) if err != nil { return res, err } - names := make([]string, len(page)) - for i, n := range page { + names := make([]string, len(candidates)) + for i, n := range candidates { names[i] = n.String() } - res.Planned += len(page) - res.PlannedChunks += len(page) - out, err := cleaner.Page(ctx, layout.PoolDir, shard, names) + res.Planned += len(candidates) + res.PlannedChunks += len(candidates) + out, err := page(layout.PoolDir, shard, names) res.Removed += len(out.Names) if out.After != "" { cur.poolAfter = path.Base(out.After) @@ -164,7 +320,10 @@ func (c *BCatalog) RemoveUnreachableAll(ctx context.Context, v VolumeRef, me lay if err != nil { return res, err } - if uint32(len(page)) < cleanPage { + if out.More { + continue + } + if uint32(len(candidates)) < cleanPage { break } } @@ -189,7 +348,7 @@ func (c *BCatalog) RemoveUnreachableAll(ctx context.Context, v VolumeRef, me lay } res.Planned += len(names) res.PlannedLists += len(names) - out, err := cleaner.Page(ctx, layout.ListDir, 0, names) + out, err := page(layout.ListDir, 0, names) res.Removed += len(out.Names) res.Lists += len(out.Names) if out.After != "" { @@ -198,6 +357,9 @@ func (c *BCatalog) RemoveUnreachableAll(ctx context.Context, v VolumeRef, me lay if err != nil { return res, err } + if out.More { + continue + } if uint32(len(names)) < cleanPage { break } @@ -205,3 +367,47 @@ func (c *BCatalog) RemoveUnreachableAll(ctx context.Context, v VolumeRef, me lay cur.phase, cur.shard, cur.after, cur.poolAfter, cur.listAfter = 0, "", "", "", "" return res, nil } + +// endCleanBatch settles an applied-but-unanswered close before any re-entry. +// Only this pass's activity may be retried; another session is never ended. +func endCleanBatch(ctx context.Context, st layout.HeadStore, me layout.HolderID, session string) (layout.Head, error) { + uncertain := false + for { + if err := ctx.Err(); err != nil { + return layout.Head{}, err + } + closed, err := layout.RunEndClean(ctx, st, me, session, layout.CauseCleanEnd) + if err != nil { + uncertain = true + h, found, readErr := st.ReadHead(ctx) + if readErr != nil || !found { + return layout.Head{}, errors.Join(err, readErr) + } + if h.Epoch != me.Epoch || h.Holder != me.Holder || h.ClaimID != me.ClaimID { + return layout.Head{}, errors.Join(err, layout.ErrNotHolder) + } + switch h.Activity { + case layout.Activity{Kind: layout.ActIdle}: + // It closed, but another writer may have acted before this read. + // Do not attribute this observed generation to our cached view. + h.Gen = 0 + return h, nil + case layout.Activity{Kind: layout.ActClean, Session: session}: + select { + case <-ctx.Done(): + return layout.Head{}, ctx.Err() + case <-time.After(time.Second): + } + continue // Still ours: retry the same close, never a new begin. + default: + return layout.Head{}, err + } + } + if uncertain { + // A later successful retry may only have read idle after a delayed + // close and another publication. Its generation is not our provenance. + closed.Gen = 0 + } + return closed, nil + } +} diff --git a/seaweed-block/core/frontend/chunkstore/clean_batch_release_test.go b/seaweed-block/core/frontend/chunkstore/clean_batch_release_test.go new file mode 100644 index 0000000000..098937fbf9 --- /dev/null +++ b/seaweed-block/core/frontend/chunkstore/clean_batch_release_test.go @@ -0,0 +1,340 @@ +package chunkstore + +import ( + "bytes" + "context" + "fmt" + "strings" + "testing" + "testing/synctest" + "time" + + "github.com/seaweedfs/seaweed-block/core/frontend/chunkstore/filerpb" + "github.com/seaweedfs/seaweed-block/core/frontend/chunkstore/layout" +) + +// Observe successful durable HEAD closes, not the end of an in-memory callback. +// One candidate per page makes consecutive removals distinct bounded batches. +type batchReleaseFiler struct { + Filer + id layout.VolumeID + idleWrites, lastIdle, deletes int + between func() +} + +func (f *batchReleaseFiler) UpdateEntry(ctx context.Context, dir string, e *filerpb.Entry, expected map[string][]byte) error { + if err := f.Filer.UpdateEntry(ctx, dir, e, expected); err != nil { + return err + } + if e.Name == layout.HeadName { + h, err := DecodeLayoutHeadEntry(e, f.id) + if err != nil { + return err + } + if h.Activity.Kind == layout.ActIdle { + f.idleWrites++ + if f.deletes > 0 && f.between != nil { + between := f.between + f.between = nil + between() + } + } + } + return nil +} + +func TestMaintenanceBatchDropsReachabilityAfterPublication(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + oldPage := cleanPage + cleanPage = 1 + defer func() { cleanPage = oldPage }() + ctx, cancel := context.WithTimeout(context.Background(), 3*time.Minute) + defer cancel() + cat, ref, st, orphans := cleanFixture(t) + // Candidate 4 sorts after the first orphan (2), in the SAME shard whose + // reachability was cached by the first candidate's removal. + data := bytes.Repeat([]byte{4}, 4096) + reused := layout.NameChunk(4, data) + if err := layout.EnsureObject(ctx, st, reused.Path(), data, "ended"); err != nil { + t.Fatal(err) + } + published := false + observed := &batchReleaseFiler{Filer: cat.f, id: ref.ID} + observed.between = func() { + live := layout.NameChunk(1, bytes.Repeat([]byte{7}, 4096)) + prev := map[uint64]layout.Ref{1: {Owner: ref.Name, OwnerID: ref.ID, Chunk: live}} + next := map[uint64]layout.Ref{1: prev[1], 4: {Owner: ref.Name, OwnerID: ref.ID, Chunk: reused}} + // EnsureObject adopts the existing candidate into this publication's + // session; its bytes were already present before cache construction. + commitImage(t, st, ref.Name, "between-batches", prev, next, map[uint64][]byte{4: data}, 2, "new-snapshot") + published = true + } + cat.f = observed + if _, _, err := cleanVia(ctx, cat, ref, cleanHolder); err != nil { + t.Fatalf("sweep across publication: %v", err) + } + if !published || !present(t, st, reused) { + t.Fatal("publication between batches was missed or its re-referenced candidate was removed") + } + for _, n := range orphans { + if present(t, st, n) { + t.Fatalf("unreferenced candidate remains: %s", n) + } + } + }) +} + +type unknownBatchCloseStore struct { + layout.HeadStore + apply bool + absent bool + calls int +} + +func (s *unknownBatchCloseStore) ReadHead(ctx context.Context) (layout.Head, bool, error) { + if s.absent && s.calls > 0 { + return layout.Head{}, false, nil + } + return s.HeadStore.ReadHead(ctx) +} + +func (s *unknownBatchCloseStore) UpdateHead(ctx context.Context, gen uint64, next layout.Head, cause layout.HeadWriteCause) error { + s.calls++ + if s.calls == 1 { + if s.apply { + if err := s.HeadStore.UpdateHead(ctx, gen, next, cause); err != nil { + return err + } + } + return context.DeadlineExceeded + } + return s.HeadStore.UpdateHead(ctx, gen, next, cause) +} + +func TestMaintenanceBatchSettlesUnknownCloseBeforeReentry(t *testing.T) { + for _, applied := range []bool{false, true} { + t.Run(fmt.Sprintf("applied=%v", applied), func(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + ctx, cancel := context.WithTimeout(context.Background(), time.Minute) + defer cancel() + _, _, st, _ := cleanFixture(t) + if _, err := layout.RunBeginClean(ctx, st, cleanHolder, "this-pass"); err != nil { + t.Fatal(err) + } + unknown := &unknownBatchCloseStore{HeadStore: st, apply: applied} + if _, err := endCleanBatch(ctx, unknown, cleanHolder, "this-pass"); err != nil { + t.Fatal(err) + } + want := 2 + if applied { + want = 1 + } + if unknown.calls != want { + t.Fatalf("close writes=%d; want %d", unknown.calls, want) + } + if _, err := layout.RunBeginClean(ctx, st, cleanHolder, "this-pass"); err != nil { + t.Fatalf("re-entry after settled close: %v", err) + } + }) + }) + } + t.Run("foreign session is preserved", func(t *testing.T) { + ctx := context.Background() + _, _, st, _ := cleanFixture(t) + if _, err := layout.RunBeginClean(ctx, st, cleanHolder, "other-pass"); err != nil { + t.Fatal(err) + } + before, _, _ := st.ReadHead(ctx) + if _, err := endCleanBatch(ctx, st, cleanHolder, "this-pass"); err == nil { + t.Fatal("foreign close accepted") + } + after, _, _ := st.ReadHead(ctx) + if after.Gen != before.Gen || after.Activity != before.Activity { + t.Fatal("foreign activity changed") + } + }) +} + +func TestMaintenanceBatchUnknownCloseAbsentHeadRefuses(t *testing.T) { + ctx := context.Background() + _, _, st, _ := cleanFixture(t) + if _, err := layout.RunBeginClean(ctx, st, cleanHolder, "this-pass"); err != nil { + t.Fatal(err) + } + unknown := &unknownBatchCloseStore{HeadStore: st, absent: true} + if _, err := endCleanBatch(ctx, unknown, cleanHolder, "this-pass"); err == nil { + t.Fatal("absent HEAD settled an unknown close") + } + h, _, err := st.ReadHead(ctx) + if err != nil || unknown.calls != 1 || h.Activity != (layout.Activity{Kind: layout.ActClean, Session: "this-pass"}) { + t.Fatalf("absent settlement changed activity: %+v calls=%d err=%v", h.Activity, unknown.calls, err) + } +} + +func (f *batchReleaseFiler) DeleteEntry(ctx context.Context, dir, name string, expected map[string][]byte) error { + if !strings.Contains(dir, "/pool/") { + return f.Filer.DeleteEntry(ctx, dir, name, expected) + } + if f.deletes > 0 && f.idleWrites <= f.lastIdle { + return fmt.Errorf("next removal batch started without a durable idle HEAD between batches (completed=%d)", f.deletes) + } + select { + case <-ctx.Done(): + return ctx.Err() + case <-time.After(20 * time.Second): + } + if err := f.Filer.DeleteEntry(ctx, dir, name, expected); err != nil { + return err + } + f.deletes++ + f.lastIdle = f.idleWrites + return nil +} + +func TestMaintenanceLongPassReleasesLayoutBetweenBatches(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + oldPage := cleanPage + cleanPage = 1 + defer func() { cleanPage = oldPage }() + ctx, cancel := context.WithTimeout(context.Background(), 3*time.Minute) + defer cancel() + cat, ref, st, orphans := cleanFixture(t) + for _, index := range []uint64{4, 5} { + data := bytes.Repeat([]byte{byte(index)}, 4096) + n := layout.NameChunk(index, data) + if err := layout.EnsureObject(ctx, st, n.Path(), data, "ended"); err != nil { + t.Fatal(err) + } + orphans = append(orphans, n) + } + observed := &batchReleaseFiler{Filer: cat.f, id: ref.ID} + cat.f = observed + started := time.Now() + res, _, err := cleanVia(ctx, cat, ref, cleanHolder) + if err != nil { + t.Fatalf("bounded-batch pass: %v (removed=%d)", err, observed.deletes) + } + if elapsed := time.Since(started); elapsed <= time.Minute || observed.deletes != len(orphans) || res.Removed != len(orphans) { + t.Fatalf("long pass witness: elapsed=%v deletes=%d result=%+v; want >1m and all %d orphans gone", elapsed, observed.deletes, res, len(orphans)) + } + for _, n := range orphans { + if present(t, st, n) { + t.Fatalf("orphan remains: %s", n) + } + } + live := layout.NameChunk(1, bytes.Repeat([]byte{7}, 4096)) + if !present(t, st, live) { + t.Fatal("the current root and snapshot's live chunk was removed") + } + }) +} + +// Return the old, valid settlement read, then let the delayed close and a +// publication land before RunEndClean retries. The retry reads idle and writes +// nothing: its generation belongs to the publication, not to this clean pass. +type delayedBatchCloseFiler struct { + Filer + id layout.VolumeID + deletes, lost, settled, idleRetryReads, writesAfterPublication int + pending func() error + publish func() + published bool +} + +func (f *delayedBatchCloseFiler) UpdateEntry(ctx context.Context, dir string, e *filerpb.Entry, expected map[string][]byte) error { + if e.Name == layout.HeadName { + h, err := DecodeLayoutHeadEntry(e, f.id) + if err != nil { + return err + } + if h.Activity.Kind == layout.ActIdle && f.deletes == 1 && f.lost == 0 { + f.lost++ + f.pending = func() error { return f.Filer.UpdateEntry(ctx, dir, e, expected) } + return context.DeadlineExceeded + } + if f.published { + f.writesAfterPublication++ + } + } + return f.Filer.UpdateEntry(ctx, dir, e, expected) +} + +func (f *delayedBatchCloseFiler) LookupEntry(ctx context.Context, dir, name string) (*filerpb.Entry, error) { + e, err := f.Filer.LookupEntry(ctx, dir, name) + if err != nil || name != layout.HeadName { + return e, err + } + h, err := DecodeLayoutHeadEntry(e, f.id) + if err != nil { + return nil, err + } + if f.pending != nil { + if h.Activity.Kind != layout.ActClean { + return nil, fmt.Errorf("settlement did not observe own clean: %+v", h.Activity) + } + f.settled++ + apply := f.pending + f.pending = nil + if err := apply(); err != nil { + return nil, err + } + f.publish() + f.published = true + // This read linearized before the delayed close and publication. + return e, nil + } + if f.published && h.Activity.Kind == layout.ActIdle && f.writesAfterPublication == 0 { + f.idleRetryReads++ + } + return e, nil +} + +func (f *delayedBatchCloseFiler) DeleteEntry(ctx context.Context, dir, name string, expected map[string][]byte) error { + if err := f.Filer.DeleteEntry(ctx, dir, name, expected); err != nil { + return err + } + if strings.Contains(dir, "/pool/") { + f.deletes++ + } + return nil +} + +func TestMaintenanceDelayedClosePublicationInvalidatesNextPage(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + oldPage := cleanPage + cleanPage = 1 + defer func() { cleanPage = oldPage }() + ctx, cancel := context.WithTimeout(context.Background(), time.Minute) + defer cancel() + cat, ref, st, orphans := cleanFixture(t) + data := bytes.Repeat([]byte{4}, 4096) + reused := layout.NameChunk(4, data) + if err := layout.EnsureObject(ctx, st, reused.Path(), data, "ended"); err != nil { + t.Fatal(err) + } + observed := &delayedBatchCloseFiler{Filer: cat.f, id: ref.ID} + observed.publish = func() { + live := layout.NameChunk(1, bytes.Repeat([]byte{7}, 4096)) + prev := map[uint64]layout.Ref{1: {Owner: ref.Name, OwnerID: ref.ID, Chunk: live}} + next := map[uint64]layout.Ref{1: prev[1], 4: {Owner: ref.Name, OwnerID: ref.ID, Chunk: reused}} + commitImage(t, st, ref.Name, "delayed-close-publication", prev, next, map[uint64][]byte{4: data}, 2, "new-snapshot") + } + cat.f = observed + _, _, err := cleanVia(ctx, cat, ref, cleanHolder) + if observed.lost != 1 || observed.settled != 1 || observed.idleRetryReads == 0 { + t.Fatalf("missing delayed-close/no-op-retry witness: lost=%d settled=%d idleReadsBeforeWrite=%d err=%v", observed.lost, observed.settled, observed.idleRetryReads, err) + } + t.Logf("lost closes=%d; settlement reads of own clean=%d; idle retry reads before any write=%d", observed.lost, observed.settled, observed.idleRetryReads) + if err != nil { + t.Fatalf("next page retained pre-publication reachability: %v", err) + } + if !present(t, st, reused) { + t.Fatal("next page removed the re-referenced candidate") + } + for _, n := range orphans { + if present(t, st, n) { + t.Fatalf("next-page continuation left orphan %s", n) + } + } + }) +} diff --git a/seaweed-block/core/frontend/chunkstore/clean_batch_time_test.go b/seaweed-block/core/frontend/chunkstore/clean_batch_time_test.go new file mode 100644 index 0000000000..19e4af7a3f --- /dev/null +++ b/seaweed-block/core/frontend/chunkstore/clean_batch_time_test.go @@ -0,0 +1,447 @@ +package chunkstore + +import ( + "bytes" + "context" + "errors" + "fmt" + "strings" + "sync" + "sync/atomic" + "testing" + "testing/synctest" + "time" + + "github.com/seaweedfs/seaweed-block/core/frontend/chunkstore/filerpb" + "github.com/seaweedfs/seaweed-block/core/frontend/chunkstore/layout" +) + +type timedBatchFiler struct { + Filer + mu sync.Mutex + id layout.VolumeID + start time.Time + maxHold time.Duration + deletes int + tagDelay time.Duration + preparationHeld bool + tagSeen map[string]bool +} + +func (f *timedBatchFiler) LookupEntry(ctx context.Context, dir, name string) (*filerpb.Entry, error) { + if f.tagDelay > 0 && strings.Contains(dir, "/pool/") { + f.mu.Lock() + if f.tagSeen == nil { + f.tagSeen = map[string]bool{} + } + key := dir + "/" + name + delay := !f.tagSeen[key] + f.tagSeen[key] = true + if delay { + f.preparationHeld = f.preparationHeld || !f.start.IsZero() + } + f.mu.Unlock() + if delay { + select { + case <-ctx.Done(): + return nil, ctx.Err() + case <-time.After(f.tagDelay): + } + } + } + return f.Filer.LookupEntry(ctx, dir, name) +} + +func TestMaintenanceSlowPreparationDoesNotHoldSession(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + ctx, cancel := context.WithTimeout(context.Background(), time.Minute) + defer cancel() + cat, ref, _, _ := cleanFixture(t) + observed := &timedBatchFiler{Filer: cat.f, id: ref.ID, tagDelay: 6 * time.Second} + cat.f = observed + started := time.Now() + if _, _, err := cleanVia(ctx, cat, ref, cleanHolder); err != nil { + t.Fatal(err) + } + if observed.preparationHeld || time.Since(started) < 12*time.Second || observed.maxHold > 5*time.Second || observed.deletes != 2 { + t.Fatalf("elapsed=%v held during preparation=%v max hold=%v removed=%d", time.Since(started), observed.preparationHeld, observed.maxHold, observed.deletes) + } + }) +} + +type missingBatchPreparationFiler struct { + Filer + id layout.VolumeID + closed bool +} + +func (f *missingBatchPreparationFiler) UpdateEntry(ctx context.Context, dir string, e *filerpb.Entry, expected map[string][]byte) error { + if err := f.Filer.UpdateEntry(ctx, dir, e, expected); err != nil { + return err + } + if e.Name == layout.HeadName { + h, err := DecodeLayoutHeadEntry(e, f.id) + if err != nil { + return err + } + if h.Activity.Kind == layout.ActIdle { + f.closed = true + } + } + return nil +} + +func (f *missingBatchPreparationFiler) LookupEntry(ctx context.Context, dir, name string) (*filerpb.Entry, error) { + if name == layout.HeadName && f.closed { + return nil, ErrNotFound + } + return f.Filer.LookupEntry(ctx, dir, name) +} + +func TestMaintenanceBatchPreparationAbsentHeadRefuses(t *testing.T) { + ctx := context.Background() + cat, ref, st, orphans := cleanFixture(t) + cat.f = &missingBatchPreparationFiler{Filer: cat.f, id: ref.ID} + if _, _, err := cleanVia(ctx, cat, ref, cleanHolder); !errors.Is(err, layout.ErrHeadAbsent) { + t.Fatalf("missing HEAD accepted for preparation: %v", err) + } + for _, n := range orphans { + if !present(t, st, n) { + t.Fatal("absent HEAD permitted candidate removal") + } + } +} + +type preparationRaceFiler struct { + Filer + id layout.VolumeID + cleanSeen, closed bool + reads int + armed atomic.Bool + beforeBegin func() +} + +func (f *preparationRaceFiler) UpdateEntry(ctx context.Context, dir string, e *filerpb.Entry, expected map[string][]byte) error { + if err := f.Filer.UpdateEntry(ctx, dir, e, expected); err != nil { + return err + } + if e.Name == layout.HeadName { + h, err := DecodeLayoutHeadEntry(e, f.id) + if err != nil { + return err + } + if h.Activity.Kind == layout.ActClean { + f.cleanSeen = true + } + if h.Activity.Kind == layout.ActIdle && f.cleanSeen { + f.closed = true + } + } + return nil +} + +func (f *preparationRaceFiler) LookupEntry(ctx context.Context, dir, name string) (*filerpb.Entry, error) { + if strings.Contains(dir, "/pool/") && strings.HasPrefix(name, "4-") { + f.armed.Store(true) + } + if name == layout.HeadName && f.closed && f.armed.Load() { + f.reads++ + // Candidate4 arms this at its tag read. Publish after preparation's + // authoritative read, just before Begin observes the new generation. + if f.reads == 2 && f.beforeBegin != nil { + publish := f.beforeBegin + f.beforeBegin = nil + publish() + } + } + return f.Filer.LookupEntry(ctx, dir, name) +} + +func TestMaintenanceBatchRefusesPublicationAfterPreparation(t *testing.T) { + ctx := context.Background() + cat, ref, st, orphans := cleanFixture(t) + data := bytes.Repeat([]byte{4}, 4096) + needed := layout.NameChunk(4, data) + if err := layout.EnsureObject(ctx, st, needed.Path(), data, "ended"); err != nil { + t.Fatal(err) + } + published := false + f := &preparationRaceFiler{Filer: cat.f, id: ref.ID} + f.beforeBegin = func() { + live := layout.NameChunk(1, bytes.Repeat([]byte{7}, 4096)) + prev := map[uint64]layout.Ref{1: {Owner: ref.Name, OwnerID: ref.ID, Chunk: live}} + next := map[uint64]layout.Ref{1: prev[1], 4: {Owner: ref.Name, OwnerID: ref.ID, Chunk: needed}} + commitImage(t, st, ref.Name, "after-preparation", prev, next, map[uint64][]byte{4: data}, 2, "later") + published = true + } + cat.f = f + if _, _, err := cleanVia(ctx, cat, ref, cleanHolder); !errors.Is(err, layout.ErrPrecondition) { + t.Fatalf("stale preparation was not refused: %v", err) + } + if !published || !present(t, st, needed) { + t.Fatal("missed publication or removed its candidate") + } + for _, n := range orphans { + if !present(t, st, n) { + t.Fatalf("stale prepared batch applied effects before refusing: %s", n) + } + } + h, _, err := st.ReadHead(ctx) + if err != nil || h.Activity.Kind != layout.ActIdle { + t.Fatalf("refusal left activity: %+v %v", h.Activity, err) + } + if _, _, err := cleanVia(ctx, cat, ref, cleanHolder); err != nil { + t.Fatalf("fresh pass: %v", err) + } + if !present(t, st, needed) { + t.Fatal("fresh pass removed the re-referenced candidate") + } +} + +func (f *timedBatchFiler) UpdateEntry(ctx context.Context, dir string, e *filerpb.Entry, expected map[string][]byte) error { + f.mu.Lock() + defer f.mu.Unlock() + if err := f.Filer.UpdateEntry(ctx, dir, e, expected); err != nil { + return err + } + if e.Name == layout.HeadName { + h, err := DecodeLayoutHeadEntry(e, f.id) + if err != nil { + return err + } + if h.Activity.Kind == layout.ActClean && f.start.IsZero() { + f.start = time.Now() + } + if h.Activity.Kind != layout.ActClean && !f.start.IsZero() { + f.maxHold = max(f.maxHold, time.Since(f.start)) + f.start = time.Time{} + } + } + return nil +} + +func (f *timedBatchFiler) DeleteEntry(ctx context.Context, dir, name string, expected map[string][]byte) error { + if strings.Contains(dir, "/pool/") { + select { + case <-ctx.Done(): + return ctx.Err() + case <-time.After(50 * time.Millisecond): + } + } + if err := f.Filer.DeleteEntry(ctx, dir, name, expected); err != nil { + return err + } + if strings.Contains(dir, "/pool/") { + f.mu.Lock() + f.deletes++ + f.mu.Unlock() + } + return nil +} + +func TestMaintenanceFiveSecondBatchLetsSnapshotDeleteFinish(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + ctx, cancel := context.WithTimeout(context.Background(), 2*time.Minute) + defer cancel() + cat, ref, st, _ := cleanFixture(t) + // Existing orphan 2 plus 998 new candidates in shard0, and the existing + // shard1 orphan: exactly 1000 slow removals; the live chunk stays intact. + for i := uint64(4); i < 1002; i++ { + data := bytes.Repeat([]byte{byte(i)}, 4096) + n := layout.NameChunk(i, data) + if err := layout.EnsureObject(ctx, st, n.Path(), data, "ended"); err != nil { + t.Fatal(err) + } + } + h, _, _ := st.ReadHead(ctx) + h.Version = layout.HeadVersion1 + snap := h.Snapshots["s"] + snap.Gen = h.Gen + 1 + h.Snapshots["s"] = snap + if err := st.UpdateHead(ctx, h.Gen, h, layout.CauseCommit); err != nil { + t.Fatal(err) + } + op, err := st.AdmitSnapshotDeleteOperation(ctx, "concurrent-delete", "s", SnapshotDeleteTarget(st, "s", 0)) + if err != nil { + t.Fatal(err) + } + observed := &timedBatchFiler{Filer: cat.f, id: ref.ID} + cat.f = observed + deleteDone := make(chan error, 1) + deleteCtx, deleteCancel := context.WithTimeout(ctx, 30*time.Second) + defer deleteCancel() + started := time.Now() + var deletedAt time.Time + go func() { + // Ensure the first request meets the open slow batch. + time.Sleep(time.Second) + for { + answer, err := cat.RunSnapshotDeleteOperation(deleteCtx, ref, op, nil) + if err == nil && answer.State == "succeeded" { + deletedAt = time.Now() + deleteDone <- nil + return + } + if err != nil && !errors.Is(err, layout.ErrBusy) && !errors.Is(err, layout.ErrPrecondition) { + deleteDone <- err + return + } + select { + case <-deleteCtx.Done(): + deleteDone <- deleteCtx.Err() + return + case <-time.After(100 * time.Millisecond): + } + op, err = st.ReadSnapshotOperationHandle(deleteCtx, op.ID, op.Verb, op.Instance, op.Sequence) + if err != nil { + deleteDone <- err + return + } + } + }() + res, _, err := cleanVia(ctx, cat, ref, cleanHolder) + if err != nil { + t.Fatal(err) + } + if err := <-deleteDone; err != nil { + t.Fatalf("concurrent snapshot delete: %v; max session hold=%v", err, observed.maxHold) + } + t.Logf("max session hold=%v; concurrent delete completed at=%v; slow removals=%d", observed.maxHold, deletedAt.Sub(started), observed.deletes) + if observed.maxHold > 5050*time.Millisecond || deletedAt.Sub(started) >= 30*time.Second || observed.deletes != 1000 || res.Removed != 1000 { + // CleanResult has aggregate removals; all seeded slow deletions must + // finish even when a timer cuts a short final page into more batches. + t.Fatalf("hold=%v delete at=%v slow removals=%d result=%+v", observed.maxHold, deletedAt.Sub(started), observed.deletes, res) + } + live := layout.NameChunk(1, bytes.Repeat([]byte{7}, 4096)) + if !present(t, st, live) { + t.Fatal("live chunk removed") + } + }) +} + +// An adversarial publisher wins every optimistic pool-page preparation, across +// separate passes. Successful metadata pages before it must not erase that +// same-page starvation history. +type repeatedPreparationFiler struct { + *timedBatchFiler + armed atomic.Bool + idleReads, publications int + attackRevisits bool + publish func() +} + +func (f *repeatedPreparationFiler) LookupEntry(ctx context.Context, dir, name string) (*filerpb.Entry, error) { + f.mu.Lock() + blocked := f.deletes == 0 + f.mu.Unlock() + if blocked && (strings.Contains(dir, "/pool/") && strings.HasPrefix(name, "4-") || f.attackRevisits && strings.HasSuffix(dir, "/"+layout.RootDir)) { + f.mu.Lock() + outside := f.start.IsZero() + f.mu.Unlock() + if outside { + f.armed.Store(true) + } + } + if name == layout.HeadName && f.armed.Load() { + e, err := f.Filer.LookupEntry(ctx, dir, name) + if err != nil { + return nil, err + } + h, err := DecodeLayoutHeadEntry(e, f.id) + if err != nil { + return nil, err + } + if h.Activity.Kind == layout.ActIdle { + f.idleReads++ + if f.idleReads == 2 { + f.armed.Store(false) + f.publications++ + f.publish() + } + } + } + return f.timedBatchFiler.LookupEntry(ctx, dir, name) +} + +func TestMaintenanceRepeatedPreparationPublicationFallsBackAfterThreeRefusals(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + ctx, cancel := context.WithTimeout(context.Background(), time.Minute) + defer cancel() + cat, ref, st, orphans := cleanFixture(t) + data := bytes.Repeat([]byte{4}, 4096) + needed := layout.NameChunk(4, data) + if err := layout.EnsureObject(ctx, st, needed.Path(), data, "ended"); err != nil { + t.Fatal(err) + } + f := &repeatedPreparationFiler{timedBatchFiler: &timedBatchFiler{Filer: cat.f, id: ref.ID}} + live := layout.NameChunk(1, bytes.Repeat([]byte{7}, 4096)) + image := map[uint64]layout.Ref{1: {Owner: ref.Name, OwnerID: ref.ID, Chunk: live}} + f.publish = func() { + next := map[uint64]layout.Ref{1: image[1], 4: {Owner: ref.Name, OwnerID: ref.ID, Chunk: needed}} + commitImage(t, st, ref.Name, "repeated-preparation", image, next, map[uint64][]byte{4: data}, uint64(f.publications+1), fmt.Sprintf("later-%d", f.publications)) + image = next + } + cat.f = f + for attempt := 1; attempt <= 4; attempt++ { + f.attackRevisits = attempt == 2 || attempt == 4 + f.armed.Store(false) + f.idleReads = 0 + // Delay each preparation, including the fourth, to measure it in hold time. + f.tagSeen = nil + f.tagDelay = 2 * time.Second + _, _, err := cleanVia(ctx, cat, ref, cleanHolder) + if attempt <= 3 { + cur := cat.cleaningCursor(ref) + if cur.refusals != uint8(attempt) || cur.stuck.phase != 2 { + t.Fatalf("attempt %d lost furthest pool history across revisit: count=%d stuck=%+v", attempt, cur.refusals, cur.stuck) + } + if !errors.Is(err, layout.ErrPrecondition) || f.deletes != 0 { + t.Fatalf("attempt %d: want zero-effect preparation refusal, deletes=%d err=%v", attempt, f.deletes, err) + } + } else if err != nil { + t.Fatalf("fourth preparation starved instead of falling back: publications=%d err=%v", f.publications, err) + } + } + if f.publications != 3 || f.deletes != len(orphans) || !f.preparationHeld || f.maxHold > 5*time.Second+50*time.Millisecond || f.maxHold < 2*time.Second { + t.Fatalf("fallback witness: publications=%d deletes=%d preparationHeld=%v maxHold=%v", f.publications, f.deletes, f.preparationHeld, f.maxHold) + } + if !present(t, st, needed) { + t.Fatal("fallback removed the re-referenced candidate") + } + for _, n := range orphans { + if present(t, st, n) { + t.Fatalf("fallback left orphan %s", n) + } + } + t.Logf("refusals=3 publications=%d preparation included in max hold=%v deletes=%d", f.publications, f.maxHold, f.deletes) + }) +} + +func TestMaintenanceFallbackPreparationSharesSessionCap(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + ctx, cancel := context.WithTimeout(context.Background(), time.Minute) + defer cancel() + cat, ref, st, orphans := cleanFixture(t) + cur := cat.cleaningCursor(ref) + cur.refusals, cur.stuck = 3, cleanPosition{phase: 2} + observed := &timedBatchFiler{Filer: cat.f, id: ref.ID, tagDelay: 6 * time.Second} + cat.f = observed + _, _, err := cleanVia(ctx, cat, ref, cleanHolder) + if !errors.Is(err, context.DeadlineExceeded) { + t.Fatalf("over-budget preparation must stop before effects: %v", err) + } + if observed.deletes != 0 || !observed.preparationHeld || observed.maxHold > 5*time.Second+50*time.Millisecond || cur.refusals != 3 { + t.Fatalf("preparation escaped session cap: hold=%v deletes=%d held=%v refusals=%d", observed.maxHold, observed.deletes, observed.preparationHeld, cur.refusals) + } + h, _, err := st.ReadHead(ctx) + if err != nil || h.Activity.Kind != layout.ActIdle { + t.Fatalf("expired preparation left activity: %+v err=%v", h.Activity, err) + } + for _, n := range orphans { + if !present(t, st, n) { + t.Fatalf("expired preparation removed candidate: %s", n) + } + } + t.Logf("fallback read preparation stopped at session cap=%v; no effects", observed.maxHold) + }) +} diff --git a/seaweed-block/core/frontend/chunkstore/clean_intent_b.go b/seaweed-block/core/frontend/chunkstore/clean_intent_b.go index 27188303b4..ac4913213e 100644 --- a/seaweed-block/core/frontend/chunkstore/clean_intent_b.go +++ b/seaweed-block/core/frontend/chunkstore/clean_intent_b.go @@ -10,6 +10,11 @@ import ( // reports whether HEAD still names work, only when err is nil. The driver does // not claim a holder, infer a target from a receipt, or enumerate the namespace. func (c *BCatalog) CleanSnapshotDeletePage(ctx context.Context, v VolumeRef) (pending bool, err error) { + done, err := c.acquirePublishers(ctx, v) + if err != nil { + return false, err + } + defer done() s, r, err := c.open(v) if err != nil { return false, err diff --git a/seaweed-block/core/frontend/chunkstore/clean_progress_test.go b/seaweed-block/core/frontend/chunkstore/clean_progress_test.go new file mode 100644 index 0000000000..640a2a8fd4 --- /dev/null +++ b/seaweed-block/core/frontend/chunkstore/clean_progress_test.go @@ -0,0 +1,35 @@ +package chunkstore + +import ( + "context" + "github.com/seaweedfs/seaweed-block/core/frontend/chunkstore/layout" + "sync" + "testing" +) + +func TestCleaningReportsProcessedObjects(t *testing.T) { + c, v, st, orphans := cleanFixture(t) + var mu sync.Mutex + stages := map[uint64]bool{} + ctx := layout.WithMaintenanceProgress(context.Background(), func(p layout.MaintenancePosition) { + mu.Lock() + defer mu.Unlock() + if p[0] != layout.MaintenanceSweep || p[2] == 0 || p[4] == 0 { + t.Errorf("unscoped progress: %v", p) + } + stages[p[3]] = true + }) + if _, _, err := cleanVia(ctx, c, v, cleanHolder); err != nil { + t.Fatal(err) + } + for _, n := range orphans { + if present(t, st, n) { + t.Fatal("orphan retained") + } + } + for _, stage := range []uint64{1, 2, 3} { + if !stages[stage] { + t.Fatalf("missing completed stage %d: %v", stage, stages) + } + } +} diff --git a/seaweed-block/core/frontend/chunkstore/head_readers_test.go b/seaweed-block/core/frontend/chunkstore/head_readers_test.go index 6da868ab36..fa7734b33b 100644 --- a/seaweed-block/core/frontend/chunkstore/head_readers_test.go +++ b/seaweed-block/core/frontend/chunkstore/head_readers_test.go @@ -24,6 +24,8 @@ import ( // pins it. "GAP" marks a reader that takes an absent HEAD for an empty // one; a change that treats an absent HEAD as unknown flips those probes. var headReaders = map[string]string{ + "core/frontend/chunkstore/clean_b.go RemoveUnreachableAll -> ReadHead": "absent HEAD refuses preparing a new batch without any effects (TestMaintenanceBatchPreparationAbsentHeadRefuses)", + "core/frontend/chunkstore/clean_b.go endCleanBatch -> ReadHead": "absent HEAD does not settle an unknown batch close or permit re-entry (TestMaintenanceBatchUnknownCloseAbsentHeadRefuses)", "core/frontend/chunkstore/catalog_snapshot_delete_intent.go snapshotDeleteLogicalStep -> ReadHead": "absent HEAD refuses without unlink, pages or terminal receipt (TestSnapshotDeleteLogicalCommitAbsentHeadRefuses)", "core/frontend/chunkstore/snapshot_operation_index.go readOperationIndex -> ReadHead": "missing HEAD gives an empty query only without INDEX; existing INDEX without HEAD refuses; deleting/deleted refuses before dead-incarnation lookup (TestSnapshotOperationDeleteFencesPausedPublications, TestSnapshotOperationCleanupRequiresDeletedHead)", diff --git a/seaweed-block/core/frontend/chunkstore/layout/clean_batch.go b/seaweed-block/core/frontend/chunkstore/layout/clean_batch.go new file mode 100644 index 0000000000..5e40080253 --- /dev/null +++ b/seaweed-block/core/frontend/chunkstore/layout/clean_batch.go @@ -0,0 +1,50 @@ +package layout + +import ( + "context" + "time" +) + +type cleanerBatchKey struct{} +type cleanerBatchEndKey struct{} +type cleanerBatch struct { + held bool + base Head + execute func(context.Context, Head, func(context.Context) error) error +} + +// WithCleanerBatch prepares outside the exclusive activity. The executor must +// begin at the prepared HEAD generation, or refuse without running effects. +func WithCleanerBatch(ctx context.Context, base Head, execute func(context.Context, Head, func(context.Context) error) error) context.Context { + return context.WithValue(ctx, cleanerBatchKey{}, cleanerBatch{base: base, execute: execute}) +} + +// WithCleanBatchEnd is a control timer for the session, never a pass deadline. +// It is inspected between completed candidate decisions, not used to cancel I/O. +func WithCleanBatchEnd(ctx context.Context, end time.Time) context.Context { + return context.WithValue(ctx, cleanerBatchEndKey{}, end) +} + +func hasCleanerBatch(ctx context.Context) bool { + _, ok := ctx.Value(cleanerBatchKey{}).(cleanerBatch) + return ok +} + +func runCleanerBatch(ctx context.Context, base Head, run func(context.Context) error) error { + if batch, ok := ctx.Value(cleanerBatchKey{}).(cleanerBatch); ok { + return batch.execute(ctx, base, run) + } + return run(ctx) +} + +func cleanBatchEnded(ctx context.Context) bool { + end, ok := ctx.Value(cleanerBatchEndKey{}).(time.Time) + return ok && !time.Now().Before(end) +} + +// WithHeldCleanerBatch prepares only after this pass has begun its activity. +// Read-only preparation may have a deadline; the executor supplies the original +// caller context to effects so the session timer never cancels a mutation. +func WithHeldCleanerBatch(ctx context.Context, base Head, execute func(context.Context, Head, func(context.Context) error) error) context.Context { + return context.WithValue(ctx, cleanerBatchKey{}, cleanerBatch{base: base, execute: execute, held: true}) +} diff --git a/seaweed-block/core/frontend/chunkstore/layout/delete_intent.go b/seaweed-block/core/frontend/chunkstore/layout/delete_intent.go index 60781ae348..625fdf5dee 100644 --- a/seaweed-block/core/frontend/chunkstore/layout/delete_intent.go +++ b/seaweed-block/core/frontend/chunkstore/layout/delete_intent.go @@ -224,6 +224,7 @@ func pendingDeleteIntent(h Head, expected *ListCursor) error { // over guest writes. Every object still passes the normal live-root and // conditional removal checks in Cleaner.removePlanned. func RunConsumeSnapshotDeleteIntent(ctx context.Context, st ListChainStore, r *Reader) (Head, error) { + ctx = maintenanceReads(WithMaintenancePhase(ctx, MaintenanceIntent), 1) var after *ListCursor attempted := false h, err := runTransition(ctx, st, CauseListAdvance, func(h Head) (Head, bool, error) { diff --git a/seaweed-block/core/frontend/chunkstore/layout/guard_test.go b/seaweed-block/core/frontend/chunkstore/layout/guard_test.go index 69b1bebf18..22612851af 100644 --- a/seaweed-block/core/frontend/chunkstore/layout/guard_test.go +++ b/seaweed-block/core/frontend/chunkstore/layout/guard_test.go @@ -238,6 +238,9 @@ func removerOrderFindings(t *testing.T, srcs map[string]string) []string { removals := func(n ast.Node) []string { var names []string ast.Inspect(n, func(n ast.Node) bool { + if _, ok := n.(*ast.FuncLit); ok { + return false // Its body is checked as a separate block below. + } if c, ok := n.(*ast.CallExpr); ok { if sel, ok := c.Fun.(*ast.SelectorExpr); ok && (strings.HasPrefix(sel.Sel.Name, "Delete") || strings.HasPrefix(sel.Sel.Name, "Remove")) { names = append(names, sel.Sel.Name) @@ -338,6 +341,27 @@ func removerOrderFindings(t *testing.T, srcs map[string]string) []string { return bad } +func TestRemoverGuardChecksBatchCallbackBodies(t *testing.T) { + for _, guarded := range []bool{false, true} { + gate := "" + if guarded { + gate = `if err := c.os.Mark(ctx, rel, tag.meta, c.session); err != nil { return err }` + } + src := `package layout +func (c *Cleaner) removePlanned() error { + return runCleanerBatch(ctx, head, func(ctx C) error { + ` + gate + ` + if err := c.os.DeleteMarked(ctx, rel, c.session); err != nil { return err } + return nil + }) +}` + bad := removerOrderFindings(t, map[string]string{"remove.go": src}) + if guarded && len(bad) != 0 || !guarded && !strings.Contains(strings.Join(bad, "\n"), "without a mark gate immediately before it") { + t.Fatalf("guarded=%v callback findings=%v", guarded, bad) + } + } +} + // deleteOrderFindings checks DeleteVolume's order in the sources: among its // top-level statements, the first use of each step comes after the // previous step's: Reserve, RunMarkDeleting, RunReleaseDependent, diff --git a/seaweed-block/core/frontend/chunkstore/layout/head.go b/seaweed-block/core/frontend/chunkstore/layout/head.go index f2068f4bef..7db03f5b2f 100644 --- a/seaweed-block/core/frontend/chunkstore/layout/head.go +++ b/seaweed-block/core/frontend/chunkstore/layout/head.go @@ -736,6 +736,18 @@ func RunAbort(ctx context.Context, st HeadStore, me HolderID, session string, ca // changed it, written as cause. An absent HEAD is refused: no transition // creates one. func runTransition(ctx context.Context, st HeadStore, cause HeadWriteCause, t func(Head) (Head, bool, error)) (Head, error) { + // Optional process-local scheduling covers the entire one-shot proposal, + // including its HEAD read. Waiting only at CAS would stale its generation. + // This hook supplies no authority and never retries or refreshes a proposal. + if admission, ok := st.(interface { + BeginHeadPublication(context.Context) (func(), error) + }); ok { + done, err := admission.BeginHeadPublication(ctx) + if err != nil { + return Head{}, err + } + defer done() + } h, found, err := st.ReadHead(ctx) if err != nil { return Head{}, err diff --git a/seaweed-block/core/frontend/chunkstore/layout/head_generation_source_guard_test.go b/seaweed-block/core/frontend/chunkstore/layout/head_generation_source_guard_test.go index 7cd33454f6..b52c11f9c5 100644 --- a/seaweed-block/core/frontend/chunkstore/layout/head_generation_source_guard_test.go +++ b/seaweed-block/core/frontend/chunkstore/layout/head_generation_source_guard_test.go @@ -184,7 +184,10 @@ func TestHeadGenerationComparedOnlyByConditionalUpdate(t *testing.T) { // not raw filer HEAD generation. Pin both syntax and count: a new or removed // site forces review. No no-op-cut authority comparison is allowed here. allowed := map[string]int{ - "core/frontend/chunkstore/layout_verify.go VerifyLayout head.Gen != heads[p].Gen": 1, // read-only observation window; TestVerifyLayoutRequiresStableHeadForMissingAndOrphans + "core/frontend/chunkstore/clean_b.go RemoveUnreachableAll fresh.Gen != closed.Gen": 1, // cache provenance; TestMaintenanceBatchDropsReachabilityAfterPublication + "core/frontend/chunkstore/clean_b.go RemoveUnreachableAll opened.Gen != base.Gen+1": 1, // refuse stale preparation after begin; TestMaintenanceBatchDropsReachabilityAfterPublication + "core/frontend/chunkstore/layout/remove.go removePlanned h.Gen != batch.base.Gen": 2, // close read/view race before preparing; TestMaintenanceBatchDropsReachabilityAfterPublication + "core/frontend/chunkstore/layout_verify.go VerifyLayout head.Gen != heads[p].Gen": 1, // read-only observation window; TestVerifyLayoutRequiresStableHeadForMissingAndOrphans "core/storage/chunk_head_belt.go confirmChunkHead got.Gen != want.Gen": 1, // publication confirmation "core/storage/chunk_layer.go captureLocked sc.headGen == l.head.Gen": 1, // staged image cache diff --git a/seaweed-block/core/frontend/chunkstore/layout/list_chain.go b/seaweed-block/core/frontend/chunkstore/layout/list_chain.go index 69aec39bdb..31b3295fb0 100644 --- a/seaweed-block/core/frontend/chunkstore/layout/list_chain.go +++ b/seaweed-block/core/frontend/chunkstore/layout/list_chain.go @@ -67,6 +67,7 @@ func readListPage(ctx context.Context, r ListPageReader, volume VolumeID, c List if p.Kind != c.Kind || p.Producer != c.Producer || p.Generation != c.Generation || !sameTarget(p.Target, c.Target) { return ListPage{}, fmt.Errorf("%w: list continuation context", ErrIdentity) } + reportMaintenanceRead(ctx) return p, nil } diff --git a/seaweed-block/core/frontend/chunkstore/layout/list_chain_test.go b/seaweed-block/core/frontend/chunkstore/layout/list_chain_test.go index 9da9ea6872..575c3cf1e9 100644 --- a/seaweed-block/core/frontend/chunkstore/layout/list_chain_test.go +++ b/seaweed-block/core/frontend/chunkstore/layout/list_chain_test.go @@ -7,6 +7,7 @@ import ( "errors" "os" "testing" + "testing/synctest" ) func TestListCursorGoldenBytes(t *testing.T) { @@ -483,3 +484,101 @@ func TestListWritesMatchExportedCensus(t *testing.T) { } check(CauseListAdvance, before, after) } + +func TestMaintenanceListPreparationReportsOnlyAuthenticatedPages(t *testing.T) { + s, c, p := chainFixture(t) + if _, err := StageListPage(context.Background(), s, me, "s1", p); err != nil { + t.Fatal(err) + } + count := 0 + ctx := maintenanceReads(WithMaintenanceProgress(context.Background(), func(MaintenancePosition) { count++ }), 2) + if _, err := readListPage(ctx, s, p.VolumeID, c); err != nil { + t.Fatal(err) + } + if count != 1 { + t.Fatalf("completed page not reported: %d", count) + } + c.Producer = "foreign" + if _, err := readListPage(ctx, s, p.VolumeID, c); !errors.Is(err, ErrIdentity) { + t.Fatal(err) + } + if count != 1 { + t.Fatal("failed preparation earned progress") + } +} + +type maintenanceOrderedTags struct { + ObjectStore + first string + release <-chan struct{} + secondDone chan struct{} + failFirst bool +} + +func (s maintenanceOrderedTags) Stat(ctx context.Context, rel string) (ObjectMeta, bool, error) { + if rel == s.first { + select { + case <-ctx.Done(): + return ObjectMeta{}, false, ctx.Err() + case <-s.release: + } + if s.failFirst { + return ObjectMeta{}, false, ErrPrecondition + } + } else { + defer close(s.secondDone) + } + return s.ObjectStore.Stat(ctx, rel) +} + +func TestMaintenanceTagPositionCountsCompletedWorkOnly(t *testing.T) { + for _, failed := range []bool{false, true} { + synctest.Test(t, func(t *testing.T) { + s, _, p := chainFixture(t) + ref, err := StageListPage(context.Background(), s, me, "s1", p) + if err != nil { + t.Fatal(err) + } + p.Entries = []string{RootName{Hash: Sum([]byte("other"))}.Path()} + other, err := StageListPage(context.Background(), s, me, "s1", p) + if err != nil { + t.Fatal(err) + } + first, _ := ref.Path() + release := make(chan struct{}) + second := make(chan struct{}) + obj := maintenanceOrderedTags{ObjectStore: s, first: first, release: release, secondDone: second, failFirst: failed} + reports := make(chan MaintenancePosition, 4) + ctx := WithMaintenanceProgress(context.Background(), func(p MaintenancePosition) { reports <- p }) + cleaner := NewCleaner(s, nil, obj, me, "not-open") + done := make(chan struct{}) + go func() { defer close(done); _, _ = cleaner.Page(ctx, ListDir, 0, []string{ref.Hash, other.Hash}) }() + <-second + synctest.Wait() + select { + case got := <-reports: + if got[3] != 1 || got[4] != 1 { + t.Errorf("completed later job not counted once: %v", got) + } + default: + t.Error("pending earlier job hid completed work") + } + close(release) + <-done + if failed { + if len(reports) != 0 { + t.Fatal("failed job earned progress") + } + } else { + select { + case got := <-reports: + if got[3] != 1 || got[4] != 2 { + t.Fatalf("completed position=%v", got) + } + default: + t.Fatal("completed job not reported") + } + } + }) + } +} diff --git a/seaweed-block/core/frontend/chunkstore/layout/maintenance_progress.go b/seaweed-block/core/frontend/chunkstore/layout/maintenance_progress.go new file mode 100644 index 0000000000..b2f50886ca --- /dev/null +++ b/seaweed-block/core/frontend/chunkstore/layout/maintenance_progress.go @@ -0,0 +1,98 @@ +package layout + +import ( + "context" + "sync/atomic" +) + +type maintenanceProgressKey struct{} +type maintenanceScopeKey struct{} +type maintenanceReadKey struct{} + +// MaintenancePosition is the finite pass's (phase, outer page, page, stage, position). +// Positions are lexicographic, scheduling only, and never removal authority. +type MaintenancePosition [5]uint64 + +const ( + MaintenanceRetention uint64 = 1 + MaintenanceIntent uint64 = 2 + MaintenanceSweep uint64 = 3 +) + +func (p MaintenancePosition) After(old MaintenancePosition) bool { + for i := range p { + if p[i] != old[i] { + return p[i] > old[i] + } + } + return false +} + +// WithMaintenanceProgress observes strict advances; the observer retains only +// its highest position. A failed request or retry of a position is not progress. +func WithMaintenanceProgress(ctx context.Context, completed func(MaintenancePosition)) context.Context { + return context.WithValue(ctx, maintenanceProgressKey{}, completed) +} + +func WithMaintenancePhase(ctx context.Context, phase uint64) context.Context { + if !HasMaintenanceProgress(ctx) { + return ctx + } + if p, ok := ctx.Value(maintenanceScopeKey{}).(MaintenancePosition); ok && p[0] == phase { + return ctx + } + return context.WithValue(ctx, maintenanceScopeKey{}, MaintenancePosition{phase}) +} + +func maintenancePage(ctx context.Context, page uint64) context.Context { + if !HasMaintenanceProgress(ctx) { + return ctx + } + p, _ := ctx.Value(maintenanceScopeKey{}).(MaintenancePosition) + p[2], p[3], p[4] = page, 0, 0 + return context.WithValue(ctx, maintenanceScopeKey{}, p) +} + +// ReportMaintenanceStep is called after work at a finite-list position completes. +func ReportMaintenanceStep(ctx context.Context, stage, position uint64) { + if f, ok := ctx.Value(maintenanceProgressKey{}).(func(MaintenancePosition)); ok && position != 0 { + p, _ := ctx.Value(maintenanceScopeKey{}).(MaintenancePosition) + p[3], p[4] = stage, position + f(p) + } +} + +// maintenanceReads numbers completed reads in one finite reachability walk. +// It is reset for each page/replayed walk, never incremented on a request retry. +func maintenanceReads(ctx context.Context, stage uint64) context.Context { + if !HasMaintenanceProgress(ctx) { + return ctx + } + return context.WithValue(ctx, maintenanceReadKey{}, &maintenanceReadPosition{stage: stage}) +} + +type maintenanceReadPosition struct { + stage uint64 + done atomic.Uint64 +} + +func reportMaintenanceRead(ctx context.Context) { + if p, ok := ctx.Value(maintenanceReadKey{}).(*maintenanceReadPosition); ok { + ReportMaintenanceStep(ctx, p.stage, p.done.Add(1)) + } +} + +func HasMaintenanceProgress(ctx context.Context) bool { + _, ok := ctx.Value(maintenanceProgressKey{}).(func(MaintenancePosition)) + return ok +} + +// WithMaintenanceIntentPage scopes a successfully advancing persisted-intent +// cursor in the finite chain. Request retries retain the same page number. +func WithMaintenanceIntentPage(ctx context.Context, page uint64) context.Context { + if !HasMaintenanceProgress(ctx) { + return ctx + } + ctx = WithMaintenancePhase(ctx, MaintenanceIntent) + return context.WithValue(ctx, maintenanceScopeKey{}, MaintenancePosition{MaintenanceIntent, page}) +} diff --git a/seaweed-block/core/frontend/chunkstore/layout/maintenance_progress_test.go b/seaweed-block/core/frontend/chunkstore/layout/maintenance_progress_test.go new file mode 100644 index 0000000000..c8c4b9bc7d --- /dev/null +++ b/seaweed-block/core/frontend/chunkstore/layout/maintenance_progress_test.go @@ -0,0 +1,61 @@ +package layout + +import ( + "context" + "errors" + "testing" + "testing/synctest" + "time" +) + +// Reachability completes six distinct metadata reads before any removal step. +// Each request is shorter than its bound; their finite walk exceeds W=1min. +func TestMaintenanceReachabilityProgressesAcrossTheWindow(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + m := &memStore{obj: map[string][]byte{}} + refs := map[uint64]string{} + for i := uint64(0); i < 5; i++ { + refs[i*ShardSize] = "live" + } + rn := putImage(t, m, "v", refs, nil) + r, err := NewReader(vbase, VolumeDir("v", vid("v", 0)), func(ctx context.Context, p string) ([]byte, bool, error) { + select { + case <-ctx.Done(): + return nil, false, ctx.Err() + case <-time.After(15 * time.Second): + } + return m.fetch(ctx, p) + }) + if err != nil { + t.Fatal(err) + } + var positions []MaintenancePosition + start := time.Now() + last := start + ctx := maintenanceReads(WithMaintenanceProgress(context.Background(), func(p MaintenancePosition) { + if time.Since(last) != 15*time.Second { + t.Errorf("completed read interval %v", time.Since(last)) + } + last = time.Now() + positions = append(positions, p) + }), 2) + if err := r.EachRef(ctx, rn, AllShards, func(uint64, Ref) bool { return true }); err != nil { + t.Fatal(err) + } + if len(positions) != 6 || time.Since(start) != 90*time.Second { + t.Fatalf("reachability progress: reads=%d elapsed=%v", len(positions), time.Since(start)) + } + for i, p := range positions { + if p[3] != 2 || p[4] != uint64(i+1) { + t.Fatalf("non-advancing read position: %v", positions) + } + } + before := len(positions) + if _, err := r.Open(ctx, RootName{Hash: Sum([]byte("missing"))}); !errors.Is(err, ErrMissing) { + t.Fatal(err) + } + if len(positions) != before { + t.Fatal("failed read earned progress") + } + }) +} diff --git a/seaweed-block/core/frontend/chunkstore/layout/read.go b/seaweed-block/core/frontend/chunkstore/layout/read.go index 2d2cd2ae8d..b2722a37e8 100644 --- a/seaweed-block/core/frontend/chunkstore/layout/read.go +++ b/seaweed-block/core/frontend/chunkstore/layout/read.go @@ -176,6 +176,7 @@ func (r *Reader) Open(ctx context.Context, rn RootName) (*Image, error) { if err != nil { return nil, fmt.Errorf("%w: root %s: %v", ErrCorrupt, rn, err) } + reportMaintenanceRead(ctx) return &Image{r: r, root: root}, nil } @@ -197,6 +198,7 @@ func (img *Image) Segment(ctx context.Context, shard uint64) (seg Segment, ok bo if seg.Shard != shard { return Segment{}, false, fmt.Errorf("%w: segment %s holds shard %d", ErrCorrupt, n, seg.Shard) } + reportMaintenanceRead(ctx) return seg, true, nil } diff --git a/seaweed-block/core/frontend/chunkstore/layout/remove.go b/seaweed-block/core/frontend/chunkstore/layout/remove.go index fe3159d97d..de972e260a 100644 --- a/seaweed-block/core/frontend/chunkstore/layout/remove.go +++ b/seaweed-block/core/frontend/chunkstore/layout/remove.go @@ -6,6 +6,7 @@ import ( "fmt" "sort" "sync" + "sync/atomic" ) // Cleaner is one clean(session)'s removal plan. Tags are read before each @@ -15,6 +16,7 @@ type Cleaner struct { // intent is set only by the persisted delete-intent consumer. Ordinary // full-sweep cleaners retain their holder + clean-session authority. intent *ListCursor + page uint64 // completed/attempted pages in this finite sweep; not request retries tagParallel int st HeadStore r *Reader @@ -33,11 +35,18 @@ func NewCleaner(st HeadStore, r *Reader, os ObjectStore, me HolderID, session st return &Cleaner{st: st, r: r, os: os, me: me, session: session, tagParallel: 32} } +// ResetReachability starts a newly entered clean batch. The finite page ordinal +// remains scheduling state; every safety decision is rebuilt from fresh HEAD. +func (c *Cleaner) ResetReachability() { + c.roots, c.rootsRead, c.metadata, c.chunks = nil, false, nil, nil +} + // RemovalResult advances through names examined (including live objects), not // merely deleted names. A failed candidate is left for the next pass to retry. type RemovalResult struct { Names []string After string + More bool // control timer yielded before all supplied candidates were decided } // ListRetirementSkipReason reports opaque work that this binary must preserve. @@ -92,7 +101,8 @@ func (c *Cleaner) Page(ctx context.Context, kind string, shard uint64, names []s } rels = append(rels, rel) } - return c.removePlanned(ctx, rels, kind, shard) + c.page++ + return c.removePlanned(maintenancePage(ctx, c.page), rels, kind, shard) } // removePlanned is the single mark/delete writer for all content-named objects: @@ -111,6 +121,8 @@ func (c *Cleaner) removePlanned(ctx context.Context, rels []string, kind string, // Bounded parallel tag reads finish before HEAD is read. Their original order // determines the first error, independent of completion order. var wg sync.WaitGroup + var completed atomic.Uint64 + trackProgress := HasMaintenanceProgress(ctx) jobs := make(chan int) for range min(c.tagParallel, len(rels)) { wg.Add(1) @@ -118,6 +130,12 @@ func (c *Cleaner) removePlanned(ctx context.Context, rels []string, kind string, defer wg.Done() for i := range jobs { tags[i].meta, tags[i].found, tags[i].err = c.os.Stat(ctx, rels[i]) + // Each finite-list job is dispatched once. Request retries occur + // inside Stat; only its final successful return advances this + // phase. A slow earlier job cannot hide later completed work. + if trackProgress && tags[i].err == nil { + ReportMaintenanceStep(ctx, 1, completed.Add(1)) + } } }() } @@ -146,7 +164,22 @@ func (c *Cleaner) removePlanned(ctx context.Context, rels []string, kind string, if err := h.holderErr(c.me); err != nil { return out, err } - if h.Activity != (Activity{Kind: ActClean, Session: c.session}) { + if hasCleanerBatch(ctx) { + batch := ctx.Value(cleanerBatchKey{}).(cleanerBatch) + if batch.held { + if h.Activity != (Activity{Kind: ActClean, Session: c.session}) { + return out, ErrNoSession + } + if h.Gen != batch.base.Gen { + return out, ErrPrecondition + } + } else if h.Activity.Kind != ActIdle { + return out, ErrBusy + } + if h.Gen != batch.base.Gen { + c.ResetReachability() + } + } else if h.Activity != (Activity{Kind: ActClean, Session: c.session}) { return out, fmt.Errorf("%w: HEAD has %s(%s), not clean(%s)", ErrNoSession, h.Activity.Kind, h.Activity.Session, c.session) } } @@ -171,6 +204,7 @@ func (c *Cleaner) removePlanned(ctx context.Context, rels []string, kind string, } } } + ctx = maintenanceReads(ctx, 2) live := map[string]bool{} if kind == ListDir { // Reserved producer chains are opaque to this binary. Do not retire @@ -223,39 +257,51 @@ func (c *Cleaner) removePlanned(ctx context.Context, rels []string, kind string, } live = c.metadata } - for i, rel := range rels { - if err := ctx.Err(); err != nil { - return out, err - } - tag := tags[i] - if !tag.found || live[rel] { + report := func(index int) { ReportMaintenanceStep(ctx, 3, uint64(index+1)) } + err = runCleanerBatch(ctx, h, func(ctx context.Context) error { + for i, rel := range rels { + if cleanBatchEnded(ctx) { + out.More = true + return nil + } + if err := ctx.Err(); err != nil { + return err + } + tag := tags[i] + if !tag.found || live[rel] { + out.After = rel + report(i) + continue + } + if err := c.os.Mark(ctx, rel, tag.meta, c.session); err != nil { + if errors.Is(err, ErrPrecondition) { + if c.intent != nil { + return err + } + out.After = rel + report(i) + continue + } + return fmt.Errorf("layout: mark %s: %w", rel, err) + } + if err := c.os.DeleteMarked(ctx, rel, c.session); err != nil { + if errors.Is(err, ErrPrecondition) { + if c.intent != nil { + return err + } + out.After = rel + report(i) + continue + } + return fmt.Errorf("layout: delete %s: %w", rel, err) + } + out.Names = append(out.Names, rel) out.After = rel - continue + report(i) } - if err := c.os.Mark(ctx, rel, tag.meta, c.session); err != nil { - if errors.Is(err, ErrPrecondition) { - if c.intent != nil { - return out, err - } - out.After = rel - continue - } - return out, fmt.Errorf("layout: mark %s: %w", rel, err) - } - if err := c.os.DeleteMarked(ctx, rel, c.session); err != nil { - if errors.Is(err, ErrPrecondition) { - if c.intent != nil { - return out, err - } - out.After = rel - continue - } - return out, fmt.Errorf("layout: delete %s: %w", rel, err) - } - out.Names = append(out.Names, rel) - out.After = rel - } - return out, nil + return nil + }) + return out, err } // RemoveUnreachable is the chunk-only compatibility boundary. A full pass uses diff --git a/seaweed-block/core/frontend/chunkstore/layout_remote.go b/seaweed-block/core/frontend/chunkstore/layout_remote.go index cfd465719b..407b4f1cfd 100644 --- a/seaweed-block/core/frontend/chunkstore/layout_remote.go +++ b/seaweed-block/core/frontend/chunkstore/layout_remote.go @@ -35,10 +35,11 @@ type sessionStore interface { } type LayoutRemote struct { - st sessionStore - r *layout.Reader - vol VolumeRef - me layout.HolderID + admission *cleanAdmission + st sessionStore + r *layout.Reader + vol VolumeRef + me layout.HolderID // headV11: commits write a v1.1 HEAD (SetHeadFormat, at attach), at // the format level headLevel (the HEAD write guard's input); @@ -158,7 +159,7 @@ func NewLayoutRemote(cat *BCatalog, v VolumeRef, me layout.HolderID) (*LayoutRem if err != nil { return nil, err } - return &LayoutRemote{st: st, r: r, vol: v, me: me}, nil + return &LayoutRemote{st: st, r: r, vol: v, me: me, admission: &cat.cleaningCursor(v).admission}, nil } // SetSnapshot names the snapshot the next commit at or past position from @@ -237,9 +238,18 @@ func (l *LayoutRemote) openSessionLocked(ctx context.Context) error { // beginSessionLocked opens a new session (no session is open) and returns // the HEAD its begin wrote. func (l *LayoutRemote) beginSessionLocked(ctx context.Context) (layout.Head, error) { + // Preserve own-cleaner cancellation/join before waiting on another batch. + // Its cancellation prevents that pass from re-entering while we join it. if err := l.stopCleaningLocked(ctx); err != nil { return layout.Head{}, err } + if l.admission != nil { + done, err := l.admission.publisher(ctx) + if err != nil { + return layout.Head{}, layoutRemoteErr(err) + } + defer done() + } if _, err := l.rollBackLocked(ctx); err != nil { return layout.Head{}, err } @@ -1311,15 +1321,42 @@ func (l *LayoutRemote) Clean(ctx context.Context, run func(ctx context.Context, // Resume only the dedicated delete intent. A generic list is consumed by // its own protocol; membership alone must not grant delete authority. + var intentPage uint64 for h.List != nil && h.List.Kind == layout.ListSnapshotDeleteIntent { if err := cctx.Err(); err != nil { return err } - h, err = layout.RunConsumeSnapshotDeleteIntent(cctx, l.st, l.r) + intentPage++ + // Intent consumption publishes a cursor; it is publisher interest, + // not a clean activity, and never nests a clean-batch admission. + var releaseIntent func() + if l.admission != nil { + releaseIntent, err = l.admission.publisher(cctx) + if err != nil { + return layoutRemoteErr(err) + } + } + h, err = layout.RunConsumeSnapshotDeleteIntent(layout.WithMaintenanceIntentPage(cctx, intentPage), l.st, l.r) + if releaseIntent != nil { + releaseIntent() + } if err != nil { return layoutRemoteErr(err) } } + // Acquire outside l.mu: a cut may need that mutex to cancel/join us. + // The catalog releases this lease at its initial durable close, before + // acquiring any per-page lease; defer covers non-catalog/error callbacks. + if l.admission != nil { + release, err := l.admission.batch(cctx) + if err != nil { + return layoutRemoteErr(err) + } + initial := &cleanAdmissionLease{done: release, gate: l.admission} + defer initial.release() + cctx = context.WithValue(cctx, initialCleanAdmissionKey{}, initial) + cctx = context.WithValue(cctx, heldCleanAdmissionKey{}, initial) + } bh, err := layout.RunBeginClean(cctx, l.st, l.me, c) if err != nil { return layoutRemoteErr(err) diff --git a/seaweed-block/core/frontend/chunkstore/layout_remote_intent_test.go b/seaweed-block/core/frontend/chunkstore/layout_remote_intent_test.go index b9f349c958..1a28e1041e 100644 --- a/seaweed-block/core/frontend/chunkstore/layout_remote_intent_test.go +++ b/seaweed-block/core/frontend/chunkstore/layout_remote_intent_test.go @@ -3,6 +3,7 @@ package chunkstore import ( "context" "errors" + "sync" "testing" "time" @@ -97,3 +98,27 @@ func TestHolderMaintenanceIntentIsCancelledBeforeTheCutJoins(t *testing.T) { t.Fatalf("cancelled work lost its continuation: head=%+v err=%v deletes=%v", h, err, cost.deletes) } } + +func TestMaintenanceIntentCursorAdvancesAcrossPages(t *testing.T) { + cat, ref, cost := largeIntentCatalog(t, 1024) // a real two-page persisted intent + remote, err := NewLayoutRemote(cat, ref, cleanHolder) + if err != nil { + t.Fatal(err) + } + var mu sync.Mutex + pages := map[uint64]bool{} + ctx := layout.WithMaintenanceProgress(context.Background(), func(p layout.MaintenancePosition) { + mu.Lock() + defer mu.Unlock() + if p[0] != layout.MaintenanceIntent || p[1] == 0 { + t.Errorf("intent lost finite cursor scope: %v", p) + } + pages[p[1]] = true + }) + if err := remote.Clean(ctx, func(context.Context, layout.HolderID, string) error { return nil }); err != nil { + t.Fatal(err) + } + if !pages[1] || !pages[2] || len(pages) != 2 || len(cost.deletes) != 4 { + t.Fatalf("intent progress pages=%v effects=%v", pages, cost.deletes) + } +} diff --git a/seaweed-block/core/frontend/chunkstore/layout_store.go b/seaweed-block/core/frontend/chunkstore/layout_store.go index 0b51d793d9..2b15656a03 100644 --- a/seaweed-block/core/frontend/chunkstore/layout_store.go +++ b/seaweed-block/core/frontend/chunkstore/layout_store.go @@ -30,11 +30,12 @@ var ErrLegacyStore = errors.New("chunkstore: legacy store format; recreate the v // Objects carry their immutable bytes as file chunks; metadata updates preserve // those chunks, and deletion delegates their reclamation to the filer. type LayoutStore struct { - headWrites *headWriteCounters - f Filer - b Blobs - root string - id layout.VolumeID + publicationAdmission *cleanAdmission // only catalog publishing-step views + headWrites *headWriteCounters + f Filer + b Blobs + root string + id layout.VolumeID } func NewLayoutStore(f Filer, b Blobs, root string, id layout.VolumeID) (*LayoutStore, error) { diff --git a/seaweed-block/core/frontend/chunkstore/maintenance_request.go b/seaweed-block/core/frontend/chunkstore/maintenance_request.go new file mode 100644 index 0000000000..9b9da5f873 --- /dev/null +++ b/seaweed-block/core/frontend/chunkstore/maintenance_request.go @@ -0,0 +1,54 @@ +package chunkstore + +import ( + "context" + "errors" + "github.com/seaweedfs/seaweed-block/core/frontend/chunkstore/layout" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "time" +) + +// maintenanceRequestTimeout bounds a single metadata or blob operation, +// independent of the pass's completed-object inactivity window. +const maintenanceRequestTimeout = 30 * time.Second + +// maintenanceCall retries only read-only requests; mutations must preserve an +// unanswered request as unknown for their existing caller settlement. +func maintenanceCall[T any](ctx context.Context, call func(context.Context) (T, error)) (T, error) { + if !layout.HasMaintenanceProgress(ctx) { + return call(ctx) + } + for { + request, cancel := context.WithTimeout(ctx, maintenanceRequestTimeout) + value, err := call(request) + cancel() + if err == nil || ctx.Err() != nil || !(errors.Is(err, context.DeadlineExceeded) || status.Code(err) == codes.DeadlineExceeded) { + return value, err + } + // A failed read is not progress. Repeat the same read-only position; + // only its caller can report a completed finite-work step. + select { + case <-ctx.Done(): + var zero T + return zero, ctx.Err() + case <-time.After(time.Second): + } + } +} +func maintenanceError(ctx context.Context, call func(context.Context) error) error { + _, err := maintenanceMutation(ctx, func(ctx context.Context) (struct{}, error) { return struct{}{}, call(ctx) }) + return err +} + +// maintenanceMutation bounds one invocation but never retries it. A timeout +// may mean applied-without-reply; retrying here could turn it into EXISTS or a +// failed precondition and defeat the caller's unknown-outcome settlement. +func maintenanceMutation[T any](ctx context.Context, call func(context.Context) (T, error)) (T, error) { + if !layout.HasMaintenanceProgress(ctx) { + return call(ctx) + } + request, cancel := context.WithTimeout(ctx, maintenanceRequestTimeout) + defer cancel() + return call(request) +} diff --git a/seaweed-block/core/frontend/chunkstore/maintenance_request_test.go b/seaweed-block/core/frontend/chunkstore/maintenance_request_test.go new file mode 100644 index 0000000000..5886474672 --- /dev/null +++ b/seaweed-block/core/frontend/chunkstore/maintenance_request_test.go @@ -0,0 +1,162 @@ +package chunkstore + +import ( + "bytes" + "context" + "errors" + "github.com/seaweedfs/seaweed-block/core/frontend/chunkstore/filerpb" + "github.com/seaweedfs/seaweed-block/core/frontend/chunkstore/layout" + "google.golang.org/grpc" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "path" + "testing" + "testing/synctest" + "time" +) + +type maintenanceDeadlineClient struct { + filerpb.SeaweedFilerClient + calls int + deadlines []time.Duration +} + +func (c *maintenanceDeadlineClient) LookupDirectoryEntry(ctx context.Context, r *filerpb.LookupDirectoryEntryRequest, _ ...grpc.CallOption) (*filerpb.LookupDirectoryEntryResponse, error) { + c.calls++ + dl, ok := ctx.Deadline() + if ok { + c.deadlines = append(c.deadlines, time.Until(dl)) + } + if c.calls < 3 { + <-ctx.Done() + return nil, ctx.Err() + } + return &filerpb.LookupDirectoryEntryResponse{Entry: &filerpb.Entry{Name: r.Name}}, nil +} +func TestMaintenanceLookupRetriesItsOwnDeadlineWithoutProgress(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + ctx, cancel := context.WithTimeout(context.Background(), 3*time.Minute) + defer cancel() + progress := 0 + ctx = layout.WithMaintenanceProgress(ctx, func(layout.MaintenancePosition) { progress++ }) + client := &maintenanceDeadlineClient{} + sw := &SWFS{fc: client} + _, err := sw.LookupEntry(ctx, "/v/pool/0", "chunk") + if err != nil || client.calls != 3 { + t.Fatalf("request did not retry independently of the pass: calls=%d err=%v", client.calls, err) + } + for _, d := range client.deadlines { + if d != 30*time.Second { + t.Fatalf("per-call deadline=%v; want 30s", d) + } + } + if progress != 0 { + t.Fatal("request retries renewed object progress") + } + }) +} + +func TestOrdinaryLookupKeepsItsCallerDeadline(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + ctx, cancel := context.WithTimeout(context.Background(), 3*time.Minute) + defer cancel() + client := &maintenanceDeadlineClient{calls: 2} + sw := &SWFS{fc: client} + if _, err := sw.LookupEntry(ctx, "/v/pool/0", "chunk"); err != nil { + t.Fatal(err) + } + if len(client.deadlines) != 1 || client.deadlines[0] != 3*time.Minute { + t.Fatalf("non-maintenance request changed: %v", client.deadlines) + } + }) +} + +// The first exclusive create lands, but its reply is lost. A second call would +// answer EXISTS; that must not prove the first call's fid was unused. +type maintenanceLostCreateClient struct { + filerpb.SeaweedFilerClient + f Filer + calls int + deadline time.Duration +} + +func (c *maintenanceLostCreateClient) CreateEntry(ctx context.Context, r *filerpb.CreateEntryRequest, _ ...grpc.CallOption) (*filerpb.CreateEntryResponse, error) { + c.calls++ + if dl, ok := ctx.Deadline(); ok { + c.deadline = time.Until(dl) + } + if err := c.f.CreateEntry(ctx, r.Directory, r.Entry, r.OExcl); err != nil { + if errors.Is(err, ErrExists) { + return &filerpb.CreateEntryResponse{ErrorCode: filerpb.FilerError_ENTRY_ALREADY_EXISTS}, nil + } + return nil, err + } + <-ctx.Done() + return nil, status.Error(codes.DeadlineExceeded, "applied, reply lost") +} + +type maintenanceCreateFiler struct { + Filer + sw *SWFS +} + +func (f maintenanceCreateFiler) CreateEntry(ctx context.Context, dir string, e *filerpb.Entry, exclusive bool) error { + return f.sw.CreateEntry(ctx, dir, e, exclusive) +} +func TestMaintenanceUnknownCreateKeepsLinkedUploadAndSettles(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + s, f, base := layoutStoreFixture(t) + blobs := &layoutCleanupBlobs{fakeBlobs: base} + s.b = blobs + client := &maintenanceLostCreateClient{f: f} + s.f = maintenanceCreateFiler{Filer: f, sw: &SWFS{fc: client}} + ctx, cancel := context.WithTimeout(context.Background(), 3*time.Minute) + defer cancel() + ctx = layout.WithMaintenanceProgress(ctx, func(layout.MaintenancePosition) { t.Error("mutation attempt earned progress") }) + raw := []byte("keep the applied exclusive create") + n := layout.NameChunk(3, raw) + err := s.Create(ctx, n.Path(), raw, "writer") + if len(blobs.deleted) != 0 { + t.Fatalf("linked fid reclaimed: %v", blobs.deleted) + } + if status.Code(err) != codes.DeadlineExceeded || errors.Is(err, layout.ErrExists) || client.calls != 1 || client.deadline != 30*time.Second { + t.Fatalf("unknown create changed outcome: err=%v calls=%d deadline=%v", err, client.calls, client.deadline) + } + got, found, err := s.Fetch(ctx, path.Join(s.root, n.Path())) + if err != nil || !found || !bytes.Equal(got, raw) { + t.Fatalf("linked data lost: %q %v %v", got, found, err) + } + if err := layout.EnsureObject(ctx, s, n.Path(), raw, "writer"); err != nil { + t.Fatal(err) + } + puts, _, stored := blobs.counts() + if puts != 1 || stored != 1 || client.calls != 1 { + t.Fatalf("settlement repeated mutation: puts=%d stored=%d calls=%d", puts, stored, client.calls) + } + }) +} + +type maintenanceLostAssignClient struct { + filerpb.SeaweedFilerClient + calls int +} + +func (c *maintenanceLostAssignClient) AssignVolume(ctx context.Context, _ *filerpb.AssignVolumeRequest, _ ...grpc.CallOption) (*filerpb.AssignVolumeResponse, error) { + c.calls++ + <-ctx.Done() + return nil, status.Error(codes.DeadlineExceeded, "assignment applied, reply lost") +} +func TestMaintenanceBlobPutDoesNotRepeatUnknownAssignment(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + ctx, cancel := context.WithTimeout(context.Background(), 3*time.Minute) + defer cancel() + ctx = layout.WithMaintenanceProgress(ctx, func(layout.MaintenancePosition) { t.Error("unknown assignment is not progress") }) + client := &maintenanceLostAssignClient{} + sw := &SWFS{fc: client} + start := time.Now() + _, err := sw.Put(ctx, []byte("payload")) + if status.Code(err) != codes.DeadlineExceeded || client.calls != 1 || time.Since(start) != 30*time.Second { + t.Fatalf("assignment repeated: calls=%d elapsed=%v err=%v", client.calls, time.Since(start), err) + } + }) +} diff --git a/seaweed-block/core/frontend/chunkstore/retain_b.go b/seaweed-block/core/frontend/chunkstore/retain_b.go index c67150eb0f..7bc4dcee94 100644 --- a/seaweed-block/core/frontend/chunkstore/retain_b.go +++ b/seaweed-block/core/frontend/chunkstore/retain_b.go @@ -132,22 +132,35 @@ func (c *BCatalog) Retain(ctx context.Context, v VolumeRef, now time.Time, dryRu snaps = append(snaps, retain.Snapshot{Name: n, CreatedNs: sn.Meta.CreatedNs, Class: sn.Meta.Class, ExpiresNs: sn.Meta.ExpiresNs, Labels: sn.Meta.Labels}) } res := RetainResult{Policy: p, Decisions: retain.Plan(p, snaps, now), Deleted: []string{}, DryRun: dryRun} - for _, d := range res.Decisions { + ctx = layout.WithMaintenancePhase(ctx, layout.MaintenanceRetention) + for i, d := range res.Decisions { + report := func() { + layout.ReportMaintenanceStep(ctx, 1, uint64(i+1)) + } if d.Keep { + report() continue } if dryRun { res.Deleted = append(res.Deleted, d.Name) continue } - if _, err := layout.RunRetireSnapshot(ctx, s, d.Name, now.UnixNano()); err != nil { + done, err := c.acquirePublishers(ctx, v) + if err != nil { + return res, err + } + _, err = layout.RunRetireSnapshot(ctx, s, d.Name, now.UnixNano()) + done() + if err != nil { if errors.Is(err, layout.ErrPinned) || errors.Is(err, layout.ErrHasDependents) { res.Refused = append(res.Refused, d.Name) + report() continue } return res, err } res.Deleted = append(res.Deleted, d.Name) + report() } return res, nil } diff --git a/seaweed-block/core/frontend/chunkstore/swfs.go b/seaweed-block/core/frontend/chunkstore/swfs.go index 021fe5a114..23941589bd 100644 --- a/seaweed-block/core/frontend/chunkstore/swfs.go +++ b/seaweed-block/core/frontend/chunkstore/swfs.go @@ -111,93 +111,101 @@ func (c *SWFS) Close() error { // LookupEntry implements Filer. func (c *SWFS) LookupEntry(ctx context.Context, dir, name string) (*filerpb.Entry, error) { - resp, err := c.fc.LookupDirectoryEntry(ctx, &filerpb.LookupDirectoryEntryRequest{Directory: dir, Name: name}) - if err != nil { - if st, ok := status.FromError(err); ok { - if st.Code() == codes.NotFound || - (st.Code() == codes.Unknown && strings.Contains(st.Message(), filerNotFoundText)) { - return nil, ErrNotFound + return maintenanceCall(ctx, func(ctx context.Context) (*filerpb.Entry, error) { + resp, err := c.fc.LookupDirectoryEntry(ctx, &filerpb.LookupDirectoryEntryRequest{Directory: dir, Name: name}) + if err != nil { + if st, ok := status.FromError(err); ok { + if st.Code() == codes.NotFound || + (st.Code() == codes.Unknown && strings.Contains(st.Message(), filerNotFoundText)) { + return nil, ErrNotFound + } } + return nil, fmt.Errorf("chunkstore: lookup %s/%s: %w", dir, name, err) } - return nil, fmt.Errorf("chunkstore: lookup %s/%s: %w", dir, name, err) - } - if resp.GetEntry() == nil { - return nil, ErrNotFound - } - return resp.Entry, nil + if resp.GetEntry() == nil { + return nil, ErrNotFound + } + return resp.Entry, nil + }) } // CreateEntry implements Filer. A failed o_excl or condition is reported by // the filer in CreateEntryResponse.ErrorCode with a nil gRPC error. func (c *SWFS) CreateEntry(ctx context.Context, dir string, e *filerpb.Entry, oExcl bool) error { - resp, err := c.fc.CreateEntry(ctx, &filerpb.CreateEntryRequest{Directory: dir, Entry: e, OExcl: oExcl}) - if err != nil { - if status.Code(err) == codes.FailedPrecondition { - return fmt.Errorf("%w: create %s/%s: %v", ErrPrecondition, dir, e.GetName(), err) + return maintenanceError(ctx, func(ctx context.Context) error { + resp, err := c.fc.CreateEntry(ctx, &filerpb.CreateEntryRequest{Directory: dir, Entry: e, OExcl: oExcl}) + if err != nil { + if status.Code(err) == codes.FailedPrecondition { + return fmt.Errorf("%w: create %s/%s: %v", ErrPrecondition, dir, e.GetName(), err) + } + return fmt.Errorf("chunkstore: create %s/%s: %w", dir, e.GetName(), err) } - return fmt.Errorf("chunkstore: create %s/%s: %w", dir, e.GetName(), err) - } - switch resp.GetErrorCode() { - case filerpb.FilerError_OK: - if resp.GetError() != "" { - return fmt.Errorf("chunkstore: create %s/%s: %s", dir, e.GetName(), resp.GetError()) + switch resp.GetErrorCode() { + case filerpb.FilerError_OK: + if resp.GetError() != "" { + return fmt.Errorf("chunkstore: create %s/%s: %s", dir, e.GetName(), resp.GetError()) + } + return nil + case filerpb.FilerError_ENTRY_ALREADY_EXISTS: + return fmt.Errorf("%w: %s/%s", ErrExists, dir, e.GetName()) + case filerpb.FilerError_PRECONDITION_FAILED: + return fmt.Errorf("%w: create %s/%s", ErrPrecondition, dir, e.GetName()) + default: + return fmt.Errorf("chunkstore: create %s/%s: %s (%s)", dir, e.GetName(), resp.GetError(), resp.GetErrorCode()) } - return nil - case filerpb.FilerError_ENTRY_ALREADY_EXISTS: - return fmt.Errorf("%w: %s/%s", ErrExists, dir, e.GetName()) - case filerpb.FilerError_PRECONDITION_FAILED: - return fmt.Errorf("%w: create %s/%s", ErrPrecondition, dir, e.GetName()) - default: - return fmt.Errorf("chunkstore: create %s/%s: %s (%s)", dir, e.GetName(), resp.GetError(), resp.GetErrorCode()) - } + }) } // UpdateEntry implements Filer. A failed expected_extended comes back as gRPC // FailedPrecondition. Any other error is ambiguous (the write may or may not // have applied) and is returned unwrapped from the sentinels. func (c *SWFS) UpdateEntry(ctx context.Context, dir string, e *filerpb.Entry, expected map[string][]byte) error { - _, err := c.fc.UpdateEntry(ctx, &filerpb.UpdateEntryRequest{Directory: dir, Entry: e, ExpectedExtended: expected}) - if err == nil { - return nil - } - switch status.Code(err) { - case codes.FailedPrecondition: - return fmt.Errorf("%w: update %s/%s: %v", ErrPrecondition, dir, e.GetName(), err) - case codes.NotFound: - return fmt.Errorf("%w: update %s/%s", ErrNotFound, dir, e.GetName()) - } - return fmt.Errorf("chunkstore: update %s/%s: %w", dir, e.GetName(), err) + return maintenanceError(ctx, func(ctx context.Context) error { + _, err := c.fc.UpdateEntry(ctx, &filerpb.UpdateEntryRequest{Directory: dir, Entry: e, ExpectedExtended: expected}) + if err == nil { + return nil + } + switch status.Code(err) { + case codes.FailedPrecondition: + return fmt.Errorf("%w: update %s/%s: %v", ErrPrecondition, dir, e.GetName(), err) + case codes.NotFound: + return fmt.Errorf("%w: update %s/%s", ErrNotFound, dir, e.GetName()) + } + return fmt.Errorf("chunkstore: update %s/%s: %w", dir, e.GetName(), err) + }) } // ListEntries implements Filer: one ListEntries stream of at most limit // entries. The filer's not-found styles (gRPC NotFound, or its raw sentinel // crossing as Unknown) mean an empty listing; any other error fails it. func (c *SWFS) ListEntries(ctx context.Context, dir, prefix, startAfter string, limit uint32) ([]*filerpb.Entry, error) { - stream, err := c.fc.ListEntries(ctx, &filerpb.ListEntriesRequest{ - Directory: dir, Prefix: prefix, StartFromFileName: startAfter, InclusiveStartFrom: false, Limit: limit, - }) - if err != nil { - if isFilerNotFound(err) { - return nil, nil - } - return nil, fmt.Errorf("chunkstore: list %s: %w", dir, err) - } - var out []*filerpb.Entry - for { - resp, err := stream.Recv() - if errors.Is(err, io.EOF) { - return out, nil - } + return maintenanceCall(ctx, func(ctx context.Context) ([]*filerpb.Entry, error) { + stream, err := c.fc.ListEntries(ctx, &filerpb.ListEntriesRequest{ + Directory: dir, Prefix: prefix, StartFromFileName: startAfter, InclusiveStartFrom: false, Limit: limit, + }) if err != nil { - if isFilerNotFound(err) && len(out) == 0 { + if isFilerNotFound(err) { return nil, nil } return nil, fmt.Errorf("chunkstore: list %s: %w", dir, err) } - if resp.GetEntry() != nil { - out = append(out, resp.Entry) + var out []*filerpb.Entry + for { + resp, err := stream.Recv() + if errors.Is(err, io.EOF) { + return out, nil + } + if err != nil { + if isFilerNotFound(err) && len(out) == 0 { + return nil, nil + } + return nil, fmt.Errorf("chunkstore: list %s: %w", dir, err) + } + if resp.GetEntry() != nil { + out = append(out, resp.Entry) + } } - } + }) } // DeleteEntry implements Filer. The filer reclaims the file's chunks; the @@ -206,19 +214,21 @@ func (c *SWFS) ListEntries(ctx context.Context, dir, prefix, startAfter string, // FailedPrecondition; other failures are a gRPC error or the response's // Error string, and are returned unwrapped from the sentinels. func (c *SWFS) DeleteEntry(ctx context.Context, dir, name string, expected map[string][]byte) error { - resp, err := c.fc.DeleteEntry(ctx, &filerpb.DeleteEntryRequest{ - Directory: dir, Name: name, IsDeleteData: true, IsRecursive: false, ExpectedExtended: expected, - }) - if err != nil { - if status.Code(err) == codes.FailedPrecondition { - return fmt.Errorf("%w: delete %s/%s: %v", ErrPrecondition, dir, name, err) + return maintenanceError(ctx, func(ctx context.Context) error { + resp, err := c.fc.DeleteEntry(ctx, &filerpb.DeleteEntryRequest{ + Directory: dir, Name: name, IsDeleteData: true, IsRecursive: false, ExpectedExtended: expected, + }) + if err != nil { + if status.Code(err) == codes.FailedPrecondition { + return fmt.Errorf("%w: delete %s/%s: %v", ErrPrecondition, dir, name, err) + } + return fmt.Errorf("chunkstore: delete %s/%s: %w", dir, name, err) } - return fmt.Errorf("chunkstore: delete %s/%s: %w", dir, name, err) - } - if resp.GetError() != "" { - return fmt.Errorf("chunkstore: delete %s/%s: %s", dir, name, resp.GetError()) - } - return nil + if resp.GetError() != "" { + return fmt.Errorf("chunkstore: delete %s/%s: %s", dir, name, resp.GetError()) + } + return nil + }) } func isFilerNotFound(err error) bool { @@ -246,26 +256,28 @@ func assignErr(prefix string, err error) error { // auto-compress only fires for types it is sure about; octet-stream is // cleared to "" first, storage/needle/needle_parse_upload.go:116-119). func (c *SWFS) Put(ctx context.Context, data []byte) (string, error) { - ar, err := c.fc.AssignVolume(ctx, &filerpb.AssignVolumeRequest{ - Count: 1, - Collection: c.cfg.Collection, - Replication: c.cfg.Replication, - Path: c.cfg.AssignPath, - ExpectedDataSize: uint64(len(data)), + return maintenanceMutation(ctx, func(ctx context.Context) (string, error) { + ar, err := c.fc.AssignVolume(ctx, &filerpb.AssignVolumeRequest{ + Count: 1, + Collection: c.cfg.Collection, + Replication: c.cfg.Replication, + Path: c.cfg.AssignPath, + ExpectedDataSize: uint64(len(data)), + }) + if err != nil { + return "", assignErr("chunkstore: assign", err) + } + if ar.GetError() != "" { + return "", assignErr("chunkstore: assign", errors.New(ar.GetError())) + } + if ar.GetFileId() == "" || ar.GetLocation().GetUrl() == "" { + return "", fmt.Errorf("chunkstore: assign returned no fid/location") + } + if err := c.upload(ctx, ar.Location.Url, ar.FileId, ar.GetAuth(), ar.GetFsync(), data); err != nil { + return "", err + } + return ar.FileId, nil }) - if err != nil { - return "", assignErr("chunkstore: assign", err) - } - if ar.GetError() != "" { - return "", assignErr("chunkstore: assign", errors.New(ar.GetError())) - } - if ar.GetFileId() == "" || ar.GetLocation().GetUrl() == "" { - return "", fmt.Errorf("chunkstore: assign returned no fid/location") - } - if err := c.upload(ctx, ar.Location.Url, ar.FileId, ar.GetAuth(), ar.GetFsync(), data); err != nil { - return "", err - } - return ar.FileId, nil } // Get implements Blobs: resolve the fid's volume through the filer, then GET @@ -274,36 +286,38 @@ func (c *SWFS) Put(ctx context.Context, data []byte) (string, error) { // answers 404: cached locations can be stale after a volume moves, so their // 404s are followed by one fresh lookup. func (c *SWFS) Get(ctx context.Context, fid string) ([]byte, error) { - vid, _, ok := strings.Cut(fid, ",") - if !ok { - return nil, fmt.Errorf("chunkstore: bad fid %q", fid) - } - urls, cached, err := c.lookupVolume(ctx, vid) - if err != nil { - return nil, err - } - b, allNotFound, lastErr := c.getFromAll(ctx, urls, fid) - if lastErr == nil { - return b, nil - } - c.mu.Lock() - delete(c.vidCache, vid) - c.mu.Unlock() - if allNotFound && cached { - if urls, _, err = c.lookupVolume(ctx, vid); err != nil { + return maintenanceCall(ctx, func(ctx context.Context) ([]byte, error) { + vid, _, ok := strings.Cut(fid, ",") + if !ok { + return nil, fmt.Errorf("chunkstore: bad fid %q", fid) + } + urls, cached, err := c.lookupVolume(ctx, vid) + if err != nil { return nil, err } - if b, allNotFound, lastErr = c.getFromAll(ctx, urls, fid); lastErr == nil { + b, allNotFound, lastErr := c.getFromAll(ctx, urls, fid) + if lastErr == nil { return b, nil } c.mu.Lock() delete(c.vidCache, vid) c.mu.Unlock() - } - if allNotFound { - lastErr = &blobNotFoundError{lastErr} - } - return nil, fmt.Errorf("chunkstore: read %s: %w", fid, lastErr) + if allNotFound && cached { + if urls, _, err = c.lookupVolume(ctx, vid); err != nil { + return nil, err + } + if b, allNotFound, lastErr = c.getFromAll(ctx, urls, fid); lastErr == nil { + return b, nil + } + c.mu.Lock() + delete(c.vidCache, vid) + c.mu.Unlock() + } + if allNotFound { + lastErr = &blobNotFoundError{lastErr} + } + return nil, fmt.Errorf("chunkstore: read %s: %w", fid, lastErr) + }) } // getFromAll tries each location in turn. On failure lastErr is the last @@ -400,32 +414,34 @@ var ErrBlobDeleteRejected = errors.New("chunkstore: blob DELETE rejected") // and retries later; no response body is used to infer success. // SeaweedFS writeDeleteResult returns 202 after ReplicatedDelete completes. func (c *SWFS) DeleteBlob(ctx context.Context, fid string) error { - vid, needle, ok := strings.Cut(fid, ",") - if !ok || vid == "" || needle == "" || strings.ContainsAny(fid, "/\\?#% \r\n") { - return fmt.Errorf("chunkstore: bad deletion fid %q", fid) - } - urls, _, err := c.lookupVolume(ctx, vid) - if err != nil { - return err - } - for _, host := range urls { - req, err := http.NewRequestWithContext(ctx, http.MethodDelete, "http://"+host+"/"+fid, nil) + return maintenanceError(ctx, func(ctx context.Context) error { + vid, needle, ok := strings.Cut(fid, ",") + if !ok || vid == "" || needle == "" || strings.ContainsAny(fid, "/\\?#% \r\n") { + return fmt.Errorf("chunkstore: bad deletion fid %q", fid) + } + urls, _, err := c.lookupVolume(ctx, vid) if err != nil { return err } - resp, err := c.http.Do(req) - if err != nil { - return err + for _, host := range urls { + req, err := http.NewRequestWithContext(ctx, http.MethodDelete, "http://"+host+"/"+fid, nil) + if err != nil { + return err + } + resp, err := c.http.Do(req) + if err != nil { + return err + } + // Drain before close so the connection is reused. + _, _ = io.Copy(io.Discard, io.LimitReader(resp.Body, 64<<10)) + resp.Body.Close() + if resp.StatusCode == http.StatusBadRequest { + return fmt.Errorf("%w: delete %s: http %d", ErrBlobDeleteRejected, fid, resp.StatusCode) + } + if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusAccepted && resp.StatusCode != http.StatusNoContent && resp.StatusCode != http.StatusNotFound { + return fmt.Errorf("chunkstore: delete %s: http %d", fid, resp.StatusCode) + } } - // Drain before close so the connection is reused. - _, _ = io.Copy(io.Discard, io.LimitReader(resp.Body, 64<<10)) - resp.Body.Close() - if resp.StatusCode == http.StatusBadRequest { - return fmt.Errorf("%w: delete %s: http %d", ErrBlobDeleteRejected, fid, resp.StatusCode) - } - if resp.StatusCode != http.StatusOK && resp.StatusCode != http.StatusAccepted && resp.StatusCode != http.StatusNoContent && resp.StatusCode != http.StatusNotFound { - return fmt.Errorf("chunkstore: delete %s: http %d", fid, resp.StatusCode) - } - } - return nil + return nil + }) } diff --git a/seaweed-block/core/frontend/durable/maintenance_progress.go b/seaweed-block/core/frontend/durable/maintenance_progress.go new file mode 100644 index 0000000000..83541602ca --- /dev/null +++ b/seaweed-block/core/frontend/durable/maintenance_progress.go @@ -0,0 +1,101 @@ +package durable + +import ( + "context" + "errors" + "fmt" + "sync" + "time" + + "github.com/seaweedfs/seaweed-block/core/frontend/chunkstore/layout" + "github.com/seaweedfs/seaweed-block/core/storage" +) + +// ErrMaintenanceNoProgress is a pass that exhausted its inactivity window. +// Cancellation still joins the callback before the next pass can start. +var ErrMaintenanceNoProgress = errors.New("durable: maintenance no_progress") + +// maintenancePass has no total deadline. Only strict advancement of the finite +// pass cursor renews the window. Its progress state is constant-sized. +func maintenancePass(ctx context.Context, layer storage.ChunkLayer, current func() bool, window time.Duration, fn func(context.Context) error) error { + passCtx, cancel := context.WithCancelCause(ctx) + defer cancel(nil) + var mu sync.Mutex + last := time.Now() + var highest layout.MaintenancePosition + closed := false + var timer *time.Timer + stall := func() { cancel(fmt.Errorf("%w: %w", ErrMaintenanceNoProgress, context.DeadlineExceeded)) } + timer = time.AfterFunc(window, func() { + mu.Lock() + defer mu.Unlock() + if closed { + return + } + if left := window - time.Since(last); left > 0 { + timer.Reset(left) + return + } + stall() + }) + passCtx = layout.WithMaintenanceProgress(passCtx, func(position layout.MaintenancePosition) { + mu.Lock() + defer mu.Unlock() + if closed || passCtx.Err() != nil { + return + } + if time.Since(last) >= window { + stall() + return + } + if !position.After(highest) { + return + } + highest = position + last = time.Now() + timer.Reset(window) + if slot, _ := ctx.Value(maintenanceContextKey{}).(*maintenanceSlot); slot != nil { + slot.mu.Lock() + slot.result.Processed++ + slot.mu.Unlock() + } + }) + // This watcher belongs only to maintenance. It never holds the progress + // mutex while consulting storage, and is joined before the pass returns. + watchCtx, stopWatch := context.WithCancel(passCtx) + watchDone := make(chan struct{}) + go func() { + defer close(watchDone) + tick := time.NewTicker(chunkSchedulePoll) + defer tick.Stop() + for { + select { + case <-watchCtx.Done(): + return + case <-tick.C: + if layer.Fenced() || !current() { + cancel(context.Canceled) + return + } + } + } + }() + err := fn(passCtx) + stopWatch() + <-watchDone + mu.Lock() + if passCtx.Err() == nil && time.Since(last) >= window { + stall() + } + closed = true + timer.Stop() + cause := context.Cause(passCtx) + mu.Unlock() + if errors.Is(cause, ErrMaintenanceNoProgress) { + return cause + } + if err == nil { + return cause + } + return err +} diff --git a/seaweed-block/core/frontend/durable/maintenance_progress_test.go b/seaweed-block/core/frontend/durable/maintenance_progress_test.go new file mode 100644 index 0000000000..2c591eda87 --- /dev/null +++ b/seaweed-block/core/frontend/durable/maintenance_progress_test.go @@ -0,0 +1,212 @@ +package durable + +import ( + "context" + "errors" + "github.com/seaweedfs/seaweed-block/core/frontend/chunkstore/layout" + "runtime" + "sync/atomic" + "testing" + "testing/synctest" + "time" +) + +// Exercises the running provider loop and its public pass result, not a timer alone. +func TestMaintenanceProgressingPastOneMinuteCompletes(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + layer := maintenanceStubLayer{} + slot := &maintenanceSlot{} + p := &DurableProvider{volumes: map[string]*volHandle{"v1": {chunk: layer, maintenance: slot}}, cfg: ProviderConfig{ + ChunkMaintenanceInterval: time.Hour, ChunkMaintenanceTimeout: time.Minute, + ChunkMaintenance: func(ctx context.Context, _ string) error { + for i := 0; i < 6; i++ { + select { + case <-ctx.Done(): + return ctx.Err() + case <-time.After(15 * time.Second): + } + layout.ReportMaintenanceStep(ctx, 1, uint64(i+1)) + } + return nil + }, + }} + ctx, cancel := context.WithCancel(context.Background()) + done := make(chan struct{}) + kick := make(chan struct{}, 1) + go func() { + defer close(done) + p.chunkMaintenanceLoop(ctx, "v1", layer, func() bool { return true }, kick, nil) + }() + defer func() { cancel(); <-done }() + kick <- struct{}{} + time.Sleep(95 * time.Second) + synctest.Wait() + got := slot.status() + if got.PassesOK < 1 || got.InProgress || got.LastPass.Processed != 6 { + t.Fatalf("progressing 90s pass must complete beyond the 1min window: %+v", got) + } + }) +} + +func TestMaintenanceRepeatedPositionDoesNotHideAStall(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + start := time.Now() + err := maintenancePass(context.Background(), maintenanceStubLayer{}, func() bool { return true }, time.Minute, func(ctx context.Context) error { + layout.ReportMaintenanceStep(ctx, 1, 1) + guard := time.After(2 * time.Minute) + for { + select { + case <-guard: + return errors.New("duplicate-progress test guard") + case <-ctx.Done(): + return ctx.Err() + case <-time.After(10 * time.Second): + layout.ReportMaintenanceStep(ctx, 1, 1) + } + } + }) + if !errors.Is(err, ErrMaintenanceNoProgress) || time.Since(start) != time.Minute { + t.Fatalf("repeated object renewed stall: elapsed=%v err=%v", time.Since(start), err) + } + }) +} + +func TestMaintenanceSilentPassReturnsTypedNoProgress(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + start := time.Now() + err := maintenancePass(context.Background(), maintenanceStubLayer{}, func() bool { return true }, time.Minute, func(ctx context.Context) error { + <-ctx.Done() + layout.ReportMaintenanceStep(ctx, 1, 1) + // Even a late completion and a callback that loses its cancellation error cannot report success. + return nil + }) + if !errors.Is(err, ErrMaintenanceNoProgress) || time.Since(start) != time.Minute { + t.Fatalf("silent pass: elapsed=%v err=%v", time.Since(start), err) + } + }) +} + +func TestMaintenanceReplayedPhaseCannotRenewWindow(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + start := time.Now() + err := maintenancePass(context.Background(), maintenanceStubLayer{}, func() bool { return true }, time.Minute, func(ctx context.Context) error { + old := layout.WithMaintenancePhase(ctx, layout.MaintenanceRetention) + layout.ReportMaintenanceStep(old, 1, 100) + time.Sleep(30 * time.Second) + next := layout.WithMaintenancePhase(ctx, layout.MaintenanceSweep) + layout.ReportMaintenanceStep(next, 1, 1) + guard := time.After(2 * time.Minute) + for { + select { + case <-guard: + return errors.New("replay-progress test guard") + case <-ctx.Done(): + return ctx.Err() + case <-time.After(10 * time.Second): + layout.ReportMaintenanceStep(old, 1, 999) + } + } + }) + if !errors.Is(err, ErrMaintenanceNoProgress) || time.Since(start) != 90*time.Second { + t.Fatalf("replayed phase renewed: %v %v", time.Since(start), err) + } + }) +} + +func TestMaintenanceFiniteStagesCanCompleteAcrossWindow(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + start := time.Now() + err := maintenancePass(context.Background(), maintenanceStubLayer{}, func() bool { return true }, time.Minute, func(ctx context.Context) error { + for stage := uint64(1); stage <= 3; stage++ { + time.Sleep(30 * time.Second) + layout.ReportMaintenanceStep(ctx, stage, 1) + } + return nil + }) + if err != nil || time.Since(start) != 90*time.Second { + t.Fatalf("finite phase advance: %v %v", time.Since(start), err) + } + }) +} + +func TestMaintenanceProgressStateDoesNotAllocatePerObject(t *testing.T) { + allocations := func(objects uint64) float64 { + return testing.AllocsPerRun(1, func() { + err := maintenancePass(context.Background(), maintenanceStubLayer{}, func() bool { return true }, time.Minute, func(ctx context.Context) error { + for i := uint64(1); i <= objects; i++ { + layout.ReportMaintenanceStep(ctx, 1, i) + } + return nil + }) + if err != nil { + t.Fatal(err) + } + }) + } + small, cap := allocations(32), allocations(2_900_000) + t.Logf("watchdog allocations: 32 positions %.0f; 2900000 positions %.0f", small, cap) + if cap > small+32 { + t.Fatalf("progress allocates with object count: small %.0f cap %.0f", small, cap) + } +} + +type maintenanceFenceAfterAdmission struct { + maintenanceStubLayer + fenced atomic.Bool +} + +func (l *maintenanceFenceAfterAdmission) Fenced() bool { return l.fenced.Load() } +func TestMaintenanceFenceWithNilSettlementDoesNotCountSuccess(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + layer := &maintenanceFenceAfterAdmission{} + slot := &maintenanceSlot{} + p := &DurableProvider{volumes: map[string]*volHandle{"v1": {chunk: layer, maintenance: slot}}, cfg: ProviderConfig{ + ChunkMaintenanceInterval: time.Hour, ChunkMaintenanceTimeout: time.Minute, + ChunkMaintenance: func(ctx context.Context, _ string) error { layer.fenced.Store(true); <-ctx.Done(); return nil }, + }} + ctx, cancel := context.WithCancel(context.Background()) + done := make(chan struct{}) + kick := make(chan struct{}, 1) + go func() { + defer close(done) + p.chunkMaintenanceLoop(ctx, "v1", layer, func() bool { return true }, kick, nil) + }() + defer func() { cancel(); <-done }() + kick <- struct{}{} + time.Sleep(time.Second) + synctest.Wait() + got := slot.status() + if got.PassesOK != 0 || got.InProgress || got.LastPass == nil || got.LastPass.Error != context.Canceled.Error() { + t.Fatalf("fenced nil settlement reported success: %+v", got) + } + }) +} + +// Sample live bytes while the observer/context and watchdog are still alive. +// Allocation counts alone would miss one large preallocated retention array. +func TestMaintenanceProgressRetainedBytesStayBounded(t *testing.T) { + measure := func(objects uint64) int64 { + runtime.GC() + var before, live runtime.MemStats + runtime.ReadMemStats(&before) + err := maintenancePass(context.Background(), maintenanceStubLayer{}, func() bool { return true }, time.Minute, func(ctx context.Context) error { + for i := uint64(1); i <= objects; i++ { + layout.ReportMaintenanceStep(ctx, 1, i) + } + runtime.GC() + runtime.ReadMemStats(&live) + runtime.KeepAlive(ctx) // retain the observer, including any bad hidden history + return nil + }) + if err != nil { + t.Fatal(err) + } + return int64(live.HeapAlloc) - int64(before.HeapAlloc) + } + small, cap := measure(32), measure(2_900_000) + const noiseAndRuntimeBudget = int64(1 << 20) + t.Logf("live watchdog HeapAlloc delta: 32 positions %d B; 2900000 positions %d B", small, cap) + if small > noiseAndRuntimeBudget || cap > noiseAndRuntimeBudget || cap-small > noiseAndRuntimeBudget { + t.Fatalf("progress retains volume-sized history: small=%d B cap=%d B budget=%d B", small, cap, noiseAndRuntimeBudget) + } +} diff --git a/seaweed-block/core/frontend/durable/maintenance_status.go b/seaweed-block/core/frontend/durable/maintenance_status.go index 0508610cb1..000cf7c145 100644 --- a/seaweed-block/core/frontend/durable/maintenance_status.go +++ b/seaweed-block/core/frontend/durable/maintenance_status.go @@ -2,6 +2,7 @@ package durable import ( "context" + "errors" "strings" "sync" "time" @@ -19,6 +20,8 @@ type MaintenanceStatus struct { // MaintenancePassStatus describes the last completed or failed pass. type MaintenancePassStatus struct { + Processed int64 `json:"processed"` // strict completed-work cursor advances in this pass + ErrorCode string `json:"errorCode,omitempty"` // no_progress when the inactivity window ends SkipReason layout.ListRetirementSkipReason `json:"skipReason,omitempty"` // conservative list-page retirement skip; never changes serving or the pass outcome AtNs int64 `json:"atNs"` // unix ns when the pass ended Planned int64 `json:"planned"` // all objects considered for removal @@ -52,6 +55,7 @@ func ReportMaintenance(ctx context.Context, result MaintenancePassStatus) { } slot.mu.Lock() defer slot.mu.Unlock() + result.Processed = slot.result.Processed slot.result = result } func (m *maintenanceSlot) begin() { @@ -66,6 +70,9 @@ func (m *maintenanceSlot) end(err error) { m.result.AtNs = time.Now().UnixNano() if err != nil { m.result.Error = err.Error() + if errors.Is(err, ErrMaintenanceNoProgress) { + m.result.ErrorCode = "no_progress" + } } else { m.s.PassesOK++ } diff --git a/seaweed-block/core/frontend/durable/provider.go b/seaweed-block/core/frontend/durable/provider.go index 7cf5d6654c..17a442f106 100644 --- a/seaweed-block/core/frontend/durable/provider.go +++ b/seaweed-block/core/frontend/durable/provider.go @@ -233,8 +233,9 @@ type ProviderConfig struct { // Maintenance runs serially for an attached healthy volume. Zero interval disables // it. Callback ownership ends only after cancellation and worker settlement. ChunkMaintenanceInterval time.Duration - ChunkMaintenanceTimeout time.Duration - ChunkMaintenance func(context.Context, string) error + // ChunkMaintenanceTimeout is the no-progress window, not a total pass bound. + ChunkMaintenanceTimeout time.Duration + ChunkMaintenance func(context.Context, string) error // ChunkSnapshotPeriod schedules a named snapshot of each attached // healthy volume on its stable per-volume grid after HEAD's latest snapshot // (zero disables it; no history means due now). ChunkScheduledSnapshot diff --git a/seaweed-block/core/frontend/durable/provider_chunk.go b/seaweed-block/core/frontend/durable/provider_chunk.go index 7fbd0e654b..86b14c3d9d 100644 --- a/seaweed-block/core/frontend/durable/provider_chunk.go +++ b/seaweed-block/core/frontend/durable/provider_chunk.go @@ -1436,26 +1436,24 @@ func (p *DurableProvider) chunkMaintenanceLoop(ctx context.Context, volumeID str if timeout <= 0 { timeout = time.Minute } - err := boundedPass(ctx, layer, current, timeout, func(passCtx context.Context) error { - p.mu.Lock() - h := p.volumes[volumeID] - var slot *maintenanceSlot - if h != nil && h.chunk == layer { - slot = h.maintenance - } - p.mu.Unlock() - if slot == nil { - return p.cfg.ChunkMaintenance(passCtx, volumeID) - } + p.mu.Lock() + h := p.volumes[volumeID] + var slot *maintenanceSlot + if h != nil && h.chunk == layer { + slot = h.maintenance + } + p.mu.Unlock() + passCtx := ctx + if slot != nil { slot.begin() - err := p.cfg.ChunkMaintenance(context.WithValue(passCtx, maintenanceContextKey{}, slot), volumeID) - observedErr := err - if observedErr == nil { - observedErr = passCtx.Err() - } - slot.end(observedErr) - return err + passCtx = context.WithValue(ctx, maintenanceContextKey{}, slot) + } + err := maintenancePass(passCtx, layer, current, timeout, func(passCtx context.Context) error { + return p.cfg.ChunkMaintenance(passCtx, volumeID) }) + if slot != nil { + slot.end(err) + } if err == nil && observed != nil { seen = observed } diff --git a/seaweed-block/core/frontend/durable/provider_maintenance_test.go b/seaweed-block/core/frontend/durable/provider_maintenance_test.go index 1f4c1f30bf..ea431cda0f 100644 --- a/seaweed-block/core/frontend/durable/provider_maintenance_test.go +++ b/seaweed-block/core/frontend/durable/provider_maintenance_test.go @@ -126,7 +126,7 @@ func TestMaintenanceAuthorityLossCancelsHeldPass(t *testing.T) { } } -func TestMaintenancePassHasOneDeadline(t *testing.T) { +func TestMaintenancePassHasOneNoProgressWindow(t *testing.T) { entered := make(chan error, 1) three := make(chan struct{}) var completed atomic.Int32 @@ -136,7 +136,7 @@ func TestMaintenancePassHasOneDeadline(t *testing.T) { ChunkMaintenance: func(ctx context.Context, _ string) error { <-ctx.Done() select { - case entered <- ctx.Err(): + case entered <- context.Cause(ctx): default: } if completed.Add(1) == 3 { @@ -175,7 +175,7 @@ func TestMaintenancePassHasOneDeadline(t *testing.T) { } select { case err := <-entered: - if !errors.Is(err, context.DeadlineExceeded) { + if !errors.Is(err, durable.ErrMaintenanceNoProgress) { t.Fatal(err) } default: diff --git a/seaweed-block/core/host/volume/chunk_control.go b/seaweed-block/core/host/volume/chunk_control.go index 0122b7283d..4b974c0a93 100644 --- a/seaweed-block/core/host/volume/chunk_control.go +++ b/seaweed-block/core/host/volume/chunk_control.go @@ -427,6 +427,8 @@ func chunkErrorCode(err error) (int, string, bool) { return http.StatusServiceUnavailable, chunkstore.CodeRemoteFull, true case errors.Is(err, layout.ErrQueueFull): return http.StatusConflict, chunkstore.CodeQueueFull, true + case errors.Is(err, layout.ErrBusy): + return http.StatusConflict, "layout_busy", true case errors.Is(err, storage.ErrChunkRemoteUnavailable): return http.StatusServiceUnavailable, chunkstore.CodeRemoteUnavailable, true case errors.Is(err, durable.ErrNotChunkVolume), errors.Is(err, durable.ErrVolumeNotOpen): diff --git a/seaweed-block/core/host/volume/chunk_layout_busy_test.go b/seaweed-block/core/host/volume/chunk_layout_busy_test.go new file mode 100644 index 0000000000..6359f3a38d --- /dev/null +++ b/seaweed-block/core/host/volume/chunk_layout_busy_test.go @@ -0,0 +1,37 @@ +package volume + +import ( + "encoding/json" + "errors" + "fmt" + "net/http" + "testing" + + "github.com/seaweedfs/seaweed-block/core/frontend/chunkstore/layout" + "github.com/seaweedfs/seaweed-block/core/storage" +) + +func TestSnapshotDeleteLayoutBusyIsTypedRetryable(t *testing.T) { + for _, tc := range []struct { + name string + err error + code string + status int + }{ + {"open clean transaction", fmt.Errorf("delete: %w", layout.ErrBusy), "layout_busy", http.StatusConflict}, + {"queue full remains specific", layout.ErrQueueFull, "queue_full", http.StatusConflict}, + {"unknown publication wins", errors.Join(storage.ErrChunkCASOutcomeUnknown, layout.ErrBusy), "outcome_unknown", http.StatusServiceUnavailable}, + } { + t.Run(tc.name, func(t *testing.T) { + s := chunkServer(t, &fakeChunkControl{err: tc.err}, true) + w := serve(t, s, http.MethodPost, "/chunk/snapshot/delete", `{"volumeID":"v1","name":"s11"}`, "") + var answer chunkErrorBody + if err := json.Unmarshal(w.Body.Bytes(), &answer); err != nil { + t.Fatal(err) + } + if w.Code != tc.status || answer.Code != tc.code || !answer.Retryable { + t.Fatalf("delete answer: HTTP %d %+v; want HTTP %d %s retryable", w.Code, answer, tc.status, tc.code) + } + }) + } +} diff --git a/seaweed-block/docs/design/invariants.md b/seaweed-block/docs/design/invariants.md index f6d5d87d95..f813cd1681 100644 --- a/seaweed-block/docs/design/invariants.md +++ b/seaweed-block/docs/design/invariants.md @@ -542,7 +542,7 @@ open) re-arms after 30 s instead of the interval. The cleaning is on by default 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 the cleaning; retention failure skips the cleaning. +A pass has no total deadline. Its one-minute no-progress window renews only on a strict advance of this pass's finite (phase, cursor) work position; a stalled pass answers `no_progress`. Each remote request has a separate 30 s deadline; request attempts never renew the window. The existing cursor resumes later; retention failure skips 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. @@ -1125,6 +1125,9 @@ Notes: | `INV-HOST-CUT-BUDGET-001` | A cooperating cut process holds a host OS slot from its admission, before staging or the capture barrier: see M7 free → admitted. | M7 free → admitted | `core/hostlimit/limiter.go` `Admit`; `core/storage/chunk_cut_budget.go`; blockvolume host-limit flags | `TestSlotsUrgentAndJoinedRelease` (`core/hostlimit/limiter_test.go`); `TestHostCutLimitDoesNotGateGuestIO` (`core/frontend/durable/host_limit_test.go`) | `HostBudget` HeldUntilJoined/PayloadBound/SpillBound (bounded OS-lock abstraction; fallback excluded) | ACTIVE | | `INV-HOST-CUT-BUDGET-RESERVE-001` | Each admitted slot, urgent included, carries at most PayloadBytes of cut payload and at most COWBytes of COW side bytes; a reservation beyond COWBytes revokes the slot and aborts its cut. | M7 admitted | `core/hostlimit/limiter.go` `Admit`, `ReserveCOW`; `core/storage/chunk_cut_budget.go` | `TestHostCOWCapAbortsCutAndRetainsPermitUntilJoin` (`core/storage/chunk_host_budget_test.go`); `TestSlotsUrgentAndJoinedRelease` (`core/hostlimit/limiter_test.go`) | `HostBudget` PayloadBound/SpillBound | ACTIVE | | `INV-HOST-CUT-BUDGET-SETTLE-001` | A slot's OS lock is released only after its cut's workers settle and Release is called; cancellation, hold expiry and limiter Close abort the cut but keep the slot until then. | M7 draining → joined → released | `core/hostlimit/limiter.go` `Release`, `releaseLoop`, `revoke`, `Close`; `core/storage/chunk_layer.go` `captureLocked` | `TestCOWAbortHoldsSlotUntilWorkerSettlement`, `TestHoldExpiryAndCloseDoNotSteal`, `TestKilledProcessReleasesButLiveHolderDoesNot` (`core/hostlimit/limiter_test.go`); `TestHostCOWCapAbortsCutAndRetainsPermitUntilJoin` (`core/storage/chunk_host_budget_test.go`) | `HostBudget` HeldUntilJoined | ACTIVE | +| `INV-MAINTENANCE-BATCH-001` | Cleaning releases HEAD activity after min(1000 decisions, 5 s), checked between decisions. Preparation normally stays outside; re-entry validates its HEAD. Unknown close settles before cursor advancement. Busy answers are typed retryable layout_busy. | M8 Running → Running | `core/frontend/chunkstore/clean_b.go` `endCleanBatch`; `core/frontend/chunkstore/layout/remove.go` `ResetReachability` | `TestMaintenanceFiveSecondBatchLetsSnapshotDeleteFinish`, `TestMaintenanceSlowPreparationDoesNotHoldSession`, `TestMaintenanceBatchRefusesPublicationAfterPreparation`, `TestMaintenanceBatchPreparationAbsentHeadRefuses`, `TestMaintenanceLongPassReleasesLayoutBetweenBatches`, `TestMaintenanceBatchDropsReachabilityAfterPublication`, `TestMaintenanceBatchSettlesUnknownCloseBeforeReentry`, `TestMaintenanceDelayedClosePublicationInvalidatesNextPage`, `TestSnapshotDeleteLayoutBusyIsTypedRetryable`, `TestSnapshotDeleteCLILayoutBusyIsTypedRetryable`, `TestSnapshotDeleteCLIRetriesBusyWithSameIdentityWithinWindow` | SnapshotRemoval BeginClean/EndClean; StaleClean r2 159-161; r2.950(2), r2.955 | STUB | +| `INV-MAINTENANCE-LIVENESS-001` | Three refusals without advancing the stuck page arm activity-held preparation for every revisit until that position advances. Its reads share the session hold cap. A waiting same-catalog publisher enters before the next batch; cancellation withdraws its mark. | M8 Running -> Running | `core/frontend/chunkstore/clean_b.go` `RemoveUnreachableAll`; `core/frontend/chunkstore/clean_admission.go`; `core/frontend/chunkstore/layout_remote.go` `beginSessionLocked` | `TestMaintenanceRepeatedPreparationPublicationFallsBackAfterThreeRefusals`, `TestMaintenanceFallbackPreparationSharesSessionCap`, `TestMaintenanceWaitingPublisherRunsBeforeNextBatch`, `TestMaintenanceCancelledPublisherWithdrawsItsMark`, `TestMaintenanceRetainPublisherPrecedesANewCleanPass`, `TestMaintenanceNestedCatalogPublishersDoNotSelfDeadlock`, `TestMaintenancePartialMultiVolumeAdmissionUnwindsOnCancellation`, `TestMaintenanceReleasedBatchContextCannotBypassANewBatch`, `TestMaintenanceCrossVolumeCallbackDoesNotWaitWhileHoldingAClean`, `TestBCatalog_OperatorSnapshotDeleteDuringACleaning` | CleanBatch r2 NoStarve / HoldCap / PubWaitOne; r2.956 | STUB | +| `INV-MAINTENANCE-NO-PROGRESS-001` | Maintenance has no total deadline. Only a strict advance of the finite (phase, cursor) work position renews its window; requests are separately bounded. No progress for the window fails typed no_progress; cancellation joins before release and the existing cursor resumes later. | M8 Running → Armed | `core/frontend/durable/maintenance_progress.go` `maintenancePass`; `core/frontend/chunkstore/layout/remove.go` `removePlanned`; `core/frontend/chunkstore/maintenance_request.go` `maintenanceCall` | `TestMaintenanceProgressingPastOneMinuteCompletes`, `TestMaintenanceRepeatedPositionDoesNotHideAStall`, `TestMaintenanceSilentPassReturnsTypedNoProgress`, `TestCleaningReportsProcessedObjects`, `TestRealMaintenanceProgressingPastOneMinuteCompletes`, `TestRealMaintenancePreparationAndRemovalEachOutliveWindow`, `TestMaintenanceListPreparationReportsOnlyAuthenticatedPages`, `TestMaintenanceReachabilityProgressesAcrossTheWindow`, `TestMaintenanceLookupRetriesItsOwnDeadlineWithoutProgress`, `TestMaintenanceReplayedPhaseCannotRenewWindow`, `TestMaintenanceFiniteStagesCanCompleteAcrossWindow`, `TestMaintenanceTagPositionCountsCompletedWorkOnly`, `TestMaintenanceIntentCursorAdvancesAcrossPages`, `TestMaintenanceProgressStateDoesNotAllocatePerObject`, `TestMaintenanceProgressRetainedBytesStayBounded`, `TestMaintenanceFenceWithNilSettlementDoesNotCountSuccess`, `TestMaintenanceUnknownCreateKeepsLinkedUploadAndSettles`, `TestMaintenanceBlobPutDoesNotRepeatUnknownAssignment` | CutTime window rule; GRID-v11-r8 maintenance pass × wall time | STUB | | `INV-HOST-HOLD-NO-PROGRESS-001` | A held slot is revoked only after its no-progress window passes with no reported progress of its work (a chunk compared, staged or uploaded by its cut): work that keeps progressing is never revoked, and a stalled hold is revoked within the window. | M7 admitted → draining (revoked) | `core/hostlimit/limiter.go` `Admit`, `Progress`, `expire`; `core/storage/chunk_cut_budget.go` `BudgetProgress`, `budgetProgress`; `core/storage/chunk_cut_observation.go` `progressed`; `core/storage/chunk_layer.go` `captureLocked` | `TestStalledHoldIsRevokedWithinTheWindow`, `TestProgressRenewsTheHold` (`core/hostlimit/limiter_progress_test.go`); `TestProgressRacingTheExpiryIsHonoured`, `TestProgressDoesNotWaitForTheLimiterLock`, `TestProgressStampIsMonotonicElapsed` (`core/hostlimit/limiter_review_test.go`); `TestCutReportsProgressToItsBudget` (`core/storage/chunk_cut_hold_progress_test.go`) | SlotShare (its progress-window rule; the share rule is a later change) | ACTIVE | | `INV-HOST-FETCH-CAP-001` | A chunk fetch holds one of the host's FetchSlots across its remote read only; a limiter's first fetch checks the host configuration (ErrConfig on a mismatch). With all held it waits, never refused: unordered, bounded by its context alone. Only non-blocking tries: an ended wait leaves nothing. | M7 (fetch slots, beside the cut slots) | `core/hostlimit/fetch.go` `HoldFetch`, `checkFetchConfig`, `waitFetch`; `core/hostlimit/limiter.go` `configGuard`; `core/storage/chunk_layer.go` `fillOnce`; `core/storage/chunk_cut_budget.go` `BudgetFetch` | `TestHoldFetchTakesAFreeSlotAtOnce`, `TestHoldFetchCapHoldsAcrossLimiters`, `TestHoldFetchAWaiterThatGivesUpLeavesNoSlotHeld`, `TestHoldFetchTakesAnotherSlotThatFreesFirst` (`core/hostlimit/fetch_test.go`); `TestHoldFetchFirstFetchChecksTheHostConfiguration`, `TestHoldFetchSlotDiesWithItsProcess`, `TestHoldFetchEndedWaitsLeaveNothingBehind`, `TestHoldFetchCancelledAtTheHandoffHoldsNothing`, `TestHoldFetchAPassedWaiterEndsByItsDeadline` (`core/hostlimit/fetch_review_test.go`); `TestChunkFetchHoldsAHostSlotAroundItsRemoteRead` (`core/storage/chunk_fetch_cap_test.go`) | — (a resource cap with no state of its own) | ACTIVE | | `INV-HOST-CUT-YIELD-001` | A Normal hold at least YieldAfter old yields its slot at its cut's next staging batch only while another cut on the host holds a live ticket it has not judged stalled; the attempt ends as yielded, never a failure, and keeps what it staged. A lone or urgent hold never yields. | M7 admitted → released (yielded) | `core/hostlimit/limiter.go` `ShouldYield`, `waiterLive`; `core/storage/chunk_layer.go` `stage`; `core/storage/chunk_cut_budget.go` `ErrCutYielded`, `budgetYield`; `core/frontend/durable/provider_chunk.go` `cutPolicy.after` | `TestShouldYieldOnlyAfterSWithALiveWaiter` (`core/hostlimit/yield_test.go`); `TestCutYieldsAtABatchBoundaryAndKeepsItsStaging` (`core/storage/chunk_cut_yield_test.go`); `TestChunkLoop_AYieldIsRetriedAtOnceAndCountedApart` (`core/frontend/durable/cut_loop_yield_test.go`) | SlotShareN (yield on the waiting probe, a new ticket at the back); SlotShare rows 189 to 193 | ACTIVE | @@ -1200,7 +1203,7 @@ 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-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`, `TestMaintenancePassHasOneNoProgressWindow`, `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 | @@ -1349,7 +1352,7 @@ Notes: | `INV-SNAPK-REMOVE-STOP-001` | A reuse of an object after the plan, or after the mark, makes the remover's mark or delete fail its condition, however late it lands; an unreadable root stops the pass before any write; an open snapshot refuses it. | M9 clean → clean (RemoveUnreachable) | `core/frontend/chunkstore/layout` `remove.go` `Cleaner.removePlanned` | `TestRemoveUnreachable_ASuccessorAfterTheHeadViewDefeatsTheMark`, `TestRemoveUnreachable_ASuccessorBeforeTheHeadViewStopsThePass`, `TestRemoveUnreachable_AReuseAfterThePlanDefeatsTheMark`, `TestRemoveUnreachable_AReuseDefeatsALateMarkOrDelete`, `TestRemoveUnreachable_NothingRemovedOnAPartialView`, `TestRemoveUnreachable_RefusedOutsideItsCleaning` | CommitReach rows 65-70; CommitReach2 rows 71-75 (CPlan, CView, CIssueMark/LandMark, CIssueDel/LandDel; model-code trace) | ACTIVE | | `INV-SNAPK-REMOVE-CONVERGE-001` | A name a cleaning marked and did not delete (the remover died in between) is planned again by the next cleaning: the re-mark replaces the old mark, so the dead remover's late delete fails, and every unreachable name goes once a cleaning completes. | M9 clean → clean | `core/frontend/chunkstore/layout` `remove.go` `Cleaner.removePlanned` | `TestRemoveUnreachable_ReclaimsAnAbandonedMark`, `TestCleaningPass_InterruptAtEveryStep`, `TestLayoutStoreCleaningReclaimsAnAbandonedMark` | CommitReach rows 65-70; CommitReach2 rows 71-75 (CPlan, CView, CIssueMark/LandMark, CIssueDel/LandDel; model-code trace) | ACTIVE | | `INV-SNAPK-REMOVE-GUARD-001` | A source scan requires DeleteMarked as Cleaner.removePlanned's only removal, each immediately after an if on its Mark's error that leaves: an unconditional delete, an ignored mark, a reused mark or another method fails. | M9 clean → clean (RemoveUnreachable) | `core/frontend/chunkstore/layout` (source scan of `remove.go`) | `TestGuard_WritersTransitionsAndRemovers`, `TestGuard_Controls` | CommitReach rows 65-70; CommitReach2 rows 71-75 (CPlan, CView, CIssueMark/LandMark, CIssueDel/LandDel; model-code trace) | ACTIVE | -| `INV-SNAPK-REUSE-001` | Writing an object for a session creates it, or reuses an existing one by a conditional update that sets the session and clears any mark; a commit names only objects its session wrote or reused, unmarked. | M9 snap → idle (Upload, Commit) | `core/frontend/chunkstore/layout` `objects.go` `EnsureObject`; `commit.go` `RunCommit` | `TestEnsureObject`, `TestRunCommit_NeedsObjectsOfItsOwnSession`, `TestSnapshotSession_InterruptAtEveryStep`, `TestLayoutStoreCreateExistsReclaimsOnlyItsUnusedUpload`, `TestLayoutStoreCreateUnknownOutcomeKeepsItsUpload` | — (the snapshot kernel model is not in this repository) | ACTIVE | +| `INV-SNAPK-REUSE-001` | Writing an object for a session creates it, or reuses an existing one by a conditional update that sets the session and clears any mark; a commit names only objects its session wrote or reused, unmarked. | M9 snap → idle (Upload, Commit) | `core/frontend/chunkstore/layout` `objects.go` `EnsureObject`; `commit.go` `RunCommit` | `TestEnsureObject`, `TestRunCommit_NeedsObjectsOfItsOwnSession`, `TestSnapshotSession_InterruptAtEveryStep`, `TestLayoutStoreCreateExistsReclaimsOnlyItsUnusedUpload`, `TestLayoutStoreCreateUnknownOutcomeKeepsItsUpload`, `TestMaintenanceUnknownCreateKeepsLinkedUploadAndSettles` | — (the snapshot kernel model is not in this repository) | ACTIVE | | `INV-START-LAYOUT-ID-001` | The launcher's full layout id must match VOLUME and HEAD, even when id8 collides; mismatch is ErrIdentity and startup exits 78 without claiming or serving. The flag comes from the master's volume record. | M9 Start refusal | `core/frontend/chunkstore/layout_create.go` `ReadVolumeRecord`; `core/frontend/chunkstore/layout_store.go` `ReadHead`; `core/frontend/durable/provider_startup.go`; `cmd/blockvolume/process_exit.go`; `core/lifecycle/workload_plan.go` | `TestLayoutIDMismatchIsTypedAndExits78`; `TestLauncherCarriesTheMasterLayoutIdentity`; `TestG15d_WorkloadPlan_BlankPoolRF2CreatesReplicaWorkloads` | K1; full identity, not the directory suffix | ACTIVE | | `INV-SNAPK-IDENTITY-001` | A volume is identified by the random id in its VOLUME record, never by its name alone; HEAD carries the volume id and refuses to encode without it. | Content-named layout; M9 every transition | `core/frontend/chunkstore/layout` `volume.go` `Volume`, `VolumeID`; `head.go` `Head.check` | `TestVolumeID_RandomAndParsed`, `TestVolume_GoldenEncodingRoundTrip`, `TestHead_GoldenEncodingRoundTrip`, `TestHead_Refusals` | — (the snapshot kernel model is not in this repository) | ACTIVE | | `INV-SNAPK-HEAD-ID-001` | HEAD is decoded only for the volume whose VOLUME carries its volume id; a HEAD of another id, left by an interrupted delete or an old restore under a reused name, is ErrIdentity; a holder without a claim id is malformed. | M9 every transition | `core/frontend/chunkstore/layout` `head.go` `DecodeHead`, `Head.check` | `TestDecodeHead_RefusesAnotherVolumesHead`, `TestHead_HolderNeedsAClaimID` | — (the snapshot kernel model is not in this repository) | ACTIVE | diff --git a/seaweed-block/docs/maintenance-admission.md b/seaweed-block/docs/maintenance-admission.md new file mode 100644 index 0000000000..1775fcdd32 --- /dev/null +++ b/seaweed-block/docs/maintenance-admission.md @@ -0,0 +1,94 @@ +# Maintenance admission boundaries + +Admission is process-local scheduling for one `BCatalog` and a full volume +identity. It never adds an activity-idle guard or replaces a holder check, +session, conditional HEAD write, or conditional Mark/Delete. Retain and legacy +snapshot deletion remain legal during `ActClean` in the kernel. + +## Publisher entries + +A publisher is a same-catalog non-cleaner HEAD publication, including one the +kernel permits during cleaning. Register for an acquisition or one bounded +publication, never for the surrounding multi-step operation. + +| Entry | Registration lifetime | +|---|---| +| `LayoutRemote.beginSessionLocked` | session acquisition, after cancelling and joining its own cleaner | +| `BCatalog.Retain` | each individual `RunRetireSnapshot`; planning and other retirements hold no interest | +| `BCatalog.DeleteSnapshot` | one legacy delete transition | +| `BCatalog.RunSnapshotDeleteOperation` | its publishing store registers each read/compute/CAS transition; receipt reads, receipt settlement, callbacks and intent staging hold no interest | +| `BCatalog.Restore` | publishing store views register each source or target transition; root copying and dependency enumeration hold no interest | +| `BCatalog.ReleaseTarget` | each source/target transition | +| `BCatalog.DeleteVolume` | each target or discovered source transition; object enumeration and reclamation hold no interest | +| `BCatalog.CleanSnapshotDeletePage` | one bounded intent-page continuation | +| `LayoutRemote.Clean` intent loop | one bounded intent-page continuation at a time, before opening clean activity | + +`publishingStore` is a shallow view with shared backends and counters. Its optional +`BeginHeadPublication` hook is called by `runTransition` before reading HEAD and +released after the single compute/CAS, no-op or error. `UpdateHead` does not +register again. Waiting only at CAS would make the read generation stale when +the preceding clean batch closes. The hook does not retry or change an externally +supplied expected base; an already prepared intent can still refuse a stale base +and must be resumed through its original caller protocol. +Plain `Store` views remain unchanged +for low-level/authority users. Multi-volume operations never hold several +admissions while copying or enumerating; each publication releases before the +next one. The scheduling state per volume is O(1). + +## Clean entries and transfer + +| Entry | Admission lifetime | +|---|---| +| `LayoutRemote.Clean` initial `RunBeginClean` | acquired outside the remote mutex, before initial activity | +| `RemoveUnreachableAll` initial `endCleanBatch` | releases initial admission after durable close/settlement, before any page admission | +| optimistic and armed page batches | before Begin until close/settlement | + +The initial lease uses `sync.Once`; the remote defers the same release for errors +and non-catalog callbacks. Publisher and clean acquisition never nest. No +storage call runs with the admission mutex held. Cancellation withdraws the +publisher mark. + +A3: a synchronous reference-removing call carrying this exact live batch context +is **unregistered**, rather than waiting on itself. SnapshotRemoval monotonicity +keeps the cached superset safe; an armed batch's held-generation check fails +safe after such a publication. The original kernel checks remain unchanged. +The callback is not given layout authority. A released context cannot bypass a +later batch. A callback holding a different volume's clean lease does not wait +on a held clean admission; it returns retryable `layout_busy`. + +## Explicit scope and liveness assumptions + +- A2: publisher preference is not FIFO. Cleaning liveness assumes registrations + do not overlap continuously. An overlapping stream can delay an armed batch; + no unsafe effect follows, and its maintenance window can end the pass. +- Other processes/catalogs (offline CLI or another holder) have no shared waiter; + they retain typed `layout_busy` and their own command window. +- Authority transitions (claim, fence, takeover), rollback and stop settlement + are outside scheduling. Stop first joins maintenance. Cleaner-owned activity + writes, non-publishing calls and direct low-level users are also excluded. +- Fresh volume creation has no attached cleaner. No new exclusive-create retry + is introduced. + +## Controls + +`TestMaintenanceRetainPublisherPrecedesANewCleanPass` pauses the individual +retirement after it registers: a real new `LayoutRemote.Clean` must let it publish +first, then transfer initial admission to real catalog page batches. +`TestMaintenanceRetainPlanningDoesNotRegister` proves planning does not hold the +mark. `TestMaintenancePublishingStoreScopesOneConditionalWrite` proves reads and +plain stores remain unregistered, a read/compute/CAS publication waits and registers, +and its interest ends on return. Existing delete-during-clean and released-token +controls preserve A3 and the original kernel semantics. These native controls do +not claim Linux/race or scale qualification. + +`TestMaintenanceReleasePublicationReadsAfterBatchClose` opens a real clean +activity, then starts the real dependent-release kernel transition. It must +wait before reading HEAD, survive the close's generation advance, and remove +the dependent successfully. The old CAS-only registration fails this control +with ErrPrecondition. No stale-proposal retry is introduced. + +The A3 control observes the publisher count INSIDE the actual backend HEAD CAS, +so a transient register/release cannot pass it. `TestMaintenancePublisherInterestHeldThroughBackendCAS` +pauses the actual backend CAS and asserts a next clean batch cannot enter until +that call returns. Both a transient-A3-registration mutant and a release-just- +before-CAS mutant fail their named controls. diff --git a/seaweed-block/docs/operator-guide.md b/seaweed-block/docs/operator-guide.md index 58d4ce0103..8b85c811d7 100644 --- a/seaweed-block/docs/operator-guide.md +++ b/seaweed-block/docs/operator-guide.md @@ -647,7 +647,7 @@ and the volume does not serve. A monitor that only watches for failed units does holder itself (the schedule's retention) and every `--chunk-maintenance-interval` (default 1 h). A snapshot deleted with `ops chunk snapshot-delete` is cleaned at the next pass, so its space can take up to that interval to return; when freeing space on a full store, allow for it. `--chunk-maintenance-gc=false` turns it off, and then nothing - removes them. The disk space returns when SeaweedFS vacuums its volumes. + removes them. The disk space returns when SeaweedFS vacuums its volumes. A maintenance pass has no total time limit: each strict advance of the finite (phase, cursor) work position renews its one-minute inactivity window. A stalled pass reports `no_progress` and the next pass resumes its cursor; each remote request is bounded separately at 30 seconds. Compatibility cleaning normally prepares outside its HEAD activity, then closes that activity after at most 1,000 candidate decisions or 5 seconds, checked between completed decisions; an in-flight operation keeps its own request bound. It continues from the remaining cursor without ending the pass. After an intervening HEAD write it rebuilds reachability and rejects preparation that raced a publication. After three preparation refusals without passing the stuck cursor position, the whole retry pass prepares under activity; read-only preparation shares the 5-second hold budget. Root/segment revisits do not erase the refusal history. Same-catalog publishers go before the next cleaning batch; an independent CLI has no shared waiter. A concurrent layout operation reports retryable `layout_busy`, and snapshot-delete resumes its captured operation within its own command window. - **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. diff --git a/seaweed-block/docs/releases/v1.1.md b/seaweed-block/docs/releases/v1.1.md index e84a7964e1..1c8a8e5a73 100644 --- a/seaweed-block/docs/releases/v1.1.md +++ b/seaweed-block/docs/releases/v1.1.md @@ -80,3 +80,5 @@ These notes collect v1.1's changes as they land; v1.1 is not released. is unchanged) and a usage error. - v1.1 answers the reverse case, a store or HEAD written by a later version, with a final exit 78 (`store_format_newer`, `head_newer_version`), which the unit does not restart. + +Maintenance cleaning now uses a one-minute inactivity window renewed by strict advances of the finite (phase, cursor) work position, with separate 30-second remote-request deadlines. A stalled pass reports `no_progress` and resumes at its existing cursor on the next pass; a large progressing pass has no total deadline. diff --git a/seaweed-block/docs/status-schema.md b/seaweed-block/docs/status-schema.md index 8187841179..e40feaa5dc 100644 --- a/seaweed-block/docs/status-schema.md +++ b/seaweed-block/docs/status-schema.md @@ -275,6 +275,8 @@ Durable store state of the served volume. Go type `volume.durableStatusBody`. | `Volumes[].Chunk.Maintenance.inProgress` | bool | a maintenance callback is running | | `Volumes[].Chunk.Maintenance.currentStartNs` | int64 | unix ns start of the running pass; zero when idle | | `Volumes[].Chunk.Maintenance.lastPass` | object | absent until a pass ends (omitted when empty) | +| `Volumes[].Chunk.Maintenance.lastPass.processed` | int64 | strict completed-work cursor advances in this pass | +| `Volumes[].Chunk.Maintenance.lastPass.errorCode` | string | no_progress when the inactivity window ends (omitted when empty) | | `Volumes[].Chunk.Maintenance.lastPass.skipReason` | ListRetirementSkipReason (string) | conservative list-page retirement skip; never changes serving or the pass outcome (omitted when empty) | | `Volumes[].Chunk.Maintenance.lastPass.atNs` | int64 | unix ns when the pass ended | | `Volumes[].Chunk.Maintenance.lastPass.planned` | int64 | all objects considered for removal | From 7cbfb8db61a34f882b0947024d0930ec45658692 Mon Sep 17 00:00:00 2001 From: pingqiu-cpu Date: Thu, 3 Dec 2026 00:39:29 -0800 Subject: [PATCH 05/66] docs, test: a registry of every fixed time bound in core/ and cmd/ (#970) Interim merge note (spec trace workflow startup_failure since 22:45Z): go test (linux) and process-level tests (real binaries) passed on 7780e280; spec-trace-check.sh and public-text-check.sh run locally with the base branch's scripts against this head and body: both pass. Code review ACCEPT (scanner and coverage rounds); model review ACCEPT on 7780e280 (row fixes and citations, rebased after the C7 fix). --- .../.github/pull_request_template.md | 1 + seaweed-block/docs/releases/v1.1.md | 14 + seaweed-block/docs/time-bounds.tsv | 264 +++++++++++++++ .../internal/timebound/registry_check_test.go | 241 +++++++++++++ .../internal/timebound/registry_test.go | 222 ++++++++++++ seaweed-block/internal/timebound/scan_test.go | 320 ++++++++++++++++++ .../internal/timebound/testdata/bounds.go.txt | 80 +++++ 7 files changed, 1142 insertions(+) create mode 100644 seaweed-block/docs/time-bounds.tsv create mode 100644 seaweed-block/internal/timebound/registry_check_test.go create mode 100644 seaweed-block/internal/timebound/registry_test.go create mode 100644 seaweed-block/internal/timebound/scan_test.go create mode 100644 seaweed-block/internal/timebound/testdata/bounds.go.txt diff --git a/seaweed-block/.github/pull_request_template.md b/seaweed-block/.github/pull_request_template.md index 61589136cc..f8bd94d181 100644 --- a/seaweed-block/.github/pull_request_template.md +++ b/seaweed-block/.github/pull_request_template.md @@ -3,6 +3,7 @@ Machine/INV: / Model: Red-first: Simplest: +Time bounds: Five questions, answered in plain words before review: Serves: diff --git a/seaweed-block/docs/releases/v1.1.md b/seaweed-block/docs/releases/v1.1.md index 1c8a8e5a73..687396b197 100644 --- a/seaweed-block/docs/releases/v1.1.md +++ b/seaweed-block/docs/releases/v1.1.md @@ -49,6 +49,20 @@ These notes collect v1.1's changes as they land; v1.1 is not released. snapshots of distinct data, a default pass takes longer than the old fixed 10 minutes; it now completes while it progresses. `--deadline` optionally bounds the whole pass. +## Fixed time bounds kept in v1.1 +Every fixed time bound in `core/` and `cmd/` is listed with its class in `docs/time-bounds.tsv`, which a test keeps in +step with the code. These totals stay fixed in v1.1: the work under each was measured at the 1 TiB cap, or runs only +on a path v1.1 refuses or ships as a preview. v1.2 replaces them with progress windows. +- `sw-block chunk usage` keeps one fixed total: at the 1 TiB cap usage took 8.45 s against its 60 s default. +- Restore's metadata create (`sw-block chunk restore`, `sw-block volume restore`) keeps its 6 minute default: it took + 0.42 s at the 1 TiB cap. Attaching the restored volume and filling its data are separate operations. +- Precopy detach keeps its fixed budgets; it is refused in v1.1. +- Replication catch-up, a preview in v1.1, sets one 5 s connection deadline around the whole catch-up stream, so a + long catch-up can time out. +- A HEAD read through a chunk store remote that does not bound its own HEAD steps (one that returns the full chunk + manifest; not the default) is bounded by one fixed 2 s total. The default segmented remote bounds each fetch, and a + whole read only by its caller's context. + ## Upgrade - With `--host-limit-dir` set, the limiter's `configuration.json` in that directory records the flags it was created with, and v1.1's differ. Upgrade such a host whole: stop every process using the directory, remove diff --git a/seaweed-block/docs/time-bounds.tsv b/seaweed-block/docs/time-bounds.tsv new file mode 100644 index 0000000000..8f480bc666 --- /dev/null +++ b/seaweed-block/docs/time-bounds.tsv @@ -0,0 +1,264 @@ +# Fixed time bounds in core/ and cmd/ (non-test code). Kept in step with the code by +# internal/timebound: every bound site has one row; line numbers refresh with TIME_BOUNDS_UPDATE=1. +# A new bound names its class and model row here. Classes: per-call, no-progress-window, +# availability-contract, control-timer, pending-fix (names its fix PR or the measurement owed; none at the v1.1 tag), +# ruled-total (a fixed total accepted for v1.1 by measurement at the cap, or on a refused path). +path func kind n line class model note +cmd/blockcsi/main.go run context.WithTimeout 1 214 per-call NONE: no model row maps this file yet one shutdown or startup step +cmd/blockmaster/main.go run context.WithTimeout 1 380 per-call NONE: no model row maps this file yet one shutdown or startup step +cmd/blockvolume/main.go runVolume context.WithTimeout 1 863 per-call NONE: no model row maps this file yet one shutdown or startup step +cmd/blockvolume/main.go runVolume context.WithTimeout 2 870 per-call NONE: no model row maps this file yet one shutdown or startup step +cmd/blockvolume/main.go runVolume context.WithTimeout 3 891 per-call NONE: no model row maps this file yet one shutdown or startup step +cmd/blockvolume/main.go runVolume context.WithTimeout 4 933 per-call NONE: no model row maps this file yet one shutdown or startup step +cmd/blockvolume/main.go runVolume context.WithTimeout 5 950 per-call NONE: no model row maps this file yet one shutdown or startup step +cmd/blockvolume/main.go runVolume context.WithTimeout 6 999 per-call NONE: no model row maps this file yet one shutdown or startup step +cmd/blockvolume/main.go runVolume context.WithTimeout 7 1017 per-call NONE: no model row maps this file yet one shutdown or startup step +cmd/blockvolume/main.go runVolume context.WithTimeout 8 1092 per-call NONE: no model row maps this file yet one shutdown or startup step +cmd/blockvolume/main.go runVolume context.WithTimeout 9 1112 per-call NONE: no model row maps this file yet one shutdown or startup step +cmd/blockvolume/main.go runVolume context.WithTimeout 10 1124 per-call NONE: no model row maps this file yet one shutdown or startup step +cmd/blockvolume/main.go runVolume context.WithTimeout 11 1160 per-call NONE: no model row maps this file yet one shutdown or startup step +cmd/blockvolume/main.go runVolume context.WithTimeout 12 1189 per-call NONE: no model row maps this file yet one shutdown or startup step +cmd/blockvolume/main.go runVolume context.WithTimeout 13 1270 per-call NONE: no model row maps this file yet one shutdown or startup step +cmd/blockvolume/main.go runVolume context.WithTimeout 14 1313 per-call NONE: no model row maps this file yet one shutdown or startup step +cmd/blockvolume/main.go runVolume context.WithTimeout 15 1379 per-call NONE: no model row maps this file yet one shutdown or startup step +cmd/blockvolume/main.go runVolume context.WithTimeout 16 1453 per-call NONE: no model row maps this file yet one shutdown or startup step +cmd/blockvolume/main.go runVolume context.WithTimeout 17 1529 per-call NONE: no model row maps this file yet one shutdown or startup step +cmd/blockvolume/main.go waitFaultedDurableRecovery context.WithTimeout 1 1700 per-call NONE: no model row maps this file yet one shutdown or startup step +cmd/blockvolume/process_exit.go superviseProcess time.NewTimer 1 115 availability-contract NONE: no model row maps this file yet exit drain bounded by the workspace drain timeout +cmd/blockvolume/process_exit.go finishWorkspaceLease time.After 1 250 availability-contract NONE: no model row maps this file yet lease closeout on exit, bounded +cmd/blockvolume/ready_latch.go handleReadyAssignment context.WithTimeout 1 62 per-call NONE: no model row maps this file yet one RPC or request +cmd/blockvolume/snapshot_operation_shutdown.go stopSnapshotOperationsForShutdown context.WithTimeout 1 15 per-call SnapOps.Stall one RPC or request +cmd/sparrow/main.go shutdownServer context.WithTimeout 1 326 per-call NONE: no model row maps this file yet test-harness binary: one bounded step +cmd/sparrow/main.go waitForMode time.Now().Add 1 332 per-call NONE: no model row maps this file yet test-harness binary: one bounded wait +cmd/sparrow/s5_bootstrap.go runS5Bootstrap context.WithTimeout 1 54 per-call NONE: no model row maps this file yet test-harness binary: one bounded step +cmd/sparrow/s7_restart_smoke.go runS7RestartSmoke context.WithTimeout 1 69 per-call NONE: no model row maps this file yet test-harness binary: one bounded step +cmd/sparrow/s7_restart_smoke.go runS7RestartSmoke time.Now().Add 1 84 per-call NONE: no model row maps this file yet test-harness binary: one bounded wait +cmd/sw-block/chunk.go refuseUnlessSingleFilerWithin context.WithTimeout 1 68 per-call NONE: no model row maps this file yet the single-filer start check, bounded by --timeout and by its caller's pass +cmd/sw-block/chunk.go chunkPost time.Now().Add 1 153 pending-fix NONE: no model row maps this file yet CLI chunk POST observation deadline (manual cut and its waiters); fix #964 (poll by cut id) +cmd/sw-block/chunk.go chunkPostUntil context.WithDeadline 1 168 pending-fix NONE: no model row maps this file yet CLI manual-cut observation total; fix #964 (poll by cut id) +cmd/sw-block/chunk.go chunkSnapshot time.Now().Add 1 280 control-timer NONE: no model row maps this file yet snapshot expiry: a timestamp (validity, expiry or due time), not a wait +cmd/sw-block/chunk_b.go volumeFlags.ref context.WithTimeout 1 100 per-call NONE: no model row maps this file yet one CLI request (operator --timeout) +cmd/sw-block/chunk_b.go bCommand.run context.WithTimeout 1 158 pending-fix NONE: no model row maps this file yet unmeasured: applies each catalog command's own budget (its newBCommand row); open while snapshot delete and retain are unmeasured +cmd/sw-block/chunk_b.go chunkSnapshots newBCommand 1 174 per-call NONE: no model row maps this file yet lists one volume's snapshot names from one HEAD read (30 s) +cmd/sw-block/chunk_b.go snapshotDeleteFormatLevel context.WithTimeout 1 215 per-call NONE: no model row maps this file yet one CLI request (operator --timeout) +cmd/sw-block/chunk_b.go chunkSnapshotDelete newBCommand 1 250 pending-fix NONE: no model row maps this file yet unmeasured: a snapshot delete stages intents across the snapshot's chunks under 30 s; a measurement at the cap or a window is owed +cmd/sw-block/chunk_b.go chunkShowContext newBCommand 1 315 per-call NONE: no model row maps this file yet one volume record and one HEAD read (30 s) +cmd/sw-block/chunk_b.go chunkUsage newBCommand 1 346 ruled-total NONE: no model row maps this file yet docs/releases/v1.1.md: "at the 1 TiB cap usage took 8.45 s against its 60 s default" +cmd/sw-block/chunk_b.go chunkRestore newBCommand 1 360 ruled-total NONE: no model row maps this file yet docs/releases/v1.1.md: "it took 0.42 s at the 1 TiB cap" +cmd/sw-block/chunk_b.go chunkRestore context.WithTimeout 1 376 ruled-total NONE: no model row maps this file yet docs/releases/v1.1.md: "it took 0.42 s at the 1 TiB cap" +cmd/sw-block/chunk_b.go chunkRelease newBCommand 1 415 per-call NONE: no model row maps this file yet releases one restore target from its source (30 s) +cmd/sw-block/chunk_b.go chunkRetain newBCommand 1 472 pending-fix NONE: no model row maps this file yet unmeasured: retain retires expired snapshots under 5 min; a measurement at the cap or a window is owed +cmd/sw-block/chunk_diag.go diagWriter.close time.NewTimer 1 68 per-call NONE: no model row maps this file yet drain of one diagnostics writer on close +cmd/sw-block/chunk_loop.go chunkPostLoop time.Now().Add 1 75 pending-fix NONE: no model row maps this file yet CLI cut retry loop's one absolute end; fix #964 +cmd/sw-block/chunk_loop.go chunkStats context.WithDeadline 1 184 per-call NONE: no model row maps this file yet one CLI request (operator --timeout) +cmd/sw-block/chunk_verify.go chunkVerify context.WithTimeoutCause 1 94 availability-contract NONE: no model row maps this file yet the operator's optional --deadline (off by default), an absolute total the operator chooses +cmd/sw-block/chunk_verify.go chunkVerify watchVerifyProgress 1 97 no-progress-window NONE: no model row maps this file yet verify's --timeout: the pass ends only after that long with no object read completed (each read renews it) +cmd/sw-block/chunk_volume_delete.go chunkVolumeDelete newBCommand 1 35 no-progress-window NONE: no model row maps this file yet growing command: no total; the budget is one sweep and the no-progress window +cmd/sw-block/chunk_volume_delete.go deleteVolumeWithProgress context.WithDeadline 1 150 no-progress-window NONE: no model row maps this file yet batch deadline min(now+bound, last progress+bound): renewed by sweep progress +cmd/sw-block/chunk_volume_delete.go deleteVolumeWithProgress time.NewTimer 1 203 control-timer NONE: no model row maps this file yet poll or delay timer +cmd/sw-block/cluster_format.go runClusterFormatLevel context.WithTimeout 1 75 per-call NONE: no model row maps this file yet one CLI request (operator --timeout) +cmd/sw-block/cluster_format.go runClusterFinalizeFormat context.WithTimeout 1 158 per-call NONE: no model row maps this file yet one CLI request (operator --timeout) +cmd/sw-block/cluster_format.go runClusterRetireHost context.WithTimeout 1 295 per-call NONE: no model row maps this file yet one CLI request (operator --timeout) +cmd/sw-block/failover.go runOpsFailover context.WithTimeout 1 102 per-call NONE: no model row maps this file yet one CLI request (operator --timeout) +cmd/sw-block/log_collect.go inspectionShell.collectLogs context.WithTimeout 1 197 per-call NONE: no model row maps this file yet one CLI request (operator --timeout) +cmd/sw-block/main.go runOpsStatus context.WithTimeout 1 904 per-call NONE: no model row maps this file yet one CLI request (operator --timeout) +cmd/sw-block/main.go runOpsInventory context.WithTimeout 1 961 per-call NONE: no model row maps this file yet one CLI request (operator --timeout) +cmd/sw-block/main.go loadObservationCluster context.WithTimeout 1 1091 per-call NONE: no model row maps this file yet one CLI request (operator --timeout) +cmd/sw-block/main.go loadObservationCluster context.WithTimeout 2 1102 per-call NONE: no model row maps this file yet one CLI request (operator --timeout) +cmd/sw-block/main.go enrichLiveObservationCluster context.WithTimeout 1 1144 per-call NONE: no model row maps this file yet one CLI request (operator --timeout) +cmd/sw-block/main.go applyCleanupSummaryProjection context.WithTimeout 1 1169 per-call NONE: no model row maps this file yet one CLI request (operator --timeout) +cmd/sw-block/main.go runOpsReport context.WithTimeout 1 1448 per-call NONE: no model row maps this file yet one CLI request (operator --timeout) +cmd/sw-block/main.go runOpsReport context.WithTimeout 2 1459 per-call NONE: no model row maps this file yet one CLI request (operator --timeout) +cmd/sw-block/main.go runOpsDashboard http.Server.ReadHeaderTimeout 1 1568 per-call NONE: no model row maps this file yet one HTTP request or connection +cmd/sw-block/main.go runOpsDashboard time.NewTimer 1 1583 control-timer NONE: no model row maps this file yet poll or delay timer +cmd/sw-block/main.go runOpsDashboard context.WithTimeout 1 1593 per-call NONE: no model row maps this file yet one CLI request (operator --timeout) +cmd/sw-block/main.go loadDashboardCluster context.WithTimeout 1 1637 per-call NONE: no model row maps this file yet one CLI request (operator --timeout) +cmd/sw-block/main.go loadDashboardCluster context.WithTimeout 2 1649 per-call NONE: no model row maps this file yet one CLI request (operator --timeout) +cmd/sw-block/main.go runOpsGenerateHelmValues context.WithTimeout 1 1872 per-call NONE: no model row maps this file yet one CLI request (operator --timeout) +cmd/sw-block/main.go loadObservationVolume context.WithTimeout 1 2222 per-call NONE: no model row maps this file yet one CLI request (operator --timeout) +cmd/sw-block/mini.go miniRun.ready time.Now().Add 1 294 per-call NONE: no model row maps this file yet mini cluster start wait +cmd/sw-block/mini.go miniRun.ready time.After 1 317 control-timer NONE: no model row maps this file yet start-wait poll +cmd/sw-block/mini.go miniRun.stop time.After 1 346 per-call NONE: no model row maps this file yet mini cluster stop wait +cmd/sw-block/mini.go mini time.Now().Add 1 523 per-call NONE: no model row maps this file yet mini cluster resolve wait +cmd/sw-block/mini.go mini context.WithTimeout 1 525 per-call NONE: no model row maps this file yet one CLI request (operator --timeout) +cmd/sw-block/mini.go mini time.After 1 540 control-timer NONE: no model row maps this file yet resolve-wait poll +cmd/sw-block/mini.go mini time.After 2 568 control-timer NONE: no model row maps this file yet resolve-wait poll +cmd/sw-block/shell.go inspectionShell.execute context.WithTimeout 1 195 per-call NONE: no model row maps this file yet one CLI request (operator --timeout) +cmd/sw-block/shell_check.go inspectionShell.check context.WithTimeout 1 104 per-call NONE: no model row maps this file yet one CLI request (operator --timeout) +cmd/sw-block/snapshot_operation.go chunkObserveSnapshot context.WithTimeout 1 66 per-call SnapOps.Send one CLI request (operator --timeout) +cmd/sw-block/snapshot_operation.go chunkObserveSnapshot time.NewTimer 1 113 control-timer SnapOps.Send poll or delay timer +cmd/sw-block/volume_backup.go volumeSnapshot context.WithTimeout 1 136 pending-fix RestoreCommand.Abort; RestoreCommand.AbortVerify; RestoreCommand.Run; RestoreCommand.Start a cut waiter's fixed total; fix follows the cut window of #964 (one waiter PR for snapshot, backup, plain detach and stop) +cmd/sw-block/volume_backup.go volumeSnapshot set.Timeout 1 145 pending-fix RestoreCommand.Abort; RestoreCommand.AbortVerify; RestoreCommand.Run; RestoreCommand.Start a cut waiter's fixed total; fix follows the cut window of #964 (one waiter PR for snapshot, backup, plain detach and stop) +cmd/sw-block/volume_backup.go volumeRestore context.WithTimeout 1 286 ruled-total RestoreCommand.Abort; RestoreCommand.AbortVerify; RestoreCommand.Run; RestoreCommand.Start docs/releases/v1.1.md: "it took 0.42 s at the 1 TiB cap" +cmd/sw-block/volume_backup.go volumeRestoreAbort context.WithTimeout 1 381 per-call RestoreCommand.Abort; RestoreCommand.AbortVerify; RestoreCommand.Run; RestoreCommand.Start one CLI request (operator --timeout) +cmd/sw-block/volume_create.go runOpsVolumeCreate context.WithTimeout 1 60 per-call NONE: no model row maps this file yet one CLI request (operator --timeout) +cmd/sw-block/volume_resolve.go runOpsVolume context.WithTimeout 1 37 per-call NONE: no model row maps this file yet one CLI request (operator --timeout) +cmd/sw-block/volume_verbs.go runVolume http.Client.Timeout 1 110 per-call NONE: no model row maps this file yet one HTTP request +cmd/sw-block/volume_verbs.go volumeStart time.Now().Add 1 281 per-call NONE: no model row maps this file yet volume start: the operator's --wait for it to serve +cmd/sw-block/volume_verbs.go volumeStart time.After 1 295 control-timer NONE: no model row maps this file yet volume start poll +cmd/sw-block/volume_verbs.go volumeCut context.WithTimeout 1 522 pending-fix NONE: no model row maps this file yet a cut waiter's fixed total; fix follows the cut window of #964 (one waiter PR for snapshot, backup, plain detach and stop) +cmd/sw-block/volume_verbs.go volumeCut set.Timeout 1 534 pending-fix NONE: no model row maps this file yet a cut waiter's fixed total; fix follows the cut window of #964 (one waiter PR for snapshot, backup, plain detach and stop) +cmd/sw-block/workspace.go runWorkspaceForceMove context.WithTimeout 1 205 per-call NONE: no model row maps this file yet one CLI request (operator --timeout) +cmd/sw-block/workspace.go runWorkspaceLostRange context.WithTimeout 1 356 per-call NONE: no model row maps this file yet one CLI request (operator --timeout) +cmd/sw-block/workspace_clean.go runWorkspaceCleanMove context.WithTimeout 1 60 per-call NONE: no model row maps this file yet one CLI request (operator --timeout) +cmd/sw-block/workspace_revoke.go runWorkspaceRevoke context.WithTimeout 1 50 per-call NONE: no model row maps this file yet one CLI request (operator --timeout) +cmd/sw-block/workspace_show.go runWorkspaceShow context.WithTimeout 1 37 per-call NONE: no model row maps this file yet one CLI request (operator --timeout) +core/adapter/adapter.go VolumeReplicaAdapter.armFenceWatchdog time.AfterFunc 1 285 availability-contract NONE: no model row maps this file yet fence watchdog: a fence that never answers fails typed +core/adapter/adapter.go VolumeReplicaAdapter.armStartWatchdog time.AfterFunc 1 638 availability-contract NONE: no model row maps this file yet start watchdog: a start that never answers fails typed +core/auth/audit.go AuditLog.attempt time.NewTimer 1 164 per-call NONE: no model row maps this file yet one audit record write +core/auth/authtest/certs.go NewCA time.Now().Add 1 50 control-timer NONE: no model row maps this file yet test CA certificate validity: a timestamp (validity, expiry or due time), not a wait +core/auth/authtest/certs.go NewCA time.Now().Add 2 51 control-timer NONE: no model row maps this file yet test CA certificate validity: a timestamp (validity, expiry or due time), not a wait +core/auth/authtest/certs.go CA.Issue time.Now().Add 1 82 control-timer NONE: no model row maps this file yet test certificate validity: a timestamp (validity, expiry or due time), not a wait +core/authority/directive.go StaticDirective.Next time.After 1 211 control-timer NONE: no model row maps this file yet directive poll +core/authority/observation_host.go ObservationHost.run time.NewTimer 1 265 control-timer NONE: no model row maps this file yet next observation deadline +core/authority/observation_host.go ObservationHost.run time.Now().Add 1 268 control-timer NONE: no model row maps this file yet next observation time: a timestamp (validity, expiry or due time), not a wait +core/calibration/harness.go harness.waitForDecisionFinal time.Now().Add 1 105 per-call NONE: no model row maps this file yet calibration harness: one bounded wait +core/csi/controller.go ControllerServer.waitForControllerMultipathPublishContext time.NewTimer 1 157 per-call NONE: no model row maps this file yet one bounded wait +core/csi/kubernetes_metadata.go newInClusterKubernetesClient http.Client.Timeout 1 78 per-call NONE: no model row maps this file yet one HTTP request +core/csi/linux_util.go realISCSIUtil.GetDeviceByIQN time.After 1 87 per-call NONE: no model row maps this file yet one iSCSI device discovery wait +core/csi/linux_util.go realISCSIUtil.GetMultipathDeviceByIQN time.After 1 122 per-call NONE: no model row maps this file yet one multipath device discovery wait +core/csi/linux_util.go refreshMultipathMaps context.WithTimeout 1 143 per-call NONE: no model row maps this file yet one RPC or request +core/csi/linux_util.go iscsiMultipathDeviceForIQN context.WithTimeout 1 154 per-call NONE: no model row maps this file yet one RPC or request +core/csi/linux_util.go realNVMeUtil.GetDeviceByNQN time.After 1 387 per-call NONE: no model row maps this file yet one NVMe device discovery wait +core/csi/node.go NodeServer.waitForNVMePathsConnected time.NewTimer 1 699 per-call NONE: no model row maps this file yet one bounded wait +core/csi/node.go NodeServer.reportCSIReattachObserved context.WithTimeout 1 759 per-call NONE: no model row maps this file yet one RPC or request +core/csi/node.go NodeServer.waitForISCSIMultipathPublishContext time.NewTimer 1 1067 per-call NONE: no model row maps this file yet one bounded wait +core/csi/node.go NodeServer.waitForNVMeMultipathPublishContext time.NewTimer 1 1108 per-call NONE: no model row maps this file yet one bounded wait +core/frontend/chunkstore/catalog_snapshot_operation.go BCatalog.RunSnapshotDeleteOperation context.WithTimeout 1 59 per-call NONE: no model row maps this file yet one settle step after a snapshot delete +core/frontend/chunkstore/layout/delete_intent.go StageSnapshotDeletePage context.WithTimeout 1 41 per-call PageChain.CAdvance; PageChain.CApply; PageChain.CRead; PageChain.CResolve; PageChain.Resend; PageChain.Send; PageChain.WritePage; QueueCap.Consume; QueueCap.Produce; VolDelSweep.Land; VolDelSweep.Stage staging one list page: one HEAD read and one page write (ListStageRequestTimeout) +core/frontend/chunkstore/layout/delete_intent.go adoptDeleteIntentPage context.WithTimeout 1 87 per-call PageChain.CAdvance; PageChain.CApply; PageChain.CRead; PageChain.CResolve; PageChain.Resend; PageChain.Send; PageChain.WritePage; QueueCap.Consume; QueueCap.Produce; VolDelSweep.Land; VolDelSweep.Stage staging one list page: one HEAD read and one page write (ListStageRequestTimeout) +core/frontend/chunkstore/layout/list_chain.go StageListPage context.WithTimeout 1 130 per-call PageChain.CAdvance; PageChain.CRead; PageChain.CResolve; PageChain.Resend; PageChain.Send; PageChain.WritePage; QueueCap.Produce; VolDelSweep.Land; VolDelSweep.Stage staging one list page: one HEAD read and one page write (ListStageRequestTimeout) +core/frontend/chunkstore/layout_remote.go walkSegments context.WithTimeout 1 443 per-call EngineAdapter.Begin; EngineAdapter.ReadHead; EngineAdapter.SendCommit; EngineAdapter.SettleAbort; EngineAdapter.TakeAbandon; PageChain.CRead; StopAndRestart.SendCommit; StopAndRestart.SettleAbort one segment fetch (attach), with reported progress +core/frontend/chunkstore/layout_remote.go attachFetchBound context.WithTimeout 1 518 per-call EngineAdapter.Begin; EngineAdapter.ReadHead; EngineAdapter.SendCommit; EngineAdapter.SettleAbort; EngineAdapter.TakeAbandon; PageChain.CRead; StopAndRestart.SendCommit; StopAndRestart.SettleAbort one attach fetch +core/frontend/chunkstore/layout_remote.go headStep context.WithTimeout 1 740 per-call EngineAdapter.Begin; EngineAdapter.ReadHead; EngineAdapter.SendCommit; EngineAdapter.SettleAbort; EngineAdapter.TakeAbandon; PageChain.CRead; StopAndRestart.SendCommit; StopAndRestart.SettleAbort one conditional HEAD exchange +core/frontend/chunkstore/single_filer.go SWFS.CheckSingleFiler context.WithTimeout 1 45 per-call NONE: no model row maps this file yet one RPC or request +core/frontend/chunkstore/single_filer.go SWFS.CheckSingleFiler time.After 1 68 control-timer NONE: no model row maps this file yet single-filer check retry pause +core/frontend/chunkstore/single_filer.go SWFS.singleFilerRound context.WithTimeout 1 89 per-call NONE: no model row maps this file yet one RPC or request +core/frontend/chunkstore/single_filer.go SWFS.singleFilerRound context.WithTimeout 2 111 per-call NONE: no model row maps this file yet one RPC or request +core/frontend/chunkstore/single_filer.go SWFS.singleFilerRound context.WithTimeout 3 119 per-call NONE: no model row maps this file yet one RPC or request +core/frontend/chunkstore/single_filer.go SWFS.singleFilerRound context.WithTimeout 4 129 per-call NONE: no model row maps this file yet one RPC or request +core/frontend/chunkstore/startup_head_probe.go BCatalog.cleanStartupProbes context.WithTimeout 1 60 per-call NONE: no model row maps this file yet startup probe cleanup: one bounded step each +core/frontend/chunkstore/startup_head_probe.go BCatalog.cleanStartupProbes time.NewTimer 1 83 per-call NONE: no model row maps this file yet startup probe cleanup: one bounded step each +core/frontend/chunkstore/startup_head_probe.go BCatalog.cleanStartupProbes context.WithTimeout 2 92 per-call NONE: no model row maps this file yet startup probe cleanup: one bounded step each +core/frontend/chunkstore/startup_head_probe.go BCatalog.cleanStartupProbes context.WithTimeout 3 99 per-call NONE: no model row maps this file yet startup probe cleanup: one bounded step each +core/frontend/chunkstore/startup_head_probe.go BCatalog.checkConditionalHead context.WithTimeout 1 110 per-call NONE: no model row maps this file yet one conditional HEAD probe at startup +core/frontend/chunkstore/startup_head_probe.go BCatalog.checkConditionalHead context.WithTimeout 2 129 per-call NONE: no model row maps this file yet one conditional HEAD probe at startup +core/frontend/chunkstore/swfs.go newBlobHTTPClient http.Client.Timeout 1 93 per-call VolumeCreate.Land one HTTP request +core/frontend/durable/chunk_snapshot_schedule.go DurableProvider.chunkSnapshotLoop time.NewTimer 1 288 control-timer NONE: no model row maps this file yet snapshot schedule timer +core/frontend/durable/chunk_snapshot_schedule.go DurableProvider.chunkSnapshotLoop boundedPass 1 321 pending-fix NONE: no model row maps this file yet scheduled snapshot's fixed total (two cut bounds); removed by #964 +core/frontend/durable/hold_kzhold.go DurableProvider.HoldBeforeChunkFreshRetireForTest time.Now().Add 1 21 per-call NONE: no model row maps this file yet a test seam's bounded hold +core/frontend/durable/precopy_admission.go StorageBackend.admitPrecopy context.WithDeadline 1 145 per-call NONE: no model row maps this file yet one RPC or request +core/frontend/durable/provider.go DurableProvider.waitHealthy context.WithTimeout 1 899 per-call NONE: no model row maps this file yet one provider open, bounded by OpenTimeout +core/frontend/durable/provider.go DurableProvider.waitHealthy time.After 1 909 control-timer NONE: no model row maps this file yet health poll +core/frontend/durable/provider_chunk.go DurableProvider.chunkAuthorityWait time.After 1 360 control-timer EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume attach retry pause +core/frontend/durable/provider_chunk.go DurableProvider.newChunkLayer context.WithTimeout 1 496 per-call EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume attach: one geometry check, one HEAD claim +core/frontend/durable/provider_chunk.go DurableProvider.newChunkLayer context.WithTimeout 2 515 per-call EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume attach: one geometry check, one HEAD claim +core/frontend/durable/provider_chunk.go closeBoundRemote.bind context.WithTimeout 1 718 per-call EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume one remote fetch during attach +core/frontend/durable/provider_chunk.go DurableProvider.chunkBackground time.Now().Add 1 1187 control-timer EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume first maintenance attempt's due time: a timestamp (validity, expiry or due time), not a wait +core/frontend/durable/provider_chunk.go DurableProvider.chunkMaintenanceLoop time.Now().Add 1 1332 control-timer EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume maintenance due time: a timestamp (validity, expiry or due time), not a wait +core/frontend/durable/provider_chunk.go DurableProvider.chunkMaintenanceLoop time.Now().Add 2 1334 control-timer EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume maintenance due time: a timestamp (validity, expiry or due time), not a wait +core/frontend/durable/provider_chunk.go DurableProvider.chunkMaintenanceLoop time.NewTimer 1 1336 control-timer EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume poll or delay timer +core/frontend/durable/provider_chunk.go DurableProvider.chunkMaintenanceLoop boundedPass 1 1348 per-call EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume snapshot-name probe: one bounded listing that grows with snapshot names, not with chunks +core/frontend/durable/provider_chunk.go DurableProvider.chunkMaintenanceLoop time.NewTimer 2 1419 control-timer EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume poll or delay timer +core/frontend/durable/provider_chunk.go DurableProvider.chunkMaintenanceLoop boundedPass 2 1439 pending-fix EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume maintenance pass total (retention plus cleaning); fix #969 (no-progress window per object) +core/frontend/durable/provider_chunk.go boundedPass context.WithTimeout 1 1492 pending-fix EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume maintenance pass total (retention plus cleaning); fix #969 (no-progress window per object) +core/frontend/durable/provider_chunk.go DurableProvider.chunkCutContext context.WithTimeout 1 1608 pending-fix EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume the cut's fixed total around changed-chunk uploads; fix #964 (cut progress window) +core/frontend/durable/provider_chunk.go DurableProvider.detachVolume time.AfterFunc 1 1757 availability-contract EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume detach freeze and settle budget: the guest-visible freeze is bounded by contract +core/frontend/durable/provider_chunk.go DurableProvider.detachVolume time.AfterFunc 2 1770 availability-contract EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume detach freeze and settle budget: the guest-visible freeze is bounded by contract +core/frontend/durable/provider_chunk.go DurableProvider.detachVolume context.WithDeadline 1 1894 availability-contract EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume detach freeze and settle budget: the guest-visible freeze is bounded by contract +core/frontend/durable/provider_chunk.go DurableProvider.retryUnknownDetach time.After 1 1972 control-timer EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume detach retry backoff +core/frontend/durable/provider_chunk.go DurableProvider.retryUnknownDetach context.WithTimeout 1 1982 per-call EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume one detach retry attempt +core/frontend/durable/storage_adapter.go StorageBackend.admitAfterAttachUnqueued context.WithTimeout 1 767 per-call EngineAdapter.GuestWrite; HolderInterface.Write; WALHold.Resubmit one RPC or request +core/frontend/iscsi/session.go Session.collectWriteData SetReadDeadline 1 470 per-call NONE: no model row maps this file yet one connection exchange or frame +core/frontend/memback/provider.go Provider.Open time.After 1 69 control-timer NONE: no model row maps this file yet open poll +core/frontend/nbd/device_linux.go Device.waitDone time.After 1 165 per-call NONE: no model row maps this file yet one NBD device teardown wait +core/frontend/nbd/device_linux.go waitActive time.Now().Add 1 220 per-call NONE: no model row maps this file yet one NBD device activation wait +core/frontend/nvmerdma/target.go providerBackend.get context.WithTimeout 1 98 per-call NONE: no model row maps this file yet one RPC or request +core/frontend/nvmerdma/target.go providerBackend.Read context.WithTimeout 1 144 per-call NONE: no model row maps this file yet one RPC or request +core/frontend/nvmerdma/target.go providerBackend.Write context.WithTimeout 1 162 per-call NONE: no model row maps this file yet one RPC or request +core/frontend/nvmerdma/target.go providerBackend.Sync context.WithTimeout 1 180 per-call NONE: no model row maps this file yet one RPC or request +core/frontend/ublk/device_linux.go openWhenPresent time.Now().Add 1 239 per-call NONE: no model row maps this file yet one ublk device open wait +core/frontend/ublk/lifecycle.go settleQueues time.NewTimer 1 44 per-call NONE: no model row maps this file yet one bounded wait +core/frontend/write_budget.go WithWriteBudget context.WithDeadline 1 21 per-call NONE: no model row maps this file yet one guest write command's budget +core/host/master/host.go New http.Server.ReadHeaderTimeout 1 418 per-call NONE: no model row maps this file yet one HTTP request or connection +core/host/master/host.go New http.Server.ReadTimeout 1 418 per-call NONE: no model row maps this file yet one HTTP request or connection +core/host/master/host.go New http.Server.WriteTimeout 1 419 per-call NONE: no model row maps this file yet one HTTP request or connection +core/host/master/host.go New http.Server.IdleTimeout 1 419 per-call NONE: no model row maps this file yet one HTTP request or connection +core/host/master/probe_round.go roundEvidenceProvider.round time.NewTimer 1 213 per-call FencingRound.Deliver; FencingRound.Open one probe round's evidence wait +core/host/master/services.go services.deleteHolderEvidence context.WithTimeout 1 1321 per-call FormatGate.Report one RPC or request +core/host/master/workspace_service.go services.AckWorkspaceRevoked context.WithTimeout 1 235 per-call FormatGate.Place; MoveAdmission.ReadForMove; StopAndRestart.ReadClean one RPC or request +core/host/master/workspace_service.go services.MoveWorkspace context.WithTimeout 1 354 per-call FormatGate.Place; MoveAdmission.ReadForMove; StopAndRestart.ReadClean one RPC or request +core/host/master/workspace_service.go services.PreviewWorkspaceMove context.WithTimeout 1 622 per-call FormatGate.Place; MoveAdmission.ReadForMove; StopAndRestart.ReadClean one RPC or request +core/host/volume/chunk_control.go chunkContext context.WithTimeout 1 522 pending-fix SnapOps.Start HTTP chunk handlers' default 5 min total (manual cut, snapshot, backup); fix #964 and its waiter follow-up +core/host/volume/chunk_control.go StatusServer.handleChunkDetach context.WithTimeout 1 711 pending-fix SnapOps.Start a cut waiter's fixed total; fix follows the cut window of #964 (one waiter PR for snapshot, backup, plain detach and stop) +core/host/volume/chunk_control.go chunkControl.snapshotOperationAttempt context.WithTimeout 1 944 per-call SnapOps.Start one RPC or request +core/host/volume/chunk_control.go chunkControl.deleteSnapshotOperation time.Now().Add 1 1077 pending-fix SnapOps.Start unmeasured: the holder's snapshot-delete resume loop (30 s) around intent preparation; a measurement at the cap or a window is owed +core/host/volume/chunk_control.go chunkControl.deleteSnapshotOperation time.After 1 1100 control-timer SnapOps.Start resume loop poll +core/host/volume/host.go Host.runRoleRetry time.After 1 550 control-timer FormatGate.Downgrade; FormatGate.Upgrade role retry delay +core/host/volume/host.go Host.runHeartbeat context.WithTimeout 1 792 per-call FormatGate.Downgrade; FormatGate.Upgrade one RPC or request +core/host/volume/host.go Host.runSubscribe time.After 1 962 control-timer FormatGate.Downgrade; FormatGate.Upgrade subscribe retry backoff +core/host/volume/peer_command_executor.go PeerCommandExecutor.afterSessionClose context.WithTimeout 1 115 per-call NONE: no model row maps this file yet one RPC or request +core/host/volume/peer_command_executor.go PeerCommandExecutor.PublishHealthy context.WithTimeout 1 197 per-call NONE: no model row maps this file yet one RPC or request +core/host/volume/probe_round.go Host.runProbeRounds time.After 1 45 control-timer FencingRound.Answer probe retry backoff +core/host/volume/probe_round.go Host.probeStreamOnce context.WithTimeout 1 76 per-call FencingRound.Answer one RPC or request +core/host/volume/status_server.go StatusServer.Start http.Server.ReadHeaderTimeout 1 422 per-call NONE: no model row maps this file yet one HTTP request or connection +core/host/volume/workspace_lease.go WorkspaceLeaseGuard.Refresh context.WithTimeout 1 258 per-call HolderInterface.Expire; MoveAdmission.StopOnExpiry; MoveAdmission.Write; SnapshotRemoval.Expire; StopAndRestart.Write one lease renewal RPC, capped at the lease end +core/host/volume/workspace_lease.go WorkspaceLeaseGuard.Refresh context.WithDeadline 1 261 per-call HolderInterface.Expire; MoveAdmission.StopOnExpiry; MoveAdmission.Write; SnapshotRemoval.Expire; StopAndRestart.Write one lease renewal RPC, capped at the lease end +core/host/volume/workspace_lease.go WorkspaceLeaseGuard.drain context.WithTimeout 1 402 availability-contract HolderInterface.Expire; MoveAdmission.StopOnExpiry; MoveAdmission.Write; SnapshotRemoval.Expire; StopAndRestart.Write lease drain on exit: bounded by the lease +core/host/volume/workspace_lease.go WorkspaceLeaseGuard.drain context.WithDeadline 1 427 availability-contract HolderInterface.Expire; MoveAdmission.StopOnExpiry; MoveAdmission.Write; SnapshotRemoval.Expire; StopAndRestart.Write lease drain on exit: bounded by the lease +core/host/volume/workspace_lease.go WorkspaceLeaseGuard.drain context.WithTimeout 2 435 availability-contract HolderInterface.Expire; MoveAdmission.StopOnExpiry; MoveAdmission.Write; SnapshotRemoval.Expire; StopAndRestart.Write lease drain on exit: bounded by the lease +core/host/volume/workspace_lease.go WorkspaceLeaseGuard.drain time.After 1 445 control-timer HolderInterface.Expire; MoveAdmission.StopOnExpiry; MoveAdmission.Write; SnapshotRemoval.Expire; StopAndRestart.Write ack retry pause +core/hostlimit/fetch.go sleepCtx time.NewTimer 1 140 control-timer NONE: no model row maps this file yet poll or delay timer +core/hostlimit/limiter.go lockGuard time.Now().Add 1 327 per-call NONE: no model row maps this file yet one wait for the host limiter's lock +core/hostlimit/limiter.go Limiter.Admit time.AfterFunc 1 489 no-progress-window NONE: no model row maps this file yet an upload slot expires only after NoProgress without progress +core/hostlimit/limiter.go Limiter.WaitUpload time.NewTimer 1 887 per-call NONE: no model row maps this file yet one bounded wait +core/hostlimit/pending.go holdSharedBounded time.Now().Add 1 45 per-call NONE: no model row maps this file yet one bounded shared hold +core/launcher/k8s_client.go NewKubernetesDeploymentClient http.Client.Timeout 1 63 per-call NONE: no model row maps this file yet one HTTP request +core/launcher/k8s_client.go NewInClusterDeploymentClient http.Client.Timeout 1 100 per-call NONE: no model row maps this file yet one HTTP request +core/ops/authority_rebuild_runtime_http.go NewHTTPAuthorityRebuildRuntime http.Client.Timeout 1 21 per-call NONE: no model row maps this file yet one HTTP request +core/ops/authority_rebuild_runtime_http.go HTTPAuthorityRebuildRuntime.ExecuteRebuild http.Client.Timeout 1 35 per-call NONE: no model row maps this file yet one HTTP request +core/ops/failback_runtime_http.go NewHTTPFailbackRuntime http.Client.Timeout 1 21 per-call NONE: no model row maps this file yet one HTTP request +core/ops/failback_runtime_http.go HTTPFailbackRuntime.ExecuteFailback http.Client.Timeout 1 35 per-call NONE: no model row maps this file yet one HTTP request +core/ops/frontend_publication_runtime_http.go NewHTTPFrontendPublicationRuntime http.Client.Timeout 1 21 per-call NONE: no model row maps this file yet one HTTP request +core/ops/frontend_publication_runtime_http.go HTTPFrontendPublicationRuntime.ExecuteFrontendPublication http.Client.Timeout 1 35 per-call NONE: no model row maps this file yet one HTTP request +core/ops/k8s_inventory.go statusAddressForKubernetesInventory time.After 1 423 per-call NONE: no model row maps this file yet one status address lookup +core/ops/k8s_inventory.go waitInventoryTCPReady time.Now().Add 1 466 per-call NONE: no model row maps this file yet one TCP readiness wait +core/ops/kubernetes_status_writer.go NewInClusterKubernetesStatusClient http.Client.Timeout 1 60 per-call NONE: no model row maps this file yet one HTTP request +core/ops/live_sources.go NewLiveVolumeStatusReportCollector http.Client.Timeout 1 38 per-call NONE: no model row maps this file yet one HTTP request +core/ops/server.go NewServer http.Server.ReadHeaderTimeout 1 39 per-call NONE: no model row maps this file yet one HTTP request or connection +core/replication/component/cluster.go Cluster.CatchUpReplica time.After 1 689 per-call NONE: no model row maps this file yet component test cluster: one catch-up wait +core/replication/component/cluster.go Cluster.WaitForConverge time.Now().Add 1 747 per-call NONE: no model row maps this file yet component test cluster: one convergence wait +core/replication/volume.go ReplicationVolume.seedNewPeerLiveCursorsLocked context.WithTimeout 1 714 per-call FencingRound.Ack; Promotion.Ack1; Promotion.Rejoin; Promotion.Write1; Promotion.Write2; ReplicationPeer.Ack; ReplicationPeer.Write one RPC or request +core/storage/chunk_cut_cow.go cutCOWWindow.acquireSaver time.NewTimer 1 403 per-call NONE: no model row maps this file yet one protected chunk's saver wait +core/storage/chunk_cut_cow.go chunkLayerImpl.fillMissing context.WithTimeout 1 603 per-call NONE: no model row maps this file yet one chunk miss fill +core/storage/chunk_head_belt.go casChunkHeadBy context.WithTimeout 1 79 per-call HolderInterface.Fence one HEAD compare-and-swap +core/storage/chunk_head_belt.go readChunkHead context.WithTimeout 1 93 ruled-total HolderInterface.Fence docs/releases/v1.1.md: "is bounded by one fixed 2 s total" +core/storage/chunk_head_belt.go readChunkHeadRoot context.WithTimeout 1 105 per-call HolderInterface.Fence one HEAD root read +core/storage/chunk_head_belt.go confirmChunkHead context.WithTimeout 1 118 ruled-total HolderInterface.Fence docs/releases/v1.1.md: "is bounded by one fixed 2 s total" +core/storage/chunk_head_belt.go confirmChunkTakeover time.NewTimer 1 171 availability-contract HolderInterface.Fence takeover confirmation window +core/storage/chunk_hydrate_all.go chunkLayerImpl.HydrateAllAt time.NewTimer 1 68 control-timer NONE: no model row maps this file yet hydration pacing and retry backoff +core/storage/chunk_hydrate_all.go chunkLayerImpl.HydrateAllAt time.NewTimer 2 104 control-timer NONE: no model row maps this file yet hydration pacing and retry backoff +core/storage/chunk_hydration.go chunkLayerImpl.hydrationWorker context.WithTimeout 1 212 per-call NONE: no model row maps this file yet one chunk fetch +core/storage/chunk_precopy.go chunkLayerImpl.precopyDetach context.WithTimeout 1 157 ruled-total NONE: no model row maps this file yet docs/releases/v1.1.md: "Precopy detach keeps its fixed budgets; it is refused in v1.1" +core/storage/chunk_precopy.go chunkLayerImpl.precopyDetach context.WithTimeout 2 203 ruled-total NONE: no model row maps this file yet docs/releases/v1.1.md: "Precopy detach keeps its fixed budgets; it is refused in v1.1" +core/storage/chunk_upgrade_pass.go upgradePass.Run time.NewTimer 1 356 control-timer NONE: no model row maps this file yet upgrade-pass pacing pause +core/storage/chunk_upload.go chunkLayerImpl.putCapturedWith context.WithTimeout 1 25 pending-fix NONE: no model row maps this file yet a 30 s total over one object's upload retries (it wraps the retry loop and its backoff); fix #964 (a per-request deadline and the cut's no-progress window) +core/storage/chunk_upload.go chunkLayerImpl.putCapturedWith time.NewTimer 1 55 control-timer NONE: no model row maps this file yet upload retry backoff +core/storage/group_commit.go GroupCommitter.Run time.NewTimer 1 81 control-timer NONE: no model row maps this file yet group commit batching delay +core/storage/wal_admission.go walAdmission.acquireContext time.NewTimer 1 128 per-call WALHold.Arrive one write's admission wait, under its command budget +core/storage/wal_admission.go walAdmission.acquireContext time.After 1 239 control-timer WALHold.Arrive admission re-check poll +core/storage/wal_write_hold.go WithWALWriteHold context.WithDeadline 1 104 availability-contract WALHold.CapAnswer; WALHold.Stall a held write's maximum hold, the guest's write budget +core/storage/walstore.go WALStore.admitExtentWrite time.After 1 1308 control-timer WALHold.Admit held extent write's hard-mark re-check +core/storage/walstore.go WALStore.tryCaptureLockWhileHeld time.Now().Add 1 1318 per-call WALHold.Admit the barrier's bounded try for its lock while the flusher hold is on +core/transport/barrier.go sendBarrierReq SetDeadline 1 146 per-call NONE: no model row maps this file yet one connection exchange or frame +core/transport/barrier.go recvBarrierResp SetDeadline 1 157 per-call NONE: no model row maps this file yet one connection exchange or frame +core/transport/catchup_sender.go BlockExecutor.doCatchUp SetDeadline 1 107 ruled-total ReplicationPeer.CatchUp docs/releases/v1.1.md: "one 5 s connection deadline around the whole catch-up stream" +core/transport/catchup_sender.go BlockExecutor.doCatchUp SetDeadline 2 191 per-call ReplicationPeer.CatchUp catch-up final barrier exchange +core/transport/executor.go BlockExecutor.Probe SetDeadline 1 750 per-call NONE: no model row maps this file yet one connection exchange or frame +core/transport/executor.go BlockExecutor.WalShipperFor SetWriteDeadline 1 968 per-call NONE: no model row maps this file yet one connection exchange or frame +core/transport/executor.go BlockExecutor.PublishRecoveryPrefix SetDeadline 1 1393 per-call NONE: no model row maps this file yet one connection exchange or frame +core/transport/rebuild_sender.go BlockExecutor.doRebuild SetDeadline 1 130 per-call ReplicationPeer.Rebuild one connection exchange or frame +core/transport/rebuild_sender.go BlockExecutor.doRebuild SetDeadline 2 146 per-call ReplicationPeer.Rebuild one connection exchange or frame +core/transport/replica.go ReplicaListener.floorAndDrain time.AfterFunc 1 884 per-call FencingRound.Recv; ReplicationPeer.CatchUp; ReplicationPeer.Rebuild; ReplicationPeer.Ship one drain wait of the replica listener +core/transport/wal_shipper.go WalShipper.DrainBacklog time.After 1 799 control-timer NONE: no model row maps this file yet idle pause between drain rounds +core/transport/wal_shipper.go WalShipper.DrainBacklog time.After 2 863 control-timer NONE: no model row maps this file yet idle pause between drain rounds diff --git a/seaweed-block/internal/timebound/registry_check_test.go b/seaweed-block/internal/timebound/registry_check_test.go new file mode 100644 index 0000000000..9e9a9b11d8 --- /dev/null +++ b/seaweed-block/internal/timebound/registry_check_test.go @@ -0,0 +1,241 @@ +package timebound + +import ( + "fmt" + "os" + "regexp" + "sort" + "strconv" + "strings" +) + +// The registry's file and its columns. +const ( + registryPath = "docs/time-bounds.tsv" + tracePath = ".github/model-code-trace.tsv" + header = "path\tfunc\tkind\tn\tline\tclass\tmodel\tnote" +) + +// The classes a bound may have. +var classes = map[string]string{ + "per-call": "one request, RPC, frame, command or chunk", + "no-progress-window": "renewed while the work progresses", + "availability-contract": "a bound promised to a guest, peer or operator", + "control-timer": "a schedule, poll, backoff or batching delay", + "pending-fix": "a fixed total around sized work; names its fix PR or the measurement owed; none may remain at the v1.1 tag", + "ruled-total": "a fixed total accepted for v1.1; cites the release-note line that states it", +} + +// unclassified marks a row the update mode added for a new site; it never passes. +const unclassified = "unclassified" + +type row struct { + site + Class, Model, Note string + lineNo int // in the registry file +} + +var ( + actionRe = regexp.MustCompile(`^[A-Za-z_][A-Za-z0-9_]*\.[A-Za-z_][A-Za-z0-9_]*$`) + prRe = regexp.MustCompile(`#[0-9]+\b`) + citationRe = regexp.MustCompile(`^(docs/[A-Za-z0-9_./-]+\.md): "([^"]+)"$`) + spaceRe = regexp.MustCompile(`\s+`) +) + +// parseRegistry reads the registry text: comment lines (#), the header, then one row per site. +func parseRegistry(text string) (comments []string, rows []row, err error) { + seenHeader := false + for i, line := range strings.Split(strings.ReplaceAll(text, "\r\n", "\n"), "\n") { + if line == "" { + continue + } + if strings.HasPrefix(line, "#") { + comments = append(comments, line) + continue + } + if !seenHeader { + if line != header { + return nil, nil, fmt.Errorf("%s:%d: header %q, want %q", registryPath, i+1, line, header) + } + seenHeader = true + continue + } + f := strings.Split(line, "\t") + if len(f) != 8 { + return nil, nil, fmt.Errorf("%s:%d: %d columns, want 8", registryPath, i+1, len(f)) + } + n, err1 := strconv.Atoi(f[3]) + ln, err2 := strconv.Atoi(f[4]) + if err1 != nil || err2 != nil { + return nil, nil, fmt.Errorf("%s:%d: n and line must be numbers", registryPath, i+1) + } + rows = append(rows, row{site: site{Path: f[0], Func: f[1], Kind: f[2], Ordinal: n, Line: ln}, + Class: f[5], Model: f[6], Note: f[7], lineNo: i + 1}) + } + if !seenHeader { + return nil, nil, fmt.Errorf("%s: no header", registryPath) + } + return comments, rows, nil +} + +// parseTrace reads the model-code trace: path -> its model actions. +func parseTrace(text string) map[string]map[string]bool { + out := map[string]map[string]bool{} + for _, line := range strings.Split(strings.ReplaceAll(text, "\r\n", "\n"), "\n") { + if line == "" || strings.HasPrefix(line, "#") { + continue + } + f := strings.Split(line, "\t") + if len(f) != 2 { + continue + } + if out[f[0]] == nil { + out[f[0]] = map[string]bool{} + } + out[f[0]][f[1]] = true + } + return out +} + +// check returns every problem with the registry against the scanned sites. +// readDoc returns a repository file's text (for ruled-total citations). +func check(sites []site, rows []row, trace map[string]map[string]bool, readDoc func(string) (string, error)) []string { + var problems []string + bad := func(format string, a ...any) { problems = append(problems, fmt.Sprintf(format, a...)) } + byKey := map[string]row{} + for _, r := range rows { + if _, dup := byKey[r.key()]; dup { + bad("%s:%d: duplicate row for %s", registryPath, r.lineNo, r.key()) + } + byKey[r.key()] = r + } + allActions := map[string]bool{} + for _, acts := range trace { + for a := range acts { + allActions[a] = true + } + } + seen := map[string]bool{} + for _, s := range sites { + r, ok := byKey[s.key()] + if !ok { + bad("%s:%d: %s in %s is not in %s (add a row naming its class and model row; TIME_BOUNDS_UPDATE=1 adds it as %s)", + s.Path, s.Line, s.Kind, s.Func, registryPath, unclassified) + continue + } + seen[s.key()] = true + if r.Line != s.Line { + bad("%s:%d: %s in %s is listed at line %d (refresh with TIME_BOUNDS_UPDATE=1)", s.Path, s.Line, s.Kind, s.Func, r.Line) + } + if r.Class == "per-call" && len(s.Loops) > 0 { + bad("%s:%d: per-call %s in %s, but its function then loops over chunks or objects (%s): a total around sized work is not per-call", + s.Path, s.Line, s.Kind, s.Func, strings.Join(s.Loops, "; ")) + } + } + for _, r := range rows { + where := fmt.Sprintf("%s:%d (%s %s in %s)", registryPath, r.lineNo, r.Path, r.Kind, r.Func) + if !seen[r.key()] { + bad("%s: no such bound in the code any more; remove the row", where) + } + if _, ok := classes[r.Class]; !ok { + bad("%s: class %q; want one of %s", where, r.Class, strings.Join(sortedKeys(classes), ", ")) + } + switch r.Class { + case "pending-fix": + if !prRe.MatchString(r.Note) && !strings.HasPrefix(r.Note, "unmeasured: ") { + bad("%s: a pending-fix row names its fix PR (#N), or starts \"unmeasured: \" with the measurement owed", where) + } + case "ruled-total": + m := citationRe.FindStringSubmatch(r.Note) + if m == nil { + bad(`%s: a ruled-total row cites the line that states it: docs/.md: ""`, where) + break + } + text, err := readDoc(m[1]) + if err != nil { + bad("%s: cited %s: %v", where, m[1], err) + } else if !strings.Contains(spaceRe.ReplaceAllString(text, " "), spaceRe.ReplaceAllString(m[2], " ")) { + bad("%s: %s does not say %q", where, m[1], m[2]) + } + default: + if strings.TrimSpace(r.Note) == "" { + bad("%s: the note says what the bound covers", where) + } + } + problems = append(problems, checkModel(where, r, trace, allActions)...) + } + return problems +} + +// checkModel: the model cell cites the file's model actions (Module.Action; several joined by "; "), or, for a file +// no model row maps, NONE: . +func checkModel(where string, r row, trace map[string]map[string]bool, all map[string]bool) []string { + mapped := trace[r.Path] + if strings.HasPrefix(r.Model, "NONE:") { + if mapped != nil { + return []string{fmt.Sprintf("%s: %s is mapped to model rows (%s); cite one, not NONE", where, r.Path, strings.Join(sortedKeys(mapped), "; "))} + } + if len(strings.TrimSpace(strings.TrimPrefix(r.Model, "NONE:"))) < 10 { + return []string{fmt.Sprintf("%s: NONE needs a reason of at least 10 characters", where)} + } + return nil + } + var out []string + cited := false + for _, a := range strings.Split(r.Model, ";") { + a = strings.TrimSpace(a) + switch { + case !actionRe.MatchString(a): + out = append(out, fmt.Sprintf("%s: model %q is not Module.Action", where, a)) + case !all[a]: + out = append(out, fmt.Sprintf("%s: model %q is no row of %s", where, a, tracePath)) + case mapped[a]: + cited = true + } + } + if mapped != nil && !cited && len(out) == 0 { + out = append(out, fmt.Sprintf("%s: cite one of %s's model rows (%s)", where, r.Path, strings.Join(sortedKeys(mapped), "; "))) + } + return out +} + +// update rewrites the registry for the scanned sites: listed rows keep their class, model and note with refreshed +// line numbers, rows for vanished sites are dropped, and new sites are appended as unclassified. +func update(comments []string, sites []site, rows []row, trace map[string]map[string]bool) string { + byKey := map[string]row{} + for _, r := range rows { + byKey[r.key()] = r + } + var b strings.Builder + for _, c := range comments { + b.WriteString(c + "\n") + } + b.WriteString(header + "\n") + for _, s := range sites { + r, ok := byKey[s.key()] + if !ok { + r = row{Class: unclassified, Model: "NONE: no model row maps this file yet", Note: "classify this new bound"} + if acts := trace[s.Path]; acts != nil { + r.Model = strings.Join(sortedKeys(acts), "; ") + } + } + fmt.Fprintf(&b, "%s\t%s\t%s\t%d\t%d\t%s\t%s\t%s\n", s.Path, s.Func, s.Kind, s.Ordinal, s.Line, r.Class, r.Model, r.Note) + } + return b.String() +} + +func sortedKeys[V any](m map[string]V) []string { + out := make([]string, 0, len(m)) + for k := range m { + out = append(out, k) + } + sort.Strings(out) + return out +} + +func readFile(root string) func(string) (string, error) { + return func(rel string) (string, error) { + b, err := os.ReadFile(root + "/" + rel) + return string(b), err + } +} diff --git a/seaweed-block/internal/timebound/registry_test.go b/seaweed-block/internal/timebound/registry_test.go new file mode 100644 index 0000000000..c790de0b9d --- /dev/null +++ b/seaweed-block/internal/timebound/registry_test.go @@ -0,0 +1,222 @@ +package timebound + +import ( + "os" + "path/filepath" + "strings" + "testing" +) + +func repoRoot(t *testing.T) string { + t.Helper() + dir, err := os.Getwd() + if err != nil { + t.Fatal(err) + } + for { + if _, err := os.Stat(filepath.Join(dir, "go.mod")); err == nil { + return dir + } + parent := filepath.Dir(dir) + if parent == dir { + t.Fatal("go.mod not found above the test directory") + } + dir = parent + } +} + +// Every fixed time bound in core/ and cmd/ has one row in docs/time-bounds.tsv +// naming its class and model row; a per-call bound never wraps a loop over +// chunks or objects; a pending-fix row names its fix PR and a ruled-total row +// cites the release-note line that states it. TIME_BOUNDS_UPDATE=1 refreshes +// the line numbers, drops vanished sites and appends new ones as unclassified +// (which still fails until classified). +func TestTheTimeBoundRegistryNamesEveryBound(t *testing.T) { + root := repoRoot(t) + sites, err := scan(root) + if err != nil { + t.Fatal(err) + } + raw, err := os.ReadFile(filepath.Join(root, registryPath)) + if err != nil { + t.Fatal(err) + } + comments, rows, err := parseRegistry(string(raw)) + if err != nil { + t.Fatal(err) + } + traceRaw, err := os.ReadFile(filepath.Join(root, tracePath)) + if err != nil { + t.Fatal(err) + } + trace := parseTrace(string(traceRaw)) + if os.Getenv("TIME_BOUNDS_UPDATE") == "1" { + if err := os.WriteFile(filepath.Join(root, registryPath), []byte(update(comments, sites, rows, trace)), 0o644); err != nil { + t.Fatal(err) + } + if comments, rows, err = parseRegistry(update(comments, sites, rows, trace)); err != nil { + t.Fatal(err) + } + } + counts := map[string]int{} + for _, r := range rows { + counts[r.Class]++ + } + t.Logf("%d bounds: %v", len(sites), counts) + for _, p := range check(sites, rows, trace, readFile(root)) { + t.Error(p) + } +} + +// The scanner finds every kind of bound the registry covers, in functions and +// in package-level var initializers, including a catalog command's budget; +// a time.After wait and a time.Now().Add deadline value count (one in an +// AfterFunc callback too, but not one that is a WithDeadline or SetDeadline +// deadline argument, already that call's); it +// skips a deadline clear and sees a sized loop after a bound in the same +// function, a package-level function literal's included. +func TestTheScannerFindsEveryKindOfBound(t *testing.T) { + sites, err := scanFile(filepath.Join("testdata", "bounds.go.txt"), "testdata/bounds.go") + if err != nil { + t.Fatal(err) + } + got := map[string]int{} + var loops []string + for _, s := range sites { + got[s.Func+" "+s.Kind]++ + loops = append(loops, s.Loops...) + } + want := map[string]int{ + "timeouts context.WithTimeout": 1, "timeouts context.WithDeadline": 1, "timeouts context.WithTimeoutCause": 1, + "timeouts context.WithDeadlineCause": 1, "timers time.NewTimer": 1, "timers time.AfterFunc": 1, + "timers time.After": 1, "timers time.Now().Add": 2, + "deadlines SetDeadline": 1, "deadlines SetReadDeadline": 1, "deadlines SetWriteDeadline": 1, + "httpBounds http.Client.Timeout": 1, "httpBounds http.Server.ReadHeaderTimeout": 1, + "httpBounds set.Timeout": 1, "passes boundedPass": 2, "S.sized context.WithTimeout": 1, + "var defaultClient http.Client.Timeout": 1, "var initCtx context.WithTimeout": 1, "catalog newBCommand": 1, + "var load context.WithTimeout": 1, "verify watchVerifyProgress": 1, + } + for k, n := range want { + if got[k] != n { + t.Errorf("%s: found %d, want %d", k, got[k], n) + } + } + for k, n := range got { + if want[k] == 0 { + t.Errorf("unexpected site %s (%d)", k, n) + } + } + if len(loops) != 2 || !strings.Contains(strings.Join(loops, " "), "chunks") || !strings.Contains(strings.Join(loops, " "), "objects") { + t.Errorf("sized loops after a bound: %v, want the chunk loop in S.sized and the object loop in var load's literal", loops) + } +} + +// The check fails each way a registry can drift from the code. Each case is +// one change to an otherwise passing registry. +func TestTheRegistryCheckRefusesEachDrift(t *testing.T) { + trace := map[string]map[string]bool{"core/m.go": {"Mod.Act": true}} + docs := func(p string) (string, error) { + if p == "docs/notes.md" { + return "the total took 1 s\n at the cap", nil + } + return "", os.ErrNotExist + } + baseSites := []site{ + {Path: "core/a.go", Func: "f", Kind: "context.WithTimeout", Ordinal: 1, Line: 10}, + {Path: "core/m.go", Func: "g", Kind: "time.NewTimer", Ordinal: 1, Line: 20}, + {Path: "core/a.go", Func: "h", Kind: "boundedPass", Ordinal: 1, Line: 30}, + {Path: "core/a.go", Func: "k", Kind: "context.WithTimeout", Ordinal: 1, Line: 40}, + } + baseRows := func() []row { + return []row{ + {site: baseSites[0], Class: "per-call", Model: "NONE: no model row maps this file yet", Note: "one RPC"}, + {site: baseSites[1], Class: "control-timer", Model: "Mod.Act", Note: "poll"}, + {site: baseSites[2], Class: "pending-fix", Model: "NONE: no model row maps this file yet", Note: "fix #12"}, + {site: baseSites[3], Class: "ruled-total", Model: "NONE: no model row maps this file yet", Note: `docs/notes.md: "the total took 1 s at the cap"`}, + } + } + if p := check(baseSites, baseRows(), trace, docs); len(p) != 0 { + t.Fatalf("the passing registry fails: %v", p) + } + cases := []struct { + name string + edit func(s []site, r []row) ([]site, []row) + wants string + }{ + {"a new bound with no row", func(s []site, r []row) ([]site, []row) { + return append(s, site{Path: "core/a.go", Func: "n", Kind: "time.AfterFunc", Ordinal: 1, Line: 50}), r + }, "is not in"}, + {"a package-level initializer bound with no row", func(s []site, r []row) ([]site, []row) { + return append(s, site{Path: "core/a.go", Func: "var client", Kind: "http.Client.Timeout", Ordinal: 1, Line: 5}), r + }, "is not in"}, + {"a per-call bound in an initializer's function literal around an object loop", func(s []site, r []row) ([]site, []row) { + s = append(s, site{Path: "core/a.go", Func: "var load", Kind: "context.WithTimeout", Ordinal: 1, Line: 6, Loops: []string{"8: objects"}}) + return s, append(r, row{site: s[len(s)-1], Class: "per-call", Model: "NONE: no model row maps this file yet", Note: "one step"}) + }, "loops over chunks or objects"}, + {"a time.After wait with no row", func(s []site, r []row) ([]site, []row) { + return append(s, site{Path: "core/a.go", Func: "w", Kind: "time.After", Ordinal: 1, Line: 60}), r + }, "is not in"}, + {"a loop deadline with no row", func(s []site, r []row) ([]site, []row) { + return append(s, site{Path: "core/a.go", Func: "w", Kind: "time.Now().Add", Ordinal: 1, Line: 61}), r + }, "is not in"}, + {"a callback-local deadline with no row", func(s []site, r []row) ([]site, []row) { + return append(s, site{Path: "core/a.go", Func: "t", Kind: "time.Now().Add", Ordinal: 2, Line: 62}), r + }, "is not in"}, + {"a verify window with no row", func(s []site, r []row) ([]site, []row) { + return append(s, site{Path: "cmd/v.go", Func: "chunkVerify", Kind: "watchVerifyProgress", Ordinal: 1, Line: 9}), r + }, "is not in"}, + {"a row for a vanished bound", func(s []site, r []row) ([]site, []row) { return s[1:], r }, "no such bound"}, + {"a moved bound with a stale line", func(s []site, r []row) ([]site, []row) { + s = append([]site(nil), s...) + s[0].Line = 11 + return s, r + }, "refresh with TIME_BOUNDS_UPDATE=1"}, + {"a per-call bound around a chunk loop", func(s []site, r []row) ([]site, []row) { + s = append([]site(nil), s...) + s[0].Loops = []string{"12: l.chunks"} + return s, r + }, "loops over chunks or objects"}, + {"an unknown class", func(s []site, r []row) ([]site, []row) { r[0].Class = "fast"; return s, r }, "class \"fast\""}, + {"an unclassified new row", func(s []site, r []row) ([]site, []row) { r[0].Class = unclassified; return s, r }, "class \"unclassified\""}, + {"pending-fix without a PR or the measurement owed", func(s []site, r []row) ([]site, []row) { r[2].Note = "fix soon"; return s, r }, "names its fix PR"}, + {"ruled-total without a citation", func(s []site, r []row) ([]site, []row) { r[3].Note = "measured"; return s, r }, "cites the line"}, + {"ruled-total citing words the doc lacks", func(s []site, r []row) ([]site, []row) { + r[3].Note = `docs/notes.md: "the total took 9 s"` + return s, r + }, "does not say"}, + {"NONE for a mapped file", func(s []site, r []row) ([]site, []row) { r[1].Model = "NONE: not modelled here at all"; return s, r }, "cite one, not NONE"}, + {"a model action that is no trace row", func(s []site, r []row) ([]site, []row) { r[1].Model = "Mod.Other"; return s, r }, "is no row of"}, + {"NONE without a reason", func(s []site, r []row) ([]site, []row) { r[0].Model = "NONE: x"; return s, r }, "at least 10 characters"}, + {"a row without a note", func(s []site, r []row) ([]site, []row) { r[0].Note = ""; return s, r }, "says what the bound covers"}, + } + for _, tc := range cases { + t.Run(tc.name, func(t *testing.T) { + s, r := tc.edit(append([]site(nil), baseSites...), baseRows()) + p := check(s, r, trace, docs) + if !strings.Contains(strings.Join(p, "\n"), tc.wants) { + t.Errorf("problems %v, want one saying %q", p, tc.wants) + } + }) + } +} + +// The update mode keeps each row's class, model and note, refreshes its line, +// drops vanished sites and appends new ones as unclassified. +func TestTheRegistryUpdateKeepsClassesAndAddsNewSitesUnclassified(t *testing.T) { + old := []row{ + {site: site{Path: "core/a.go", Func: "f", Kind: "time.NewTimer", Ordinal: 1, Line: 10}, Class: "control-timer", Model: "NONE: no model row maps this file yet", Note: "poll"}, + {site: site{Path: "core/a.go", Func: "gone", Kind: "time.NewTimer", Ordinal: 1, Line: 20}, Class: "per-call", Model: "NONE: no model row maps this file yet", Note: "x"}, + } + sites := []site{ + {Path: "core/a.go", Func: "f", Kind: "time.NewTimer", Ordinal: 1, Line: 12}, + {Path: "core/a.go", Func: "new", Kind: "context.WithTimeout", Ordinal: 1, Line: 30}, + } + _, rows, err := parseRegistry(update([]string{"# c"}, sites, old, nil)) + if err != nil { + t.Fatal(err) + } + if len(rows) != 2 || rows[0].Line != 12 || rows[0].Class != "control-timer" || rows[0].Note != "poll" || + rows[1].Func != "new" || rows[1].Class != unclassified { + t.Fatalf("updated rows %+v", rows) + } +} diff --git a/seaweed-block/internal/timebound/scan_test.go b/seaweed-block/internal/timebound/scan_test.go new file mode 100644 index 0000000000..a33ee93d72 --- /dev/null +++ b/seaweed-block/internal/timebound/scan_test.go @@ -0,0 +1,320 @@ +// Package timebound keeps the registry of fixed time bounds in core/ and cmd/ +// (docs/time-bounds.tsv) in step with the code: every bound site is listed +// with its class and model row, and a per-call bound never wraps a loop over +// chunks or objects. +package timebound + +import ( + "go/ast" + "go/parser" + "go/token" + "io/fs" + "os" + "path/filepath" + "regexp" + "sort" + "strconv" + "strings" +) + +// A site is one fixed time bound in the source. +type site struct { + Path string // repository-relative, forward slashes + Func string // enclosing top-level function (Name or Recv.Name), or "var Name" for a package-level initializer + Kind string // what sets the bound (see kinds) + Ordinal int // 1-based, among the same Path, Func and Kind in source order + Line int + Loops []string // for loops after the site, in the same function, whose header names chunks or objects +} + +// key identifies a site across edits that only move it. +func (s site) key() string { + return s.Path + "\t" + s.Func + "\t" + s.Kind + "\t" + strconv.Itoa(s.Ordinal) +} + +// Package-qualified calls that set a bound, by import path. A time.Now().Add +// value is a deadline too (a loop or wait deadline), unless it lies in the +// deadline argument of a recorded WithDeadline or Set*Deadline call (then it +// is that call's deadline). One inside a callback, such as an AfterFunc's, is +// its own site. +var pkgCalls = map[string]map[string]bool{ + "context": {"WithTimeout": true, "WithDeadline": true, "WithTimeoutCause": true, "WithDeadlineCause": true}, + "time": {"NewTimer": true, "AfterFunc": true, "After": true}, +} + +// Method calls that set a connection deadline, whatever the receiver. +var deadlineMethods = map[string]bool{"SetDeadline": true, "SetReadDeadline": true, "SetWriteDeadline": true} + +// net/http struct fields that are time bounds. +var httpTimeoutFields = map[string]map[string]bool{ + "Client": {"Timeout": true}, + "Server": {"ReadTimeout": true, "ReadHeaderTimeout": true, "WriteTimeout": true, "IdleTimeout": true}, +} + +// Field names whose assignment is an http time bound (client.Timeout = d). +var assignedTimeoutFields = map[string]bool{"Timeout": true, "ReadTimeout": true, "ReadHeaderTimeout": true, "WriteTimeout": true, "IdleTimeout": true} + +// The product's own budget helpers: boundedPass bounds a whole pass, +// newBCommand gives each catalog CLI command its budget (which bCommand.run +// applies), and watchVerifyProgress enforces verify's no-progress window (its +// ticker only polls; the window is its argument). +var budgetCalls = map[string]bool{"boundedPass": true, "newBCommand": true, "watchVerifyProgress": true} + +// sizedLoop names a loop over chunks or objects: its header mentions one. +var sizedLoop = regexp.MustCompile(`(?i)chunk|object|segment|manifest|\brefs?\b|references`) + +// scan returns every bound site under core/ and cmd/ below root (non-test Go +// files, testdata excluded), sorted by path and line. +func scan(root string) ([]site, error) { + var out []site + for _, top := range []string{"core", "cmd"} { + err := filepath.WalkDir(filepath.Join(root, top), func(p string, d fs.DirEntry, err error) error { + if err != nil { + return err + } + if d.IsDir() { + if d.Name() == "testdata" { + return filepath.SkipDir + } + return nil + } + if !strings.HasSuffix(p, ".go") || strings.HasSuffix(p, "_test.go") { + return nil + } + rel, err := filepath.Rel(root, p) + if err != nil { + return err + } + sites, err := scanFile(p, filepath.ToSlash(rel)) + if err != nil { + return err + } + out = append(out, sites...) + return nil + }) + if err != nil { + return nil, err + } + } + sort.Slice(out, func(i, j int) bool { + if out[i].Path != out[j].Path { + return out[i].Path < out[j].Path + } + return out[i].Line < out[j].Line + }) + return out, nil +} + +func scanFile(path, rel string) ([]site, error) { + src, err := os.ReadFile(path) + if err != nil { + return nil, err + } + fset := token.NewFileSet() + f, err := parser.ParseFile(fset, path, src, parser.SkipObjectResolution) + if err != nil { + return nil, err + } + imports := map[string]string{} // local name -> import path + for _, im := range f.Imports { + p, _ := strconv.Unquote(im.Path.Value) + name := p[strings.LastIndex(p, "/")+1:] + if im.Name != nil { + name = im.Name.Name + } + imports[name] = p + } + text := func(n ast.Node) string { + return string(src[fset.Position(n.Pos()).Offset:fset.Position(n.End()).Offset]) + } + var out []site + count := map[string]int{} + add := func(fn string, kind string, n ast.Node, body *ast.BlockStmt) { + s := site{Path: rel, Func: fn, Kind: kind, Line: fset.Position(n.Pos()).Line} + k := fn + "\t" + kind + count[k]++ + s.Ordinal = count[k] + if body != nil { + ast.Inspect(body, func(m ast.Node) bool { + if m == nil || m.Pos() <= n.Pos() { + return true + } + var header string + switch l := m.(type) { + case *ast.RangeStmt: + header = text(l.X) + case *ast.ForStmt: + if l.Cond != nil { + header = text(l.Cond) + } + default: + return true + } + if sizedLoop.MatchString(header) { + s.Loops = append(s.Loops, strconv.Itoa(fset.Position(m.Pos()).Line)+": "+header) + } + return true + }) + } + out = append(out, s) + } + // visit finds the bounds under root. A bound's loop check runs over its + // innermost enclosing function body: a function literal's own body, else + // the declaration's (body; nil for an initializer outside any literal). + visit := func(fn string, root ast.Node, declBody *ast.BlockStmt) { + var lits []*ast.FuncLit // enclosing function literals, innermost last + var covered []ast.Node // deadline arguments of recorded calls: a time.Now().Add inside one is that call's + ast.Inspect(root, func(n ast.Node) bool { + if n == nil { + return true + } + for len(lits) > 0 && n.Pos() >= lits[len(lits)-1].End() { + lits = lits[:len(lits)-1] // left the innermost literal + } + if lit, ok := n.(*ast.FuncLit); ok { + lits = append(lits, lit) + } + body := declBody + if len(lits) > 0 { + body = lits[len(lits)-1].Body + } + switch x := n.(type) { + case *ast.CallExpr: + switch fun := x.Fun.(type) { + case *ast.SelectorExpr: + if id, ok := fun.X.(*ast.Ident); ok { + if names := pkgCalls[imports[id.Name]]; names[fun.Sel.Name] { + add(fn, imports[id.Name]+"."+fun.Sel.Name, x, body) + if (fun.Sel.Name == "WithDeadline" || fun.Sel.Name == "WithDeadlineCause") && len(x.Args) >= 2 { + covered = append(covered, x.Args[1]) // the deadline argument only + } + return true + } + } + if deadlineMethods[fun.Sel.Name] { + if len(x.Args) == 1 && isZeroTime(x.Args[0], imports) { + return true // clears the deadline: no bound + } + add(fn, fun.Sel.Name, x, body) + for _, a := range x.Args { // the deadline argument only + covered = append(covered, a) + } + } else if fun.Sel.Name == "Add" && isTimeNow(fun.X, imports) && !inside(x, covered) { + add(fn, "time.Now().Add", x, body) // a deadline value (a loop or wait deadline) + } else if budgetCalls[fun.Sel.Name] { + add(fn, fun.Sel.Name, x, body) + } + case *ast.Ident: + if budgetCalls[fun.Name] { + add(fn, fun.Name, x, body) + } + } + case *ast.AssignStmt: + // client.Timeout = ...: an http time bound set by assignment (the field + // names are net/http's; the receiver's type is not resolved here). + for _, lhs := range x.Lhs { + if sel, ok := lhs.(*ast.SelectorExpr); ok && assignedTimeoutFields[sel.Sel.Name] { + add(fn, "set."+sel.Sel.Name, x, nil) + } + } + case *ast.CompositeLit: + sel, ok := x.Type.(*ast.SelectorExpr) + if !ok { + return true + } + id, ok := sel.X.(*ast.Ident) + if !ok || imports[id.Name] != "net/http" { + return true + } + fields := httpTimeoutFields[sel.Sel.Name] + for _, el := range x.Elts { + if kv, ok := el.(*ast.KeyValueExpr); ok { + if k, ok := kv.Key.(*ast.Ident); ok && fields[k.Name] { + add(fn, "http."+sel.Sel.Name+"."+k.Name, kv, nil) + } + } + } + } + return true + }) + } + for _, decl := range f.Decls { + switch d := decl.(type) { + case *ast.FuncDecl: + if d.Body == nil { + continue + } + fn := d.Name.Name + if d.Recv != nil && len(d.Recv.List) == 1 { + fn = recvName(d.Recv.List[0].Type) + "." + fn + } + visit(fn, d.Body, d.Body) + case *ast.GenDecl: // package-level var initializers (and any func literal in them) + if d.Tok != token.VAR { + continue + } + for _, spec := range d.Specs { + vs, ok := spec.(*ast.ValueSpec) + if !ok || len(vs.Values) == 0 || len(vs.Names) == 0 { + continue + } + for _, v := range vs.Values { + visit("var "+vs.Names[0].Name, v, nil) + } + } + } + } + return out, nil +} + +// isTimeNow reports a call of time.Now(). +func isTimeNow(e ast.Expr, imports map[string]string) bool { + c, ok := e.(*ast.CallExpr) + if !ok || len(c.Args) != 0 { + return false + } + sel, ok := c.Fun.(*ast.SelectorExpr) + if !ok || sel.Sel.Name != "Now" { + return false + } + id, ok := sel.X.(*ast.Ident) + return ok && imports[id.Name] == "time" +} + +// inside reports n lying within one of the nodes. +func inside(n ast.Node, nodes []ast.Node) bool { + for _, c := range nodes { + if n.Pos() >= c.Pos() && n.End() <= c.End() { + return true + } + } + return false +} + +// isZeroTime reports time.Time{}: a deadline argument that clears the deadline. +func isZeroTime(e ast.Expr, imports map[string]string) bool { + lit, ok := e.(*ast.CompositeLit) + if !ok || len(lit.Elts) != 0 { + return false + } + sel, ok := lit.Type.(*ast.SelectorExpr) + if !ok || sel.Sel.Name != "Time" { + return false + } + id, ok := sel.X.(*ast.Ident) + return ok && imports[id.Name] == "time" +} + +func recvName(e ast.Expr) string { + switch t := e.(type) { + case *ast.StarExpr: + return recvName(t.X) + case *ast.IndexExpr: + return recvName(t.X) + case *ast.IndexListExpr: + return recvName(t.X) + case *ast.Ident: + return t.Name + } + return "?" +} diff --git a/seaweed-block/internal/timebound/testdata/bounds.go.txt b/seaweed-block/internal/timebound/testdata/bounds.go.txt new file mode 100644 index 0000000000..71838d256f --- /dev/null +++ b/seaweed-block/internal/timebound/testdata/bounds.go.txt @@ -0,0 +1,80 @@ +package sample + +import ( + "context" + "errors" + "net" + "net/http" + "time" +) + +var defaultClient = &http.Client{Timeout: time.Second} + +var initCtx, initCancel = context.WithTimeout(context.Background(), time.Second) + +var load = func(ctx context.Context, objects []string) { + step, cancel := context.WithTimeout(ctx, time.Second) + defer cancel() + for range objects { + _ = step + } +} + +func catalog() { + newBCommand("usage", time.Minute, nil, nil) +} + +func verify(ctx context.Context, cancel context.CancelCauseFunc) { + _ = watchVerifyProgress(ctx, time.Minute, cancel) +} + +func timeouts(ctx context.Context) { + _, c1 := context.WithTimeout(ctx, time.Second) + _, c2 := context.WithDeadline(ctx, time.Now().Add(time.Second)) + _, c3 := context.WithTimeoutCause(ctx, time.Second, errors.New("x")) + _, c4 := context.WithDeadlineCause(ctx, time.Now(), errors.New("x")) + c1() + c2() + c3() + c4() +} + +func timers() { + t := time.NewTimer(time.Second) + t.Stop() + time.AfterFunc(time.Second, func() { + end := time.Now().Add(time.Minute) // a callback's own deadline: its own site + _ = end + }) + <-time.After(time.Second) + deadline := time.Now().Add(time.Second) // a loop deadline: its own site + _ = deadline +} + +func deadlines(c net.Conn) { + _ = c.SetDeadline(time.Now().Add(time.Second)) + _ = c.SetReadDeadline(time.Now().Add(time.Second)) + _ = c.SetWriteDeadline(time.Now().Add(time.Second)) + _ = c.SetDeadline(time.Time{}) // clears: not a bound +} + +func httpBounds() { + c := &http.Client{Timeout: time.Second} + _ = &http.Server{ReadHeaderTimeout: time.Second} + c.Timeout = 2 * time.Second +} + +func passes(p *P) { + boundedPass(time.Second) + p.boundedPass(time.Second) +} + +type S struct{ chunks []int } + +func (s *S) sized(ctx context.Context) { + ctx, cancel := context.WithTimeout(ctx, time.Second) + defer cancel() + for range s.chunks { + _ = ctx + } +} From 6f8f505fa8d706cd3076dc1e0405aa6c37edb0a8 Mon Sep 17 00:00:00 2001 From: pingqiu-cpu Date: Thu, 3 Dec 2026 01:05:59 -0800 Subject: [PATCH 06/66] sw-block, deploy: cluster check accepts a correct lifecycle setup; one writable store path (#980) Interim merge note (spec trace workflow startup_failure since 22:45Z): go test (linux) and process-level tests (real binaries) passed on c27c47ea; spec-trace-check.sh and public-text-check.sh run locally with the base branch's scripts against this head and body: both pass. Linux qualification at c27c47ea: vet clean, -short of cmd/sw-block, core/host/master and core/ops pass, targeted -race finds no race. Code review ACCEPT on c27c47ea. --- .../cmd/sw-block/master_store_paths_test.go | 91 +++++++++++++++++++ seaweed-block/cmd/sw-block/shell_check.go | 6 +- .../cmd/sw-block/shell_check_rows.go | 2 +- seaweed-block/cmd/sw-block/shell_test.go | 10 +- .../core/host/master/workspace_service.go | 5 +- seaweed-block/core/ops/workspace_messages.go | 8 ++ seaweed-block/deploy/config/blockmaster.env | 3 + .../deploy/systemd/sw-blockmaster.service | 4 +- seaweed-block/docs/troubleshooting.md | 8 +- 9 files changed, 126 insertions(+), 11 deletions(-) create mode 100644 seaweed-block/cmd/sw-block/master_store_paths_test.go create mode 100644 seaweed-block/core/ops/workspace_messages.go diff --git a/seaweed-block/cmd/sw-block/master_store_paths_test.go b/seaweed-block/cmd/sw-block/master_store_paths_test.go new file mode 100644 index 0000000000..17903ca29f --- /dev/null +++ b/seaweed-block/cmd/sw-block/master_store_paths_test.go @@ -0,0 +1,91 @@ +package main + +import ( + "os" + "path/filepath" + "regexp" + "strings" + "testing" +) + +// masterStorePathsOutsideState lists every blockmaster store path under +// /var/lib that the docs, the README or the example env give (as +// --lifecycle-store, --authority-store or SWB_MASTER_AUTHORITY_STORE) and that +// is not inside the shipped unit's StateDirectory. ProtectSystem=strict makes +// every other /var/lib path read-only, so blockmaster would stop there. +func masterStorePathsOutsideState(root string) ([]string, error) { + unit, err := os.ReadFile(filepath.Join(root, "deploy", "systemd", "sw-blockmaster.service")) + if err != nil { + return nil, err + } + m := regexp.MustCompile(`(?m)^StateDirectory=([^ ]+?)[ ]*$`).FindSubmatch([]byte(strings.ReplaceAll(string(unit), string(rune(13)), ""))) + if m == nil { + return nil, os.ErrNotExist + } + state := "/var/lib/" + strings.TrimSpace(string(m[1])) + paths := regexp.MustCompile("(?:--(?:lifecycle|authority)-store[ =]+|SWB_MASTER_AUTHORITY_STORE=)(/var/lib/[^ \"'`,)]+)") + var bad []string + check := func(path string) error { + raw, err := os.ReadFile(path) + if err != nil { + return err + } + for _, p := range paths.FindAllStringSubmatch(string(raw), -1) { + got := strings.TrimRight(strings.TrimSpace(p[1]), ".;:") + if got != state && !strings.HasPrefix(got, state+"/") { + rel, _ := filepath.Rel(root, path) + bad = append(bad, filepath.ToSlash(rel)+": "+got) + } + } + return nil + } + for _, dir := range []string{"docs", filepath.Join("deploy", "config")} { + err := filepath.WalkDir(filepath.Join(root, dir), func(path string, d os.DirEntry, err error) error { + if err != nil || d.IsDir() || !(strings.HasSuffix(path, ".md") || strings.HasSuffix(path, ".env")) { + return err + } + return check(path) + }) + if err != nil { + return nil, err + } + } + if err := check(filepath.Join(root, "README.md")); err != nil && !os.IsNotExist(err) { + return nil, err + } + return bad, nil +} + +// The documented blockmaster store paths and the shipped unit agree: each +// one under /var/lib is inside the unit's only writable state directory. +func TestMasterStorePathsInTheDocsAreWritableUnderTheShippedUnit(t *testing.T) { + bad, err := masterStorePathsOutsideState(filepath.Join("..", "..")) + if err != nil { + t.Fatal(err) + } + if len(bad) > 0 { + t.Fatalf("store paths outside the shipped unit's writable state directory: %v", bad) + } +} + +// The guard finds a documented store path outside the unit's state directory. +func TestMasterStorePathGuardFindsAPathOutsideTheUnitState(t *testing.T) { + root := t.TempDir() + for name, body := range map[string]string{ + "deploy/systemd/sw-blockmaster.service": "[Service]\nStateDirectory=sw-block-master\n", + "deploy/config/blockmaster.env": "SWB_MASTER_AUTHORITY_STORE=/var/lib/sw-block-master/authority\n", + "docs/manual.md": "blockmaster --lifecycle-store /var/lib/sw-block/lifecycle --workspace-rpc\n", + } { + p := filepath.Join(root, filepath.FromSlash(name)) + if err := os.MkdirAll(filepath.Dir(p), 0o755); err != nil { + t.Fatal(err) + } + if err := os.WriteFile(p, []byte(body), 0o644); err != nil { + t.Fatal(err) + } + } + bad, err := masterStorePathsOutsideState(root) + if err != nil || len(bad) != 1 || bad[0] != "docs/manual.md: /var/lib/sw-block/lifecycle" { + t.Fatalf("guard over a wrong path: %v %v, want the manual's path", bad, err) + } +} diff --git a/seaweed-block/cmd/sw-block/shell_check.go b/seaweed-block/cmd/sw-block/shell_check.go index 3fa0fd1b27..e820e03104 100644 --- a/seaweed-block/cmd/sw-block/shell_check.go +++ b/seaweed-block/cmd/sw-block/shell_check.go @@ -121,9 +121,11 @@ func (s inspectionShell) checkObservation(ctx context.Context, o *inspectionObse if err == nil { defer conn.Close() client := control.NewWorkspaceServiceClient(conn) - // A nonexistent name still distinguishes a missing lifecycle store or disabled RPC. + // A nonexistent name still distinguishes a missing lifecycle store or + // disabled RPC: blockmaster refuses those first, and answers an absent + // name only once both are in place. _, err = client.QueryWorkspace(ctx, &control.WorkspaceVolume{VolumeId: "__cluster_check__"}) - if status.Code(err) == codes.NotFound { + if status.Code(err) == codes.NotFound || (status.Code(err) == codes.FailedPrecondition && status.Convert(err).Message() == ops.WorkspaceVolumeAbsent) { err = nil } o.lifecycleErr = err diff --git a/seaweed-block/cmd/sw-block/shell_check_rows.go b/seaweed-block/cmd/sw-block/shell_check_rows.go index 1bc57a5958..4a8ae4a974 100644 --- a/seaweed-block/cmd/sw-block/shell_check_rows.go +++ b/seaweed-block/cmd/sw-block/shell_check_rows.go @@ -3,7 +3,7 @@ package main // The order and cure paragraphs are pinned to docs/troubleshooting.md. var inspectionChecks = []inspectionCheck{ {ID: "master.reachable", Title: "master.reachable", Reach: "anywhere", Cure: "blockmaster did not answer at `-master`: check that it runs and that `-master` is its `--listen` address; a non-loopback address needs the client certificate the role file names.", Run: (*inspectionObservation).reachable}, - {ID: "master.lifecycle", Title: "master.lifecycle", Reach: "anywhere", Cure: "blockmaster runs without `--lifecycle-store`: walstore-chunk volumes need it, so start blockmaster with it and restart.", Run: (*inspectionObservation).lifecycle}, + {ID: "master.lifecycle", Title: "master.lifecycle", Reach: "anywhere", Cure: "blockmaster answers no workspace query: start it with `--workspace-rpc=true` and a writable `--lifecycle-store` (with the shipped unit, under /var/lib/sw-block-master), then restart.", Run: (*inspectionObservation).lifecycle}, {ID: "master.version", Title: "master.version", Reach: "anywhere", Cure: "blockmaster did not report its version: it is older than v1.0.1, so upgrade it first.", Run: (*inspectionObservation).version}, {ID: "filer.single", Title: "filer.single", Reach: "master+filer", Cure: "sw-block needs exactly one filer in its filer group: remove the other filers of the group or give the block store its own group, then restart the volume hosts.", Run: (*inspectionObservation).filer}, {ID: "host.heartbeat", Title: "host.heartbeat", Reach: "anywhere", Cure: "No fresh heartbeat from `` for this volume: check that its blockvolume unit runs and reaches `--master`, and that its clock is synchronized (a backward step beyond the freshness window expires its slots).", Run: (*inspectionObservation).heartbeat}, diff --git a/seaweed-block/cmd/sw-block/shell_test.go b/seaweed-block/cmd/sw-block/shell_test.go index 53cedeb2d1..1b1064f5b7 100644 --- a/seaweed-block/cmd/sw-block/shell_test.go +++ b/seaweed-block/cmd/sw-block/shell_test.go @@ -14,6 +14,7 @@ import ( "testing" "time" + "github.com/seaweedfs/seaweed-block/core/ops" "github.com/seaweedfs/seaweed-block/core/rpc/control" "google.golang.org/grpc" "google.golang.org/grpc/codes" @@ -97,8 +98,13 @@ func (s inspectionControlServer) QueryWorkspace(_ context.Context, q *control.Wo if s.mode == "disabled" { return nil, status.Error(codes.FailedPrecondition, "workspace RPC disabled") } + if s.mode == "store-missing" { + return nil, status.Error(codes.FailedPrecondition, "lifecycle store unavailable") + } if q.GetVolumeId() == "__cluster_check__" { - return nil, status.Error(codes.NotFound, "not found") + // As blockmaster answers an absent name once the RPC is enabled and + // the lifecycle store is open. + return nil, status.Error(codes.FailedPrecondition, ops.WorkspaceVolumeAbsent) } l := &control.WorkspaceLeaseFact{ReplicaId: "r2", Epoch: 2, ValidForNs: int64(time.Second)} switch s.mode { @@ -113,7 +119,7 @@ func (s inspectionControlServer) QueryWorkspace(_ context.Context, q *control.Wo } func TestShellCheckUsesTypedLeaseReadinessCutAndVersionAnswers(t *testing.T) { for _, tc := range []struct{ mode, id string }{ - {"healthy", ""}, {"disabled", "master.lifecycle"}, {"lease-expired", "volume.lease"}, {"lease-revoking", "volume.lease"}, {"lease-wrong-holder", "volume.lease"}, + {"healthy", ""}, {"disabled", "master.lifecycle"}, {"store-missing", "master.lifecycle"}, {"lease-expired", "volume.lease"}, {"lease-revoking", "volume.lease"}, {"lease-wrong-holder", "volume.lease"}, {"frontend-false", "volume.frontend"}, {"cut-pending", "volume.cut"}, {"snapshot-overdue", "volume.cut"}, {"missing-cut-fields", "volume.cut"}, {"version-missing", "versions.equal"}, {"version-mismatch", "versions.equal"}, {"cleaning-error", "volume.cleaning"}, {"cleaning-not-run", "volume.cleaning"}, {"cleaning-running", "volume.cleaning"}, {"cleaning-missing", "volume.cleaning"}, {"missing-cleaning-head-gen", "volume.cleaning"}, {"null-cleaning-head-gen", "volume.cleaning"}, {"missing-cleaning-breakdown", "volume.cleaning"}, {"retention-only", "volume.cleaning"}, {"missing-cleaning-error", "volume.cleaning"}, {"null-cleaning-error", "volume.cleaning"}, {"completed-empty", ""}, {"completed-head-gen-note", ""}, {"failed-head-gen-note", "volume.cleaning"}, {"no-chunk-store", "volume.cut"}, diff --git a/seaweed-block/core/host/master/workspace_service.go b/seaweed-block/core/host/master/workspace_service.go index eded2a3683..a131a5df40 100644 --- a/seaweed-block/core/host/master/workspace_service.go +++ b/seaweed-block/core/host/master/workspace_service.go @@ -10,6 +10,7 @@ import ( "github.com/seaweedfs/seaweed-block/core/authority" "github.com/seaweedfs/seaweed-block/core/lifecycle" + "github.com/seaweedfs/seaweed-block/core/ops" control "github.com/seaweedfs/seaweed-block/core/rpc/control" "github.com/seaweedfs/seaweed-block/core/rpc/lifecycleclient" "google.golang.org/grpc/codes" @@ -25,7 +26,7 @@ func (s *services) workspaceVolume(volume string) error { } r, ok := s.host.lifecycle.Volumes.GetVolume(volume) if !ok || r.Spec.ReplicationFactor != 1 { - return status.Error(codes.FailedPrecondition, "workspace move requires an existing RF1 volume") + return status.Error(codes.FailedPrecondition, ops.WorkspaceVolumeAbsent) } // Deletion first: a deleted name's CreateVolume is refused, so it must // never be told to retry it. @@ -53,7 +54,7 @@ func (s *services) workspaceVolumeForRenewal(volume string) error { } r, ok := s.host.lifecycle.Volumes.GetVolumeSnapshot(volume) if !ok || r.Spec.ReplicationFactor != 1 { - return status.Error(codes.FailedPrecondition, "workspace move requires an existing RF1 volume") + return status.Error(codes.FailedPrecondition, ops.WorkspaceVolumeAbsent) } if s.host.lifecycle.Deletions.ReservedSnapshot(volume) { if s.host.lifecycle.Deletions.CommittedSnapshot(volume) { diff --git a/seaweed-block/core/ops/workspace_messages.go b/seaweed-block/core/ops/workspace_messages.go new file mode 100644 index 0000000000..6d0bd067d8 --- /dev/null +++ b/seaweed-block/core/ops/workspace_messages.go @@ -0,0 +1,8 @@ +package ops + +// WorkspaceVolumeAbsent is blockmaster's refusal text for a workspace call on +// a name that has no RF1 volume record. The master checks that the workspace +// RPC is enabled and the lifecycle store is open before it looks the name up, +// so a cluster check that probes an absent name reads this refusal as proof +// of both. +const WorkspaceVolumeAbsent = "workspace move requires an existing RF1 volume" diff --git a/seaweed-block/deploy/config/blockmaster.env b/seaweed-block/deploy/config/blockmaster.env index 822471926e..0aa9fc952c 100644 --- a/seaweed-block/deploy/config/blockmaster.env +++ b/seaweed-block/deploy/config/blockmaster.env @@ -41,5 +41,8 @@ SWB_MASTER_WORKSPACE_MAX_CLOCK_SKEW=20s # Extra blockmaster flags, split on spaces. # A standalone workspace volume (lease, planned hand-over) needs --cluster-spec, # --lifecycle-store and the --workspace-* flags here: see docs/volume-lifecycle.md. +# The unit's only writable state directory is /var/lib/sw-block-master +# (ProtectSystem=strict), so keep the lifecycle store under it, for example +# --lifecycle-store /var/lib/sw-block-master/lifecycle. # Kubernetes launcher/runtime flags are configured separately by the Helm chart. SWB_MASTER_EXTRA_ARGS= diff --git a/seaweed-block/deploy/systemd/sw-blockmaster.service b/seaweed-block/deploy/systemd/sw-blockmaster.service index 3342b8b865..84623a4e1d 100644 --- a/seaweed-block/deploy/systemd/sw-blockmaster.service +++ b/seaweed-block/deploy/systemd/sw-blockmaster.service @@ -13,7 +13,9 @@ User=sw-block Group=sw-block EnvironmentFile=/etc/sw-block/blockmaster.env # systemd creates /var/lib/sw-block-master owned by User/Group. blockvolume -# units use their own state directories, never this one. +# units use their own state directories, never this one. It is the only +# writable state path (ProtectSystem=strict): --authority-store and +# --lifecycle-store must be under it. StateDirectory=sw-block-master StateDirectoryMode=0750 ExecStart=/usr/local/bin/blockmaster \ diff --git a/seaweed-block/docs/troubleshooting.md b/seaweed-block/docs/troubleshooting.md index 4349e54dee..a5fd5fd6e0 100644 --- a/seaweed-block/docs/troubleshooting.md +++ b/seaweed-block/docs/troubleshooting.md @@ -26,14 +26,16 @@ blockmaster requires mutual TLS: see [authenticate the control API](operator-gui ## master.lifecycle -blockmaster runs without `--lifecycle-store`: walstore-chunk volumes need it, so start blockmaster with it and -restart. +blockmaster answers no workspace query: start it with `--workspace-rpc=true` and a writable `--lifecycle-store` +(with the shipped unit, under /var/lib/sw-block-master), then restart. **What you see:** `FAIL master.lifecycle: lifecycle store unavailable`. The same check reports `workspace RPC disabled` when blockmaster runs without `--workspace-rpc`, which walstore-chunk volumes also need. **Fix:** set `--lifecycle-store` and `--workspace-rpc` on blockmaster (see -[standalone deployment](standalone-deployment.md#blockmaster-settings)) and restart it. +[standalone deployment](standalone-deployment.md#blockmaster-settings)) and restart it. The shipped unit makes only +/var/lib/sw-block-master writable, so a lifecycle store elsewhere (for example under /var/lib/sw-block) stops +blockmaster with `read-only file system`. ## master.version From 02127e950eb9b6bb93af06f78b04ed0a42f380c6 Mon Sep 17 00:00:00 2001 From: pingqiu-cpu Date: Thu, 3 Dec 2026 02:02:30 -0800 Subject: [PATCH 07/66] timebound: rows for the maintenance window change's bounds (#984) Interim merge note (spec trace workflow startup_failure since 22:45Z): registry-only fix for main's red internal/timebound test (bounds that landed with the maintenance window change had no rows). go test (linux) and process-level tests (real binaries) passed on 98d25f29 against the current main head 911c2706; spec-trace-check.sh and public-text-check.sh run locally: both pass. --- seaweed-block/docs/time-bounds.tsv | 55 +++++++++++++++++------------- 1 file changed, 31 insertions(+), 24 deletions(-) diff --git a/seaweed-block/docs/time-bounds.tsv b/seaweed-block/docs/time-bounds.tsv index 8f480bc666..00de06a2eb 100644 --- a/seaweed-block/docs/time-bounds.tsv +++ b/seaweed-block/docs/time-bounds.tsv @@ -33,6 +33,7 @@ cmd/sparrow/main.go waitForMode time.Now().Add 1 332 per-call NONE: no model row cmd/sparrow/s5_bootstrap.go runS5Bootstrap context.WithTimeout 1 54 per-call NONE: no model row maps this file yet test-harness binary: one bounded step cmd/sparrow/s7_restart_smoke.go runS7RestartSmoke context.WithTimeout 1 69 per-call NONE: no model row maps this file yet test-harness binary: one bounded step cmd/sparrow/s7_restart_smoke.go runS7RestartSmoke time.Now().Add 1 84 per-call NONE: no model row maps this file yet test-harness binary: one bounded wait +cmd/sw-block/catalog_snapshot_operation.go chunkCatalogSnapshotDeleteAnswer time.After 1 49 control-timer NONE: no model row maps this file yet retry pause inside the snapshot-delete command's window cmd/sw-block/chunk.go refuseUnlessSingleFilerWithin context.WithTimeout 1 68 per-call NONE: no model row maps this file yet the single-filer start check, bounded by --timeout and by its caller's pass cmd/sw-block/chunk.go chunkPost time.Now().Add 1 153 pending-fix NONE: no model row maps this file yet CLI chunk POST observation deadline (manual cut and its waiters); fix #964 (poll by cut id) cmd/sw-block/chunk.go chunkPostUntil context.WithDeadline 1 168 pending-fix NONE: no model row maps this file yet CLI manual-cut observation total; fix #964 (poll by cut id) @@ -47,7 +48,7 @@ cmd/sw-block/chunk_b.go chunkUsage newBCommand 1 346 ruled-total NONE: no model cmd/sw-block/chunk_b.go chunkRestore newBCommand 1 360 ruled-total NONE: no model row maps this file yet docs/releases/v1.1.md: "it took 0.42 s at the 1 TiB cap" cmd/sw-block/chunk_b.go chunkRestore context.WithTimeout 1 376 ruled-total NONE: no model row maps this file yet docs/releases/v1.1.md: "it took 0.42 s at the 1 TiB cap" cmd/sw-block/chunk_b.go chunkRelease newBCommand 1 415 per-call NONE: no model row maps this file yet releases one restore target from its source (30 s) -cmd/sw-block/chunk_b.go chunkRetain newBCommand 1 472 pending-fix NONE: no model row maps this file yet unmeasured: retain retires expired snapshots under 5 min; a measurement at the cap or a window is owed +cmd/sw-block/chunk_b.go chunkRetain newBCommand 1 473 pending-fix NONE: no model row maps this file yet unmeasured: retain retires expired snapshots under 5 min; a measurement at the cap or a window is owed cmd/sw-block/chunk_diag.go diagWriter.close time.NewTimer 1 68 per-call NONE: no model row maps this file yet drain of one diagnostics writer on close cmd/sw-block/chunk_loop.go chunkPostLoop time.Now().Add 1 75 pending-fix NONE: no model row maps this file yet CLI cut retry loop's one absolute end; fix #964 cmd/sw-block/chunk_loop.go chunkStats context.WithDeadline 1 184 per-call NONE: no model row maps this file yet one CLI request (operator --timeout) @@ -124,13 +125,19 @@ core/csi/node.go NodeServer.waitForNVMePathsConnected time.NewTimer 1 699 per-ca core/csi/node.go NodeServer.reportCSIReattachObserved context.WithTimeout 1 759 per-call NONE: no model row maps this file yet one RPC or request core/csi/node.go NodeServer.waitForISCSIMultipathPublishContext time.NewTimer 1 1067 per-call NONE: no model row maps this file yet one bounded wait core/csi/node.go NodeServer.waitForNVMeMultipathPublishContext time.NewTimer 1 1108 per-call NONE: no model row maps this file yet one bounded wait -core/frontend/chunkstore/catalog_snapshot_operation.go BCatalog.RunSnapshotDeleteOperation context.WithTimeout 1 59 per-call NONE: no model row maps this file yet one settle step after a snapshot delete +core/frontend/chunkstore/catalog_snapshot_operation.go BCatalog.RunSnapshotDeleteOperation context.WithTimeout 1 60 per-call CleanBatch.Publish one settle step after a snapshot delete +core/frontend/chunkstore/clean_b.go BCatalog.RemoveUnreachableAll context.WithDeadline 1 148 control-timer CleanBatch.BeginIn; CleanBatch.Close; CleanBatch.Effects; CleanBatch.PrepIn; CleanBatch.PrepOut; CutTime.Complete; PageChain.Sweep; SnapshotRemoval.BeginClean; SnapshotRemoval.EndClean; StaleClean.HeadRead clean batch session hold (5 s): bounds one batch's read-only preparation; the session is closed and the pass resumes at its cursor, no total over the pass +core/frontend/chunkstore/clean_b.go BCatalog.RemoveUnreachableAll time.After 1 220 control-timer CleanBatch.BeginIn; CleanBatch.Close; CleanBatch.Effects; CleanBatch.PrepIn; CleanBatch.PrepOut; CutTime.Complete; PageChain.Sweep; SnapshotRemoval.BeginClean; SnapshotRemoval.EndClean; StaleClean.HeadRead pause between clean batches, outside the session +core/frontend/chunkstore/clean_b.go endCleanBatch time.After 1 399 control-timer CleanBatch.BeginIn; CleanBatch.Close; CleanBatch.Effects; CleanBatch.PrepIn; CleanBatch.PrepOut; CutTime.Complete; PageChain.Sweep; SnapshotRemoval.BeginClean; SnapshotRemoval.EndClean; StaleClean.HeadRead retry pause for a clean batch's close core/frontend/chunkstore/layout/delete_intent.go StageSnapshotDeletePage context.WithTimeout 1 41 per-call PageChain.CAdvance; PageChain.CApply; PageChain.CRead; PageChain.CResolve; PageChain.Resend; PageChain.Send; PageChain.WritePage; QueueCap.Consume; QueueCap.Produce; VolDelSweep.Land; VolDelSweep.Stage staging one list page: one HEAD read and one page write (ListStageRequestTimeout) core/frontend/chunkstore/layout/delete_intent.go adoptDeleteIntentPage context.WithTimeout 1 87 per-call PageChain.CAdvance; PageChain.CApply; PageChain.CRead; PageChain.CResolve; PageChain.Resend; PageChain.Send; PageChain.WritePage; QueueCap.Consume; QueueCap.Produce; VolDelSweep.Land; VolDelSweep.Stage staging one list page: one HEAD read and one page write (ListStageRequestTimeout) -core/frontend/chunkstore/layout/list_chain.go StageListPage context.WithTimeout 1 130 per-call PageChain.CAdvance; PageChain.CRead; PageChain.CResolve; PageChain.Resend; PageChain.Send; PageChain.WritePage; QueueCap.Produce; VolDelSweep.Land; VolDelSweep.Stage staging one list page: one HEAD read and one page write (ListStageRequestTimeout) -core/frontend/chunkstore/layout_remote.go walkSegments context.WithTimeout 1 443 per-call EngineAdapter.Begin; EngineAdapter.ReadHead; EngineAdapter.SendCommit; EngineAdapter.SettleAbort; EngineAdapter.TakeAbandon; PageChain.CRead; StopAndRestart.SendCommit; StopAndRestart.SettleAbort one segment fetch (attach), with reported progress -core/frontend/chunkstore/layout_remote.go attachFetchBound context.WithTimeout 1 518 per-call EngineAdapter.Begin; EngineAdapter.ReadHead; EngineAdapter.SendCommit; EngineAdapter.SettleAbort; EngineAdapter.TakeAbandon; PageChain.CRead; StopAndRestart.SendCommit; StopAndRestart.SettleAbort one attach fetch -core/frontend/chunkstore/layout_remote.go headStep context.WithTimeout 1 740 per-call EngineAdapter.Begin; EngineAdapter.ReadHead; EngineAdapter.SendCommit; EngineAdapter.SettleAbort; EngineAdapter.TakeAbandon; PageChain.CRead; StopAndRestart.SendCommit; StopAndRestart.SettleAbort one conditional HEAD exchange +core/frontend/chunkstore/layout/list_chain.go StageListPage context.WithTimeout 1 131 per-call PageChain.CAdvance; PageChain.CRead; PageChain.CResolve; PageChain.Resend; PageChain.Send; PageChain.WritePage; QueueCap.Produce; VolDelSweep.Land; VolDelSweep.Stage staging one list page: one HEAD read and one page write (ListStageRequestTimeout) +core/frontend/chunkstore/layout_remote.go walkSegments context.WithTimeout 1 453 per-call EngineAdapter.Begin; EngineAdapter.ReadHead; EngineAdapter.SendCommit; EngineAdapter.SettleAbort; EngineAdapter.TakeAbandon; PageChain.CRead; StopAndRestart.SendCommit; StopAndRestart.SettleAbort one segment fetch (attach), with reported progress +core/frontend/chunkstore/layout_remote.go attachFetchBound context.WithTimeout 1 528 per-call EngineAdapter.Begin; EngineAdapter.ReadHead; EngineAdapter.SendCommit; EngineAdapter.SettleAbort; EngineAdapter.TakeAbandon; PageChain.CRead; StopAndRestart.SendCommit; StopAndRestart.SettleAbort one attach fetch +core/frontend/chunkstore/layout_remote.go headStep context.WithTimeout 1 750 per-call EngineAdapter.Begin; EngineAdapter.ReadHead; EngineAdapter.SendCommit; EngineAdapter.SettleAbort; EngineAdapter.TakeAbandon; PageChain.CRead; StopAndRestart.SendCommit; StopAndRestart.SettleAbort one conditional HEAD exchange +core/frontend/chunkstore/maintenance_request.go maintenanceCall context.WithTimeout 1 23 per-call CutTime.CallTimeout one maintenance read request +core/frontend/chunkstore/maintenance_request.go maintenanceCall time.After 1 35 control-timer CutTime.CallTimeout retry pause after a timed-out maintenance read +core/frontend/chunkstore/maintenance_request.go maintenanceMutation context.WithTimeout 1 51 per-call CutTime.CallTimeout one maintenance mutation request core/frontend/chunkstore/single_filer.go SWFS.CheckSingleFiler context.WithTimeout 1 45 per-call NONE: no model row maps this file yet one RPC or request core/frontend/chunkstore/single_filer.go SWFS.CheckSingleFiler time.After 1 68 control-timer NONE: no model row maps this file yet single-filer check retry pause core/frontend/chunkstore/single_filer.go SWFS.singleFilerRound context.WithTimeout 1 89 per-call NONE: no model row maps this file yet one RPC or request @@ -147,9 +154,10 @@ core/frontend/chunkstore/swfs.go newBlobHTTPClient http.Client.Timeout 1 93 per- core/frontend/durable/chunk_snapshot_schedule.go DurableProvider.chunkSnapshotLoop time.NewTimer 1 288 control-timer NONE: no model row maps this file yet snapshot schedule timer core/frontend/durable/chunk_snapshot_schedule.go DurableProvider.chunkSnapshotLoop boundedPass 1 321 pending-fix NONE: no model row maps this file yet scheduled snapshot's fixed total (two cut bounds); removed by #964 core/frontend/durable/hold_kzhold.go DurableProvider.HoldBeforeChunkFreshRetireForTest time.Now().Add 1 21 per-call NONE: no model row maps this file yet a test seam's bounded hold +core/frontend/durable/maintenance_progress.go maintenancePass time.AfterFunc 1 29 no-progress-window CutTime.Complete; CutTime.Fail; CutTime.Tick the maintenance pass's window: renewed by each completed step, no total core/frontend/durable/precopy_admission.go StorageBackend.admitPrecopy context.WithDeadline 1 145 per-call NONE: no model row maps this file yet one RPC or request -core/frontend/durable/provider.go DurableProvider.waitHealthy context.WithTimeout 1 899 per-call NONE: no model row maps this file yet one provider open, bounded by OpenTimeout -core/frontend/durable/provider.go DurableProvider.waitHealthy time.After 1 909 control-timer NONE: no model row maps this file yet health poll +core/frontend/durable/provider.go DurableProvider.waitHealthy context.WithTimeout 1 900 per-call NONE: no model row maps this file yet one provider open, bounded by OpenTimeout +core/frontend/durable/provider.go DurableProvider.waitHealthy time.After 1 910 control-timer NONE: no model row maps this file yet health poll core/frontend/durable/provider_chunk.go DurableProvider.chunkAuthorityWait time.After 1 360 control-timer EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume attach retry pause core/frontend/durable/provider_chunk.go DurableProvider.newChunkLayer context.WithTimeout 1 496 per-call EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume attach: one geometry check, one HEAD claim core/frontend/durable/provider_chunk.go DurableProvider.newChunkLayer context.WithTimeout 2 515 per-call EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume attach: one geometry check, one HEAD claim @@ -160,14 +168,13 @@ core/frontend/durable/provider_chunk.go DurableProvider.chunkMaintenanceLoop tim core/frontend/durable/provider_chunk.go DurableProvider.chunkMaintenanceLoop time.NewTimer 1 1336 control-timer EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume poll or delay timer core/frontend/durable/provider_chunk.go DurableProvider.chunkMaintenanceLoop boundedPass 1 1348 per-call EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume snapshot-name probe: one bounded listing that grows with snapshot names, not with chunks core/frontend/durable/provider_chunk.go DurableProvider.chunkMaintenanceLoop time.NewTimer 2 1419 control-timer EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume poll or delay timer -core/frontend/durable/provider_chunk.go DurableProvider.chunkMaintenanceLoop boundedPass 2 1439 pending-fix EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume maintenance pass total (retention plus cleaning); fix #969 (no-progress window per object) -core/frontend/durable/provider_chunk.go boundedPass context.WithTimeout 1 1492 pending-fix EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume maintenance pass total (retention plus cleaning); fix #969 (no-progress window per object) -core/frontend/durable/provider_chunk.go DurableProvider.chunkCutContext context.WithTimeout 1 1608 pending-fix EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume the cut's fixed total around changed-chunk uploads; fix #964 (cut progress window) -core/frontend/durable/provider_chunk.go DurableProvider.detachVolume time.AfterFunc 1 1757 availability-contract EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume detach freeze and settle budget: the guest-visible freeze is bounded by contract -core/frontend/durable/provider_chunk.go DurableProvider.detachVolume time.AfterFunc 2 1770 availability-contract EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume detach freeze and settle budget: the guest-visible freeze is bounded by contract -core/frontend/durable/provider_chunk.go DurableProvider.detachVolume context.WithDeadline 1 1894 availability-contract EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume detach freeze and settle budget: the guest-visible freeze is bounded by contract -core/frontend/durable/provider_chunk.go DurableProvider.retryUnknownDetach time.After 1 1972 control-timer EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume detach retry backoff -core/frontend/durable/provider_chunk.go DurableProvider.retryUnknownDetach context.WithTimeout 1 1982 per-call EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume one detach retry attempt +core/frontend/durable/provider_chunk.go boundedPass context.WithTimeout 1 1490 pending-fix EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume maintenance pass total (retention plus cleaning); fix #969 (no-progress window per object) +core/frontend/durable/provider_chunk.go DurableProvider.chunkCutContext context.WithTimeout 1 1606 pending-fix EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume the cut's fixed total around changed-chunk uploads; fix #964 (cut progress window) +core/frontend/durable/provider_chunk.go DurableProvider.detachVolume time.AfterFunc 1 1755 availability-contract EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume detach freeze and settle budget: the guest-visible freeze is bounded by contract +core/frontend/durable/provider_chunk.go DurableProvider.detachVolume time.AfterFunc 2 1768 availability-contract EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume detach freeze and settle budget: the guest-visible freeze is bounded by contract +core/frontend/durable/provider_chunk.go DurableProvider.detachVolume context.WithDeadline 1 1892 availability-contract EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume detach freeze and settle budget: the guest-visible freeze is bounded by contract +core/frontend/durable/provider_chunk.go DurableProvider.retryUnknownDetach time.After 1 1970 control-timer EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume detach retry backoff +core/frontend/durable/provider_chunk.go DurableProvider.retryUnknownDetach context.WithTimeout 1 1980 per-call EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume one detach retry attempt core/frontend/durable/storage_adapter.go StorageBackend.admitAfterAttachUnqueued context.WithTimeout 1 767 per-call EngineAdapter.GuestWrite; HolderInterface.Write; WALHold.Resubmit one RPC or request core/frontend/iscsi/session.go Session.collectWriteData SetReadDeadline 1 470 per-call NONE: no model row maps this file yet one connection exchange or frame core/frontend/memback/provider.go Provider.Open time.After 1 69 control-timer NONE: no model row maps this file yet open poll @@ -186,14 +193,14 @@ core/host/master/host.go New http.Server.WriteTimeout 1 419 per-call NONE: no mo core/host/master/host.go New http.Server.IdleTimeout 1 419 per-call NONE: no model row maps this file yet one HTTP request or connection core/host/master/probe_round.go roundEvidenceProvider.round time.NewTimer 1 213 per-call FencingRound.Deliver; FencingRound.Open one probe round's evidence wait core/host/master/services.go services.deleteHolderEvidence context.WithTimeout 1 1321 per-call FormatGate.Report one RPC or request -core/host/master/workspace_service.go services.AckWorkspaceRevoked context.WithTimeout 1 235 per-call FormatGate.Place; MoveAdmission.ReadForMove; StopAndRestart.ReadClean one RPC or request -core/host/master/workspace_service.go services.MoveWorkspace context.WithTimeout 1 354 per-call FormatGate.Place; MoveAdmission.ReadForMove; StopAndRestart.ReadClean one RPC or request -core/host/master/workspace_service.go services.PreviewWorkspaceMove context.WithTimeout 1 622 per-call FormatGate.Place; MoveAdmission.ReadForMove; StopAndRestart.ReadClean one RPC or request -core/host/volume/chunk_control.go chunkContext context.WithTimeout 1 522 pending-fix SnapOps.Start HTTP chunk handlers' default 5 min total (manual cut, snapshot, backup); fix #964 and its waiter follow-up -core/host/volume/chunk_control.go StatusServer.handleChunkDetach context.WithTimeout 1 711 pending-fix SnapOps.Start a cut waiter's fixed total; fix follows the cut window of #964 (one waiter PR for snapshot, backup, plain detach and stop) -core/host/volume/chunk_control.go chunkControl.snapshotOperationAttempt context.WithTimeout 1 944 per-call SnapOps.Start one RPC or request -core/host/volume/chunk_control.go chunkControl.deleteSnapshotOperation time.Now().Add 1 1077 pending-fix SnapOps.Start unmeasured: the holder's snapshot-delete resume loop (30 s) around intent preparation; a measurement at the cap or a window is owed -core/host/volume/chunk_control.go chunkControl.deleteSnapshotOperation time.After 1 1100 control-timer SnapOps.Start resume loop poll +core/host/master/workspace_service.go services.AckWorkspaceRevoked context.WithTimeout 1 236 per-call FormatGate.Place; MoveAdmission.ReadForMove; StopAndRestart.ReadClean one RPC or request +core/host/master/workspace_service.go services.MoveWorkspace context.WithTimeout 1 355 per-call FormatGate.Place; MoveAdmission.ReadForMove; StopAndRestart.ReadClean one RPC or request +core/host/master/workspace_service.go services.PreviewWorkspaceMove context.WithTimeout 1 623 per-call FormatGate.Place; MoveAdmission.ReadForMove; StopAndRestart.ReadClean one RPC or request +core/host/volume/chunk_control.go chunkContext context.WithTimeout 1 524 pending-fix SnapOps.Start HTTP chunk handlers' default 5 min total (manual cut, snapshot, backup); fix #964 and its waiter follow-up +core/host/volume/chunk_control.go StatusServer.handleChunkDetach context.WithTimeout 1 713 pending-fix SnapOps.Start a cut waiter's fixed total; fix follows the cut window of #964 (one waiter PR for snapshot, backup, plain detach and stop) +core/host/volume/chunk_control.go chunkControl.snapshotOperationAttempt context.WithTimeout 1 946 per-call SnapOps.Start one RPC or request +core/host/volume/chunk_control.go chunkControl.deleteSnapshotOperation time.Now().Add 1 1079 pending-fix SnapOps.Start unmeasured: the holder's snapshot-delete resume loop (30 s) around intent preparation; a measurement at the cap or a window is owed +core/host/volume/chunk_control.go chunkControl.deleteSnapshotOperation time.After 1 1102 control-timer SnapOps.Start resume loop poll core/host/volume/host.go Host.runRoleRetry time.After 1 550 control-timer FormatGate.Downgrade; FormatGate.Upgrade role retry delay core/host/volume/host.go Host.runHeartbeat context.WithTimeout 1 792 per-call FormatGate.Downgrade; FormatGate.Upgrade one RPC or request core/host/volume/host.go Host.runSubscribe time.After 1 962 control-timer FormatGate.Downgrade; FormatGate.Upgrade subscribe retry backoff From 26a6361f6a396641df260968e7651598de2c3c76 Mon Sep 17 00:00:00 2001 From: pingqiu-cpu Date: Thu, 3 Dec 2026 02:40:36 -0800 Subject: [PATCH 08/66] fix: keep progressing manual cuts alive beyond the total timeout (#964) Interim merge note (spec trace workflow startup_failure since 22:45Z): go test (linux) and process-level tests (real binaries) passed on 8f14f03a against the current main head 9533b51f; spec-trace-check.sh and public-text-check.sh run locally with the base branch's scripts against this head and body: both pass. Linux qualification at 7be2a259 (8f14f03a differs only in docs/time-bounds.tsv): vet clean, -short of the six touched packages pass, targeted -race -count=2 finds no race; matched-box runtime of chunkstore and durable below main. Code review ACCEPT carried to 7be2a259; model review FINAL ACCEPT (CutTime r8c). --- seaweed-block/.github/model-code-trace.tsv | 33 ++ seaweed-block/cmd/sw-block/chunk.go | 19 +- seaweed-block/cmd/sw-block/chunk_loop.go | 11 +- .../cmd/sw-block/chunk_output_test.go | 13 +- .../cmd/sw-block/chunk_request_loop_test.go | 12 +- seaweed-block/cmd/sw-block/chunk_test.go | 12 +- .../cmd/sw-block/cut_progress_poll.go | 189 +++++++ .../cmd/sw-block/cut_progress_poll_test.go | 525 ++++++++++++++++++ .../sw-block/integration_invocations_test.go | 10 + .../core/frontend/chunkstore/control_types.go | 6 +- .../chunkstore/cut_verification_window.go | 46 ++ .../cut_verification_window_test.go | 141 +++++ .../core/frontend/chunkstore/layout/commit.go | 9 + .../head_generation_source_guard_test.go | 18 +- .../core/frontend/chunkstore/layout_remote.go | 2 +- .../frontend/chunkstore/layout_remote_test.go | 8 +- .../durable/chunk_snapshot_schedule.go | 8 +- .../durable/chunk_upload_pacing_sent_test.go | 4 + .../core/frontend/durable/provider.go | 3 +- .../core/frontend/durable/provider_chunk.go | 42 +- .../provider_chunk_detach_abort_test.go | 6 +- .../durable/provider_maintenance_test.go | 7 +- .../core/host/volume/chunk_control.go | 119 +++- .../core/host/volume/chunk_control_test.go | 37 +- .../host/volume/chunk_frozen_budget_test.go | 7 +- .../host/volume/chunk_unknown_path_test.go | 4 +- .../host/volume/cut_progress_window_test.go | 224 ++++++++ seaweed-block/core/host/volume/manual_cut.go | 155 ++++++ .../core/host/volume/manual_cut_test.go | 513 +++++++++++++++++ .../volume/snapshot_operation_red_test.go | 35 ++ .../chunk_commit_check_callers_test.go | 6 +- seaweed-block/core/storage/chunk_cut_cow.go | 4 +- .../storage/chunk_cut_payload_budget_test.go | 3 +- .../chunk_cut_timeout_progress_test.go | 21 + seaweed-block/core/storage/chunk_layer.go | 66 ++- .../core/storage/chunk_manual_cut.go | 180 ++++++ .../core/storage/chunk_manual_cut_test.go | 38 ++ .../core/storage/chunk_manual_settle_test.go | 263 +++++++++ .../core/storage/chunk_periodic_cut.go | 6 +- seaweed-block/core/storage/chunk_seam.go | 2 + seaweed-block/core/storage/chunk_upload.go | 16 +- .../core/storage/cut_progress_window.go | 169 ++++++ seaweed-block/docs/design/block-design.md | 91 +++ .../docs/design/cut-time-resource-grid.tsv | 7 + seaweed-block/docs/design/invariants.md | 63 ++- seaweed-block/docs/releases/v1.1.md | 8 + seaweed-block/docs/spec/README.md | 42 ++ seaweed-block/docs/spec/cuttime/CutTime.tla | 484 ++++++++++++++++ seaweed-block/docs/spec/cuttime/README.md | 80 +++ .../docs/spec/cuttime/cfg/EXPECTED.txt | 44 ++ .../docs/spec/cuttime/cfg/mut_answer_late.cfg | 28 + .../spec/cuttime/cfg/mut_attempt_renews.cfg | 28 + .../spec/cuttime/cfg/mut_busy_when_free.cfg | 28 + .../spec/cuttime/cfg/mut_cli_no_slack.cfg | 28 + .../spec/cuttime/cfg/mut_cli_no_window.cfg | 28 + .../cuttime/cfg/mut_cli_total_timeout.cfg | 28 + .../spec/cuttime/cfg/mut_fence_renews.cfg | 28 + .../spec/cuttime/cfg/mut_forget_on_send.cfg | 28 + .../spec/cuttime/cfg/mut_global_renews.cfg | 28 + .../spec/cuttime/cfg/mut_inherited_as_own.cfg | 28 + .../spec/cuttime/cfg/mut_no_call_deadline.cfg | 28 + .../spec/cuttime/cfg/mut_overwrite_next.cfg | 28 + .../cuttime/cfg/mut_preempt_loses_uploads.cfg | 28 + .../spec/cuttime/cfg/mut_preempt_manual.cfg | 28 + .../spec/cuttime/cfg/mut_queued_no_renew.cfg | 28 + .../spec/cuttime/cfg/mut_queued_stalls.cfg | 28 + .../docs/spec/cuttime/cfg/mut_repost.cfg | 28 + .../cuttime/cfg/mut_restart_as_failed.cfg | 28 + .../spec/cuttime/cfg/mut_retire_early.cfg | 28 + .../cuttime/cfg/mut_retry_loses_progress.cfg | 28 + .../spec/cuttime/cfg/mut_settle_as_failed.cfg | 28 + .../cuttime/cfg/mut_settle_as_failed_nff.cfg | 15 + .../spec/cuttime/cfg/mut_settle_no_rise.cfg | 28 + .../docs/spec/cuttime/cfg/mut_settle_skip.cfg | 28 + .../spec/cuttime/cfg/mut_timeout_renews.cfg | 28 + .../docs/spec/cuttime/cfg/mut_total_cap.cfg | 28 + .../spec/cuttime/cfg/mut_window_not_reset.cfg | 28 + .../docs/spec/cuttime/cfg/safe_cut.cfg | 28 + .../spec/cuttime/cfg/safe_cut_deadline.cfg | 28 + .../docs/spec/cuttime/cfg/safe_cut_late.cfg | 28 + .../docs/spec/cuttime/cfg/safe_detach.cfg | 28 + .../docs/spec/cuttime/cfg/wit_busy.cfg | 15 + .../spec/cuttime/cfg/wit_cli_deadline.cfg | 15 + .../docs/spec/cuttime/cfg/wit_cli_stalled.cfg | 15 + .../cuttime/cfg/wit_detach_after_queue.cfg | 15 + .../docs/spec/cuttime/cfg/wit_fenced.cfg | 15 + .../cuttime/cfg/wit_inherited_then_own.cfg | 15 + .../cuttime/cfg/wit_lost_reply_then_ok.cfg | 15 + .../spec/cuttime/cfg/wit_preempt_reuse.cfg | 15 + .../spec/cuttime/cfg/wit_restart_unknown.cfg | 15 + .../spec/cuttime/cfg/wit_settle_then_ok.cfg | 15 + .../spec/cuttime/cfg/wit_settle_unknown.cfg | 15 + .../spec/cuttime/cfg/wit_slow_no_fail.cfg | 15 + .../cuttime/cfg/wit_stalled_retry_pub.cfg | 15 + .../cuttime/cfg/wit_timed_out_then_pub.cfg | 15 + .../spec/cuttime/cfg/wit_unknown_then_pub.cfg | 15 + .../docs/spec/cuttime/recorded-r5/RESULT.txt | 26 + .../spec/cuttime/recorded-r5/coverage.txt | 10 + .../recorded-r5/out-mut_answer_late.txt | 340 ++++++++++++ .../recorded-r5/out-mut_attempt_renews.txt | 253 +++++++++ .../recorded-r5/out-mut_busy_when_free.txt | 79 +++ .../recorded-r5/out-mut_cli_no_slack.txt | 195 +++++++ .../recorded-r5/out-mut_cli_no_window.txt | 253 +++++++++ .../recorded-r5/out-mut_cli_total_timeout.txt | 253 +++++++++ .../recorded-r5/out-mut_global_renews.txt | 282 ++++++++++ .../recorded-r5/out-mut_no_call_deadline.txt | 195 +++++++ .../recorded-r5/out-mut_queued_stalls.txt | 166 ++++++ .../cuttime/recorded-r5/out-mut_repost.txt | 108 ++++ .../recorded-r5/out-mut_restart_as_failed.txt | 137 +++++ .../out-mut_retry_loses_progress.txt | 224 ++++++++ .../recorded-r5/out-mut_timeout_renews.txt | 282 ++++++++++ .../cuttime/recorded-r5/out-mut_total_cap.txt | 311 +++++++++++ .../recorded-r5/out-mut_window_not_reset.txt | 282 ++++++++++ .../spec/cuttime/recorded-r5/out-safe_cut.txt | 23 + .../recorded-r5/out-safe_cut_deadline.txt | 23 + .../cuttime/recorded-r5/out-safe_cut_late.txt | 23 + .../spec/cuttime/recorded-r5/out-wit_busy.txt | 108 ++++ .../recorded-r5/out-wit_cli_deadline.txt | 195 +++++++ .../recorded-r5/out-wit_cli_stalled.txt | 224 ++++++++ .../recorded-r5/out-wit_restart_unknown.txt | 166 ++++++ .../recorded-r5/out-wit_slow_no_fail.txt | 427 ++++++++++++++ .../recorded-r5/out-wit_stalled_retry_pub.txt | 398 +++++++++++++ .../out-wit_timed_out_then_pub.txt | 369 ++++++++++++ .../recorded-r5/out-wit_unknown_then_pub.txt | 311 +++++++++++ .../spec/cuttime/recorded-r5/verdicts.txt | 26 + .../docs/spec/cuttime/recorded-r6/RESULT.txt | 30 + .../spec/cuttime/recorded-r6/coverage.txt | 10 + .../recorded-r6/out-mut_answer_late.txt | 373 +++++++++++++ .../recorded-r6/out-mut_attempt_renews.txt | 277 +++++++++ .../recorded-r6/out-mut_busy_when_free.txt | 85 +++ .../recorded-r6/out-mut_cli_no_slack.txt | 213 +++++++ .../recorded-r6/out-mut_cli_no_window.txt | 277 +++++++++ .../recorded-r6/out-mut_cli_total_timeout.txt | 277 +++++++++ .../recorded-r6/out-mut_forget_on_send.txt | 341 ++++++++++++ .../recorded-r6/out-mut_global_renews.txt | 309 +++++++++++ .../recorded-r6/out-mut_no_call_deadline.txt | 213 +++++++ .../recorded-r6/out-mut_overwrite_next.txt | 309 +++++++++++ .../recorded-r6/out-mut_queued_stalls.txt | 181 ++++++ .../cuttime/recorded-r6/out-mut_repost.txt | 117 ++++ .../recorded-r6/out-mut_restart_as_failed.txt | 149 +++++ .../recorded-r6/out-mut_retire_early.txt | 309 +++++++++++ .../out-mut_retry_loses_progress.txt | 245 ++++++++ .../recorded-r6/out-mut_timeout_renews.txt | 309 +++++++++++ .../cuttime/recorded-r6/out-mut_total_cap.txt | 341 ++++++++++++ .../recorded-r6/out-mut_window_not_reset.txt | 309 +++++++++++ .../spec/cuttime/recorded-r6/out-safe_cut.txt | 23 + .../recorded-r6/out-safe_cut_deadline.txt | 24 + .../cuttime/recorded-r6/out-safe_cut_late.txt | 23 + .../spec/cuttime/recorded-r6/out-wit_busy.txt | 117 ++++ .../recorded-r6/out-wit_cli_deadline.txt | 213 +++++++ .../recorded-r6/out-wit_cli_stalled.txt | 245 ++++++++ .../out-wit_lost_reply_then_ok.txt | 341 ++++++++++++ .../recorded-r6/out-wit_restart_unknown.txt | 149 +++++ .../recorded-r6/out-wit_slow_no_fail.txt | 469 ++++++++++++++++ .../recorded-r6/out-wit_stalled_retry_pub.txt | 437 +++++++++++++++ .../out-wit_timed_out_then_pub.txt | 405 ++++++++++++++ .../recorded-r6/out-wit_unknown_then_pub.txt | 341 ++++++++++++ .../spec/cuttime/recorded-r6/verdicts.txt | 30 + .../docs/spec/cuttime/recorded-r8b/RESULT.txt | 42 ++ .../docs/spec/cuttime/recorded-r8c/RESULT.txt | 46 ++ .../docs/spec/cutwindow/CutWindow.tla | 105 ++++ .../cutwindow/cfg/mut_no_call_deadline.cfg | 13 + .../cfg/mut_retry_loses_progress.cfg | 13 + .../spec/cutwindow/cfg/mut_timeout_renews.cfg | 13 + .../docs/spec/cutwindow/cfg/mut_total_cap.cfg | 13 + .../cutwindow/cfg/mut_window_not_reset.cfg | 13 + .../docs/spec/cutwindow/cfg/safe_cut.cfg | 13 + .../spec/cutwindow/cfg/wit_fail_retry_pub.cfg | 10 + .../spec/cutwindow/cfg/wit_slow_no_fail.cfg | 10 + .../cutwindow/cfg/wit_timed_out_then_pub.cfg | 10 + seaweed-block/docs/spec/cutwindow/results.txt | 9 + seaweed-block/docs/status-schema.md | 18 +- seaweed-block/docs/time-bounds.tsv | 52 +- 173 files changed, 18298 insertions(+), 153 deletions(-) create mode 100644 seaweed-block/cmd/sw-block/cut_progress_poll.go create mode 100644 seaweed-block/cmd/sw-block/cut_progress_poll_test.go create mode 100644 seaweed-block/core/frontend/chunkstore/cut_verification_window.go create mode 100644 seaweed-block/core/frontend/chunkstore/cut_verification_window_test.go create mode 100644 seaweed-block/core/host/volume/cut_progress_window_test.go create mode 100644 seaweed-block/core/host/volume/manual_cut.go create mode 100644 seaweed-block/core/host/volume/manual_cut_test.go create mode 100644 seaweed-block/core/storage/chunk_manual_cut.go create mode 100644 seaweed-block/core/storage/chunk_manual_cut_test.go create mode 100644 seaweed-block/core/storage/chunk_manual_settle_test.go create mode 100644 seaweed-block/core/storage/cut_progress_window.go create mode 100644 seaweed-block/docs/design/cut-time-resource-grid.tsv create mode 100644 seaweed-block/docs/spec/cuttime/CutTime.tla create mode 100644 seaweed-block/docs/spec/cuttime/README.md create mode 100644 seaweed-block/docs/spec/cuttime/cfg/EXPECTED.txt create mode 100644 seaweed-block/docs/spec/cuttime/cfg/mut_answer_late.cfg create mode 100644 seaweed-block/docs/spec/cuttime/cfg/mut_attempt_renews.cfg create mode 100644 seaweed-block/docs/spec/cuttime/cfg/mut_busy_when_free.cfg create mode 100644 seaweed-block/docs/spec/cuttime/cfg/mut_cli_no_slack.cfg create mode 100644 seaweed-block/docs/spec/cuttime/cfg/mut_cli_no_window.cfg create mode 100644 seaweed-block/docs/spec/cuttime/cfg/mut_cli_total_timeout.cfg create mode 100644 seaweed-block/docs/spec/cuttime/cfg/mut_fence_renews.cfg create mode 100644 seaweed-block/docs/spec/cuttime/cfg/mut_forget_on_send.cfg create mode 100644 seaweed-block/docs/spec/cuttime/cfg/mut_global_renews.cfg create mode 100644 seaweed-block/docs/spec/cuttime/cfg/mut_inherited_as_own.cfg create mode 100644 seaweed-block/docs/spec/cuttime/cfg/mut_no_call_deadline.cfg create mode 100644 seaweed-block/docs/spec/cuttime/cfg/mut_overwrite_next.cfg create mode 100644 seaweed-block/docs/spec/cuttime/cfg/mut_preempt_loses_uploads.cfg create mode 100644 seaweed-block/docs/spec/cuttime/cfg/mut_preempt_manual.cfg create mode 100644 seaweed-block/docs/spec/cuttime/cfg/mut_queued_no_renew.cfg create mode 100644 seaweed-block/docs/spec/cuttime/cfg/mut_queued_stalls.cfg create mode 100644 seaweed-block/docs/spec/cuttime/cfg/mut_repost.cfg create mode 100644 seaweed-block/docs/spec/cuttime/cfg/mut_restart_as_failed.cfg create mode 100644 seaweed-block/docs/spec/cuttime/cfg/mut_retire_early.cfg create mode 100644 seaweed-block/docs/spec/cuttime/cfg/mut_retry_loses_progress.cfg create mode 100644 seaweed-block/docs/spec/cuttime/cfg/mut_settle_as_failed.cfg create mode 100644 seaweed-block/docs/spec/cuttime/cfg/mut_settle_as_failed_nff.cfg create mode 100644 seaweed-block/docs/spec/cuttime/cfg/mut_settle_no_rise.cfg create mode 100644 seaweed-block/docs/spec/cuttime/cfg/mut_settle_skip.cfg create mode 100644 seaweed-block/docs/spec/cuttime/cfg/mut_timeout_renews.cfg create mode 100644 seaweed-block/docs/spec/cuttime/cfg/mut_total_cap.cfg create mode 100644 seaweed-block/docs/spec/cuttime/cfg/mut_window_not_reset.cfg create mode 100644 seaweed-block/docs/spec/cuttime/cfg/safe_cut.cfg create mode 100644 seaweed-block/docs/spec/cuttime/cfg/safe_cut_deadline.cfg create mode 100644 seaweed-block/docs/spec/cuttime/cfg/safe_cut_late.cfg create mode 100644 seaweed-block/docs/spec/cuttime/cfg/safe_detach.cfg create mode 100644 seaweed-block/docs/spec/cuttime/cfg/wit_busy.cfg create mode 100644 seaweed-block/docs/spec/cuttime/cfg/wit_cli_deadline.cfg create mode 100644 seaweed-block/docs/spec/cuttime/cfg/wit_cli_stalled.cfg create mode 100644 seaweed-block/docs/spec/cuttime/cfg/wit_detach_after_queue.cfg create mode 100644 seaweed-block/docs/spec/cuttime/cfg/wit_fenced.cfg create mode 100644 seaweed-block/docs/spec/cuttime/cfg/wit_inherited_then_own.cfg create mode 100644 seaweed-block/docs/spec/cuttime/cfg/wit_lost_reply_then_ok.cfg create mode 100644 seaweed-block/docs/spec/cuttime/cfg/wit_preempt_reuse.cfg create mode 100644 seaweed-block/docs/spec/cuttime/cfg/wit_restart_unknown.cfg create mode 100644 seaweed-block/docs/spec/cuttime/cfg/wit_settle_then_ok.cfg create mode 100644 seaweed-block/docs/spec/cuttime/cfg/wit_settle_unknown.cfg create mode 100644 seaweed-block/docs/spec/cuttime/cfg/wit_slow_no_fail.cfg create mode 100644 seaweed-block/docs/spec/cuttime/cfg/wit_stalled_retry_pub.cfg create mode 100644 seaweed-block/docs/spec/cuttime/cfg/wit_timed_out_then_pub.cfg create mode 100644 seaweed-block/docs/spec/cuttime/cfg/wit_unknown_then_pub.cfg create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r5/RESULT.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r5/coverage.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_answer_late.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_attempt_renews.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_busy_when_free.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_cli_no_slack.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_cli_no_window.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_cli_total_timeout.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_global_renews.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_no_call_deadline.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_queued_stalls.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_repost.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_restart_as_failed.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_retry_loses_progress.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_timeout_renews.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_total_cap.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_window_not_reset.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r5/out-safe_cut.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r5/out-safe_cut_deadline.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r5/out-safe_cut_late.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r5/out-wit_busy.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r5/out-wit_cli_deadline.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r5/out-wit_cli_stalled.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r5/out-wit_restart_unknown.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r5/out-wit_slow_no_fail.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r5/out-wit_stalled_retry_pub.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r5/out-wit_timed_out_then_pub.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r5/out-wit_unknown_then_pub.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r5/verdicts.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r6/RESULT.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r6/coverage.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_answer_late.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_attempt_renews.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_busy_when_free.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_cli_no_slack.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_cli_no_window.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_cli_total_timeout.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_forget_on_send.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_global_renews.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_no_call_deadline.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_overwrite_next.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_queued_stalls.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_repost.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_restart_as_failed.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_retire_early.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_retry_loses_progress.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_timeout_renews.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_total_cap.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_window_not_reset.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r6/out-safe_cut.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r6/out-safe_cut_deadline.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r6/out-safe_cut_late.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r6/out-wit_busy.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r6/out-wit_cli_deadline.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r6/out-wit_cli_stalled.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r6/out-wit_lost_reply_then_ok.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r6/out-wit_restart_unknown.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r6/out-wit_slow_no_fail.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r6/out-wit_stalled_retry_pub.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r6/out-wit_timed_out_then_pub.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r6/out-wit_unknown_then_pub.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r6/verdicts.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r8b/RESULT.txt create mode 100644 seaweed-block/docs/spec/cuttime/recorded-r8c/RESULT.txt create mode 100644 seaweed-block/docs/spec/cutwindow/CutWindow.tla create mode 100644 seaweed-block/docs/spec/cutwindow/cfg/mut_no_call_deadline.cfg create mode 100644 seaweed-block/docs/spec/cutwindow/cfg/mut_retry_loses_progress.cfg create mode 100644 seaweed-block/docs/spec/cutwindow/cfg/mut_timeout_renews.cfg create mode 100644 seaweed-block/docs/spec/cutwindow/cfg/mut_total_cap.cfg create mode 100644 seaweed-block/docs/spec/cutwindow/cfg/mut_window_not_reset.cfg create mode 100644 seaweed-block/docs/spec/cutwindow/cfg/safe_cut.cfg create mode 100644 seaweed-block/docs/spec/cutwindow/cfg/wit_fail_retry_pub.cfg create mode 100644 seaweed-block/docs/spec/cutwindow/cfg/wit_slow_no_fail.cfg create mode 100644 seaweed-block/docs/spec/cutwindow/cfg/wit_timed_out_then_pub.cfg create mode 100644 seaweed-block/docs/spec/cutwindow/results.txt diff --git a/seaweed-block/.github/model-code-trace.tsv b/seaweed-block/.github/model-code-trace.tsv index 7d58c62940..8a75564bcc 100644 --- a/seaweed-block/.github/model-code-trace.tsv +++ b/seaweed-block/.github/model-code-trace.tsv @@ -251,3 +251,36 @@ core/frontend/chunkstore/layout_store.go CleanBatch.Request core/frontend/chunkstore/layout_store.go CleanBatch.Publish core/frontend/chunkstore/layout/head.go CleanBatch.Request core/frontend/chunkstore/layout/head.go CleanBatch.Publish +core/storage/cut_progress_window.go CutWindow.Complete +core/storage/cut_progress_window.go CutTime.Complete +core/storage/cut_progress_window.go CutWindow.Tick +core/storage/cut_progress_window.go CutWindow.Fail +core/storage/chunk_upload.go CutWindow.Start +core/storage/chunk_upload.go CutWindow.CallTimeout +core/storage/chunk_layer.go CutWindow.Retry +core/storage/chunk_layer.go CutWindow.Publish +core/frontend/durable/provider_chunk.go CutWindow.Fail +core/host/volume/chunk_control.go CutWindow.Fail +core/frontend/chunkstore/cut_verification_window.go CutWindow.CallTimeout +cmd/sw-block/cut_progress_poll.go CutTime.Poll +cmd/sw-block/cut_progress_poll.go CutTime.CliSilent +cmd/sw-block/cut_progress_poll.go CutTime.CliGiveUp +cmd/sw-block/cut_progress_poll.go CutTime.HolderRestart +cmd/sw-block/chunk.go CutTime.Poll +core/frontend/chunkstore/layout/commit.go CutTime.Complete +core/frontend/chunkstore/cut_verification_window.go CutTime.Complete +core/host/volume/manual_cut.go CutTime.Admit +core/host/volume/manual_cut.go CutTime.InProgress +core/host/volume/manual_cut.go CutTime.Poll +core/host/volume/manual_cut.go CutTime.Retire +core/storage/chunk_manual_cut.go CutTime.Busy +core/frontend/durable/provider_chunk.go CutTime.Admit +core/host/volume/chunk_control.go CutTime.InProgress +core/storage/chunk_manual_cut.go CutTime.PublishLost +core/storage/chunk_manual_cut.go CutTime.Settle +core/storage/chunk_manual_cut.go CutTime.SettleStall +core/storage/chunk_layer.go CutTime.Settle +cmd/sw-block/cut_progress_poll.go CutTime.CliServerUnknown +core/storage/chunk_manual_cut.go HolderInterface.Fence +core/storage/chunk_manual_cut.go CutTime.SettleInherited +core/storage/cut_progress_window.go CutWindow.CallTimeout diff --git a/seaweed-block/cmd/sw-block/chunk.go b/seaweed-block/cmd/sw-block/chunk.go index 631ac9a735..4ed08fb0e4 100644 --- a/seaweed-block/cmd/sw-block/chunk.go +++ b/seaweed-block/cmd/sw-block/chunk.go @@ -222,21 +222,30 @@ func chunkPostUntil(name, statusAddr, route string, timeout time.Duration, waitU func chunkCut(args []string, stdout, stderr io.Writer) int { fs := chunkFlagSet("cut", stderr) var ( - volumeID, statusAddr string - minLSN uint64 - timeout time.Duration + volumeID, statusAddr, deadlineText string + minLSN uint64 + timeout time.Duration ) fs.StringVar(&volumeID, "volume", "", "volume id") fs.StringVar(&statusAddr, "status-addr", "", "blockvolume status address or URL (with --chunk-control-endpoint)") fs.Uint64Var(&minLSN, "min-lsn", 0, "fail unless the cut reaches this LSN") - fs.DurationVar(&timeout, "timeout", 60*time.Second, chunkTimeoutHelp) + fs.DurationVar(&timeout, "timeout", 60*time.Second, "no-progress window for this cut; answered polls alone do not renew it") + fs.StringVar(&deadlineText, "deadline", "", "optional absolute RFC3339 deadline") if err := fs.Parse(args); err != nil { return chunkFail(chunkName(fs), stdout, stderr, ops.VolumeStatusExitInvalid, codeBadRequestCLI, err.Error(), false) } if volumeID == "" || statusAddr == "" { return chunkFail("cut", stdout, stderr, ops.VolumeStatusExitInvalid, codeBadRequestCLI, "--volume and --status-addr are required", false) } - return chunkPostLoop("cut", statusAddr, "/chunk/cut", timeout, map[string]any{"volumeID": volumeID, "minLSN": minLSN}, stdout, stderr) + var deadline time.Time + if deadlineText != "" { + var err error + deadline, err = time.Parse(time.RFC3339Nano, deadlineText) + if err != nil || deadline.IsZero() || !time.Unix(0, deadline.UnixNano()).Equal(deadline) { + return chunkFail("cut", stdout, stderr, 2, codeBadRequestCLI, "--deadline must be a nonzero absolute RFC3339 time representable as Unix nanoseconds", false) + } + } + return chunkObserveCut(statusAddr, timeout, deadline, map[string]any{"volumeID": volumeID, "minLSN": minLSN}, stdout, stderr) } func chunkSnapshot(args []string, stdout, stderr io.Writer) int { diff --git a/seaweed-block/cmd/sw-block/chunk_loop.go b/seaweed-block/cmd/sw-block/chunk_loop.go index 0de1b072bd..57b9939eec 100644 --- a/seaweed-block/cmd/sw-block/chunk_loop.go +++ b/seaweed-block/cmd/sw-block/chunk_loop.go @@ -42,13 +42,10 @@ func chunkMinRequest() time.Duration { return min(time.Second, chunkRequestBound // cannot take a request's time (2 s; less when the bound is short, as in tests). func chunkReadBound() time.Duration { return min(2*time.Second, chunkRequestBound/10) } -// chunkPostLoop is the cut budget's request loop (v1.0.1): a cut, -// snapshot or detach whose work outlasts the server's bound on one request -// (chunkRequestBound) finishes across requests. Each request carries the same -// body; the server answers a snapshot name it already holds from HEAD, so a -// snapshot that committed during a timed-out request is found by the next one, -// not taken again. The holder keeps an unfinished cut's uploads between -// requests, so each request sends only what is missing. +// chunkPostLoop repeats snapshot and detach requests after a retryable or +// uncertain answer. Manual cuts use one POST and read-only handle polling. +// Each request carries the same snapshot intent or detach body; the holder +// answers an already committed snapshot from HEAD rather than taking it again. // // One deadline, now + timeout, bounds everything the loop does: each request's // own bound and the client's wait for its answer end inside it, the progress diff --git a/seaweed-block/cmd/sw-block/chunk_output_test.go b/seaweed-block/cmd/sw-block/chunk_output_test.go index 7badc1e765..472831e3a1 100644 --- a/seaweed-block/cmd/sw-block/chunk_output_test.go +++ b/seaweed-block/cmd/sw-block/chunk_output_test.go @@ -12,7 +12,6 @@ import ( "net/http/httptest" "strings" "testing" - ) type failWriter struct{} @@ -30,7 +29,9 @@ func (shortWriter) Write(p []byte) (int, error) { func sizedServer(t *testing.T, n int) *httptest.Server { t.Helper() - body := bytes.Repeat([]byte("a"), n) + prefix, suffix := []byte(`{"volumeID":"v1","cutLSN":9,"headGen":4,"padding":"`), []byte(`"}`) + body := append(prefix, bytes.Repeat([]byte("a"), n-len(prefix)-len(suffix))...) + body = append(body, suffix...) srv := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { _, _ = io.Copy(io.Discard, r.Body) w.WriteHeader(http.StatusOK) @@ -43,11 +44,11 @@ func sizedServer(t *testing.T, n int) *httptest.Server { func TestOpsChunk_OversizedResponseIsRefused(t *testing.T) { var out, errb bytes.Buffer code := run([]string{"ops", "chunk", "cut", "--volume", "v1", "--status-addr", sizedServer(t, chunkResponseLimit+1).URL}, &out, &errb) - if code != chunkExitFailed || out.Len() > 1024 || !strings.Contains(errb.String(), "exceeds") { + if code != chunkExitUnknown || out.Len() > 1024 || !strings.Contains(errb.String(), "exceeds") { t.Fatalf("200 body one byte over the limit: exit %d, %d bytes on stdout, stderr %q; want a refusal, not the body", code, out.Len(), errb.String()) } - if e := chunkErrorOut(t, out.String()); e.Code != "internal" { - t.Fatalf("200 body one byte over the limit: %+v, want the internal error body", e) + if e := chunkErrorOut(t, out.String()); e.Code != "outcome_unknown" { + t.Fatalf("200 body one byte over the limit: %+v, want the unknown-outcome error body", e) } out.Reset() errb.Reset() @@ -57,7 +58,7 @@ func TestOpsChunk_OversizedResponseIsRefused(t *testing.T) { } func TestOpsChunk_LostResultFailsTheCommand(t *testing.T) { - srv, _ := chunkServer(t, 200, `{"volumeID":"v1","cutLSN":9}`) + srv, _ := chunkServer(t, 200, `{"volumeID":"v1","cutLSN":9,"headGen":4}`) store := newMemChunkStore() useMemChunkStore(t, store) v := cliVolume(t, store, "v1", "s1") diff --git a/seaweed-block/cmd/sw-block/chunk_request_loop_test.go b/seaweed-block/cmd/sw-block/chunk_request_loop_test.go index 88d60aad3f..da92d9e7db 100644 --- a/seaweed-block/cmd/sw-block/chunk_request_loop_test.go +++ b/seaweed-block/cmd/sw-block/chunk_request_loop_test.go @@ -104,7 +104,7 @@ const ( detachAborted = `{"code":"detach_aborted","message":"durable: detach aborted; the volume keeps serving on this host","retryable":true}` detachFenced = `{"code":"fenced","message":"HEAD belongs to a newer epoch or another holder","retryable":false}` sealed = `{"volumeID":"v1","cutLSN":9,"headGen":5,"headEpoch":1,"lastWrittenLSN":9}` - cutUnknown = `{"code":"outcome_unknown","message":"storage: chunk HEAD CAS outcome unknown","retryable":true}` + cutUnknown = `{"apiVersion":1,"code":"outcome_unknown","message":"storage: chunk HEAD CAS outcome unknown","retryable":true}` ) // The request loop: a snapshot whose work outlasts one request finishes across requests, every request carrying @@ -342,15 +342,19 @@ func TestChunkLoopReportsTheHolderProgressSinceTheFirstRequest(t *testing.T) { } } -// cut and the plain detach loop the same way; the sealed generation is printed once. -func TestChunkCutAndPlainDetachRepeatTimedOutRequests(t *testing.T) { +// A cut with an unidentified admission outcome must not start a second cut. +// Plain detach retains its retry loop; the sealed generation is printed once. +func TestChunkCutUnknownIsNotRepostedAndPlainDetachRetries(t *testing.T) { shortLoop(t, 200*time.Millisecond, 10*time.Millisecond, 10*time.Millisecond) s := &scripted{replies: []scriptedReply{{503, cutUnknown}, {200, `{"volumeID":"v1","cutLSN":9}`}}} srv := s.start(t) code, out, errs := runChunk("cut", "--volume", "v1", "--status-addr", srv.URL, "--timeout", "5s") - if code != 0 || out != `{"volumeID":"v1","cutLSN":9}` || len(s.recorded()) != 2 { + if code != chunkExitUnknown || !strings.Contains(out, `"code":"outcome_unknown"`) || len(s.recorded()) != 1 { t.Fatalf("cut: exit %d stdout %q stderr %q, %d requests", code, out, errs, len(s.recorded())) } + if s.recorded()[0].body["observe"] != nil { + t.Fatal("cut still sends the removed observe opt-in") + } if strings.Contains(errs, "stopped guest I/O") { t.Fatalf("cut stderr %q: an outcome_unknown cut does not stop guest I/O", errs) } diff --git a/seaweed-block/cmd/sw-block/chunk_test.go b/seaweed-block/cmd/sw-block/chunk_test.go index b2e9054945..03601c67bf 100644 --- a/seaweed-block/cmd/sw-block/chunk_test.go +++ b/seaweed-block/cmd/sw-block/chunk_test.go @@ -46,9 +46,9 @@ func runChunk(args ...string) (int, string, string) { } func TestOpsChunk_HTTPCommandsSendSpecRequests(t *testing.T) { - srv, got := chunkServer(t, 200, `{"volumeID":"v1","cutLSN":9}`) + srv, got := chunkServer(t, 200, `{"volumeID":"v1","cutLSN":9,"headGen":4}`) addr := strings.TrimPrefix(srv.URL, "http://") - if code, out, errs := runChunk("cut", "--volume", "v1", "--status-addr", addr, "--min-lsn", "7", "--timeout", "2s"); code != 0 || out != `{"volumeID":"v1","cutLSN":9}` { + if code, out, errs := runChunk("cut", "--volume", "v1", "--status-addr", addr, "--min-lsn", "7", "--timeout", "2s"); code != 0 || out != `{"volumeID":"v1","cutLSN":9,"headGen":4}` { t.Fatalf("cut: %d %q %q", code, out, errs) } code, _, errs := runChunk("snapshot", "--volume", "v1", "--status-addr", srv.URL, "--name", "s1", "--label", "agent.step=npm-ci", "--consistency", "app") @@ -84,7 +84,7 @@ func TestOpsChunk_HTTPCommandsSendSpecRequests(t *testing.T) { } func TestOpsChunk_HTTPFailureIsTyped(t *testing.T) { - srv, _ := chunkServer(t, 409, `{"code":"not_primary","message":"volume v1 is not a healthy primary here","retryable":false}`) + srv, _ := chunkServer(t, 409, `{"apiVersion":1,"code":"not_primary","message":"volume v1 is not a healthy primary here","retryable":false}`) code, out, errs := runChunk("cut", "--volume", "v1", "--status-addr", srv.URL) if e := chunkErrorOut(t, out); code != chunkExitFailed || e.Code != "not_primary" || e.Message != "volume v1 is not a healthy primary here" || e.Retryable || !strings.Contains(errs, "not_primary: volume v1 is not a healthy primary here") { @@ -123,10 +123,10 @@ func TestOpsChunk_ErrorsAreJSONOnStdout(t *testing.T) { dead := httptest.NewServer(http.NotFoundHandler()) addr := dead.URL dead.Close() - if code, out, _ := runChunk("cut", "--volume", "v1", "--status-addr", addr); code != chunkExitFailed { + if code, out, _ := runChunk("cut", "--volume", "v1", "--status-addr", addr); code != chunkExitUnknown { t.Fatalf("unreachable blockvolume: exit %d %q", code, out) - } else if e := chunkErrorOut(t, out); e.Code != "remote_unavailable" || !e.Retryable { - t.Fatalf("unreachable blockvolume: %+v, want remote_unavailable and retryable", e) + } else if e := chunkErrorOut(t, out); e.Code != "outcome_unknown" || !e.Retryable { + t.Fatalf("unreachable blockvolume: %+v, want outcome_unknown and retryable", e) } store := newMemChunkStore() diff --git a/seaweed-block/cmd/sw-block/cut_progress_poll.go b/seaweed-block/cmd/sw-block/cut_progress_poll.go new file mode 100644 index 0000000000..39549063f7 --- /dev/null +++ b/seaweed-block/cmd/sw-block/cut_progress_poll.go @@ -0,0 +1,189 @@ +package main + +import ( + "bytes" + "context" + "encoding/json" + "fmt" + "io" + "net/http" + "net/url" + "strings" + "time" + + "github.com/seaweedfs/seaweed-block/core/frontend/chunkstore" +) + +const cutObservationSlack = 5 * time.Second +const chunkExitUnknown = 3 +const chunkExitCutBusy = 4 + +// chunkObserveCut starts once, then reads status by the holder's in-memory ID. +// Only this cut's completed-step sequence renews observation. +// A chosen deadline remains absolute across every request. +func chunkObserveCut(addr string, window time.Duration, deadline time.Time, body map[string]any, stdout, stderr io.Writer) int { + if window < time.Millisecond || window > time.Duration(1<<63-1)-cutObservationSlack { + return chunkFail("cut", stdout, stderr, 2, codeBadRequestCLI, "--timeout must be at least 1ms and leave room for observation slack", false) + } + body["timeoutMs"] = window.Milliseconds() + if !deadline.IsZero() { + body["deadlineNs"] = deadline.UnixNano() + } + payload, err := json.Marshal(body) + if err != nil { + return chunkFail("cut", stdout, stderr, 2, codeBadRequestCLI, err.Error(), false) + } + if !strings.Contains(addr, "://") { + addr = "http://" + addr + } + id := "" + last := time.Now() + seen := uint64(0) + bound := window + cutObservationSlack + // A 307/308 redirect can replay a POST inside Client.Do. An admission + // whose answer is ambiguous must remain unknown, never start again. + client := *chunkHTTPClient + client.CheckRedirect = func(*http.Request, []*http.Request) error { return http.ErrUseLastResponse } + unknown := func(why string) int { + if id != "" { + why += "; cut id " + id + } + return chunkFail("cut", stdout, stderr, chunkExitUnknown, "outcome_unknown", why, true) + } + for { + until := last.Add(bound) + if !deadline.IsZero() && deadline.Before(until) { + until = deadline + } + if !time.Now().Before(until) { + return unknown("cut observation window or explicit deadline expired") + } + ctx, cancel := context.WithDeadline(context.Background(), until) + method, endpoint := http.MethodPost, strings.TrimRight(addr, "/")+"/chunk/cut" + var requestBody io.Reader = bytes.NewReader(payload) + if id != "" { + method = http.MethodGet + endpoint += "?" + url.Values{"volumeID": {fmt.Sprint(body["volumeID"])}, "cutID": {id}}.Encode() + requestBody = nil + } + req, err := http.NewRequestWithContext(ctx, method, endpoint, requestBody) + if err != nil { + cancel() + return chunkFail("cut", stdout, stderr, 2, codeBadRequestCLI, err.Error(), false) + } + if method == http.MethodPost { + req.Header.Set("Content-Type", "application/json") + } + resp, err := client.Do(req) + var raw []byte + if err != nil && id == "" { + cancel() + return unknown("cut admission answer was not received; no second cut was started") + } + if err == nil { + raw, err = io.ReadAll(io.LimitReader(resp.Body, chunkResponseLimit+1)) + _ = resp.Body.Close() + if len(raw) > chunkResponseLimit { + err = fmt.Errorf("cut answer exceeds response limit") + } + } + cancel() + // Late sequence rises cannot revive silence already exhausted. + if !time.Now().Before(until) { + return unknown("cut observation window or explicit deadline expired") + } + if err == nil { + var protocol struct { + Version json.RawMessage `json:"apiVersion"` + } + protocolErr := json.Unmarshal(raw, &protocol) + versionText := strings.TrimSpace(string(protocol.Version)) + if versionText == "" { + versionText = "missing" + } + var version int + supported := protocolErr == nil && versionText != "null" && json.Unmarshal(protocol.Version, &version) == nil && version >= max(0, chunkstore.CutAPIVersion-1) && version <= chunkstore.CutAPIVersion + // Only an initial, unversioned synchronous 200 can be a v1.0 answer. + // A polling answer must always identify its response protocol. + legacy := protocolErr == nil && len(protocol.Version) == 0 && id == "" && resp.StatusCode == http.StatusOK + unsupported := func() int { + // An unsupported protocol cannot prove non-admission, even on + // an initial error: the worker may have finished before its reply. + return chunkFail("cut", stdout, stderr, chunkExitUnknown, "unsupported_api_version", fmt.Sprintf("server cut API version %s is unsupported by CLI version %d (supports %d and %d); cut outcome not established", versionText, chunkstore.CutAPIVersion, chunkstore.CutAPIVersion, max(0, chunkstore.CutAPIVersion-1)), false) + } + if !supported && !legacy { + return unsupported() + } + if resp.StatusCode == http.StatusOK { + var result struct { + VolumeID string `json:"volumeID"` + CutID string `json:"cutID"` + CutLSN *uint64 `json:"cutLSN"` + HeadGen *uint64 `json:"headGen"` + } + if json.Unmarshal(raw, &result) == nil && (id == "" || result.CutID == id) && result.VolumeID == body["volumeID"] && result.CutLSN != nil && result.HeadGen != nil && (!legacy || result.CutID == "") { + if err := writeAll(stdout, raw); err != nil { + fmt.Fprintf(stderr, "sw-block ops chunk cut: write the result: %v\n", err) + return chunkExitFailed + } + return 0 + } + } + if legacy { + return unsupported() + } + var answer struct { + Code string `json:"code"` + Message string `json:"message"` + ID string `json:"cutID"` + Sequence uint64 `json:"sequence"` + Retryable bool `json:"retryable"` + } + if json.Unmarshal(raw, &answer) == nil && answer.Code != "" { + if resp.StatusCode == http.StatusAccepted && answer.Code == "in_progress" { + if id == "" && answer.ID != "" { + id = answer.ID + fmt.Fprintf(stderr, "sw-block ops chunk cut: cut id %s\n", id) + } + if answer.ID == id && answer.Sequence > seen { + seen = answer.Sequence + last = time.Now() + } + } else if id == "" && answer.Code == "cut_busy" { + fmt.Fprintf(stderr, "sw-block ops chunk cut: %s: %s\n", answer.Code, answer.Message) + if err := writeAll(stdout, raw); err != nil { + fmt.Fprintf(stderr, "sw-block ops chunk cut: write the result: %v\n", err) + return chunkExitFailed + } + return chunkExitCutBusy + } else if answer.Code == "unknown_cut_id" && answer.ID == id && id != "" { + return unknown("holder no longer knows this cut id") + } else if answer.Code == "outcome_unknown" && answer.ID == id && id != "" { + return unknown("cut publication settlement exhausted its progress window") + } else if (id == "" || answer.ID == id) && (answer.Code == "cut_stalled" || (!answer.Retryable && answer.Code != "outcome_unknown")) { + fmt.Fprintf(stderr, "sw-block ops chunk cut: %s: %s\n", answer.Code, answer.Message) + if err := writeAll(stdout, raw); err != nil { + fmt.Fprintf(stderr, "sw-block ops chunk cut: write the result: %v\n", err) + return chunkExitFailed + } + return chunkExitFailed + } + } + } + if id == "" { + if err != nil { + return unknown("cut admission answer could not be read: " + err.Error()) + } + return unknown("cut admission answer did not identify its outcome") + } + // Prompt short polling keeps the observation gap within the modeled slack. + next := last.Add(bound) + if !deadline.IsZero() && deadline.Before(next) { + next = deadline + } + pause := min(100*time.Millisecond, max(time.Duration(0), time.Until(next))) + if pause > 0 { + time.Sleep(pause) + } + } +} diff --git a/seaweed-block/cmd/sw-block/cut_progress_poll_test.go b/seaweed-block/cmd/sw-block/cut_progress_poll_test.go new file mode 100644 index 0000000000..e2984dccf1 --- /dev/null +++ b/seaweed-block/cmd/sw-block/cut_progress_poll_test.go @@ -0,0 +1,525 @@ +package main + +import ( + "context" + "encoding/json" + "fmt" + "io" + "net/http" + "strings" + "testing" + "testing/synctest" + "time" +) + +type cutPollTransport func(*http.Request) (*http.Response, error) + +func (f cutPollTransport) RoundTrip(r *http.Request) (*http.Response, error) { return f(r) } +func cutPollReply(code int, body string) *http.Response { + return &http.Response{StatusCode: code, Body: io.NopCloser(strings.NewReader(body)), Header: make(http.Header)} +} +func installCutPollTransport(t *testing.T, f cutPollTransport) { + t.Helper() + old := chunkHTTPClient + chunkHTTPClient = &http.Client{Transport: f} + t.Cleanup(func() { chunkHTTPClient = old }) +} +func TestCutCLIStartsOnceThenOnlyPollsTheReturnedID(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + posts, polls := 0, 0 + installCutPollTransport(t, func(r *http.Request) (*http.Response, error) { + if r.Method == http.MethodPost { + posts++ + var admission map[string]any + if err := json.NewDecoder(r.Body).Decode(&admission); err != nil || admission["observe"] != nil { + t.Errorf("unexpected observe opt-in: %v err=%v", admission, err) + } + if posts > 1 { + return cutPollReply(503, `{"apiVersion":1,"code":"cut_busy","retryable":true}`), nil + } + return cutPollReply(202, `{"apiVersion":1,"code":"in_progress","cutID":"server-cut","sequence":1}`), nil + } + if r.Method != http.MethodGet || r.URL.Path != "/chunk/cut" || r.URL.Query().Get("cutID") != "server-cut" || r.URL.Query().Get("volumeID") != "v1" { + t.Errorf("not a read-only poll of the admitted cut: %s %s", r.Method, r.URL) + } + polls++ + return cutPollReply(200, `{"apiVersion":1,"volumeID":"v1","cutID":"server-cut","cutLSN":16,"headGen":4}`), nil + }) + code, out, errOut := runChunk("cut", "--volume", "v1", "--status-addr", "http://cut", "--deadline", time.Now().Add(2*time.Minute).Format(time.RFC3339Nano)) + if code != 0 || posts != 1 || polls != 1 || !strings.Contains(out, `"cutLSN":16`) || !strings.Contains(errOut, "server-cut") { + t.Fatalf("code=%d posts=%d polls=%d out=%s stderr=%s", code, posts, polls, out, errOut) + } + }) +} +func TestCutCLIRestartLosesTheHandleWithoutClaimingFailure(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + posts, polls := 0, 0 + installCutPollTransport(t, func(r *http.Request) (*http.Response, error) { + if r.Method == http.MethodPost { + posts++ + return cutPollReply(202, `{"apiVersion":1,"code":"in_progress","cutID":"before-restart","sequence":1}`), nil + } + polls++ + return cutPollReply(404, `{"apiVersion":1,"code":"unknown_cut_id","cutID":"before-restart","retryable":false}`), nil + }) + code, out, _ := runChunk("cut", "--volume", "v1", "--status-addr", "http://cut") + if code != chunkExitUnknown || posts != 1 || polls != 1 || !strings.Contains(out, `"code":"outcome_unknown"`) || strings.Contains(out, "cut_stalled") { + t.Fatalf("code=%d posts=%d polls=%d out=%s", code, posts, polls, out) + } + }) +} +func TestCutCLIBusyIsDistinctAndDoesNotStartAnotherCut(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + calls := 0 + installCutPollTransport(t, func(r *http.Request) (*http.Response, error) { + calls++ + return cutPollReply(503, `{"apiVersion":1,"code":"cut_busy","cutID":"other-cut","retryable":true}`), nil + }) + code, out, _ := runChunk("cut", "--volume", "v1", "--status-addr", "http://cut") + if code != chunkExitCutBusy || calls != 1 || !strings.Contains(out, `"code":"cut_busy"`) { + t.Fatalf("code=%d calls=%d out=%s", code, calls, out) + } + }) +} + +func TestCutCLISettlementUnknownEndsWithoutRepostingOrWaitingAnotherWindow(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + start := time.Now() + calls := 0 + installCutPollTransport(t, func(r *http.Request) (*http.Response, error) { + calls++ + if calls == 1 { + return cutPollReply(202, `{"apiVersion":1,"code":"in_progress","cutID":"settling","sequence":1}`), nil + } + if r.Method != http.MethodGet || r.URL.Query().Get("cutID") != "settling" { + t.Errorf("settlement was restarted: %s %s", r.Method, r.URL) + } + return cutPollReply(503, `{"apiVersion":1,"code":"outcome_unknown","cutID":"settling","retryable":true}`), nil + }) + code, out, _ := runChunk("cut", "--volume", "v1", "--status-addr", "http://cut") + if code != chunkExitUnknown || calls != 2 || time.Since(start) >= time.Second || !strings.Contains(out, `"code":"outcome_unknown"`) { + t.Fatalf("code=%d calls=%d elapsed=%s out=%s", code, calls, time.Since(start), out) + } + }) +} +func TestCutCLIAdmissionRedirectCannotReplayThePost(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + calls := 0 + installCutPollTransport(t, func(r *http.Request) (*http.Response, error) { + calls++ + if calls > 1 { + return cutPollReply(503, `{"apiVersion":1,"code":"cut_busy","cutID":"own-cut","retryable":true}`), nil + } + resp := cutPollReply(http.StatusTemporaryRedirect, "") + resp.Header.Set("Location", "/redirected") + return resp, nil + }) + code, out, _ := runChunk("cut", "--volume", "v1", "--status-addr", "http://cut") + if calls != 1 || code != chunkExitUnknown || !strings.Contains(out, `"code":"unsupported_api_version"`) { + t.Fatalf("admission replayed across redirect: code=%d calls=%d out=%s", code, calls, out) + } + }) +} +func TestCutCLIProgressingFor46MinutesPollsOneCutID(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + start := time.Now() + id := "holder-cut" + calls := 0 + installCutPollTransport(t, func(r *http.Request) (*http.Response, error) { + calls++ + if calls == 1 && r.Method != http.MethodPost || calls > 1 && (r.Method != http.MethodGet || r.URL.Query().Get("cutID") != id) { + t.Errorf("cut was restarted or polled with another identity: %s %s", r.Method, r.URL) + } + select { + case <-time.After(50 * time.Second): + case <-r.Context().Done(): + return nil, r.Context().Err() + } + if calls == 56 { + return cutPollReply(200, `{"apiVersion":1,"volumeID":"v1","cutID":"holder-cut","cutLSN":16,"headGen":4}`), nil + } + return cutPollReply(202, fmt.Sprintf(`{"apiVersion":1,"code":"in_progress","cutID":%q,"sequence":%d}`, id, calls)), nil + }) + code, out, errOut := runChunk("cut", "--volume", "v1", "--status-addr", "http://cut") + if code != 0 || !strings.Contains(out, `"cutLSN":16`) || calls != 56 || time.Since(start) < 46*time.Minute || !strings.Contains(errOut, id) { + t.Fatalf("progressing default cut: code=%d calls=%d elapsed=%s out=%s stderr=%s", code, calls, time.Since(start), out, errOut) + } + }) +} +func TestCutCLIUnchangedSequenceCannotRenewItsWindow(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + start := time.Now() + installCutPollTransport(t, func(r *http.Request) (*http.Response, error) { + select { + case <-time.After(10 * time.Second): + case <-r.Context().Done(): + return nil, r.Context().Err() + } + return cutPollReply(202, `{"apiVersion":1,"code":"in_progress","cutID":"same","sequence":1}`), nil + }) + code, out, _ := runChunk("cut", "--volume", "v1", "--status-addr", "http://cut", "--deadline", start.Add(3*time.Minute).Format(time.RFC3339Nano)) + if code != 3 || !strings.Contains(out, `"code":"outcome_unknown"`) || time.Since(start) < 75*time.Second || time.Since(start) > 76*time.Second { + t.Fatalf("fixed sequence renewed silence: code=%d elapsed=%s out=%s", code, time.Since(start), out) + } + }) +} +func TestCutCLIAbsoluteDeadlineEndsAProgressingCut(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + start := time.Now() + calls := 0 + installCutPollTransport(t, func(r *http.Request) (*http.Response, error) { + select { + case <-time.After(20 * time.Second): + case <-r.Context().Done(): + return nil, r.Context().Err() + } + calls++ + return cutPollReply(202, fmt.Sprintf(`{"apiVersion":1,"code":"in_progress","cutID":"same","sequence":%d}`, calls)), nil + }) + code, out, _ := runChunk("cut", "--volume", "v1", "--status-addr", "http://cut", "--deadline", start.Add(3*time.Minute).Format(time.RFC3339Nano)) + if code != 3 || !strings.Contains(out, `"code":"outcome_unknown"`) || time.Since(start) != 3*time.Minute { + t.Fatalf("absolute deadline lost: code=%d elapsed=%s out=%s", code, time.Since(start), out) + } + }) +} +func TestCutCLIUnansweredRequestEndsUnknownWithinItsOwnWindow(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + start := time.Now() + calls := 0 + installCutPollTransport(t, func(r *http.Request) (*http.Response, error) { + calls++ + <-r.Context().Done() + return nil, r.Context().Err() + }) + code, out, _ := runChunk("cut", "--volume", "v1", "--status-addr", "http://cut", "--deadline", start.Add(3*time.Minute).Format(time.RFC3339Nano)) + if code != 3 || calls != 1 || !strings.Contains(out, `"code":"outcome_unknown"`) || time.Since(start) != 65*time.Second { + t.Fatalf("silent request: code=%d elapsed=%s out=%s", code, time.Since(start), out) + } + }) +} + +func TestCutCLIForeignSequenceCannotRenewItsWindow(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + start := time.Now() + n := 0 + installCutPollTransport(t, func(r *http.Request) (*http.Response, error) { + if r.Method == http.MethodPost { + return cutPollReply(202, `{"apiVersion":1,"code":"in_progress","cutID":"same","sequence":0}`), nil + } + select { + case <-time.After(10 * time.Second): + case <-r.Context().Done(): + return nil, r.Context().Err() + } + n++ + return cutPollReply(202, fmt.Sprintf(`{"apiVersion":1,"code":"in_progress","cutID":"foreign","sequence":%d}`, n)), nil + }) + code, out, _ := runChunk("cut", "--volume", "v1", "--status-addr", "http://cut", "--deadline", start.Add(3*time.Minute).Format(time.RFC3339Nano)) + if code != 3 || !strings.Contains(out, `"code":"outcome_unknown"`) || time.Since(start) != 65*time.Second { + t.Fatalf("foreign cut renewed silence: code=%d elapsed=%s out=%s", code, time.Since(start), out) + } + }) +} +func TestCutCLIStalledAnswerIsAFailure(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + installCutPollTransport(t, func(r *http.Request) (*http.Response, error) { + return cutPollReply(503, `{"apiVersion":1,"code":"cut_stalled","message":"upload stopped","retryable":true}`), nil + }) + code, out, _ := runChunk("cut", "--volume", "v1", "--status-addr", "http://cut") + if code != 1 || !strings.Contains(out, `"code":"cut_stalled"`) { + t.Fatalf("terminal stall code=%d out=%s", code, out) + } + }) +} + +func TestCutCLIForeignTerminalCannotSettleThisObservation(t *testing.T) { + for _, tc := range []struct { + name string + status int + body string + }{ + {"success", 200, `{"apiVersion":1,"volumeID":"v1","cutID":"foreign","cutLSN":16,"headGen":4}`}, + {"stalled", 503, `{"apiVersion":1,"code":"cut_stalled","cutID":"foreign","retryable":true}`}, + } { + t.Run(tc.name, func(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + start := time.Now() + installCutPollTransport(t, func(r *http.Request) (*http.Response, error) { + if r.Method == http.MethodPost { + return cutPollReply(202, `{"apiVersion":1,"code":"in_progress","cutID":"same","sequence":0}`), nil + } + select { + case <-time.After(10 * time.Second): + case <-r.Context().Done(): + return nil, r.Context().Err() + } + return cutPollReply(tc.status, tc.body), nil + }) + code, out, _ := runChunk("cut", "--volume", "v1", "--status-addr", "http://cut", "--deadline", start.Add(3*time.Minute).Format(time.RFC3339Nano)) + if code != 3 || !strings.Contains(out, `"code":"outcome_unknown"`) || time.Since(start) != 65*time.Second { + t.Fatalf("foreign terminal settled observation: code=%d elapsed=%s out=%s", code, time.Since(start), out) + } + }) + }) + } +} + +func TestCutCLIRejectsUnrepresentableDeadlinesBeforeAdmission(t *testing.T) { + for _, deadline := range []string{"0001-01-01T00:00:00Z", "1600-01-01T00:00:00Z", "2500-01-01T00:00:00Z"} { + t.Run(deadline, func(t *testing.T) { + calls := 0 + installCutPollTransport(t, func(r *http.Request) (*http.Response, error) { + calls++ + return cutPollReply(200, `{"apiVersion":1,"volumeID":"v1","cutLSN":1,"headGen":1}`), nil + }) + code, _, _ := runChunk("cut", "--volume", "v1", "--status-addr", "http://cut", "--deadline", deadline) + if code != 2 || calls != 0 { + t.Fatalf("deadline %s: code=%d calls=%d", deadline, code, calls) + } + }) + } +} + +func TestCutCLISequenceUsesStrictHighWater(t *testing.T) { + for _, final := range []uint64{5, 6} { + t.Run(fmt.Sprint(final), func(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + start := time.Now() + calls := 0 + installCutPollTransport(t, func(r *http.Request) (*http.Response, error) { + calls++ + if calls == 1 { + return cutPollReply(202, `{"apiVersion":1,"code":"in_progress","cutID":"same","sequence":5}`), nil + } + select { + case <-time.After(25 * time.Second): + case <-r.Context().Done(): + return nil, r.Context().Err() + } + seq := uint64(4) + if calls >= 3 { + seq = final + } + if calls == 4 { + return cutPollReply(200, `{"apiVersion":1,"volumeID":"v1","cutID":"same","cutLSN":1,"headGen":1}`), nil + } + return cutPollReply(202, fmt.Sprintf(`{"apiVersion":1,"code":"in_progress","cutID":"same","sequence":%d}`, seq)), nil + }) + code, _, _ := runChunk("cut", "--volume", "v1", "--status-addr", "http://cut") + if final == 5 && (code != chunkExitUnknown || time.Since(start) != 65*time.Second) { + t.Fatalf("5->4->5 renewed: code=%d elapsed=%s", code, time.Since(start)) + } + if final == 6 && code != 0 { + t.Fatalf("5->4->6 did not renew: code=%d elapsed=%s", code, time.Since(start)) + } + }) + }) + } +} + +type stalledCutPollBody struct { + ctx context.Context + closed *bool +} + +func (b stalledCutPollBody) Read([]byte) (int, error) { <-b.ctx.Done(); return 0, b.ctx.Err() } +func (b stalledCutPollBody) Close() error { *b.closed = true; return nil } +func TestCutCLIAdmittedPollCancellation(t *testing.T) { + for _, bodyStall := range []bool{false, true} { + t.Run(fmt.Sprint(bodyStall), func(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + start := time.Now() + calls := 0 + closed := false + installCutPollTransport(t, func(r *http.Request) (*http.Response, error) { + calls++ + if calls == 1 { + return cutPollReply(202, `{"apiVersion":1,"code":"in_progress","cutID":"same","sequence":1}`), nil + } + if r.Method != http.MethodGet { + t.Errorf("admitted request is %s", r.Method) + } + if bodyStall { + resp := cutPollReply(202, "") + resp.Body = stalledCutPollBody{r.Context(), &closed} + return resp, nil + } + <-r.Context().Done() + return nil, r.Context().Err() + }) + code, _, _ := runChunk("cut", "--volume", "v1", "--status-addr", "http://cut") + if code != chunkExitUnknown || calls != 2 || time.Since(start) != 65*time.Second || bodyStall && !closed { + t.Fatalf("code=%d calls=%d elapsed=%s closed=%v", code, calls, time.Since(start), closed) + } + }) + }) + } +} + +func TestCutCLILegacyTerminalAnswerNeedsNoPolling(t *testing.T) { + calls := 0 + installCutPollTransport(t, func(r *http.Request) (*http.Response, error) { + calls++ + var body map[string]any + if err := json.NewDecoder(r.Body).Decode(&body); err != nil || body["observe"] != nil { + t.Errorf("unexpected opt-in: %v err=%v", body, err) + } + return cutPollReply(200, `{"volumeID":"v1","cutLSN":7,"headGen":3}`), nil + }) + code, out, _ := runChunk("cut", "--volume", "v1", "--status-addr", "http://cut") + if code != 0 || calls != 1 || !strings.Contains(out, `"cutLSN":7`) { + t.Fatalf("code=%d calls=%d out=%s", code, calls, out) + } +} + +func TestCutCLINewerClientAcceptsOwnAndOneOlderHolder(t *testing.T) { + for _, version := range []int{0, 1} { + t.Run(fmt.Sprint(version), func(t *testing.T) { + calls := 0 + installCutPollTransport(t, func(r *http.Request) (*http.Response, error) { + calls++ + var request map[string]any + if err := json.NewDecoder(r.Body).Decode(&request); err != nil || request["apiVersion"] != nil { + t.Errorf("client sent a negotiation version: %v err=%v", request, err) + } + return cutPollReply(200, fmt.Sprintf(`{"apiVersion":%d,"volumeID":"v1","cutLSN":7,"headGen":3}`, version)), nil + }) + code, out, _ := runChunk("cut", "--volume", "v1", "--status-addr", "http://cut") + if code != 0 || calls != 1 { + t.Fatalf("version=%d code=%d calls=%d out=%s", version, code, calls, out) + } + }) + } +} + +func TestCutCLIOlderClientRefusesNewerHolder(t *testing.T) { + for _, version := range []int{2, 99} { + t.Run(fmt.Sprint(version), func(t *testing.T) { + calls := 0 + installCutPollTransport(t, func(r *http.Request) (*http.Response, error) { + calls++ + if r.Method != http.MethodPost { + t.Errorf("unsupported holder must not be polled: %s", r.Method) + } + return cutPollReply(202, fmt.Sprintf(`{"apiVersion":%d,"code":"in_progress","cutID":"new-version","sequence":1}`, version)), nil + }) + code, out, _ := runChunk("cut", "--volume", "v1", "--status-addr", "http://cut") + answer := chunkErrorOut(t, out) + if code != chunkExitUnknown || calls != 1 || answer.Code != "unsupported_api_version" || !strings.Contains(answer.Message, fmt.Sprintf("server cut API version %d", version)) || !strings.Contains(answer.Message, "CLI version 1") { + t.Fatalf("version=%d code=%d calls=%d out=%s", version, code, calls, out) + } + }) + } +} + +func TestCutCLIUnsupportedVersionNeverStartsAnotherCut(t *testing.T) { + for _, tc := range []struct { + name, version string + status int + admitted bool + }{ + {"future terminal", `99`, 200, false}, + {"missing progress", ``, 202, false}, + {"null", `null`, 202, false}, + {"string", `"1"`, 202, false}, + {"negative", `-1`, 202, false}, + {"missing poll", ``, 202, true}, + {"unversioned terminal poll", ``, 200, true}, + {"unsupported refusal before admission", `99`, 409, false}, + {"unsupported refusal after admission", `99`, 409, true}, + } { + t.Run(tc.name, func(t *testing.T) { + calls, posts := 0, 0 + installCutPollTransport(t, func(r *http.Request) (*http.Response, error) { + calls++ + if r.Method == http.MethodPost { + posts++ + } + if tc.admitted && calls == 1 { + return cutPollReply(202, `{"apiVersion":1,"code":"in_progress","cutID":"one-cut","sequence":1}`), nil + } + fields := `"volumeID":"v1","cutLSN":7,"headGen":3,"code":"in_progress","cutID":"one-cut","sequence":2` + if tc.version != "" { + fields = `"apiVersion":` + tc.version + `,` + fields + } + return cutPollReply(tc.status, `{`+fields+`}`), nil + }) + code, out, _ := runChunk("cut", "--volume", "v1", "--status-addr", "http://cut") + answer := chunkErrorOut(t, out) + wantCalls := 1 + if tc.admitted { + wantCalls = 2 + } + wantExit := chunkExitUnknown + if code != wantExit || posts != 1 || calls != wantCalls || answer.Code != "unsupported_api_version" || !strings.Contains(answer.Message, "CLI version 1") || !strings.Contains(answer.Message, "cut outcome not established") { + t.Fatalf("code=%d posts=%d calls=%d out=%s", code, posts, calls, out) + } + }) + } +} + +func TestCutCLIInvalidUnversionedInitialTerminalAnswerIsUnknown(t *testing.T) { + for _, tc := range []struct{ name, raw string }{ + {"missing frontier", `{"volumeID":"v1","headGen":3}`}, + {"missing generation", `{"volumeID":"v1","cutLSN":7}`}, + {"wrong volume", `{"volumeID":"other","cutLSN":7,"headGen":3}`}, + {"unexpected handle", `{"volumeID":"v1","cutID":"one-cut","cutLSN":7,"headGen":3}`}, + } { + t.Run(tc.name, func(t *testing.T) { + posts, calls := 0, 0 + installCutPollTransport(t, func(r *http.Request) (*http.Response, error) { + calls++ + if r.Method == http.MethodPost { + posts++ + } + return cutPollReply(200, tc.raw), nil + }) + code, out, _ := runChunk("cut", "--volume", "v1", "--status-addr", "http://cut") + answer := chunkErrorOut(t, out) + if code != chunkExitUnknown || calls != 1 || posts != 1 || answer.Code != "unsupported_api_version" || !strings.Contains(answer.Message, "cut outcome not established") { + t.Fatalf("code=%d calls=%d posts=%d out=%s", code, calls, posts, out) + } + }) + } +} + +func TestCutCLIUnsupportedInitialErrorNeverProvesNonAdmission(t *testing.T) { + for _, tc := range []struct { + name, raw string + status int + }{ + {"missing version terminal", `{"code":"outcome_unknown","cutID":"finished-before-reply","retryable":true}`, 503}, + {"future version terminal", `{"apiVersion":99,"code":"outcome_unknown","cutID":"finished-before-reply","retryable":true}`, 503}, + {"forwarded gateway error", `{"code":"bad_gateway"}`, 502}, + {"untrusted admission refusal", `{"apiVersion":99,"code":"not_primary"}`, 409}, + } { + t.Run(tc.name, func(t *testing.T) { + posts, calls := 0, 0 + installCutPollTransport(t, func(r *http.Request) (*http.Response, error) { + calls++ + if r.Method == http.MethodPost { + posts++ + } + return cutPollReply(tc.status, tc.raw), nil + }) + code, out, _ := runChunk("cut", "--volume", "v1", "--status-addr", "http://cut") + answer := chunkErrorOut(t, out) + if code != chunkExitUnknown || calls != 1 || posts != 1 || answer.Code != "unsupported_api_version" || !strings.Contains(answer.Message, "cut outcome not established") { + t.Fatalf("code=%d calls=%d posts=%d out=%s", code, calls, posts, out) + } + }) + } +} + +func TestCutCLISupportedAdmissionRefusalStillFails(t *testing.T) { + calls := 0 + installCutPollTransport(t, func(r *http.Request) (*http.Response, error) { + calls++ + return cutPollReply(409, `{"apiVersion":1,"code":"not_primary","message":"not admitted","retryable":false}`), nil + }) + code, out, _ := runChunk("cut", "--volume", "v1", "--status-addr", "http://cut") + answer := chunkErrorOut(t, out) + if code != chunkExitFailed || calls != 1 || answer.Code != "not_primary" { + t.Fatalf("code=%d calls=%d out=%s", code, calls, out) + } +} diff --git a/seaweed-block/cmd/sw-block/integration_invocations_test.go b/seaweed-block/cmd/sw-block/integration_invocations_test.go index 671dfc2e28..92323d679e 100644 --- a/seaweed-block/cmd/sw-block/integration_invocations_test.go +++ b/seaweed-block/cmd/sw-block/integration_invocations_test.go @@ -9,6 +9,7 @@ import ( "go/ast" "go/parser" "go/token" + "net/http" "os" "os/exec" "path/filepath" @@ -60,6 +61,8 @@ func TestIntegrationInvocationGuardReachesLateFlagChecks(t *testing.T) { args []string want string }{ + {[]string{"ops", "chunk", "cut", "--volume", "v1"}, guardRefused}, + {[]string{"ops", "chunk", "cut", "--volume", "v1", "--status-addr", "127.0.0.1:1"}, guardPast}, {[]string{"ops", "chunk", "snapshots", "--master", "127.0.0.1:1", "--volume", "v1"}, guardRefused}, {[]string{"ops", "chunk", "snapshot-delete", "--master", "127.0.0.1:1", "--volume", "v1", "--name", "s1"}, guardRefused}, {[]string{"ops", "chunk", "restore", "--source", "v1", "--snapshot", "s1", "--target", "v2", "--chunk-filer", "127.0.0.1:1"}, guardRefused}, @@ -133,6 +136,13 @@ func TestIntegrationInvocationChild(t *testing.T) { restoreCreateRPC = func(context.Context, string, *control.CreateVolumeRequest) (*control.CreateVolumeResponse, error) { return nil, errGuardPast } + // The cut observer deliberately hides a lost transport answer behind + // outcome_unknown. Mark dispatch itself as the argument proof, rather + // than depending on a particular wrapped network-error message. + chunkHTTPClient = &http.Client{Transport: cutPollTransport(func(*http.Request) (*http.Response, error) { + fmt.Println(errGuardPast) + return nil, errGuardPast + })} var stdout, stderr bytes.Buffer code := run(args, &stdout, &stderr) fmt.Printf("exit %d\n%s%s", code, stdout.String(), stderr.String()) diff --git a/seaweed-block/core/frontend/chunkstore/control_types.go b/seaweed-block/core/frontend/chunkstore/control_types.go index 060deb2ab1..ca2e3fdcb8 100644 --- a/seaweed-block/core/frontend/chunkstore/control_types.go +++ b/seaweed-block/core/frontend/chunkstore/control_types.go @@ -15,6 +15,10 @@ import ( // its final write (spec §2.3). const DefaultOpDeadline = 5 * time.Minute +// CutAPIVersion is the integer response protocol of the manual cut endpoints. +// Clients accept this version and its predecessor; requests carry no version. +const CutAPIVersion = 1 + // ErrNotAdmitted marks a delete admission error that is a definite refusal // (nothing was recorded). Any other admission error leaves the outcome // unknown. @@ -50,7 +54,7 @@ const ( CodeDeadlineExceeded = "deadline_exceeded" CodeRemoteUnavailable = "remote_unavailable" CodeRemoteFull = "remote_full" // the chunk store has no space; retry after adding capacity - CodeQueueFull = "queue_full" // pending reclamation work must drain before another producer publishes + CodeQueueFull = "queue_full" // pending reclamation work must drain before another producer publishes CodeOutcomeUnknown = "outcome_unknown" CodeInvalidLabel = "invalid_label" ) diff --git a/seaweed-block/core/frontend/chunkstore/cut_verification_window.go b/seaweed-block/core/frontend/chunkstore/cut_verification_window.go new file mode 100644 index 0000000000..009a82c059 --- /dev/null +++ b/seaweed-block/core/frontend/chunkstore/cut_verification_window.go @@ -0,0 +1,46 @@ +package chunkstore + +import ( + "context" + "errors" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + + "github.com/seaweedfs/seaweed-block/core/frontend/chunkstore/layout" + "github.com/seaweedfs/seaweed-block/core/storage" +) + +// Each verification lookup/adoption gets its own call deadline. The check +// remains outside the bounded HEAD update, with no total bound around its +// object count. Conditional adoption and all identity checks are unchanged. +type cutVerificationObjects struct{ layout.ObjectStore } + +// The layout verifier calls this only after ownership/adoption is proved. +// Its plan contains each object once; retries of Stat/Reuse do not report. +func (s cutVerificationObjects) CommitObjectVerified(ctx context.Context, _ string) { + storage.ReportCutObjectVerified(ctx) +} + +func (s cutVerificationObjects) Stat(ctx context.Context, rel string) (meta layout.ObjectMeta, found bool, err error) { + err = storage.RunCutRequest(ctx, func(step context.Context) error { + var callErr error + meta, found, callErr = s.ObjectStore.Stat(step, rel) + return cutVerificationError(step, callErr) + }) + return +} +func (s cutVerificationObjects) Reuse(ctx context.Context, rel string, expect layout.ObjectMeta, session string) error { + return storage.RunCutRequest(ctx, func(step context.Context) error { + return cutVerificationError(step, s.ObjectStore.Reuse(step, rel, expect, session)) + }) +} + +// gRPC deadlines carry a transport status rather than the context sentinel. +// Normalize only the adapter's own expired call; ordinary failures stay final. +func cutVerificationError(ctx context.Context, err error) error { + if errors.Is(ctx.Err(), context.DeadlineExceeded) && status.Code(err) == codes.DeadlineExceeded { + return errors.Join(err, context.DeadlineExceeded) + } + return err +} diff --git a/seaweed-block/core/frontend/chunkstore/cut_verification_window_test.go b/seaweed-block/core/frontend/chunkstore/cut_verification_window_test.go new file mode 100644 index 0000000000..605cdc1260 --- /dev/null +++ b/seaweed-block/core/frontend/chunkstore/cut_verification_window_test.go @@ -0,0 +1,141 @@ +package chunkstore + +import ( + "context" + "errors" + "fmt" + "github.com/seaweedfs/seaweed-block/core/frontend/chunkstore/layout" + "github.com/seaweedfs/seaweed-block/core/storage" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "strings" + "sync/atomic" + "testing" + "testing/synctest" + "time" +) + +func TestCutVerificationTimeoutRetriesTheIndividualLookup(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + var calls atomic.Int64 + var elapsed time.Duration + _, _, err := c1Cut(t, func(w *c1Remote) func(context.Context, storage.ChunkHeadVersion, storage.ChunkHead) error { + return func(ctx context.Context, e storage.ChunkHeadVersion, n storage.ChunkHead) error { + w.ff.slowLookup = func(p string) time.Duration { + if strings.Contains(p, "/pool/") && calls.Add(1) == 1 { + return 31 * time.Second + } + return 0 + } + start := time.Now() + err := w.LayoutRemote.CheckCommit(ctx, e, n) + elapsed = time.Since(start) + return err + } + }) + if err != nil || elapsed != storage.CutRequestTimeout { + t.Fatalf("verification call must time out and retry within the cut window: elapsed=%s calls=%d err=%v", elapsed, calls.Load(), err) + } + }) +} + +type deadlineVerificationObjects struct { + layout.ObjectStore + calls int +} + +func (s *deadlineVerificationObjects) Stat(ctx context.Context, rel string) (layout.ObjectMeta, bool, error) { + s.calls++ + if s.calls == 1 { + <-ctx.Done() + return layout.ObjectMeta{}, false, fmt.Errorf("filer lookup: %w", status.Error(codes.DeadlineExceeded, "lookup expired")) + } + return layout.ObjectMeta{Session: "kept"}, true, nil +} +func TestCutVerificationRetriesTheProductionGRPCDeadline(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + ctx, cancel := storage.WithCutProgressWindow(context.Background(), time.Minute) + defer cancel() + calls := &deadlineVerificationObjects{} + meta, found, err := (cutVerificationObjects{calls}).Stat(ctx, "object") + if err != nil || !found || meta.Session != "kept" || calls.calls != 2 { + t.Fatalf("GRPC deadline lost retry: meta=%+v found=%t err=%v calls=%d", meta, found, err, calls.calls) + } + }) +} + +type progressingVerificationObjects struct { + layout.ObjectStore + volume layout.VolumeID + calls atomic.Int64 + adopt bool + conflict bool +} + +func (s *progressingVerificationObjects) Stat(ctx context.Context, rel string) (layout.ObjectMeta, bool, error) { + delay := 2 * time.Millisecond + if s.conflict { + delay = 400 * time.Millisecond + } + select { + case <-time.After(delay): + s.calls.Add(1) + session := "verify" + if s.adopt || s.conflict { + session = "previous" + } + return layout.ObjectMeta{Volume: s.volume, Session: session}, true, nil + case <-ctx.Done(): + return layout.ObjectMeta{}, false, ctx.Err() + } +} + +func (s *progressingVerificationObjects) Reuse(ctx context.Context, rel string, expect layout.ObjectMeta, session string) error { + if s.conflict { + return layout.ErrPrecondition + } + return nil +} + +func TestCutVerification262144ObjectsAfterUploadRenewsTheWindow(t *testing.T) { + for _, adopt := range []bool{false, true} { + t.Run(fmt.Sprintf("adopt=%t", adopt), func(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + volume := layout.VolumeID{1} + next := make(map[uint64]layout.Ref, 262144) + for i := uint64(0); i < 262144; i++ { + next[i] = layout.Ref{Owner: "v1", OwnerID: volume, Chunk: layout.NameChunk(i, []byte("captured"))} + } + me := layout.HolderID{Epoch: 3, Holder: "holder", ClaimID: "claim"} + head := layout.Head{Gen: 1, VolumeID: volume, Epoch: me.Epoch, Holder: me.Holder, ClaimID: me.ClaimID, Activity: layout.Activity{Kind: layout.ActSnap, Session: "verify"}} + objects := &progressingVerificationObjects{volume: volume, adopt: adopt} + ctx, cancel := storage.WithCutProgressWindow(context.Background(), time.Second) + defer cancel() + start := time.Now() + // No payload completes during this check: only proved objects can + // renew the window after the last upload. + err := layout.CheckCommitObjects(ctx, head, cutVerificationObjects{objects}, "v1", me, layout.CommitRequest{Session: "verify", Next: next, Position: 1, State: layout.StateLive}) + if err != nil || ctx.Err() != nil || objects.calls.Load() < 262144 || time.Since(start) <= time.Second { + t.Fatalf("verification lost completed-object progress: calls=%d elapsed=%s err=%v cause=%v", objects.calls.Load(), time.Since(start), err, context.Cause(ctx)) + } + }) + }) + } +} + +func TestCutVerificationConflictedAdoptionsDoNotRenewTheWindow(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + volume := layout.VolumeID{1} + me := layout.HolderID{Epoch: 3, Holder: "holder", ClaimID: "claim"} + head := layout.Head{Gen: 1, VolumeID: volume, Epoch: me.Epoch, Holder: me.Holder, ClaimID: me.ClaimID, Activity: layout.Activity{Kind: layout.ActSnap, Session: "verify"}} + next := map[uint64]layout.Ref{0: {Owner: "v1", OwnerID: volume, Chunk: layout.NameChunk(0, []byte("captured"))}} + objects := &progressingVerificationObjects{volume: volume, conflict: true} + ctx, cancel := storage.WithCutProgressWindow(context.Background(), time.Second) + defer cancel() + start := time.Now() + err := layout.CheckCommitObjects(ctx, head, cutVerificationObjects{objects}, "v1", me, layout.CommitRequest{Session: "verify", Next: next, Position: 1, State: layout.StateLive}) + if err == nil || !errors.Is(context.Cause(ctx), storage.ErrCutStalled) || time.Since(start) != time.Second { + t.Fatalf("failed adoptions renewed progress: elapsed=%s err=%v cause=%v", time.Since(start), err, context.Cause(ctx)) + } + }) +} diff --git a/seaweed-block/core/frontend/chunkstore/layout/commit.go b/seaweed-block/core/frontend/chunkstore/layout/commit.go index 596c8b811c..f031aae48e 100644 --- a/seaweed-block/core/frontend/chunkstore/layout/commit.go +++ b/seaweed-block/core/frontend/chunkstore/layout/commit.go @@ -536,6 +536,15 @@ func allOwnedBySession(ctx context.Context, os ObjectStore, rels []string, sessi ok, err = ownedBySession(ctx, os, rel, session) } got[i] = outcome{done: true, ok: ok, err: err} + if ok && err == nil { + // One completed object from this plan, after every ownership + // and conditional-adoption guard. Failed attempts never renew. + if progress, observes := os.(interface { + CommitObjectVerified(context.Context, string) + }); observes { + progress.CommitObjectVerified(ctx, rel) + } + } if err != nil || !ok { failed.Store(true) } diff --git a/seaweed-block/core/frontend/chunkstore/layout/head_generation_source_guard_test.go b/seaweed-block/core/frontend/chunkstore/layout/head_generation_source_guard_test.go index b52c11f9c5..9d5f9e8c50 100644 --- a/seaweed-block/core/frontend/chunkstore/layout/head_generation_source_guard_test.go +++ b/seaweed-block/core/frontend/chunkstore/layout/head_generation_source_guard_test.go @@ -189,15 +189,15 @@ func TestHeadGenerationComparedOnlyByConditionalUpdate(t *testing.T) { "core/frontend/chunkstore/layout/remove.go removePlanned h.Gen != batch.base.Gen": 2, // close read/view race before preparing; TestMaintenanceBatchDropsReachabilityAfterPublication "core/frontend/chunkstore/layout_verify.go VerifyLayout head.Gen != heads[p].Gen": 1, // read-only observation window; TestVerifyLayoutRequiresStableHeadForMissingAndOrphans - "core/storage/chunk_head_belt.go confirmChunkHead got.Gen != want.Gen": 1, // publication confirmation - "core/storage/chunk_layer.go captureLocked sc.headGen == l.head.Gen": 1, // staged image cache - "core/storage/chunk_layer.go noopCutHead root.Gen == baseHead.Gen": 1, // no-op cut keeps its base while HEAD's image token is unchanged - "core/storage/chunk_layer.go captureLocked cur.Gen == expected.Gen": 1, // unresolved CAS base - "core/storage/chunk_layer.go SettleDetach cur.Gen == base.Gen": 2, // pending and cancelled CAS base - "core/storage/chunk_layer.go resolvePending cur.Gen == base.Gen": 2, // pending and cancelled CAS base - "core/storage/chunk_layer.go stage sc.headGen == l.head.Gen": 1, // staged image cache - "core/storage/chunk_memremote.go CASHead expected.Gen != m.head.Gen": 1, // in-memory conditional update - "core/storage/chunk_publish_settled.go noteSettled next.Gen == prev.Gen": 1, // publication notification deduplication + "core/storage/chunk_head_belt.go confirmChunkHead got.Gen != want.Gen": 1, // publication confirmation + "core/storage/chunk_layer.go captureInvocationLocked sc.headGen == l.head.Gen": 1, // staged image cache + "core/storage/chunk_layer.go noopCutHead root.Gen == baseHead.Gen": 1, // no-op cut keeps its base while HEAD's image token is unchanged + "core/storage/chunk_layer.go captureInvocationLocked cur.Gen == expected.Gen": 1, // unresolved CAS base + "core/storage/chunk_layer.go SettleDetach cur.Gen == base.Gen": 2, // pending and cancelled CAS base + "core/storage/chunk_layer.go resolvePendingWithProgress cur.Gen == base.Gen": 2, // pending and cancelled CAS base + "core/storage/chunk_layer.go stage sc.headGen == l.head.Gen": 1, // staged image cache + "core/storage/chunk_memremote.go CASHead expected.Gen != m.head.Gen": 1, // in-memory conditional update + "core/storage/chunk_publish_settled.go noteSettled next.Gen == prev.Gen": 1, // publication notification deduplication } seen := map[string]int{} err := filepath.WalkDir(root, func(path string, d fs.DirEntry, err error) error { diff --git a/seaweed-block/core/frontend/chunkstore/layout_remote.go b/seaweed-block/core/frontend/chunkstore/layout_remote.go index 407b4f1cfd..9f602aac85 100644 --- a/seaweed-block/core/frontend/chunkstore/layout_remote.go +++ b/seaweed-block/core/frontend/chunkstore/layout_remote.go @@ -653,7 +653,7 @@ func (l *LayoutRemote) checkCommit(ctx context.Context, expected storage.ChunkHe } req.Plan = &plan } - if err := layout.CheckCommitObjects(ctx, h, l.st, l.vol.Name, l.me, req); err != nil { + if err := layout.CheckCommitObjects(ctx, h, cutVerificationObjects{l.st}, l.vol.Name, l.me, req); err != nil { if errors.Is(err, layout.ErrNotPrepared) { l.forceView = true // as CASHead: the re-read drops what the ended session staged return fmt.Errorf("%w: %w", storage.ErrChunkHeadPrecondition, err) diff --git a/seaweed-block/core/frontend/chunkstore/layout_remote_test.go b/seaweed-block/core/frontend/chunkstore/layout_remote_test.go index 40917e25b9..862f8410e9 100644 --- a/seaweed-block/core/frontend/chunkstore/layout_remote_test.go +++ b/seaweed-block/core/frontend/chunkstore/layout_remote_test.go @@ -429,8 +429,12 @@ func TestLayoutRemote_AnAbandonedNamedCutDropsItsName(t *testing.T) { r.st = fail writeSync(t, s, map[uint32][]byte{5: block(5)}) r.SetSnapshot("weekly", layout.SnapshotMeta{CreatedNs: 1}, 0) - if _, err := l.Capture(ctx); err == nil { - t.Fatal("a cut whose upload failed committed") + // A persistent upload failure now retries until the silence window. + // Exercise that path without spending the production five-minute window. + failed, cancel := storage.WithCutProgressWindow(ctx, time.Second) + defer cancel() + if _, err := l.Capture(failed); !errors.Is(err, storage.ErrCutStalled) || !strings.Contains(err.Error(), "volume server unreachable") { + t.Fatalf("failed upload: %v; want its cause and cut_stalled", err) } // The failed cut keeps its session for the retry; the snapshot request // that failed withdraws its name (SnapshotVolume does), so the retry diff --git a/seaweed-block/core/frontend/durable/chunk_snapshot_schedule.go b/seaweed-block/core/frontend/durable/chunk_snapshot_schedule.go index 79d057944c..9e90ef9480 100644 --- a/seaweed-block/core/frontend/durable/chunk_snapshot_schedule.go +++ b/seaweed-block/core/frontend/durable/chunk_snapshot_schedule.go @@ -287,10 +287,6 @@ func (p *DurableProvider) chunkSnapshotLoop(ctx context.Context, volumeID string defer close(workerDone) timer := time.NewTimer(time.Until(slot.due())) defer timer.Stop() - timeout := 2 * p.cfg.ChunkCutTimeout - if timeout <= 0 { - timeout = 10 * time.Minute - } cut := func(ctx context.Context) (storage.ChunkHead, error) { r, err := p.CutVolume(hostlimit.WithClass(ctx, hostlimit.Urgent), volumeID, 0) return r.Head, err @@ -318,9 +314,11 @@ func (p *DurableProvider) chunkSnapshotLoop(ctx context.Context, volumeID string // Restoring: HEAD names chunks this volume has not fetched yet. err = &SnapshotSkip{Reason: SnapshotSkipRestoring} } else { - err = boundedPass(ctx, layer, current, timeout, func(passCtx context.Context) error { + passCtx, end := p.chunkCutContext(ctx) + err = boundedPass(passCtx, layer, current, 0, func(passCtx context.Context) error { return p.cfg.ChunkScheduledSnapshot(passCtx, volumeID, at, cut) }) + end() } if ctx.Err() != nil { return diff --git a/seaweed-block/core/frontend/durable/chunk_upload_pacing_sent_test.go b/seaweed-block/core/frontend/durable/chunk_upload_pacing_sent_test.go index 873f574eec..fbd15086c5 100644 --- a/seaweed-block/core/frontend/durable/chunk_upload_pacing_sent_test.go +++ b/seaweed-block/core/frontend/durable/chunk_upload_pacing_sent_test.go @@ -7,6 +7,7 @@ import ( "strings" "sync" "testing" + "time" "github.com/seaweedfs/seaweed-block/core/frontend/chunkstore" "github.com/seaweedfs/seaweed-block/core/frontend/chunkstore/layout" @@ -118,6 +119,9 @@ func TestUploadPacingRefusalSendsNoChunk(t *testing.T) { budget := &pacingCounter{} p := fixture.provider(t, t.TempDir(), v1View(), "s/r1", func(cfg *durable.ProviderConfig) { cfg.ChunkBudget = budget + // The persistent pacing refusal retries until the silence window; + // its cause and zero-upload assertion do not need five real minutes. + cfg.ChunkCutTimeout = time.Second }) s := openRecovered(t, p) if _, err := s.Write(1, block(0x6B)); err != nil { diff --git a/seaweed-block/core/frontend/durable/provider.go b/seaweed-block/core/frontend/durable/provider.go index 17a442f106..cddd032cd6 100644 --- a/seaweed-block/core/frontend/durable/provider.go +++ b/seaweed-block/core/frontend/durable/provider.go @@ -228,7 +228,8 @@ type ProviderConfig struct { // passed since the volume's last successful cut (of any kind). Zero // disables the timer. ChunkCaptureInterval time.Duration - // ChunkCutTimeout bounds a cut as a whole; zero uses five minutes. + // ChunkCutTimeout is the inactivity window between completed payload + // uploads, not a total cut deadline; zero uses five minutes. ChunkCutTimeout time.Duration // Maintenance runs serially for an attached healthy volume. Zero interval disables // it. Callback ownership ends only after cancellation and worker settlement. diff --git a/seaweed-block/core/frontend/durable/provider_chunk.go b/seaweed-block/core/frontend/durable/provider_chunk.go index 86b14c3d9d..296eeb5402 100644 --- a/seaweed-block/core/frontend/durable/provider_chunk.go +++ b/seaweed-block/core/frontend/durable/provider_chunk.go @@ -1487,7 +1487,13 @@ func (p *DurableProvider) chunkMaintenanceLoop(ctx context.Context, volumeID str // projection has no change channel: one bounded watcher belongs to the // pass, never to an individual tick, and is joined before return. func boundedPass(ctx context.Context, layer storage.ChunkLayer, current func() bool, timeout time.Duration, fn func(context.Context) error) error { - passCtx, cancel := context.WithTimeout(ctx, timeout) + var passCtx context.Context + var cancel context.CancelFunc + if timeout > 0 { + passCtx, cancel = context.WithTimeout(ctx, timeout) + } else { + passCtx, cancel = context.WithCancel(ctx) + } watchDone := make(chan struct{}) go func() { defer close(watchDone) @@ -1601,9 +1607,9 @@ func chunkFenced(volumeID string, h *volHandle) error { func (p *DurableProvider) chunkCutContext(ctx context.Context) (context.Context, context.CancelFunc) { timeout := p.cfg.ChunkCutTimeout if timeout <= 0 { - timeout = 5 * time.Minute + timeout = storage.DefaultCutProgressWindow } - return context.WithTimeout(ctx, timeout) + return storage.WithCutProgressWindow(ctx, timeout) } func (p *DurableProvider) CutVolume(ctx context.Context, volumeID string, minLSN uint64) (storage.ChunkCutResult, error) { @@ -1611,7 +1617,7 @@ func (p *DurableProvider) CutVolume(ctx context.Context, volumeID string, minLSN defer cancel() h, layer, err := p.chunkHandle(volumeID) if err != nil { - return storage.ChunkCutResult{}, err + return storage.ChunkCutResult{}, storage.CutWindowError(ctx, err) } if hook := p.testAfterChunkResolve; hook != nil { hook() @@ -1626,7 +1632,7 @@ func (p *DurableProvider) CutVolume(ctx context.Context, volumeID string, minLSN } r, err := layer.Cut(ctx) if err != nil { - return storage.ChunkCutResult{}, err + return storage.ChunkCutResult{}, storage.CutWindowError(ctx, err) } if r.H < minLSN { return storage.ChunkCutResult{}, fmt.Errorf("durable: cut of %s reached LSN %d, below %d", volumeID, r.H, minLSN) @@ -1634,6 +1640,32 @@ func (p *DurableProvider) CutVolume(ctx context.Context, volumeID string, minLSN return r, nil } +// AdmitManualCut reserves capture without queueing. The control owns the +// returned worker and must run it once, including when shutdown cancels it. +func (p *DurableProvider) AdmitManualCut(ctx context.Context, volumeID string, minLSN uint64, id string) (func(context.Context) (storage.ChunkCutResult, error), error) { + h, layer, err := p.chunkHandle(volumeID) + if err != nil { + return nil, err + } + if minLSN > 0 && minLSN > h.storage.NextLSN()-1 { + return nil, fmt.Errorf("durable: cut to LSN %d was never written", minLSN) + } + work, err := storage.AdmitManualChunkCut(ctx, layer, id) + if err != nil { + return nil, err + } + return func(ctx context.Context) (storage.ChunkCutResult, error) { + if minLSN > 0 { + ctx = hostlimit.WithClass(ctx, hostlimit.Urgent) + } + r, err := work(ctx) + if err == nil && r.H < minLSN { + err = fmt.Errorf("durable: cut reached LSN %d, below %d", r.H, minLSN) + } + return r, err + }, nil +} + // DetachVolume is a clean stop's final cut (B9 W2 §3.6): it stops the // volume's frontend I/O and waits for the I/O already admitted to finish, // stops the periodic cuts, then publishes one cut with HEAD state detached. diff --git a/seaweed-block/core/frontend/durable/provider_chunk_detach_abort_test.go b/seaweed-block/core/frontend/durable/provider_chunk_detach_abort_test.go index 5e702dba82..76dba2c36f 100644 --- a/seaweed-block/core/frontend/durable/provider_chunk_detach_abort_test.go +++ b/seaweed-block/core/frontend/durable/provider_chunk_detach_abort_test.go @@ -296,7 +296,11 @@ func assertServing(t *testing.T, p *durable.DurableProvider, b frontend.Backend, func TestWALStoreChunk_FailedDetachUploadResumes(t *testing.T) { remote, p, b := detachFixture(t) remote.set(func(r *faultRemote) { r.putErr = errInjected }) - if _, _, err := p.DetachVolume(context.Background(), "v1"); !errors.Is(err, durable.ErrDetachAborted) { + // Upload retries need a silence window, not the production freeze budget, + // to exercise the abort-and-resume ordering under a persistent failure. + failed, cancel := storage.WithCutProgressWindow(context.Background(), time.Second) + defer cancel() + if _, _, err := p.DetachVolume(failed, "v1"); !errors.Is(err, durable.ErrDetachAborted) { t.Fatalf("detach with failing uploads: %v; want ErrDetachAborted", err) } remote.set(func(r *faultRemote) { r.putErr = nil }) diff --git a/seaweed-block/core/frontend/durable/provider_maintenance_test.go b/seaweed-block/core/frontend/durable/provider_maintenance_test.go index ea431cda0f..0fd4090723 100644 --- a/seaweed-block/core/frontend/durable/provider_maintenance_test.go +++ b/seaweed-block/core/frontend/durable/provider_maintenance_test.go @@ -12,6 +12,7 @@ import ( "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/storage" ) func TestMaintenanceCloseCancelsAndJoinsWithoutGuestLock(t *testing.T) { @@ -183,7 +184,7 @@ func TestMaintenancePassHasOneNoProgressWindow(t *testing.T) { } } -func TestCutDeadlineIncludesUploadWithBackgroundCaller(t *testing.T) { +func TestCutSilenceWindowIncludesUploadWithBackgroundCaller(t *testing.T) { fixture := testutil.NewLayoutFixture(t, "v1", pcBlocks, pcChunkBlocks) fixture.Blobs.PutHook = func(ctx context.Context) error { <-ctx.Done(); return ctx.Err() } cfg := durable.ProviderConfig{ @@ -205,8 +206,8 @@ func TestCutDeadlineIncludesUploadWithBackgroundCaller(t *testing.T) { t.Fatal(err) } _, err = p.CaptureVolume(context.Background(), "v1") - if !errors.Is(err, context.DeadlineExceeded) { - t.Fatalf("whole cut did not expire: %v", err) + if !errors.Is(err, storage.ErrCutStalled) { + t.Fatalf("silent cut did not report its stalled window: %v", err) } h, found, err := fixture.Catalog.ReadHead(context.Background(), fixture.Ref) // BeginSnap may advance HEAD's generation before the upload. The diff --git a/seaweed-block/core/host/volume/chunk_control.go b/seaweed-block/core/host/volume/chunk_control.go index 4b974c0a93..557b15e8ce 100644 --- a/seaweed-block/core/host/volume/chunk_control.go +++ b/seaweed-block/core/host/volume/chunk_control.go @@ -47,6 +47,7 @@ type ChunkControl interface { // ChunkCutResponse is the body of a successful POST /chunk/cut (§3.1). type ChunkCutResponse struct { + CutID string `json:"cutID,omitempty"` CandidateTail *storage.ChunkCandidateTail `json:"candidateTail,omitempty"` VolumeID string `json:"volumeID"` CutLSN uint64 `json:"cutLSN"` @@ -218,6 +219,8 @@ type chunkFrozenRefusalBody struct { } type chunkErrorBody struct { + CutID string `json:"cutID,omitempty"` + Reason string `json:"reason,omitempty"` *chunkFrozenRefusalBody Code string `json:"code"` Message string `json:"message"` @@ -305,7 +308,40 @@ const codeHostSlotBusy = "host_slot_busy" // progress; status reports it as Chunk.Stats.UpgradePass). const codeInProgress = "in_progress" +// Marks the cut route, including its shared admission/decoding errors, so +// every JSON answer identifies the same protocol without an opt-in field. +type cutAPIResponseWriter struct{ http.ResponseWriter } + +func cutAPIAnswer(v any) (map[string]json.RawMessage, error) { + raw, err := json.Marshal(v) + if err != nil { + return nil, err + } + var fields map[string]json.RawMessage + if err := json.Unmarshal(raw, &fields); err != nil { + return nil, err + } + if fields == nil { + return nil, errors.New("cut answer must be an object") + } + version, err := json.Marshal(chunkstore.CutAPIVersion) + if err != nil { + return nil, err + } + fields["apiVersion"] = version + return fields, nil +} + func writeChunkJSON(w http.ResponseWriter, status int, v any) { + if _, cut := w.(cutAPIResponseWriter); cut { + answer, err := cutAPIAnswer(v) + if err != nil { + status = http.StatusInternalServerError + v = map[string]any{"apiVersion": chunkstore.CutAPIVersion, "code": codeInternal, "message": "encode cut answer", "retryable": false} + } else { + v = answer + } + } w.Header().Set("Content-Type", "application/json") w.WriteHeader(status) _ = json.NewEncoder(w).Encode(v) @@ -324,6 +360,11 @@ func writeChunkFailure(w http.ResponseWriter, err error) { msg = ce.Detail() // the code is in its own field } body := chunkErrorBody{Code: code, Message: msg, Retryable: retryable} + var busy *storage.CutBusyError + if errors.As(err, &busy) { + body.CutID = busy.CutID + body.Reason = busy.Reason + } var refusal *storage.FrozenRefusal // INV-WS-FREEZE-ACCOUNTING-001: transport observation, never a second forecast. if code == "frozen_tail_too_large" && errors.As(err, &refusal) { @@ -338,6 +379,10 @@ func writeChunkFailure(w http.ResponseWriter, err error) { // attempt was also refused or the re-read failed on the remote; otherwise // a refused capture reports why it was refused. func chunkErrorCode(err error) (int, string, bool) { + var busy *storage.CutBusyError + if errors.As(err, &busy) { + return http.StatusConflict, "cut_busy", true + } if errors.Is(err, chunkstore.ErrSnapshotOperationRetired) { return http.StatusGone, "operation_retired", false } @@ -357,6 +402,14 @@ func chunkErrorCode(err error) (int, string, bool) { var ce *chunkstore.CatalogError var pass *storage.ErrUpgradePassInProgress switch { + case errors.Is(err, storage.ErrChunkCASOutcomeUnknown): + // A possibly landed publication cannot be reported as a failed cut, + // even when its settlement also exhausted the progress window. + return http.StatusServiceUnavailable, chunkstore.CodeOutcomeUnknown, true + case errors.Is(err, storage.ErrChunkLayerFenced): + return http.StatusConflict, codeFenced, false + case errors.Is(err, storage.ErrCutStalled): + return http.StatusServiceUnavailable, "cut_stalled", true case errors.As(err, &pass): return http.StatusConflict, codeInProgress, true case errors.Is(err, durable.ErrPlainDetachBusy): @@ -386,12 +439,6 @@ func chunkErrorCode(err error) (int, string, bool) { return http.StatusConflict, "layout_refused", false case errors.As(err, &ce): return catalogStatus(ce.Code), ce.Code, ce.Retryable - case errors.Is(err, storage.ErrChunkLayerFenced): - return http.StatusConflict, codeFenced, false - case errors.Is(err, storage.ErrChunkCASOutcomeUnknown): - // An earlier CAS may still land: report that even when this - // attempt was also refused (the re-proposal re-checks admission). - return http.StatusServiceUnavailable, chunkstore.CodeOutcomeUnknown, true case errors.Is(err, storage.ErrChunkLSNBehind): return http.StatusConflict, codeLSNBehind, false case errors.Is(err, durable.ErrChunkAwaitingAuthority): @@ -525,13 +572,19 @@ func chunkContext(r *http.Request, timeoutMs int64) (context.Context, context.Ca } func (s *StatusServer) handleChunkCut(w http.ResponseWriter, r *http.Request) { + w = cutAPIResponseWriter{w} + if r.Method == http.MethodGet { + s.handleManualCutStatus(w, r) + return + } if !s.chunkAdmit(w, r, http.MethodPost) { return } var req struct { - VolumeID string `json:"volumeID"` - MinLSN uint64 `json:"minLSN"` - TimeoutMs int64 `json:"timeoutMs"` + VolumeID string `json:"volumeID"` + MinLSN uint64 `json:"minLSN"` + TimeoutMs int64 `json:"timeoutMs"` + DeadlineNs *int64 `json:"deadlineNs"` } if !decodeChunkBody(w, r, &req) { return @@ -540,14 +593,46 @@ func (s *StatusServer) handleChunkCut(w http.ResponseWriter, r *http.Request) { if ctl == nil { return } - ctx, cancel := chunkContext(r, req.TimeoutMs) - defer cancel() - res, err := ctl.Cut(ctx, req.VolumeID, req.MinLSN) + window := chunkstore.DefaultOpDeadline + if req.TimeoutMs > 0 { + if req.TimeoutMs > int64(((1<<63-1)-int64(manualCutObservationSlack))/int64(time.Millisecond)) { + writeChunkErr(w, http.StatusBadRequest, codeBadRequest, false, "cut window is too large") + return + } + window = time.Duration(req.TimeoutMs) * time.Millisecond + } + if req.TimeoutMs < 0 { + writeChunkErr(w, http.StatusBadRequest, codeBadRequest, false, "cut window must be positive") + return + } + executor, ok := ctl.(manualCutExecutor) + if !ok { + writeChunkErr(w, http.StatusConflict, chunkstore.CodeNotChunkVolume, false, "volume control does not support manual cut handles") + return + } + var deadline time.Time + if req.DeadlineNs != nil { + deadline = time.Unix(0, *req.DeadlineNs) + if !time.Now().Before(deadline) { + writeChunkErr(w, http.StatusBadRequest, codeBadRequest, false, "cut deadline has expired") + return + } + } + h, err := executor.startManualCut(r.Context(), req.VolumeID, req.MinLSN, window, deadline) if err != nil { writeChunkFailure(w, err) return } - writeChunkJSON(w, http.StatusOK, res) + timer := time.NewTimer(window) + defer timer.Stop() + select { + case <-h.done: + case <-storage.CutProgressSignal(h.ctx): + case <-timer.C: + case <-r.Context().Done(): + return + } + executor.writeManualCut(w, h) } func (s *StatusServer) handleChunkSnapshot(w http.ResponseWriter, r *http.Request) { @@ -770,6 +855,7 @@ type chunkControl struct { opCtx context.Context opCancel context.CancelFunc opJobs map[string]struct{} + cuts map[string]*manualCutHandle opClosed, opJoinedClosed bool opJoined chan struct{} } @@ -956,9 +1042,10 @@ func (c *chunkControl) snapshotOperationAttempt(ctx context.Context, volumeID st stop() return result, terminalErr } - _, code, _ := chunkErrorCode(err) - if code == codeFenced || code == codeEpochStale || code == codeNotPrimary { - // A displaced worker may observe a receipt, but cannot mutate it. + if errors.Is(err, storage.ErrChunkLayerFenced) || errors.Is(err, durable.ErrChunkEpochStale) || errors.Is(err, durable.ErrChunkNotPrimary) { + // Authority comes from the typed cause, independently of the wire + // outcome_unknown precedence. A displaced worker may observe a + // receipt, but cannot mutate it. stop() return chunkstore.SnapshotInfo{}, err } diff --git a/seaweed-block/core/host/volume/chunk_control_test.go b/seaweed-block/core/host/volume/chunk_control_test.go index 996d0b5c49..149faf028d 100644 --- a/seaweed-block/core/host/volume/chunk_control_test.go +++ b/seaweed-block/core/host/volume/chunk_control_test.go @@ -48,6 +48,25 @@ func (f *fakeChunkControl) Cut(ctx context.Context, vol string, minLSN uint64) ( f.lastMin = minLSN return f.cut, f.err } + +// The route fixture supplies an immediately completed manual handle. Real +// worker admission, ownership and polling are exercised in manual_cut_test.go. +func (f *fakeChunkControl) startManualCut(ctx context.Context, volume string, minLSN uint64, window time.Duration, deadline time.Time) (*manualCutHandle, error) { + ctx, stop := storage.WithCutProgressWindow(ctx, window) + defer stop() + result, err := f.Cut(ctx, volume, minLSN) + if err != nil { + return nil, err + } + result.CutID = "fixture-cut" + done := make(chan struct{}) + close(done) + return &manualCutHandle{id: result.CutID, volume: volume, ctx: ctx, done: done, ended: time.Now(), result: result}, nil +} +func (f *fakeChunkControl) writeManualCut(w http.ResponseWriter, h *manualCutHandle) { + (&chunkControl{}).writeManualCut(w, h) +} + func (f *fakeChunkControl) Snapshot(ctx context.Context, vol string, req ChunkSnapshotRequest) (chunkstore.SnapshotInfo, error) { f.calls++ f.remember(ctx) @@ -152,16 +171,16 @@ func TestStatusServer_ChunkSuccessBodiesUseSpecFields(t *testing.T) { s := chunkServer(t, ctl, true) w := serve(t, s, http.MethodPost, "/chunk/cut", `{"volumeID":"v1","minLSN":7,"timeoutMs":1000}`, "") - if w.Code != 200 || ctl.lastMin != 7 || ctl.deadline <= 0 || ctl.deadline > time.Second { + if w.Code != 200 || ctl.lastMin != 7 || ctl.deadline != 0 { t.Fatalf("cut: %d %s (minLSN %d, deadline %v)", w.Code, w.Body, ctl.lastMin, ctl.deadline) } - // A timeoutMs too large for a Duration is clamped to OpDeadline, not overflowed. - if w := serve(t, s, http.MethodPost, "/chunk/cut", `{"volumeID":"v1","timeoutMs":9223372036855}`, ""); w.Code != 200 || - ctl.deadline < chunkstore.DefaultOpDeadline-time.Minute || ctl.deadline > chunkstore.DefaultOpDeadline { - t.Fatalf("cut with a huge timeoutMs: %d (deadline %v), want OpDeadline", w.Code, ctl.deadline) + // A cut window is not a total context deadline. Overflow is refused + // before conversion, rather than silently wrapping or imposing a cap. + if w := serve(t, s, http.MethodPost, "/chunk/cut", `{"volumeID":"v1","timeoutMs":9223372036855}`, ""); w.Code != http.StatusBadRequest { + t.Fatalf("overflowed cut window: %d %s", w.Code, w.Body) } // The chunk layer fills the cut statistics (§3.1), so the body carries them. - wantKeys(t, "cut", jsonKeys(t, w.Body.Bytes()), "volumeID", "cutLSN", "headGen", "headEpoch", "holder", "noop", "fullHash", "stats") + wantKeys(t, "cut", jsonKeys(t, w.Body.Bytes()), "apiVersion", "cutID", "volumeID", "cutLSN", "headGen", "headEpoch", "holder", "noop", "fullHash", "stats") w = serve(t, s, http.MethodPost, "/chunk/snapshot", `{"volumeID":"v1","name":"s1","requestID":"r","labels":{"agent.step":"x"},"consistency":"app","expiresAtNs":9}`, "") if w.Code != 200 || ctl.lastSnap.Name != "s1" || ctl.lastSnap.RequestID != "r" || ctl.lastSnap.Consistency != "app" || ctl.lastSnap.Labels["agent.step"] != "x" || ctl.lastSnap.ExpiresAtNs != 9 { @@ -218,6 +237,8 @@ func TestStatusServer_ChunkErrorBodyIsTyped(t *testing.T) { {fmt.Errorf("%w: %w", storage.ErrChunkCaptureRefused, storage.ErrChunkReconciling), "reconciling", 409, true}, {fmt.Errorf("%w: %w", storage.ErrChunkReconciling, context.DeadlineExceeded), "reconciling", 409, true}, {fmt.Errorf("x: %w", storage.ErrChunkCASOutcomeUnknown), "outcome_unknown", 503, true}, + {errors.Join(storage.ErrChunkCASOutcomeUnknown, storage.ErrCutStalled), "outcome_unknown", 503, true}, + {errors.Join(storage.ErrChunkLayerFenced, storage.ErrCutStalled), "fenced", 409, false}, {fmt.Errorf("x: %w", storage.ErrChunkHeadPrecondition), "head_conflict", 409, true}, {fmt.Errorf("x: %w", layout.ErrPrecondition), "head_conflict", 409, true}, // a raced catalog transition (snapshot delete) {fmt.Errorf("x: %w", layout.ErrQueueFull), "queue_full", 409, true}, @@ -297,8 +318,8 @@ func TestStatusServer_ChunkRequestGuards(t *testing.T) { t.Fatalf("other volume: %d %s", w.Code, w.Body) } // Transport errors are JSON too (ruling of 2026-11-15). - if w := serve(t, s, http.MethodGet, "/chunk/cut", "", ""); w.Code != http.StatusMethodNotAllowed || code(w) != "method_not_allowed" { - t.Fatalf("GET on a POST route: %d %s", w.Code, w.Body) + if w := serve(t, s, http.MethodDelete, "/chunk/cut", "", ""); w.Code != http.StatusMethodNotAllowed || code(w) != "method_not_allowed" { + t.Fatalf("DELETE on the cut route: %d %s", w.Code, w.Body) } if w := serve(t, s, http.MethodPost, "/chunk/cut", `{"volumeID":"v1"}`, "10.0.0.9:4000"); w.Code != http.StatusForbidden || code(w) != "forbidden" { t.Fatalf("non-loopback client: %d %s", w.Code, w.Body) diff --git a/seaweed-block/core/host/volume/chunk_frozen_budget_test.go b/seaweed-block/core/host/volume/chunk_frozen_budget_test.go index 004d446fe9..cadaf19646 100644 --- a/seaweed-block/core/host/volume/chunk_frozen_budget_test.go +++ b/seaweed-block/core/host/volume/chunk_frozen_budget_test.go @@ -1,11 +1,11 @@ package volume import ( - "github.com/seaweedfs/seaweed-block/core/frontend/chunkstore" "context" "encoding/json" "errors" "fmt" + "github.com/seaweedfs/seaweed-block/core/frontend/chunkstore" "github.com/seaweedfs/seaweed-block/core/storage" "net/http" "testing" @@ -59,9 +59,12 @@ func TestChunkFrozenDetachWireContractAndPrecedence(t *testing.T) { } func TestChunkCheckpointCarriesCandidateTail(t *testing.T) { tail := &storage.ChunkCandidateTail{Bytes: 4096, Estimate: time.Second, Known: true, RateSamples: 3, BytesPerSecond: 4096} - p := &fakeChunkProvider{cut: storage.ChunkCutResult{CandidateTail: tail}} + p := &handleCutProvider{work: func(context.Context) (storage.ChunkCutResult, error) { + return storage.ChunkCutResult{CandidateTail: tail}, nil + }} s := chunkServer(t, NewChunkControl(p, nil, chunkstore.VolumeRef{}), true) w := serve(t, s, http.MethodPost, "/chunk/cut", `{"volumeID":"v1"}`, "") + w = awaitManualCutAnswer(t, s, w) var body ChunkCutResponse if err := json.Unmarshal(w.Body.Bytes(), &body); err != nil || w.Code != 200 || body.CandidateTail == nil || *body.CandidateTail != *tail { t.Fatalf("cut response lost tail: %d %s %v", w.Code, w.Body, err) diff --git a/seaweed-block/core/host/volume/chunk_unknown_path_test.go b/seaweed-block/core/host/volume/chunk_unknown_path_test.go index 23738f21a1..d8c2b2cc53 100644 --- a/seaweed-block/core/host/volume/chunk_unknown_path_test.go +++ b/seaweed-block/core/host/volume/chunk_unknown_path_test.go @@ -30,7 +30,7 @@ func TestStatusServer_ChunkUnknownPathIsJSON404(t *testing.T) { } } // The known routes are unaffected. - if w := serve(t, s, http.MethodGet, "/chunk/cut", "", ""); w.Code != http.StatusMethodNotAllowed { - t.Fatalf("GET /chunk/cut: %d, want 405", w.Code) + if w := serve(t, s, http.MethodDelete, "/chunk/cut", "", ""); w.Code != http.StatusMethodNotAllowed { + t.Fatalf("DELETE /chunk/cut: %d, want 405", w.Code) } } diff --git a/seaweed-block/core/host/volume/cut_progress_window_test.go b/seaweed-block/core/host/volume/cut_progress_window_test.go new file mode 100644 index 0000000000..ea4ce1f2f2 --- /dev/null +++ b/seaweed-block/core/host/volume/cut_progress_window_test.go @@ -0,0 +1,224 @@ +package volume + +import ( + "bytes" + "context" + "encoding/json" + "net/http" + "net/http/httptest" + "strings" + "sync/atomic" + "testing" + "testing/synctest" + "time" + + "github.com/seaweedfs/seaweed-block/core/frontend/durable" + "github.com/seaweedfs/seaweed-block/core/frontend/durable/testutil" +) + +func TestManualCutProgressingBeyondFiveMinutesFinishesWithOneAdmission(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + fixture := testutil.NewLayoutFixture(t, "v1", 256, 16) + cfg := durable.ProviderConfig{Impl: durable.ImplWALStoreChunk, StorageRoot: t.TempDir(), BlockSize: 4096, NumBlocks: 256, ChunkBlocks: 16, ChunkUploadConcurrency: 1} + fixture.Configure(&cfg) + p, err := durable.NewDurableProvider(cfg, healthyView{}) + if err != nil { + t.Fatal(err) + } + defer p.Close() + st, err := p.EnsureStorage("v1") + if err != nil { + t.Fatal(err) + } + if _, err = p.RecoverVolume(context.Background(), "v1"); err != nil { + t.Fatal(err) + } + fixture.Blobs.PutHook = func(ctx context.Context) error { + select { + case <-time.After(19 * time.Second): + return nil + case <-ctx.Done(): + return ctx.Err() + } + } + for i := uint32(0); i < 16; i++ { + if _, err = st.Write(i*16, bytes.Repeat([]byte{byte(i + 1)}, 4096)); err != nil { + t.Fatal(err) + } + } + server := chunkServer(t, NewChunkControl(p, fixture.Catalog, fixture.Ref), true) + began := time.Now() + w := awaitManualCutAnswer(t, server, serve(t, server, http.MethodPost, "/chunk/cut", `{"volumeID":"v1"}`, "")) + var answer struct { + CutLSN uint64 `json:"cutLSN"` + Stats struct { + UploadedChunks int `json:"uploadedChunks"` + } `json:"stats"` + } + if err = json.Unmarshal(w.Body.Bytes(), &answer); err != nil { + t.Fatal(err) + } + if w.Code != http.StatusOK || answer.CutLSN != 16 || answer.Stats.UploadedChunks != 16 || time.Since(began) <= 5*time.Minute { + t.Fatalf("healthy progressing cut failed: elapsed=%s HTTP=%d answer=%s", time.Since(began), w.Code, w.Body.String()) + } + }) +} + +func TestManualCutCallTimeoutRetriesWithoutEndingTheWindow(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + p, fixture, st, _ := limitVolume(t) + calls := 0 + fixture.Blobs.PutHook = func(ctx context.Context) error { + calls++ + if calls == 1 { + <-ctx.Done() + return ctx.Err() + } + return nil + } + if _, err := st.Write(0, bytes.Repeat([]byte{7}, 4096)); err != nil { + t.Fatal(err) + } + server := chunkServer(t, NewChunkControl(p, fixture.Catalog, fixture.Ref), true) + began := time.Now() + w := awaitManualCutAnswer(t, server, serve(t, server, http.MethodPost, "/chunk/cut", `{"volumeID":"v1","timeoutMs":120000}`, "")) + if w.Code != http.StatusOK || time.Since(began) < 30*time.Second || time.Since(began) >= 2*time.Minute { + t.Fatalf("a per-call expiry ended a healthy window: elapsed=%s HTTP=%d body=%s", time.Since(began), w.Code, w.Body.String()) + } + }) +} + +func TestManualCutSilenceReturnsTypedStallAtItsWindow(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + p, fixture, st, _ := limitVolume(t) + fixture.Blobs.PutHook = func(ctx context.Context) error { <-ctx.Done(); return ctx.Err() } + if _, err := st.Write(0, bytes.Repeat([]byte{7}, 4096)); err != nil { + t.Fatal(err) + } + server := chunkServer(t, NewChunkControl(p, fixture.Catalog, fixture.Ref), true) + began := time.Now() + w := awaitManualCutAnswer(t, server, serve(t, server, http.MethodPost, "/chunk/cut", `{"volumeID":"v1","timeoutMs":2000}`, "")) + var body struct { + Code string `json:"code"` + Retryable bool `json:"retryable"` + } + if err := json.Unmarshal(w.Body.Bytes(), &body); err != nil { + t.Fatal(err) + } + if time.Since(began) != 2*time.Second || w.Code != http.StatusServiceUnavailable || body.Code != "cut_stalled" || !body.Retryable { + t.Fatalf("stall: elapsed=%s HTTP=%d body=%s", time.Since(began), w.Code, w.Body.String()) + } + }) +} + +func TestManualCutStallRetryKeepsProgressAndReportsAttemptCounters(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + p, fixture, st, _ := limitVolume(t) + var calls atomic.Uint64 + retry := false + fixture.Blobs.PutHook = func(ctx context.Context) error { + ticket := calls.Add(1) + if retry { + return nil + } + if ticket == 1 { + select { + case <-time.After(500 * time.Millisecond): + return nil + case <-ctx.Done(): + return ctx.Err() + } + } + <-ctx.Done() + return ctx.Err() + } + for _, lba := range []uint32{0, 16} { + if _, err := st.Write(lba, bytes.Repeat([]byte{byte(lba + 1)}, 4096)); err != nil { + t.Fatal(err) + } + } + server := chunkServer(t, NewChunkControl(p, fixture.Catalog, fixture.Ref), true) + began := time.Now() + failed := awaitManualCutAnswer(t, server, serve(t, server, http.MethodPost, "/chunk/cut", `{"volumeID":"v1","timeoutMs":2000}`, "")) + var failure struct { + Code string `json:"code"` + } + json.Unmarshal(failed.Body.Bytes(), &failure) + if failed.Code != 503 || failure.Code != "cut_stalled" || time.Since(began) != 2500*time.Millisecond || fixture.Blobs.Puts() != 1 { + t.Fatalf("completed upload did not renew its window: elapsed=%s body=%s puts=%d", time.Since(began), failed.Body.String(), fixture.Blobs.Puts()) + } + retry = true + answer := awaitManualCutAnswer(t, server, serve(t, server, http.MethodPost, "/chunk/cut", `{"volumeID":"v1","timeoutMs":2000}`, "")) + var success struct { + Stats struct { + UploadedChunks int `json:"uploadedChunks"` + StagedChunksUsed int `json:"stagedChunksUsed"` + } `json:"stats"` + } + if err := json.Unmarshal(answer.Body.Bytes(), &success); err != nil { + t.Fatal(err) + } + if answer.Code != 200 || success.Stats.UploadedChunks != 1 || success.Stats.StagedChunksUsed != 1 { + t.Fatalf("retry attempt counters: HTTP=%d body=%s", answer.Code, answer.Body.String()) + } + noop := awaitManualCutAnswer(t, server, serve(t, server, http.MethodPost, "/chunk/cut", `{"volumeID":"v1","timeoutMs":2000}`, "")) + if err := json.Unmarshal(noop.Body.Bytes(), &success); err != nil { + t.Fatal(err) + } + if noop.Code != 200 || success.Stats.UploadedChunks != 0 { + t.Fatalf("next cut inherited old uploads: HTTP=%d body=%s", noop.Code, noop.Body.String()) + } + }) +} + +func TestManualCutTimedOutCallsDoNotRenewProgress(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + p, fixture, st, _ := limitVolume(t) + calls := 0 + fixture.Blobs.PutHook = func(ctx context.Context) error { calls++; <-ctx.Done(); return ctx.Err() } + if _, err := st.Write(0, bytes.Repeat([]byte{7}, 4096)); err != nil { + t.Fatal(err) + } + server := chunkServer(t, NewChunkControl(p, fixture.Catalog, fixture.Ref), true) + ctx, cancel := context.WithTimeout(context.Background(), 3*time.Minute) + defer cancel() + req := httptest.NewRequest(http.MethodPost, "/chunk/cut", strings.NewReader(`{"volumeID":"v1","timeoutMs":90000}`)).WithContext(ctx) + req.RemoteAddr = "127.0.0.1:1" + w := httptest.NewRecorder() + began := time.Now() + server.chunkMux().ServeHTTP(w, req) + w = awaitManualCutAnswer(t, server, w) + var body struct { + Code string `json:"code"` + } + json.Unmarshal(w.Body.Bytes(), &body) + if time.Since(began) != 90*time.Second || body.Code != "cut_stalled" || calls < 2 { + t.Fatalf("timeouts renewed the window: elapsed=%s calls=%d HTTP=%d body=%s", time.Since(began), calls, w.Code, w.Body.String()) + } + }) +} + +// The initial call is bounded even when healthy work outlives its window. +// Subsequent requests only observe its returned identity. +func awaitManualCutAnswer(t *testing.T, s *StatusServer, w *httptest.ResponseRecorder) *httptest.ResponseRecorder { + t.Helper() + if w.Code != http.StatusAccepted { + return w + } + var admission struct { + ID string `json:"cutID"` + } + if err := json.Unmarshal(w.Body.Bytes(), &admission); err != nil || admission.ID == "" { + t.Fatalf("invalid admission: %s", w.Body.String()) + } + for i := 0; i < 10000; i++ { + synctest.Wait() + w = serve(t, s, http.MethodGet, "/chunk/cut?volumeID=v1&cutID="+admission.ID, "", "") + if w.Code != http.StatusAccepted { + return w + } + time.Sleep(100 * time.Millisecond) + } + t.Fatal("terminal cut answer never arrived") + return nil +} diff --git a/seaweed-block/core/host/volume/manual_cut.go b/seaweed-block/core/host/volume/manual_cut.go new file mode 100644 index 0000000000..736a3379f8 --- /dev/null +++ b/seaweed-block/core/host/volume/manual_cut.go @@ -0,0 +1,155 @@ +package volume + +import ( + "context" + "crypto/rand" + "net/http" + "time" + + "github.com/seaweedfs/seaweed-block/core/storage" +) + +const manualCutHandleLimit = 4 +const manualCutObservationSlack = 5 * time.Second + +type manualCutHandle struct { + id, volume string + ctx context.Context + done chan struct{} + ended time.Time + retention time.Duration + result ChunkCutResponse + err error +} +type manualCutExecutor interface { + startManualCut(context.Context, string, uint64, time.Duration, time.Time) (*manualCutHandle, error) + writeManualCut(http.ResponseWriter, *manualCutHandle) +} + +type manualCutProvider interface { + AdmitManualCut(context.Context, string, uint64, string) (func(context.Context) (storage.ChunkCutResult, error), error) +} + +func (c *chunkControl) retireManualCutsLocked(now time.Time) { + for id, h := range c.cuts { + if !h.ended.IsZero() && !now.Before(h.ended.Add(h.retention)) { + delete(c.cuts, id) + } + } +} + +// Reservation, admission and work are registered before leaving the control +// lock, so Close cannot finish while an admitted worker still owns capture. +// HTTP cancellation stops observation only; work belongs to opCtx. +func (c *chunkControl) startManualCut(admission context.Context, volume string, minLSN uint64, window time.Duration, deadline time.Time) (*manualCutHandle, error) { + provider, ok := c.p.(manualCutProvider) + if !ok { + return nil, &manualCutUnsupported{} + } + c.opMu.Lock() + if c.opClosed { + c.opMu.Unlock() + return nil, storage.ErrChunkLayerClosed + } + c.retireManualCutsLocked(time.Now()) + if len(c.cuts) >= manualCutHandleLimit { + c.opMu.Unlock() + return nil, &storage.CutBusyError{Reason: "handles_full"} + } + if c.cuts == nil { + c.cuts = make(map[string]*manualCutHandle) + } + h := &manualCutHandle{id: rand.Text(), volume: volume, done: make(chan struct{}), retention: window + manualCutObservationSlack} + c.cuts[h.id] = h + c.opAdmissions++ + c.opMu.Unlock() + // Admission is immediate, but shutdown still cancels its context if a + // provider validation step is interrupted. + admit, cancelAdmission := context.WithCancel(admission) + stopRoot := context.AfterFunc(c.opCtx, cancelAdmission) + work, err := provider.AdmitManualCut(admit, volume, minLSN, h.id) + stopRoot() + cancelAdmission() + if err != nil { + c.opMu.Lock() + delete(c.cuts, h.id) + c.opAdmissions-- + c.maybeJoinSnapshotOperationsLocked() + c.opMu.Unlock() + return nil, err + } + root := c.opCtx + stopDeadline := func() {} + if !deadline.IsZero() { + root, stopDeadline = context.WithDeadline(root, deadline) + } + ctx, stopWindow := storage.WithCutProgressWindow(root, window) + c.opMu.Lock() + h.ctx = ctx + c.opMu.Unlock() + go func() { + r, err := work(ctx) + err = storage.CutWindowError(ctx, err) + stopWindow() + stopDeadline() + c.opMu.Lock() + h.result = ChunkCutResponse{CutID: h.id, VolumeID: volume, CutLSN: r.H, HeadGen: r.Head.Gen, HeadEpoch: r.Head.Epoch, Holder: r.Head.Holder, Noop: r.Noop, FullHash: r.FullHash, CandidateTail: r.CandidateTail, Stats: cutStatsBody(r.Stats)} + h.err = err + h.ended = time.Now() + close(h.done) + c.opAdmissions-- + c.maybeJoinSnapshotOperationsLocked() + c.opMu.Unlock() + }() + return h, nil +} + +type manualCutUnsupported struct{} + +func (*manualCutUnsupported) Error() string { + return "manual cut admission is unsupported by this provider" +} + +func (c *chunkControl) writeManualCut(w http.ResponseWriter, h *manualCutHandle) { + c.opMu.Lock() + result, err, ended, ctx := h.result, h.err, h.ended, h.ctx + c.opMu.Unlock() + if ended.IsZero() { + writeChunkJSON(w, http.StatusAccepted, struct { + Code string `json:"code"` + ID string `json:"cutID"` + Sequence uint64 `json:"sequence"` + }{"in_progress", h.id, storage.CutProgressSequence(ctx)}) + return + } + if err != nil { + status, code, retry := chunkErrorCode(err) + writeChunkJSON(w, status, chunkErrorBody{CutID: h.id, Code: code, Message: err.Error(), Retryable: retry}) + return + } + writeChunkJSON(w, http.StatusOK, result) +} +func (s *StatusServer) handleManualCutStatus(w http.ResponseWriter, r *http.Request) { + if !s.chunkAdmit(w, r, http.MethodGet) { + return + } + ctl := s.chunkTarget(w, r.URL.Query().Get("volumeID")) + if ctl == nil { + return + } + c, ok := ctl.(*chunkControl) + id := r.URL.Query().Get("cutID") + if !ok || id == "" { + writeChunkErr(w, http.StatusBadRequest, codeBadRequest, false, "cut status requires a cutID") + return + } + c.opMu.Lock() + c.retireManualCutsLocked(time.Now()) + h := c.cuts[id] + c.opMu.Unlock() + if h == nil { + writeChunkJSON(w, http.StatusNotFound, chunkErrorBody{CutID: id, Code: "unknown_cut_id", Message: "cut handle is unknown in this process"}) + return + } + c.writeManualCut(w, h) +} diff --git a/seaweed-block/core/host/volume/manual_cut_test.go b/seaweed-block/core/host/volume/manual_cut_test.go new file mode 100644 index 0000000000..6884dd5d8b --- /dev/null +++ b/seaweed-block/core/host/volume/manual_cut_test.go @@ -0,0 +1,513 @@ +package volume + +import ( + "bytes" + "context" + "encoding/json" + "errors" + "fmt" + "github.com/seaweedfs/seaweed-block/core/frontend/chunkstore" + "github.com/seaweedfs/seaweed-block/core/frontend/durable" + "github.com/seaweedfs/seaweed-block/core/storage" + "net/http" + "net/http/httptest" + "strings" + "sync" + "sync/atomic" + "testing" + "testing/synctest" + "time" +) + +type handleCutProvider struct { + fakeChunkProvider + work func(context.Context) (storage.ChunkCutResult, error) + calls int +} + +func (p *handleCutProvider) AdmitManualCut(ctx context.Context, _ string, _ uint64, _ string) (func(context.Context) (storage.ChunkCutResult, error), error) { + p.calls++ + return p.work, nil +} +func cutControlForHandles(p *handleCutProvider) *chunkControl { + return NewChunkControl(p, nil, chunkstore.VolumeRef{}).(*chunkControl) +} + +func TestManualCutHandlesKeepLostTerminalRepliesUntilTheirOwnWindow(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + p := &handleCutProvider{work: func(context.Context) (storage.ChunkCutResult, error) { return storage.ChunkCutResult{H: 7}, nil }} + c := cutControlForHandles(p) + defer c.closeSnapshotOperations(context.Background()) + var first *manualCutHandle + for i := 0; i < 4; i++ { + h, err := c.startManualCut(context.Background(), "v1", 0, time.Second, time.Time{}) + if err != nil { + t.Fatal(err) + } + <-h.done + if i == 0 { + first = h + } + w := httptest.NewRecorder() + c.writeManualCut(w, h) + if w.Code != 200 { + t.Fatal(w.Code) + } + } + _, err := c.startManualCut(context.Background(), "v1", 0, time.Second, time.Time{}) + var busy *storage.CutBusyError + if !errors.As(err, &busy) || busy.Reason != "handles_full" || p.calls != 4 { + t.Fatalf("capacity: err=%v calls=%d", err, p.calls) + } + time.Sleep(6*time.Second - time.Nanosecond) + c.opMu.Lock() + c.retireManualCutsLocked(time.Now()) + kept := c.cuts[first.id] + c.opMu.Unlock() + if kept != first { + t.Fatal("lost reply forgotten before its Wc") + } + w := httptest.NewRecorder() + c.writeManualCut(w, first) + if w.Code != 200 { + t.Fatal("lost terminal reply did not replay") + } + time.Sleep(time.Nanosecond) + h, err := c.startManualCut(context.Background(), "v1", 0, time.Second, time.Time{}) + if err != nil { + t.Fatal(err) + } + <-h.done + if h.id == first.id || len(c.cuts) != 1 { + t.Fatal("retired identity reused or handles not bounded") + } + }) +} + +func TestManualCutHTTPReturnsHandleAndCloseJoinsWorker(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + joined := make(chan struct{}) + p := &handleCutProvider{work: func(ctx context.Context) (storage.ChunkCutResult, error) { + defer close(joined) + tick := time.NewTicker(400 * time.Millisecond) + defer tick.Stop() + for { + select { + case <-ctx.Done(): + return storage.ChunkCutResult{}, ctx.Err() + case <-tick.C: + storage.ReportCutObjectVerified(ctx) + } + } + }} + c := cutControlForHandles(p) + defer c.closeSnapshotOperations(context.Background()) + server := chunkServer(t, c, true) + start := time.Now() + w := serve(t, server, http.MethodPost, "/chunk/cut", `{"volumeID":"v1","timeoutMs":1000}`, "") + if w.Code != 202 || time.Since(start) != 400*time.Millisecond { + t.Fatalf("admission HTTP=%d elapsed=%s body=%s", w.Code, time.Since(start), w.Body.String()) + } + var h *manualCutHandle + for _, x := range c.cuts { + h = x + } + poll := serve(t, server, http.MethodGet, "/chunk/cut?volumeID=v1&cutID="+h.id, "", "") + if poll.Code != 202 || storage.CutProgressSequence(h.ctx) != 1 { + t.Fatalf("poll=%d sequence=%d", poll.Code, storage.CutProgressSequence(h.ctx)) + } + if err := server.Close(context.Background()); err != nil { + t.Fatal(err) + } + select { + case <-joined: + default: + t.Fatal("Close returned before worker joined") + } + if _, err := c.startManualCut(context.Background(), "v1", 0, time.Second, time.Time{}); !errors.Is(err, storage.ErrChunkLayerClosed) { + t.Fatalf("admission after close: %v", err) + } + restarted := cutControlForHandles(p) + defer restarted.closeSnapshotOperations(context.Background()) + restartServer := chunkServer(t, restarted, true) + poll = serve(t, restartServer, http.MethodGet, "/chunk/cut?volumeID=v1&cutID="+h.id, "", "") + if poll.Code != 404 { + t.Fatalf("restart inherited handle: %s", poll.Body.String()) + } + }) +} + +func TestManualCutBusyNamesTheRunningCaptureWithoutQueueing(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + p, fixture, st, _ := limitVolume(t) + entered := make(chan struct{}) + var once sync.Once + fixture.Blobs.PutHook = func(ctx context.Context) error { once.Do(func() { close(entered) }); <-ctx.Done(); return ctx.Err() } + if _, err := st.Write(0, bytes.Repeat([]byte{7}, 4096)); err != nil { + t.Fatal(err) + } + c := NewChunkControl(p, fixture.Catalog, fixture.Ref).(*chunkControl) + server := chunkServer(t, c, true) + first := make(chan *httptest.ResponseRecorder, 1) + go func() { + first <- serve(t, server, http.MethodPost, "/chunk/cut", `{"volumeID":"v1","timeoutMs":1000}`, "") + }() + <-entered + start := time.Now() + busy := serve(t, server, http.MethodPost, "/chunk/cut", `{"volumeID":"v1","timeoutMs":1000}`, "") + var refusal chunkErrorBody + if err := json.Unmarshal(busy.Body.Bytes(), &refusal); err != nil { + t.Fatal(err) + } + if busy.Code != 409 || refusal.Code != "cut_busy" || refusal.Reason != "capture_held" || refusal.CutID == "" || time.Since(start) != 0 { + t.Fatalf("manual cut queued: %d %s", busy.Code, busy.Body.String()) + } + answer := awaitManualCutAnswer(t, server, <-first) + var terminal chunkErrorBody + if err := json.Unmarshal(answer.Body.Bytes(), &terminal); err != nil { + t.Fatal(err) + } + if terminal.CutID != refusal.CutID || terminal.Code != "cut_stalled" { + t.Fatalf("busy named another capture: %s / %s", busy.Body.String(), answer.Body.String()) + } + }) +} + +func TestManualCutObserverCancellationDoesNotCancelAdmittedWork(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + release := make(chan struct{}) + entered := make(chan struct{}) + p := &handleCutProvider{work: func(ctx context.Context) (storage.ChunkCutResult, error) { + close(entered) + select { + case <-release: + return storage.ChunkCutResult{H: 9}, nil + case <-ctx.Done(): + return storage.ChunkCutResult{}, ctx.Err() + } + }} + c := cutControlForHandles(p) + defer c.closeSnapshotOperations(context.Background()) + server := chunkServer(t, c, true) + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + request := httptest.NewRequest(http.MethodPost, "/chunk/cut", strings.NewReader(`{"volumeID":"v1","timeoutMs":1000}`)).WithContext(ctx) + request.RemoteAddr = "127.0.0.1:1" + returned := make(chan struct{}) + go func() { defer close(returned); server.chunkMux().ServeHTTP(httptest.NewRecorder(), request) }() + <-entered + cancel() + <-returned + var h *manualCutHandle + c.opMu.Lock() + for _, v := range c.cuts { + h = v + } + c.opMu.Unlock() + if h.ctx.Err() != nil { + t.Fatal("observer canceled admitted work") + } + close(release) + <-h.done + poll := serve(t, server, http.MethodGet, "/chunk/cut?volumeID=v1&cutID="+h.id, "", "") + if poll.Code != 200 { + t.Fatalf("admitted result lost: %s", poll.Body.String()) + } + }) +} + +func TestManualCutDefaultPostUsesHandleAndPromptProgress(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + p := &handleCutProvider{work: func(ctx context.Context) (storage.ChunkCutResult, error) { + storage.ReportCutObjectVerified(ctx) + time.Sleep(100 * time.Millisecond) + return storage.ChunkCutResult{H: 7}, nil + }} + c := cutControlForHandles(p) + defer c.closeSnapshotOperations(context.Background()) + server := chunkServer(t, c, true) + w := serve(t, server, http.MethodPost, "/chunk/cut", `{"volumeID":"v1","timeoutMs":1000}`, "") + if w.Code != http.StatusAccepted || !strings.Contains(w.Body.String(), "cutID") || p.calls != 1 || p.cuts != 0 || len(c.cuts) != 1 { + t.Fatalf("default POST HTTP=%d body=%s admissions=%d cuts=%d handles=%d", w.Code, w.Body.String(), p.calls, p.cuts, len(c.cuts)) + } + if terminal := awaitManualCutAnswer(t, server, w); terminal.Code != http.StatusOK { + t.Fatalf("terminal: %d %s", terminal.Code, terminal.Body.String()) + } + }) +} + +func TestManualCutExplicitDeadlineCancelsTheHandleWorker(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + p := &handleCutProvider{work: func(ctx context.Context) (storage.ChunkCutResult, error) { + <-ctx.Done() + return storage.ChunkCutResult{}, ctx.Err() + }} + c := cutControlForHandles(p) + defer c.closeSnapshotOperations(context.Background()) + server := chunkServer(t, c, true) + began := time.Now() + body := fmt.Sprintf(`{"volumeID":"v1","timeoutMs":1000,"deadlineNs":%d}`, began.Add(500*time.Millisecond).UnixNano()) + w := serve(t, server, http.MethodPost, "/chunk/cut", body, "") + if time.Since(began) != 500*time.Millisecond || w.Code != http.StatusServiceUnavailable || !strings.Contains(w.Body.String(), "cutID") || p.calls != 1 || p.cuts != 0 || len(c.cuts) != 1 { + t.Fatalf("explicit deadline elapsed=%s HTTP=%d body=%s admissions=%d cuts=%d", time.Since(began), w.Code, w.Body.String(), p.calls, p.cuts) + } + }) +} + +func TestManualCutHTTPRetentionUsesUncappedClientWindow(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + p := &handleCutProvider{work: func(context.Context) (storage.ChunkCutResult, error) { return storage.ChunkCutResult{H: 7}, nil }} + c := cutControlForHandles(p) + defer c.closeSnapshotOperations(context.Background()) + server := chunkServer(t, c, true) + w := serve(t, server, http.MethodPost, "/chunk/cut", `{"volumeID":"v1","timeoutMs":600000}`, "") + var answer ChunkCutResponse + if err := json.Unmarshal(w.Body.Bytes(), &answer); err != nil || w.Code != 200 || answer.CutID == "" { + t.Fatalf("admission HTTP=%d body=%s err=%v", w.Code, w.Body.String(), err) + } + time.Sleep(10*time.Minute + manualCutObservationSlack - time.Nanosecond) + poll := serve(t, server, http.MethodGet, "/chunk/cut?volumeID=v1&cutID="+answer.CutID, "", "") + if poll.Code != 200 { + t.Fatalf("long-window handle retired early: %d %s", poll.Code, poll.Body.String()) + } + time.Sleep(time.Nanosecond) + poll = serve(t, server, http.MethodGet, "/chunk/cut?volumeID=v1&cutID="+answer.CutID, "", "") + if poll.Code != 404 { + t.Fatalf("handle retained beyond own window: %d %s", poll.Code, poll.Body.String()) + } + }) +} + +func TestManualCutServerCloseCancelsCaptureBeforeJoiningSnapshot(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + p, fixture, st, _ := limitVolume(t) + entered := make(chan struct{}) + var once sync.Once + fixture.Blobs.PutHook = func(ctx context.Context) error { once.Do(func() { close(entered) }); <-ctx.Done(); return ctx.Err() } + if _, err := st.Write(0, bytes.Repeat([]byte{7}, 4096)); err != nil { + t.Fatal(err) + } + c := NewChunkControl(p, fixture.Catalog, fixture.Ref).(*chunkControl) + server := chunkServer(t, c, true) + h, err := c.startManualCut(context.Background(), "v1", 0, time.Hour, time.Time{}) + if err != nil { + t.Fatal(err) + } + <-entered + snapshotDone := make(chan error, 1) + go func() { + _, err := c.Snapshot(context.Background(), "v1", ChunkSnapshotRequest{Name: "queued"}) + snapshotDone <- err + }() + synctest.Wait() + select { + case err := <-snapshotDone: + t.Fatalf("snapshot did not wait behind capture: %v", err) + default: + } + c.opMu.Lock() + admissions := c.opAdmissions + c.opMu.Unlock() + if admissions != 2 { + t.Fatalf("wanted cut and snapshot registered: %d", admissions) + } + ctx, cancel := context.WithTimeout(context.Background(), time.Second) + defer cancel() + if err := server.Close(ctx); err != nil { + t.Fatalf("Close joined before canceling capture: %v", err) + } + select { + case <-h.done: + default: + t.Fatal("Close left observed cut running") + } + select { + case <-snapshotDone: + default: + t.Fatal("Close left snapshot worker running") + } + }) +} + +type heldRealManualAdmission struct { + *durable.DurableProvider + entered chan struct{} + release chan struct{} + reserveFirst bool +} + +func (p *heldRealManualAdmission) AdmitManualCut(ctx context.Context, volume string, minLSN uint64, id string) (func(context.Context) (storage.ChunkCutResult, error), error) { + if !p.reserveFirst { + close(p.entered) + <-p.release + } + work, err := p.DurableProvider.AdmitManualCut(ctx, volume, minLSN, id) + if p.reserveFirst { + close(p.entered) + <-p.release + } + return work, err +} +func TestManualCutRealAdmissionCloseRaceJoinsBothSidesOfReservation(t *testing.T) { + for _, reserveFirst := range []bool{false, true} { + t.Run(fmt.Sprint(reserveFirst), func(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + p, fixture, _, _ := limitVolume(t) + held := &heldRealManualAdmission{DurableProvider: p, entered: make(chan struct{}), release: make(chan struct{}), reserveFirst: reserveFirst} + c := NewChunkControl(held, fixture.Catalog, fixture.Ref).(*chunkControl) + server := chunkServer(t, c, true) + admissionDone := make(chan error, 1) + admissionCtx, stopAdmission := context.WithTimeout(context.Background(), 2*time.Second) + defer stopAdmission() + var releaseOnce sync.Once + release := func() { releaseOnce.Do(func() { close(held.release) }) } + defer release() + go func() { + _, err := c.startManualCut(admissionCtx, "v1", 0, time.Hour, time.Time{}) + admissionDone <- err + }() + select { + case <-held.entered: + case <-time.After(time.Second): + t.Fatal("admission gate not reached") + } + closed := make(chan error, 1) + ctx, cancel := context.WithTimeout(context.Background(), time.Second) + defer cancel() + go func() { closed <- server.Close(ctx) }() + synctest.Wait() + select { + case err := <-closed: + release() + t.Fatalf("Close escaped registered admission: %v", err) + default: + } + release() + select { + case err := <-closed: + if err != nil { + t.Fatal(err) + } + case <-time.After(time.Second): + t.Fatal("Close failed to join admission") + } + select { + case <-admissionDone: + case <-time.After(time.Second): + t.Fatal("admission not joined") + } + // The real layer must have released any capture reserved before cancellation. + work, err := p.AdmitManualCut(context.Background(), "v1", 0, "after-close-probe") + if err != nil { + t.Fatalf("capture leaked after join: %v", err) + } + canceled, stop := context.WithCancel(context.Background()) + stop() + _, _ = work(canceled) + }) + }) + } +} +func TestManualCutRealPostGetReportsPromptOwnProgress(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + p, fixture, st, _ := limitVolume(t) + remaining := make(chan struct{}) + var releaseOnce sync.Once + release := func() { releaseOnce.Do(func() { close(remaining) }) } + defer release() + var uploads atomic.Uint32 + fixture.Blobs.PutHook = func(ctx context.Context) error { + if uploads.Add(1) > 1 { + select { + case <-remaining: + return nil + case <-ctx.Done(): + return ctx.Err() + } + } + select { + case <-time.After(200 * time.Millisecond): + return nil + case <-ctx.Done(): + return ctx.Err() + } + } + for _, lba := range []uint32{0, 16} { + if _, err := st.Write(lba, bytes.Repeat([]byte{7}, 4096)); err != nil { + t.Fatal(err) + } + } + c := NewChunkControl(p, fixture.Catalog, fixture.Ref).(*chunkControl) + defer func() { + release() + ctx, cancel := context.WithTimeout(context.Background(), time.Second) + defer cancel() + if err := c.closeSnapshotOperations(ctx); err != nil { + t.Errorf("join manual cut: %v", err) + } + }() + server := chunkServer(t, c, true) + began := time.Now() + post := serve(t, server, http.MethodPost, "/chunk/cut", `{"volumeID":"v1","timeoutMs":1000}`, "") + var first struct { + Code string `json:"code"` + ID string `json:"cutID"` + Sequence uint64 `json:"sequence"` + } + if err := json.Unmarshal(post.Body.Bytes(), &first); err != nil || post.Code != 202 || first.ID == "" || first.Sequence == 0 || time.Since(began) >= time.Second { + t.Fatalf("prompt POST HTTP=%d elapsed=%s body=%s err=%v", post.Code, time.Since(began), post.Body.String(), err) + } + poll := serve(t, server, http.MethodGet, "/chunk/cut?volumeID=v1&cutID="+first.ID, "", "") + var second struct { + ID string `json:"cutID"` + Sequence uint64 `json:"sequence"` + } + if err := json.Unmarshal(poll.Body.Bytes(), &second); err != nil || poll.Code != 202 || second.ID != first.ID || second.Sequence < first.Sequence { + t.Fatalf("GET changed progress: %d %s err=%v", poll.Code, poll.Body.String(), err) + } + release() + terminal := awaitManualCutAnswer(t, server, poll) + var result ChunkCutResponse + if err := json.Unmarshal(terminal.Body.Bytes(), &result); err != nil || terminal.Code != 200 || result.CutID != first.ID || result.CutLSN != 2 { + t.Fatalf("terminal HTTP=%d body=%s err=%v", terminal.Code, terminal.Body.String(), err) + } + }) +} + +func TestManualCutAPIVersionCoversEveryCutAnswer(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + const frontier = uint64(1<<53 + 1) + p := &handleCutProvider{work: func(ctx context.Context) (storage.ChunkCutResult, error) { + storage.ReportCutObjectVerified(ctx) + time.Sleep(100 * time.Millisecond) + return storage.ChunkCutResult{H: frontier}, nil + }} + c := cutControlForHandles(p) + defer c.closeSnapshotOperations(context.Background()) + server := chunkServer(t, c, true) + check := func(w *httptest.ResponseRecorder, status int) { + t.Helper() + var reply struct { + Version int `json:"apiVersion"` + } + if err := json.Unmarshal(w.Body.Bytes(), &reply); err != nil || w.Code != status || reply.Version != 1 { + t.Fatalf("HTTP=%d body=%s err=%v", w.Code, w.Body.String(), err) + } + } + first := serve(t, server, http.MethodPost, "/chunk/cut", `{"volumeID":"v1","timeoutMs":1000}`, "") + check(first, http.StatusAccepted) + terminal := awaitManualCutAnswer(t, server, first) + check(terminal, http.StatusOK) + var result ChunkCutResponse + if err := json.Unmarshal(terminal.Body.Bytes(), &result); err != nil || result.CutLSN != frontier { + t.Fatalf("version envelope changed the frontier: %s err=%v", terminal.Body.String(), err) + } + check(serve(t, server, http.MethodGet, "/chunk/cut?volumeID=v1&cutID=missing", "", ""), http.StatusNotFound) + check(serve(t, server, http.MethodPost, "/chunk/cut", `{"volumeID":"v1","observe":true}`, ""), http.StatusBadRequest) + check(serve(t, server, http.MethodPost, "/chunk/cut", `{"volumeID":"v1","apiVersion":1}`, ""), http.StatusBadRequest) + for i := 0; i < 3; i++ { + check(awaitManualCutAnswer(t, server, serve(t, server, http.MethodPost, "/chunk/cut", `{"volumeID":"v1","timeoutMs":1000}`, "")), http.StatusOK) + } + check(serve(t, server, http.MethodPost, "/chunk/cut", `{"volumeID":"v1","timeoutMs":1000}`, ""), http.StatusConflict) + }) +} diff --git a/seaweed-block/core/host/volume/snapshot_operation_red_test.go b/seaweed-block/core/host/volume/snapshot_operation_red_test.go index 5edfdc4333..4ee6d4a443 100644 --- a/seaweed-block/core/host/volume/snapshot_operation_red_test.go +++ b/seaweed-block/core/host/volume/snapshot_operation_red_test.go @@ -460,3 +460,38 @@ func TestSnapshotOperationNameConflictRemainsRefusedAfterRemoval(t *testing.T) { t.Fatalf("refusal changed: status=%d/%d code=%s/%s err=%v", status, againStatus, code, againCode, err) } } + +// An uncertain answer does not restore a displaced worker's authority to +// change its receipt, whether fencing is detected before or after publication. +func TestSnapshotOperationUnknownAuthorityLossKeepsReceiptForReadmission(t *testing.T) { + for _, tc := range []struct { + name string + cause error + }{ + {"fenced", storage.ErrChunkLayerFenced}, + {"epoch-stale", durable.ErrChunkEpochStale}, + {"not-primary", durable.ErrChunkNotPrimary}, + } { + t.Run(tc.name, func(t *testing.T) { + ctx := context.Background() + dp, f, _, _ := limitVolume(t) + p := &snapshotOperationAnswerFault{DurableProvider: dp, before: errors.Join(storage.ErrChunkCASOutcomeUnknown, tc.cause)} + req := ChunkSnapshotRequest{Name: "daily", RequestID: "authority-lost-before-publication"} + _, err := NewChunkControl(p, f.Catalog, f.Ref).Snapshot(ctx, "v1", req) + if !errors.Is(err, tc.cause) || !errors.Is(err, storage.ErrChunkCASOutcomeUnknown) { + t.Fatalf("lost typed causes: %v", err) + } + st, err := f.Catalog.Store(f.Ref) + if err != nil { + t.Fatal(err) + } + op, found, err := st.ReadSnapshotOperation(ctx, req.RequestID, "create") + if err != nil || !found || op.State != "running" { + t.Fatalf("displaced worker mutated receipt: %+v found=%v err=%v", op, found, err) + } + if _, err := NewChunkControl(dp, f.Catalog, f.Ref).Snapshot(ctx, "v1", req); err != nil { + t.Fatalf("readmission failed: %v", err) + } + }) + } +} diff --git a/seaweed-block/core/storage/chunk_commit_check_callers_test.go b/seaweed-block/core/storage/chunk_commit_check_callers_test.go index b801af3d99..81340897a6 100644 --- a/seaweed-block/core/storage/chunk_commit_check_callers_test.go +++ b/seaweed-block/core/storage/chunk_commit_check_callers_test.go @@ -26,9 +26,9 @@ import ( // commit checks another proposal. func TestEveryHeadCommitIsCheckedFirst(t *testing.T) { sites := map[string]string{ - "captureLocked": "the cut's commit", - "SettleDetach": "the cancellation of an unresolved detach", - "resolvePending": "the re-proposal of an unresolved cut", + "captureInvocationLocked": "the cut's commit", + "SettleDetach": "the cancellation of an unresolved detach", + "resolvePendingWithProgress": "the re-proposal of an unresolved cut", } files, err := filepath.Glob("*.go") if err != nil { diff --git a/seaweed-block/core/storage/chunk_cut_cow.go b/seaweed-block/core/storage/chunk_cut_cow.go index 5ec83cc1c2..33c89f3602 100644 --- a/seaweed-block/core/storage/chunk_cut_cow.go +++ b/seaweed-block/core/storage/chunk_cut_cow.go @@ -217,13 +217,13 @@ func (l *chunkLayerImpl) holdCOWDestructive() func() { } // The caller owns captureMu exclusive, so no writer can miss this publication. -func (l *chunkLayerImpl) installCOWWindow(covers func(uint64) bool, spill cowSpillCap) (*cutCOWWindow, error) { +func (l *chunkLayerImpl) installCOWWindow(ctx context.Context, covers func(uint64) bool, spill cowSpillCap) (*cutCOWWindow, error) { size := uint64(l.blockSize) * l.chunkBlocks if size == 0 || size > math.MaxInt64 || l.numChunks > math.MaxInt64/size { return nil, fmt.Errorf("%w: side-store geometry", errCutCOWAborted) } w := &cutCOWWindow{layer: l, ended: make(chan struct{}), entries: make(map[uint64]*cutCOWEntry), covers: covers, spillLimit: spill.bytes, spillCause: spill.cause, chunkBytes: int64(size)} - w.ctx, w.cancel = context.WithCancel(context.Background()) + w.ctx, w.cancel = context.WithCancel(ctx) _, reserved, limit := l.cutPayloadWorkers() savers := min(max(1, int((16<<20)/int64(size))), int((limit-reserved)/(2*int64(size)))) // Active saver buffers are reserved independently of upload concurrency. diff --git a/seaweed-block/core/storage/chunk_cut_payload_budget_test.go b/seaweed-block/core/storage/chunk_cut_payload_budget_test.go index 0c0cc71a25..5d26fb8a08 100644 --- a/seaweed-block/core/storage/chunk_cut_payload_budget_test.go +++ b/seaweed-block/core/storage/chunk_cut_payload_budget_test.go @@ -1,6 +1,7 @@ package storage import ( + "context" "strings" "testing" ) @@ -13,7 +14,7 @@ func TestCutPayloadBudgetBoundsSlots(t *testing.T) { for i := 0; i < candidates; i++ { pending[uint64(i)] = true } - w, err := l.installCOWWindow(func(i uint64) bool { return pending[i] }, l.cowSpillLimit()) + w, err := l.installCOWWindow(context.Background(), func(i uint64) bool { return pending[i] }, l.cowSpillLimit()) if err != nil { t.Fatal(err) } diff --git a/seaweed-block/core/storage/chunk_cut_timeout_progress_test.go b/seaweed-block/core/storage/chunk_cut_timeout_progress_test.go index f57f0313ef..9eb16d401b 100644 --- a/seaweed-block/core/storage/chunk_cut_timeout_progress_test.go +++ b/seaweed-block/core/storage/chunk_cut_timeout_progress_test.go @@ -14,6 +14,27 @@ import ( // oneTiBChunks is the chunk count of a 1 TiB volume with 4 MiB chunks. const oneTiBChunks = 262144 +func TestCutWindowErrorPreservesCallerDeadlineAfterWorkerCancellation(t *testing.T) { + ctx, cancel := context.WithDeadline(context.Background(), time.Now().Add(-time.Second)) + defer cancel() + // A COW abort can cancel and join an upload before the parent's abort + // callback records its deadline. The parent's completed cause is decisive. + workerErr := errors.Join(errChunkRemoteUnavailable, context.Canceled) + err := CutWindowError(ctx, workerErr) + if !errors.Is(err, context.DeadlineExceeded) || !errors.Is(err, errChunkRemoteUnavailable) { + t.Fatalf("joined upload lost caller deadline: %v", err) + } + for _, terminal := range []error{errChunkCASOutcomeUnknown, errChunkLayerFenced} { + original := errors.Join(terminal, context.Canceled) + if got := CutWindowError(ctx, original); got != original { + t.Fatalf("terminal publication outcome changed: %v", got) + } + } + if CutWindowError(ctx, nil) != nil { + t.Fatal("completed work became a deadline failure") + } +} + // expiringRemote counts every PUT. Once a given number of PUTs completed it // ends the attempt: with expire set it cancels the attempt's context; in any // case every later PUT waits for the attempt's context to end (its deadline diff --git a/seaweed-block/core/storage/chunk_layer.go b/seaweed-block/core/storage/chunk_layer.go index 967ef4d5a2..b08fba08dc 100644 --- a/seaweed-block/core/storage/chunk_layer.go +++ b/seaweed-block/core/storage/chunk_layer.go @@ -132,7 +132,7 @@ type chunkLayerImpl struct { cowTransitions int cowClosed bool - capMu sync.Mutex // serializes Capture, Evict, Begin/EndBaseInstall + capMu captureMutex // serializes Capture, Evict, Begin/EndBaseInstall presMu sync.Mutex // serializes a whole presence save: snapshot, fsync, replace, version @@ -148,10 +148,13 @@ type chunkLayerImpl struct { head chunkHead // refs is the ref table of head on the v1.1 format (nil on v1.0): headRef // reads it; setHeadLocked and setHeadChangedLocked keep it head's. - refs *refTable - pending *chunkHead // a proposal whose CAS outcome is unresolved - fenced bool - detached *chunkCutResult // set by a successful Detach + refs *refTable + pending *chunkHead // a proposal whose CAS outcome is unresolved + // pendingInvocation tags the call that made the unresolved proposal. + // It is process-local and cannot make an inherited result this call's. + pendingInvocation *cutInvocation + fenced bool + detached *chunkCutResult // set by a successful Detach // pendingDetach says the unresolved proposal in pending is a Detach; // pendingCut is its cut result, installed as the detach result if the // re-read shows it applied. @@ -1378,9 +1381,14 @@ func (l *chunkLayerImpl) admit() (err error) { } func (l *chunkLayerImpl) Cut(ctx context.Context) (chunkCutResult, error) { - l.capMu.Lock() + ctx, stop := WithCutProgressWindow(ctx, DefaultCutProgressWindow) + defer stop() + if err := l.lockPrecopy(ctx); err != nil { + return chunkCutResult{}, CutWindowError(ctx, err) + } defer l.unlockCap() - return l.captureLocked(ctx, false) + res, err := l.captureLocked(ctx, false) + return res, CutWindowError(ctx, err) } func (l *chunkLayerImpl) Capture(ctx context.Context) (uint64, error) { @@ -1392,7 +1400,11 @@ func (l *chunkLayerImpl) Capture(ctx context.Context) (uint64, error) { } func (l *chunkLayerImpl) MakeRemoteDurable(ctx context.Context, t uint64) error { - l.capMu.Lock() + ctx, stop := WithCutProgressWindow(ctx, DefaultCutProgressWindow) + defer stop() + if err := l.lockPrecopy(ctx); err != nil { + return CutWindowError(ctx, err) + } defer l.unlockCap() l.stMu.Lock() fenced, detached := l.fenced, l.detached != nil @@ -1408,7 +1420,7 @@ func (l *chunkLayerImpl) MakeRemoteDurable(ctx context.Context, t uint64) error } r, err := l.captureLocked(ctx, false) if err != nil { - return err + return CutWindowError(ctx, err) } if r.H < t { return fmt.Errorf("storage: MakeRemoteDurable(%d): cut reached only %d", t, r.H) @@ -1541,7 +1553,15 @@ var barrierHoldTry = 5 * time.Millisecond const preSyncMaxRounds = 6 -func (l *chunkLayerImpl) captureLocked(ctx context.Context, detach bool) (res chunkCutResult, err error) { +type cutInvocation struct{ identity byte } // nonzero size: distinct live calls have distinct tags + +func (l *chunkLayerImpl) captureLocked(ctx context.Context, detach bool) (chunkCutResult, error) { + return l.captureInvocationLocked(ctx, detach, new(cutInvocation)) +} + +func (l *chunkLayerImpl) captureInvocationLocked(ctx context.Context, detach bool, invocation *cutInvocation) (res chunkCutResult, err error) { + ctx, stopWindow := WithCutProgressWindow(ctx, DefaultCutProgressWindow) + defer stopWindow() defer func() { err = l.latchIdentityMoved(err) }() done, err := l.register() if err != nil { @@ -1597,6 +1617,7 @@ func (l *chunkLayerImpl) captureLocked(ctx context.Context, detach bool) (res ch var pauseStart time.Time var payloadBeforeBarrier int64 defer func() { + err = CutWindowError(ctx, err) var tailBytes uint64 if err == nil { scanStart := time.Now() @@ -1858,7 +1879,7 @@ func (l *chunkLayerImpl) captureLocked(ctx context.Context, detach bool) (res ch own := l.own // stable for the cut (set and cleared under capMu) covers := func(idx uint64) bool { return all || filledTaken || taken.has(idx) || dirtyTaken[idx] || own[idx] } windowStart := time.Now() - w, installErr := l.installCOWWindow(covers, spill) + w, installErr := l.installCOWWindow(ctx, covers, spill) if installErr == nil { w.budget = budget } @@ -2222,6 +2243,7 @@ func (l *chunkLayerImpl) captureLocked(ctx context.Context, detach bool) (res ch l.stMu.Lock() p := copyHead(next) l.pending = &p + l.pendingInvocation = invocation l.pendingDetach, l.pendingCut, l.pendingBase, l.pendingAborted = detach, chunkCutResult{H: h, FullHash: all}, expected, false l.pendingCaptured = pendingCapture(captured, capturedVersions) l.pendingChanges, l.pendingMarked = changes, marked @@ -2375,6 +2397,7 @@ func (l *chunkLayerImpl) SettleDetach(ctx context.Context) (settled detachSettle defer l.stMu.Unlock() cut := l.pendingCut l.pending = nil + l.pendingInvocation = nil l.pendingDetach, l.pendingCut, l.pendingBase, l.pendingAborted = false, chunkCutResult{}, chunkHeadVersion{}, false landed := l.pendingCaptured l.pendingCaptured, l.pendingChanges, l.pendingMarked = nil, nil, nil @@ -2722,6 +2745,10 @@ func (l *chunkLayerImpl) applyCommitLocked(id chunkHead, changed []uint64) { } func (l *chunkLayerImpl) resolvePending(ctx context.Context) (err error) { + return l.resolvePendingWithProgress(ctx, nil) +} + +func (l *chunkLayerImpl) resolvePendingWithProgress(ctx context.Context, completedRead func()) (err error) { // Registered before the state unlock, so invalidation runs without stMu. defer func() { if errors.Is(err, errChunkLayerFenced) { @@ -2737,7 +2764,16 @@ func (l *chunkLayerImpl) resolvePending(ctx context.Context) (err error) { // reproposed: cur is the re-proposal this settlement landed, not HEAD // as read; by change it names the cut's chunks only. reproposed := false - cur, err := readChunkHead(ctx, l.remote) + read := func() (chunkHead, error) { + head, err := readChunkHead(ctx, l.remote) + // A foreign owner ends settlement, whether the proposal is proved + // landed or definitively fenced. Neither terminal read renews W. + if err == nil && completedRead != nil && !l.publicationOwnerChanged(head) { + completedRead() + } + return head, err + } + cur, err := read() if err != nil { return fmt.Errorf("storage: capture: earlier CAS outcome still unresolved: %w: %w", errChunkCASOutcomeUnknown, err) } @@ -2763,7 +2799,7 @@ func (l *chunkLayerImpl) resolvePending(ctx context.Context) (err error) { } else if errors.Is(casErr, errChunkLayerFenced) { l.fencePublication(chunkHead{}) return errChunkLayerFenced - } else if cur, err = readChunkHead(ctx, l.remote); err != nil { + } else if cur, err = read(); err != nil { return fmt.Errorf("storage: capture: earlier CAS outcome still unresolved (%v): %w: %w", casErr, errChunkCASOutcomeUnknown, err) } else if !proposalLanded(cur, *pending, base.Gen, changes, marked) && !l.publicationOwnerChanged(cur) && cur.Gen == base.Gen && cur.Epoch == base.Epoch { return fmt.Errorf("storage: capture: earlier CAS outcome still unresolved (%v): HEAD unchanged: %w", casErr, errChunkCASOutcomeUnknown) @@ -2781,6 +2817,7 @@ func (l *chunkLayerImpl) resolvePending(ctx context.Context) (err error) { l.stMu.Lock() defer l.stMu.Unlock() l.pending = nil + l.pendingInvocation = nil wasDetach, cut := l.pendingDetach, l.pendingCut l.pendingDetach, l.pendingCut, l.pendingBase, l.pendingAborted = false, chunkCutResult{}, chunkHeadVersion{}, false landed := l.pendingCaptured @@ -2947,6 +2984,8 @@ func (l *chunkLayerImpl) noteCutFailureLocked(err error, abortReason string) { // first, then an unreachable one, then a local abort's reason. func cutFailureCode(err error, abortReason string) string { switch { + case errors.Is(err, ErrCutStalled): + return "cut_stalled" case errors.Is(err, errChunkRemoteFull): return "remote_full" case abortReason != "" && abortReason != "upload": @@ -3162,6 +3201,7 @@ func (l *chunkLayerImpl) finishCut(head chunkHead, h uint64, changed []uint64, n l.setHeadLocked(copyHead(head)) } l.remoteLSN, l.pending = h, nil + l.pendingInvocation = nil l.pendingCaptured, l.pendingChanges, l.pendingMarked = nil, nil, nil l.reusable = nil l.inflight = map[uint64]bool{} diff --git a/seaweed-block/core/storage/chunk_manual_cut.go b/seaweed-block/core/storage/chunk_manual_cut.go new file mode 100644 index 0000000000..a0e896b853 --- /dev/null +++ b/seaweed-block/core/storage/chunk_manual_cut.go @@ -0,0 +1,180 @@ +package storage + +import ( + "context" + "crypto/rand" + "errors" + "fmt" + "sync" + "time" +) + +// CutBusyError identifies the current capture owner, or a full handle table. +// Neither refusal admits work or evicts an earlier answer. +type CutBusyError struct { + CutID string + Reason string +} + +func (e *CutBusyError) Error() string { + return fmt.Sprintf("storage: cut_busy: %s (%s)", e.Reason, e.CutID) +} + +// captureMutex publishes the lock's identity atomically with its ownership. +// A failed manual admission can therefore name the holder without a gap +// between acquiring a mutex and recording its owner. Internal callers wait +// as before; only a manual caller uses tryManual. +type captureMutex struct { + mu sync.Mutex + changed *sync.Cond + held bool + id string +} + +func (m *captureMutex) Lock() { + m.mu.Lock() + if m.changed == nil { + m.changed = sync.NewCond(&m.mu) + } + for m.held { + m.changed.Wait() + } + m.held = true + m.id = rand.Text() + m.mu.Unlock() +} +func (m *captureMutex) TryLock() bool { ok, _ := m.tryManual(""); return ok } +func (m *captureMutex) tryManual(id string) (bool, string) { + m.mu.Lock() + defer m.mu.Unlock() + if m.held { + return false, m.id + } + if id == "" { + id = rand.Text() + } + m.held = true + m.id = id + return true, id +} +func (m *captureMutex) Unlock() { + m.mu.Lock() + defer m.mu.Unlock() + if !m.held { + panic("storage: unlock of free capture mutex") + } + m.held = false + m.id = "" + if m.changed != nil { + m.changed.Broadcast() + } +} + +// AdmitManualChunkCut reserves the capture lock without waiting. Its returned +// function must be invoked exactly once, also on cancellation, to join and +// release the reservation. Scheduled cuts use their existing waiting path. +func AdmitManualChunkCut(ctx context.Context, layer ChunkLayer, id string) (func(context.Context) (ChunkCutResult, error), error) { + if err := ctx.Err(); err != nil { + return nil, err + } + l, ok := layer.(*chunkLayerImpl) + if !ok { + return nil, errors.New("storage: manual cut admission unsupported") + } + if id == "" { + return nil, errors.New("storage: manual cut requires an identity") + } + if ok, running := l.capMu.tryManual(id); !ok { + return nil, &CutBusyError{CutID: running, Reason: "capture_held"} + } + return func(ctx context.Context) (ChunkCutResult, error) { + defer l.unlockCap() + ctx, stop := WithCutProgressWindow(ctx, DefaultCutProgressWindow) + defer stop() + if err := ctx.Err(); err != nil { + return ChunkCutResult{}, CutWindowError(ctx, err) + } + return l.captureManualCut(ctx) + }, nil +} + +// The capture reservation stays owned while an uncertain publication is +// settled. Retrying the same pending proposal cannot create a second cut. +func (l *chunkLayerImpl) captureManualCut(ctx context.Context) (ChunkCutResult, error) { + done, err := l.register() + if err != nil { + return ChunkCutResult{}, err + } + defer done() + ctx, cancel := l.opCtx(ctx) + defer cancel() + l.stMu.Lock() + inherited := l.pending != nil + l.stMu.Unlock() + definiteFence := func(err error) bool { + return errors.Is(err, errChunkLayerFenced) && !errors.Is(err, errChunkCASOutcomeUnknown) + } + invocation := new(cutInvocation) + var r ChunkCutResult + if inherited { + err = l.resolvePending(ctx) + if err == nil { + reportCompletedCutStep(ctx) // SettleInherited is one completed step. + } + } + if err == nil { + r, err = l.captureInvocationLocked(ctx, false, invocation) + } + for err != nil { + if definiteFence(err) { + return r, err + } + l.stMu.Lock() + if l.pending == nil { + l.stMu.Unlock() + return r, CutWindowError(ctx, err) + } + proposal, base := copyHead(*l.pending), l.pendingBase + own := l.pendingInvocation == invocation + changes, marked, result := l.pendingChanges, l.pendingMarked, l.pendingCut + l.stMu.Unlock() + if ctx.Err() != nil { + // Do not wrap the stalled cause: publication may already have landed. + return ChunkCutResult{}, fmt.Errorf("%w: manual cut settlement stopped: %v", errChunkCASOutcomeUnknown, context.Cause(ctx)) + } + var completedRead func() + if own { + completedRead = func() { reportCompletedCutStep(ctx) } + } + err = l.resolvePendingWithProgress(ctx, completedRead) + if err == nil { + if !own { + reportCompletedCutStep(ctx) // settled inherited work, not our result + } + l.stMu.Lock() + head := l.wholeHeadLocked() + landed := proposalLanded(head, proposal, base.Gen, changes, marked) + result.Head = l.resultHead(head) + l.stMu.Unlock() + if landed && own { + return result, nil + } + // Recovery of an inherited proposal is not this invocation's cut. + // Take our own barrier even when that earlier publication landed. + r, err = l.captureInvocationLocked(ctx, false, invocation) + continue + } + if definiteFence(err) { + return ChunkCutResult{}, err + } + // Failed reads do not renew the window. Avoid a hot retry loop when + // an unavailable remote answers immediately rather than timing out. + timer := time.NewTimer(chunkHeadSettleTime) + select { + case <-timer.C: + case <-ctx.Done(): + } + timer.Stop() + } + return r, nil +} diff --git a/seaweed-block/core/storage/chunk_manual_cut_test.go b/seaweed-block/core/storage/chunk_manual_cut_test.go new file mode 100644 index 0000000000..82d433efa3 --- /dev/null +++ b/seaweed-block/core/storage/chunk_manual_cut_test.go @@ -0,0 +1,38 @@ +package storage + +import ( + "context" + "errors" + "testing" +) + +func TestManualCutCaptureAdmissionNeverQueuesAndNamesItsOwner(t *testing.T) { + l := &chunkLayerImpl{} + ok, id := l.capMu.tryManual("scheduled-owner") + if !ok { + t.Fatal("first lock") + } + _, err := AdmitManualChunkCut(context.Background(), l, "manual") + var busy *CutBusyError + if !errors.As(err, &busy) || busy.CutID != id { + t.Fatalf("busy=%v", err) + } + l.capMu.Unlock() + work, err := AdmitManualChunkCut(context.Background(), l, "manual") + if err != nil { + t.Fatal(err) + } + _, err = AdmitManualChunkCut(context.Background(), l, "younger") + if !errors.As(err, &busy) || busy.CutID != "manual" { + t.Fatalf("wrong owner=%v", err) + } + ctx, cancel := context.WithCancel(context.Background()) + cancel() + if _, err = work(ctx); !errors.Is(err, context.Canceled) { + t.Fatal(err) + } + if !l.capMu.TryLock() { + t.Fatal("canceled worker leaked capture") + } + l.capMu.Unlock() +} diff --git a/seaweed-block/core/storage/chunk_manual_settle_test.go b/seaweed-block/core/storage/chunk_manual_settle_test.go new file mode 100644 index 0000000000..3c0ad36e1c --- /dev/null +++ b/seaweed-block/core/storage/chunk_manual_settle_test.go @@ -0,0 +1,263 @@ +package storage + +import ( + "context" + "errors" + "fmt" + "testing" + "testing/synctest" + "time" +) + +func TestManualCutForeignHeadFenceTerminatesSettlement(t *testing.T) { + _, f, l, _ := precopyLayer(t, 1024, 1) + reads := 0 + f.mu.Lock() + f.casModes = []fakeCASMode{casUnknownNotApplied} + f.afterCAS = func(f *fakeChunkRemote) { + f.onGetHead = func(f *fakeChunkRemote) { + reads++ + if reads == 1 { + f.failGet = errors.New("lost read-back") + return + } + f.failGet = nil + if reads == 2 { + f.head.Gen++ + f.head.Epoch++ + f.head.Holder = "foreign-holder" + } + } + } + f.mu.Unlock() + // The independent deadline bounds a broken worker whose foreign reads + // keep renewing its window; the fixed worker must finish before it fires. + root, stop := context.WithTimeout(ctTimeout(t), 500*time.Millisecond) + defer stop() + ctx, cancel := WithCutProgressWindow(root, time.Second) + defer cancel() + work, err := AdmitManualChunkCut(ctx, l, "foreign-fence") + if err != nil { + t.Fatal(err) + } + _, err = work(ctx) + if !errors.Is(err, ErrChunkLayerFenced) || errors.Is(err, ErrChunkCASOutcomeUnknown) || root.Err() != nil || reads != 2 { + t.Fatalf("fence did not terminate: err=%v root=%v reads=%d", err, root.Err(), reads) + } + if sequence := CutProgressSequence(ctx); sequence != 1 { + t.Fatalf("foreign HEAD renewed own progress: sequence=%d", sequence) + } + if !l.capMu.TryLock() { + t.Fatal("fenced worker retained capture") + } + l.capMu.Unlock() +} + +func TestManualCutInheritedPublicationCannotReplaceItsOwnBarrier(t *testing.T) { + s, f, l, writes := precopyLayer(t, 1024, 1) + f.mu.Lock() + f.casModes = []fakeCASMode{casAppliedLost} + f.afterCAS = func(f *fakeChunkRemote) { f.failGet = errors.New("lost old publication read-back") } + f.mu.Unlock() + if _, err := l.Cut(ctTimeout(t)); !errors.Is(err, ErrChunkCASOutcomeUnknown) { + t.Fatalf("prepare inherited pending proposal: %v", err) + } + writes.write(t, s, 2, 0x77) + want := s.NextLSN() - 1 + barriers := 0 + var barrierSequence uint64 + ctx, cancel := WithCutProgressWindow(ctTimeout(t), time.Second) + defer cancel() + l.testBeforeBarrierLockHook = func() { + barriers++ + barrierSequence = CutProgressSequence(ctx) + } + f.mu.Lock() + f.onGetHead = func(f *fakeChunkRemote) { + // Recovery inside capture fails once; the wrapper's read then lands. + f.onGetHead = func(f *fakeChunkRemote) { f.failGet = nil } + } + f.mu.Unlock() + work, err := AdmitManualChunkCut(ctx, l, "new-cut") + if err != nil { + t.Fatal(err) + } + r, err := work(ctx) + if err != nil || r.H != want || barriers != 1 { + t.Fatalf("inherited proposal substituted for new cut: H=%d want=%d barriers=%d err=%v", r.H, want, barriers, err) + } + if barrierSequence != 1 { + t.Fatalf("inherited settlement must complete before the own barrier: sequence=%d", barrierSequence) + } + assertEveryHeadIsPrefixImage(t, f, writes) +} + +// Each phase completes inside W, but the own upload finishes past the original +// admission window. Only the completed inherited step can keep that cut alive. +func TestManualCutInheritedSettlementRenewsBeforeOwnWorkExceedsTheWindow(t *testing.T) { + for _, retry := range []bool{false, true} { + t.Run(fmt.Sprintf("retry=%t", retry), func(t *testing.T) { + synctest.Test(t, func(t *testing.T) { + s, f, l, writes := precopyLayer(t, 1024, 1) + f.mu.Lock() + f.casModes = []fakeCASMode{casAppliedLost} + f.afterCAS = func(f *fakeChunkRemote) { f.failGet = errors.New("lost inherited read-back") } + f.mu.Unlock() + if _, err := l.Cut(ctTimeout(t)); !errors.Is(err, ErrChunkCASOutcomeUnknown) { + t.Fatal(err) + } + writes.write(t, s, 2, 0x77) + reads := 0 + f.mu.Lock() + f.onGetHead = func(f *fakeChunkRemote) { + reads++ + if retry && reads == 1 { + return + } + f.onGetHead = nil + time.Sleep(600 * time.Millisecond) + f.failGet = nil + } + gate, entered := make(chan struct{}), make(chan string, 1) + f.putGate, f.putEntered = gate, entered + f.mu.Unlock() + ctx, cancel := WithCutProgressWindow(ctTimeout(t), time.Second) + joined := make(chan struct{}) + go func() { + defer close(joined) + defer close(gate) + select { + case <-entered: + case <-ctx.Done(): + return + } + select { + case <-time.After(600 * time.Millisecond): + case <-ctx.Done(): + } + }() + defer func() { + cancel() + select { + case <-joined: + case <-time.After(5 * time.Second): + t.Error("upload gate helper did not join") + } + }() + var barrierSequence uint64 + l.testBeforeBarrierLockHook = func() { barrierSequence = CutProgressSequence(ctx) } + work, err := AdmitManualChunkCut(ctx, l, "phased-inherited") + if err != nil { + t.Fatal(err) + } + start := time.Now() + result, err := work(ctx) + if err != nil || ctx.Err() != nil || result.H != s.NextLSN()-1 || barrierSequence != 1 || time.Since(start) <= time.Second || CutProgressSequence(ctx) < 2 { + t.Fatalf("completed inherited phase did not renew own work: H=%d err=%v cause=%v elapsed=%s barrier_sequence=%d sequence=%d", result.H, err, context.Cause(ctx), time.Since(start), barrierSequence, CutProgressSequence(ctx)) + } + }) + }) + } +} + +func TestManualCutPendingProposalsHaveDistinctInvocationTags(t *testing.T) { + s, f, l, writes := precopyLayer(t, 1024, 1) + f.mu.Lock() + f.casModes = []fakeCASMode{casAppliedLost} + f.afterCAS = func(f *fakeChunkRemote) { f.failGet = errors.New("lost old answer") } + f.mu.Unlock() + if _, err := l.Cut(ctTimeout(t)); !errors.Is(err, ErrChunkCASOutcomeUnknown) { + t.Fatal(err) + } + l.stMu.Lock() + inherited := l.pendingInvocation + l.stMu.Unlock() + if inherited == nil { + t.Fatal("inherited proposal has no invocation tag") + } + writes.write(t, s, 2, 0x77) + f.mu.Lock() + f.failGet = nil + f.casModes = []fakeCASMode{casAppliedLost} + f.afterCAS = func(f *fakeChunkRemote) { f.failGet = errors.New("lost own answer") } + f.mu.Unlock() + ctx, cancel := WithCutProgressWindow(ctTimeout(t), time.Second) + defer cancel() + work, err := AdmitManualChunkCut(ctx, l, "new-pending") + if err != nil { + t.Fatal(err) + } + if _, err := work(ctx); !errors.Is(err, ErrChunkCASOutcomeUnknown) { + t.Fatalf("own pending: %v", err) + } + l.stMu.Lock() + own, pending := l.pendingInvocation, l.pending + l.stMu.Unlock() + if pending == nil || own == nil || own == inherited { + t.Fatal("new pending proposal retained the inherited invocation tag") + } +} + +func TestManualCutSettlesLostPublicationWithoutUploadingAgain(t *testing.T) { + for _, mode := range []fakeCASMode{casAppliedLost, casUnknownNotApplied} { + t.Run(fmt.Sprint(mode), func(t *testing.T) { + _, f, l, _ := precopyLayer(t, 1024, 1) + before := f.stats() + f.mu.Lock() + f.casModes = []fakeCASMode{mode} + f.afterCAS = func(f *fakeChunkRemote) { + f.failGet = errors.New("lost read-back") + f.onGetHead = func(f *fakeChunkRemote) { + // Fail the capture's first read-back, then let its worker settle. + f.onGetHead = func(f *fakeChunkRemote) { f.failGet = nil } + } + } + f.mu.Unlock() + ctx, cancel := WithCutProgressWindow(ctTimeout(t), time.Second) + defer cancel() + work, err := AdmitManualChunkCut(ctx, l, "settle") + if err != nil { + t.Fatal(err) + } + r, err := work(ctx) + if err != nil { + t.Fatalf("lost publication was not settled: %v", err) + } + after := f.stats() + if r.H == 0 || r.Head.Gen != after.head.Gen || after.puts-before.puts != 1 { + t.Fatalf("result=%+v puts=%d", r, after.puts-before.puts) + } + if CutProgressSequence(ctx) < 2 { + t.Fatalf("settlement read-back did not raise own progress: %d", CutProgressSequence(ctx)) + } + wantCAS := 1 + if mode == casUnknownNotApplied { + wantCAS = 2 + } + if after.cas-before.cas != wantCAS { + t.Fatalf("CAS calls=%d, want %d", after.cas-before.cas, wantCAS) + } + }) + } +} + +func TestManualCutUnansweredSettlementIsUnknownNeverStalled(t *testing.T) { + _, f, l, _ := precopyLayer(t, 1024, 1) + f.mu.Lock() + f.casModes = []fakeCASMode{casAppliedLost} + f.afterCAS = func(f *fakeChunkRemote) { f.failGet = errors.New("read-back unavailable") } + f.mu.Unlock() + ctx, cancel := WithCutProgressWindow(ctTimeout(t), time.Second) + defer cancel() + work, err := AdmitManualChunkCut(ctx, l, "unanswered") + if err != nil { + t.Fatal(err) + } + _, err = work(ctx) + if !errors.Is(err, ErrChunkCASOutcomeUnknown) || errors.Is(err, ErrCutStalled) || ctx.Err() == nil { + t.Fatalf("unsettled publication: %v, context=%v; want unknown only after window", err, ctx.Err()) + } + if mapped := CutWindowError(ctx, err); errors.Is(mapped, ErrCutStalled) { + t.Fatalf("outer worker turned uncertain publication into failure: %v", mapped) + } +} diff --git a/seaweed-block/core/storage/chunk_periodic_cut.go b/seaweed-block/core/storage/chunk_periodic_cut.go index cb394d90b8..1c812bde37 100644 --- a/seaweed-block/core/storage/chunk_periodic_cut.go +++ b/seaweed-block/core/storage/chunk_periodic_cut.go @@ -18,7 +18,11 @@ type ChunkPeriodicCutter interface { var _ ChunkPeriodicCutter = (*chunkLayerImpl)(nil) func (l *chunkLayerImpl) CutUnlessCutSince(ctx context.Context, seq uint64) (chunkCutResult, bool, error) { - l.capMu.Lock() + ctx, stop := WithCutProgressWindow(ctx, DefaultCutProgressWindow) + defer stop() + if err := l.lockPrecopy(ctx); err != nil { + return chunkCutResult{}, false, CutWindowError(ctx, err) + } defer l.unlockCap() // delivers the cut's OnPublishSettled report after the lock l.stMu.Lock() cur := l.stats.CutSeq diff --git a/seaweed-block/core/storage/chunk_seam.go b/seaweed-block/core/storage/chunk_seam.go index 4dde09f5a1..383635ce7c 100644 --- a/seaweed-block/core/storage/chunk_seam.go +++ b/seaweed-block/core/storage/chunk_seam.go @@ -474,6 +474,8 @@ type chunkCutStats struct { SyncNs int64 CopyNs int64 CandidateChunks int + // UploadedChunks and UploadedBytes describe this attempt only; payloads + // retained from previous attempts are reported by StagedChunksUsed. UploadedChunks int UploadedBytes int64 ZeroedChunks int diff --git a/seaweed-block/core/storage/chunk_upload.go b/seaweed-block/core/storage/chunk_upload.go index 7394cc7f86..e0e99969a4 100644 --- a/seaweed-block/core/storage/chunk_upload.go +++ b/seaweed-block/core/storage/chunk_upload.go @@ -20,10 +20,8 @@ func (l *chunkLayerImpl) putCaptured(ctx context.Context, key string, data []byt // putCapturedWith is putCaptured over put, one object's slot in an upload // round: every retry sends through the same put. func (l *chunkLayerImpl) putCapturedWith(ctx context.Context, key string, data []byte, put func(context.Context) error) error { - // The per-object retry deadline also bounds a contextless cut. It retains - // the same point and buffer through a remote outage, never re-reads live data. - ctx, cancel := context.WithTimeout(ctx, 30*time.Second) - defer cancel() + // Each individual call has its own deadline. A timed-out call is not + // progress and does not end a still-live cut window or discard its image. backoff := 100 * time.Millisecond // full keeps a full store's answer through later attempts: SeaweedFS // says so only to the assign that tries to grow a volume, and a retry @@ -33,8 +31,11 @@ func (l *chunkLayerImpl) putCapturedWith(ctx context.Context, key string, data [ if err := ctx.Err(); err != nil { return errors.Join(keepFull(full, lastErr), err) } - err := put(ctx) + callCtx, cancelCall := context.WithTimeout(ctx, CutRequestTimeout) + err := put(callCtx) + cancelCall() if err == nil { + reportCompletedCutUpload(ctx) return nil } lastErr = err @@ -42,9 +43,12 @@ func (l *chunkLayerImpl) putCapturedWith(ctx context.Context, key string, data [ full = err } // Resolve a possibly committed binding before replaying the Put. - got, readErr := l.remote.Get(ctx, key) + readCtx, cancelRead := context.WithTimeout(ctx, CutRequestTimeout) + got, readErr := l.remote.Get(readCtx, key) + cancelRead() if readErr == nil { if bytes.Equal(got, data) { + reportCompletedCutUpload(ctx) return nil } return errChunkKeyExists diff --git a/seaweed-block/core/storage/cut_progress_window.go b/seaweed-block/core/storage/cut_progress_window.go new file mode 100644 index 0000000000..7819f43378 --- /dev/null +++ b/seaweed-block/core/storage/cut_progress_window.go @@ -0,0 +1,169 @@ +package storage + +import ( + "context" + "errors" + "sync" + "time" +) + +// ErrCutStalled means the cut completed no per-object step during its window. +// It grants neither publication nor readiness; retries retain immutable work. +var ErrCutStalled = errors.New("storage: cut_stalled") + +const DefaultCutProgressWindow = 5 * time.Minute +const CutRequestTimeout = 30 * time.Second + +type cutWindowKey struct{} +type cutProgressWindow struct { + mu sync.Mutex + last time.Time + window time.Duration + timer *time.Timer + cancel context.CancelCauseFunc + stopped bool + sequence uint64 + changed chan struct{} +} + +// WithCutProgressWindow bounds silence, never total cut duration. Nested +// provider/layer calls share the caller's window rather than restarting it. +func WithCutProgressWindow(ctx context.Context, window time.Duration) (context.Context, context.CancelFunc) { + if _, ok := ctx.Value(cutWindowKey{}).(*cutProgressWindow); ok { + return ctx, func() {} + } + if window <= 0 { + window = DefaultCutProgressWindow + } + c, cancel := context.WithCancelCause(ctx) + w := &cutProgressWindow{last: time.Now(), window: window, cancel: cancel, changed: make(chan struct{}, 1)} + w.timer = time.AfterFunc(window, func() { w.expire() }) + return context.WithValue(c, cutWindowKey{}, w), func() { + w.mu.Lock() + w.stopped = true + w.timer.Stop() + w.mu.Unlock() + cancel(context.Canceled) + } +} +func (w *cutProgressWindow) expire() { + w.mu.Lock() + if w.stopped { + w.mu.Unlock() + return + } + left := w.window - time.Since(w.last) + if left > 0 { + w.timer.Reset(left) + w.mu.Unlock() + return + } + w.stopped = true + w.mu.Unlock() + w.cancel(ErrCutStalled) +} +func reportCompletedCutUpload(ctx context.Context) { + reportCompletedCutStep(ctx) +} + +// ReportCutObjectVerified renews progress after a cut's object verifier has +// proved ownership or completed adoption of one object in its own plan. The +// verifier reports once per object per attempt, never for a failed lookup. +func ReportCutObjectVerified(ctx context.Context) { + reportCompletedCutStep(ctx) +} + +func reportCompletedCutStep(ctx context.Context) { + w, _ := ctx.Value(cutWindowKey{}).(*cutProgressWindow) + if w == nil { + return + } + w.mu.Lock() + if w.stopped { + w.mu.Unlock() + return + } + now := time.Now() + if now.Sub(w.last) >= w.window { + w.stopped = true + w.timer.Stop() + w.mu.Unlock() + w.cancel(ErrCutStalled) + return + } + w.last = now + w.sequence++ + select { + case w.changed <- struct{}{}: + default: + } + w.timer.Reset(w.window) + w.mu.Unlock() +} + +// CutWindowError preserves the typed silence cause through storage adapters +// that conventionally return ctx.Err() after joining their canceled workers. +func CutWindowError(ctx context.Context, err error) error { + if errors.Is(err, ErrChunkCASOutcomeUnknown) || errors.Is(err, ErrChunkLayerFenced) { + return err + } + // A joined worker may observe the COW abort before the caller's deadline + // callback records its cause. Preserve the caller's already-known deadline. + if errors.Is(err, context.Canceled) && errors.Is(ctx.Err(), context.DeadlineExceeded) { + err = errors.Join(err, context.DeadlineExceeded) + } + if err != nil && !errors.Is(err, ErrCutStalled) && errors.Is(context.Cause(ctx), ErrCutStalled) { + return errors.Join(err, ErrCutStalled) + } + return err +} + +// RunCutRequest bounds one metadata request inside a cut, retrying only its +// own expired calls. It never renews upload progress and leaves non-cut +// callers and ordinary operational failures unchanged. +func RunCutRequest(ctx context.Context, call func(context.Context) error) error { + if _, ok := ctx.Value(cutWindowKey{}).(*cutProgressWindow); !ok { + return call(ctx) + } + for { + if err := ctx.Err(); err != nil { + return CutWindowError(ctx, err) + } + step, cancel := context.WithTimeout(ctx, CutRequestTimeout) + err := call(step) + expired := errors.Is(step.Err(), context.DeadlineExceeded) + cancel() + if !expired || !errors.Is(err, context.DeadlineExceeded) { + return CutWindowError(ctx, err) + } + } +} + +// CutProgressSequence reads only completed own-object work in this window. +// It is observational and never renews the watchdog. +func CutProgressSequence(ctx context.Context) uint64 { + if ctx == nil { + return 0 + } + w, _ := ctx.Value(cutWindowKey{}).(*cutProgressWindow) + if w == nil { + return 0 + } + w.mu.Lock() + defer w.mu.Unlock() + return w.sequence +} + +// CutProgressSignal wakes the initial observer after completed work. The +// single buffered notification coalesces rises; the sequence is authoritative. +// Reading it never renews the watchdog and GET status does not consume it. +func CutProgressSignal(ctx context.Context) <-chan struct{} { + if ctx == nil { + return nil + } + w, _ := ctx.Value(cutWindowKey{}).(*cutProgressWindow) + if w == nil { + return nil + } + return w.changed +} diff --git a/seaweed-block/docs/design/block-design.md b/seaweed-block/docs/design/block-design.md index bdccf569bc..7855d9d102 100644 --- a/seaweed-block/docs/design/block-design.md +++ b/seaweed-block/docs/design/block-design.md @@ -398,3 +398,94 @@ stateDiagram-v2 Released --> [*] Removed --> [*] ``` + + +### Cut progress window + +The cut's transfer work follows CutWindow r1 and CutTime r8c. The provider and +HTTP control use an inactivity window, not a total duration limit. Completed +payload uploads and successful ownership/adoption checks of own-plan objects +renew it. A per-call deadline cancels an unanswered upload or verification +read; retrying the same immutable payload does not renew progress. A silent +cut returns `cut_stalled` and retains completed immutable work for retry, +provided no publication is uncertain. An observed manual worker settles a +lost publish answer by reading HEAD within the same window. A completed +read of its own proposal renews W and raises its sequence only while authority +is retained. A foreign-holder read is terminal without renewal: a proved landed +proposal returns its result, otherwise it is definite fenced. Every pending +proposal records its creating invocation's tag. Inherited recovery completes +before this invocation's own barrier, raises one progress step, and never supplies +its result. A landed proposal succeeds; an unapplied proposal is retried with its uploads kept. +Unanswered settlement exhausts W as `outcome_unknown`, never `cut_stalled`. + +```mermaid +stateDiagram-v2 + [*] --> RecoverInherited + RecoverInherited --> Uploading: no inherited proposal, or settled / own barrier + RecoverInherited --> Fenced: inherited settlement proves foreign owner + Uploading --> Uploading: completed upload / keep payload, renew W + Uploading --> Verifying: last upload completed + Verifying --> Verifying: own-plan object verified or adopted / renew W + Verifying --> Stalled: W without a completed object step + Uploading --> Uploading: per-call timeout / cancel call, retry without renewal + Uploading --> Stalled: W without completed upload + Stalled --> Uploading: retry / keep completed payloads + Verifying --> Published: all objects proved, HEAD publication confirmed + Verifying --> Settling: publish answer lost + Settling --> Published: read-back proves own proposal landed + Settling --> Settling: same-owner completed read / renew W and sequence + Settling --> Settling: read-back and same-proposal retry / keep uploads + Settling --> Unknown: W without completed settlement read + Settling --> Fenced: authoritative foreign-holder proof / no renewal +``` + +Caller cancellation and explicitly selected absolute deadlines still end work; +no timer grants publication, readiness or resource admission. The returned +payload count and bytes describe each attempt, including the final answer; +per-attempt phase logs and rate samples retain their existing scope. + +### Cut CLI observation projection (Draft) + +Every manual POST enters the handle path. The client POSTs once, then polls read-only status by the holder's in-memory +cut ID. It accepts only that cut's sequence rises +as progress. `--timeout` remains 60 seconds by default, now an inactivity +window; observation adds five seconds of slack. `--deadline` is an optional +absolute RFC3339 timestamp. A stalled terminal answer exits 1; unanswered or +unchanging observation expires as `outcome_unknown`, exit 3. An unknown ID +after holder restart also exits unknown. Immediate admission `cut_busy` exits +4 (retryable); it never re-POSTs the CLI's own cut. Replies use JSON HTTP. Every cut-route answer includes integer `apiVersion: 1`; clients send no version field. Compatibility is one direction: a newer CLI supports holders at N and N-1; an older CLI refuses a newer holder. Only a valid unversioned initial synchronous 200 uses the v1.0 fallback; other missing, malformed or unsupported versions return typed `unsupported_api_version` naming both versions, without another POST or a claim about the cut outcome. This changes neither persisted format nor the cut lifecycle. An unsupported response always exits 3 (unknown), still typed `unsupported_api_version`: HTTP status cannot prove non-admission. Only a supported, explicit admission refusal can establish failure; no protocol-error path posts again. + +```mermaid +stateDiagram-v2 + [*] --> Admission: POST once + Admission --> Polling: in_progress with cut ID + note right of Polling + Response version N/N-1 required. + Other versions refuse locally, + without claiming a cut outcome. + end note + Admission --> Busy: capture lock held or four handles retained + Polling --> Polling: same ID, sequence rise / renew Wc + Polling --> Polling: same sequence or unanswered / do not renew + Polling --> Success: terminal result + Success --> Retained: terminal reply may be lost + Failed --> Retained: terminal error reply may be lost + Retained --> Retired: Wc since cut ended + Retained --> Retained: read-only terminal replay + Polling --> Failed: cut_stalled + Polling --> Unknown: Wc silent, holder restart or absolute deadline + Polling --> Unknown: terminal settlement outcome_unknown +``` + +Intended projection, not yet qualified (INV-CUT-HANDLE-LIFETIME-001 is STUB): +the control owns and joins each admitted worker. The initial call returns +within W_cut, and polls read the completed-step sequence without renewing it. +Four handles per volume remain until Wc after their terminal result; sending +an answer does not retire it. At capacity admission returns cut_busy with +reason handles_full, without eviction. Scheduled cuts get no polling handle. +Focused controls cover retention, restart and cancellation. Native/race and +real CLI qualification remain owed. +Cuts do not use snapshot receipts. This section does not claim a complete or +merge-ready cut API. The model and supplied run are in `docs/spec/cuttime`. + +Manual POSTs have one path: a terminal result or 202 progress with a retained handle. There is no synchronous compatibility branch or opt-in field. The CLI polls only after 202, so a v1.0 holder's immediate terminal answer still completes without a poll. `TestManualCutDefaultPostUsesHandleAndPromptProgress`, `TestManualCutExplicitDeadlineCancelsTheHandleWorker` and `TestCutCLILegacyTerminalAnswerNeedsNoPolling` cover this boundary. diff --git a/seaweed-block/docs/design/cut-time-resource-grid.tsv b/seaweed-block/docs/design/cut-time-resource-grid.tsv new file mode 100644 index 0000000000..516acf8810 --- /dev/null +++ b/seaweed-block/docs/design/cut-time-resource-grid.tsv @@ -0,0 +1,7 @@ +operation resource formula bound; enforcer when exhausted attribution projection +cut time O(C) completed payloads plus checked metadata work; no total time bound W_cut inactivity since admission/last completed own-object step, default5min;30s per individual upload/verification call; caller cancellation remains cut_stalled, immutable progress kept; per-call timeout retries without renewal payload completion and successful ownership/adoption verification, once per own-plan object per attempt; answer counters stay per attempt provider/HTTP/core window and verification implemented; CutWindow r1 + CutTime r6; every manual POST uses immediate capture admission and a handle; native qualification owed +cut verification memory O(C) existing commit plan paths plus per-path outcomes; at most32 in-flight verification requests existing commit plan and semaphore; progress adds no per-object set or worker first ordered object refusal remains authoritative; all workers joined progress callback follows successful own-plan proof; no renewal on lookup/adoption attempts 262144-object owned/adopted tests and conflicted-adoption negative; virtual-time semantics only, no multi-size measurement claim +CLI cut time O(C) completed per-object steps; default --timeout60s is inactivity, not total time Wc=W_cut+5s slack; only same-cut sequence rises renew; optional absolute --deadline cut_stalled terminal exit1; admission busy retryable exit4; silence/restart/explicit deadline unknown exit3 one POST then GET by holder's in-memory cut ID; unrelated/global counters cannot renew client projects CutTime r6; server worker/handle/restart focused controls; native qualification owed; not merge-ready +cut memory at most4 manual handles per served volume, each holding a fixed response/context and referenced error; independent of C manualCutHandleLimit=4; terminal retirement only after its own Wc from end; lazy scan of4 slots cut_busy reason handles_full; no eviction, no scheduled handles in-memory cut ID, no persisted receipt; restart loses ID; fixed Stats response retained, not merely an ID CutTime r6 Retire/ReplyLost; handle capacity and lost-reply controls; actual heap bytes not measured +cut settlement time O(completed HEAD reads and same-proposal retries); no total cap same W and per-call HEAD bound; failed reads wait the existing100ms retry timer without renewal unanswered settlement at W yields outcome_unknown, never cut_stalled own-proposal read renews only with authority; foreign HEAD terminal without renewal; completed inherited settlement renews once before own barrier; invocation tag binds result CutTime r8c Settle/SettleStall/SettleInherited/NoFalseFailure/OwnResult/NoRetryAfterFence; landed/unapplied/unanswered/inherited/fenced controls; O(1) pending invocation tag; native qualification owed +cut API version encoding memory O(B) temporary JSON bytes and raw fields for the existing B-byte cut answer; no object traversal existing response body, no new persistent state or time bound encoding failure yields versioned internal refusal integer version1 stamping at the cut boundary; no client negotiation; newer CLI accepts own/N-1 holders, older CLI refuses newer holders; or legacy synchronous200; unsupported_api_version otherwise (always exit3; HTTP status cannot prove non-admission); integer tokens preserved CutTime r8b response metadata only; wire tests cover progress/terminal/refusal/status and frontier above2^53; allocation bytes not measured diff --git a/seaweed-block/docs/design/invariants.md b/seaweed-block/docs/design/invariants.md index f813cd1681..f2fdf7ef2b 100644 --- a/seaweed-block/docs/design/invariants.md +++ b/seaweed-block/docs/design/invariants.md @@ -416,7 +416,8 @@ stateDiagram-v2 | Pre-copy host drain | (Not reachable in this release; see the note below.) a committed freeze keeps commands held while host storage admission closes; transport teardown cancels held commands before joining the session, without issuing their storage work | `storage_adapter.go` `setOperationalLocked`; `nvme/session.go` `serve` | `INV-CUT-PRECOPY-001` | | Copy | every candidate chunk (native owned LSN map relative to HEAD plus retained WAL/in-memory dirt) is read by a bounded upload worker at upload time; a staged copy is reused only if unchanged since staging; native copy occurs after barrier release with pre-publication COW ownership | `core/storage/chunk_layer.go` `captureLocked` | `INV-CUT-QUIESCED-001`, `INV-CUT-STAGED-REUSE-001`, `INV-CUT-BITMAP-001`, `INV-CUT-READ-LOGICAL-001`, `INV-CUT-GUEST-BOUNDED-WAIT-001` | | LSN guard | refuse when H is below HEAD's `RemoteLSN` (`lsn_behind`) | `core/storage/chunk_layer.go` `captureLocked` | `INV-WS-HEAD-MONOTONE-001` | -| Upload | upload only chunks whose SHA-256 differs from HEAD, under content-addressed pool names, after Begin opens or replays the holder session covering the staged objects; an immutable slot retries through transient failures until cancellation or its object deadline | `core/storage/chunk_layer.go` `captureLocked`; `core/frontend/chunkstore/layout_remote.go` `Put` | `INV-CUT-INTENT-FIRST-001`, `INV-CHUNK-WRITE-ONCE-001` | +| Upload | upload only chunks whose SHA-256 differs from HEAD, under content-addressed pool names, after Begin opens or replays the holder session covering the staged objects; an immutable slot retries transient failures under per-call deadlines; a completed payload renews the cut window, while failed calls do not | `core/storage/chunk_layer.go` `captureLocked`; `core/frontend/chunkstore/layout_remote.go` `Put` | `INV-CUT-INTENT-FIRST-001`, `INV-CHUNK-WRITE-ONCE-001`, `INV-CUT-PROGRESS-WINDOW-001` | +| Verify | prove ownership or complete conditional adoption of every object in the cut's own plan; each object completes once per attempt and renews the same window after proof, never on a failed lookup or conflicted adoption. Silence ends the cut with cut_stalled; publication guards remain unchanged | `layout.allOwnedBySession`; `cutVerificationObjects.CommitObjectVerified`; `storage.ReportCutObjectVerified` | `INV-CUT-PROGRESS-WINDOW-001` | | Manifest | prepare the complete root from changed and reused segments; new objects belong to the open session and are verified before commit | `core/frontend/chunkstore/layout_remote.go` `LayoutRemote.CASHead`; `core/frontend/chunkstore/layout/objects.go` `PrepareRoot`; `core/frontend/chunkstore/layout/commit.go` `RunCommit` | `INV-CUT-SEGMENT-REUSE-001`, `INV-CUT-INTENT-FIRST-001` | | No-op cut | when nothing changed since HEAD, no CAS is sent, but HEAD is re-read; a HEAD that moved fences the holder | `core/storage/chunk_layer.go` `captureLocked` | `INV-SNAPK-HEAD-WRITE-001` | | Readmit | admission is checked again right before the CAS; a superseding HEAD fences | `core/storage/chunk_layer.go` `admit`, `supersededBy` | `INV-SNAPK-HEAD-WRITE-001` | @@ -429,7 +430,8 @@ Not reachable in this release: the frozen detach and the pre-copy detach. `/chun Periodic HEAD cuts are off by default in blockvolume (`--chunk-capture-interval` 0; when set, at least 5 minutes); they do not create named snapshots. One five-minute -context covers a cut, including uploads. Deadline-aborted uploads remain rooted +inactivity window covers a cut, renewed only by completed own-object steps; +individual remote calls have 30-second deadlines. Aborted uploads remain rooted and reusable only while their chunk version and HEAD generation match. ### M6 Chunk lifecycle @@ -686,6 +688,30 @@ cannot strand it. Lost publication or settlement replies resume the same target. Name-only snapshot deletion is a legacy-format transition only: it refuses a v1.1 HEAD before publication. Incarnation-qualified deletion uses the admitted target and atomic unlink/intent transition; a retry never resolves a replacement by name. +### Cut CLI observation (Draft projection) + +| From | To | Trigger / guard | Code | Invariant | +|---|---|---|---|---| +| Start | Admission | POST once; the explicit deadline is fixed once | `chunkCut`, `chunkObserveCut` | `INV-CLI-CUT-PROGRESS-WINDOW-001` (STUB: native qualification owed) | +| Admission | Polling / Busy | Keep the server's in-memory cut ID; cut_busy exits retryable without starting another cut | `chunkObserveCut` | `INV-CLI-CUT-PROGRESS-WINDOW-001` | +| Polling | Polling | GET status for the same ID. Only a strictly higher sequence for that ID renews Wc; errors, unchanged or foreign progress do not | `chunkObserveCut` | `INV-CLI-CUT-PROGRESS-WINDOW-001` | +| Polling | Success / Failed | A valid result / cut_stalled answer ends observation; an explicit foreign cut ID cannot settle it | `chunkObserveCut` | `INV-CLI-CUT-PROGRESS-WINDOW-001` | +| Polling | Unknown | Wc with no observed rise, unanswered transport, holder restart losing the ID, explicit deadline, or terminal outcome_unknown after settlement silence | `chunkObserveCut` | `INV-CLI-CUT-PROGRESS-WINDOW-001`, `INV-CUT-PUBLISH-SETTLE-001` | +| Admission / Polling | Local protocol refusal | reply version is neither N nor N-1; only a valid unversioned initial synchronous 200 is the legacy fallback; typed unsupported_api_version names both versions; all unsupported responses exit unknown (3); HTTP status cannot establish non-admission; never re-POSTs or establishes a cut outcome | chunkObserveCut | INV-CUT-API-VERSION-001 | + +### Cut polling handle refinement + +| From | To | Guard / action | Enforced in | Invariant | +|---|---|---|---|---| +| No manual handle | Running | every manual POST uses a handle; below four retained handles, capture acquired immediately; otherwise cut_busy (capture_held with owner ID, or handles_full); no queue | chunkControl.startManualCut; AdmitManualChunkCut | INV-CUT-HANDLE-LIFETIME-001 | +| Running | Terminal retained | work joins, fixed terminal response recorded; initial POST returns within W_cut; GET reads same ID and completed-step sequence | manual_cut.go | INV-CUT-HANDLE-LIFETIME-001 | +| Running | Running | settle inherited proposal before own capture; report one completed step; only a proposal tagged with this invocation can supply its result | captureManualCut; captureInvocationLocked | INV-CUT-PUBLISH-SETTLE-001 | +| Running | Settling | publication answer lost; keep capture and the original proposal; read HEAD inside W | captureManualCut; resolvePendingWithProgress | INV-CUT-PUBLISH-SETTLE-001 | +| Settling | Settling / Terminal retained | own-proposal read renews while authority remains; foreign HEAD terminates without renewal; invocation tag binds the result; completed inherited recovery renews once then takes its own barrier; silence ends unknown | captureManualCut | INV-CUT-PUBLISH-SETTLE-001 | +| Terminal retained | Terminal retained | sending or losing a reply never retires or replaces the handle | writeManualCut | INV-CUT-HANDLE-LIFETIME-001 | +| Terminal retained | Retired | at least this handle's Wc since its end; next admission or poll scans bounded table | retireManualCutsLocked | INV-CUT-HANDLE-LIFETIME-001 | + + ## Part B. Invariant ledger @@ -1152,13 +1178,20 @@ Notes: | `INV-CUT-HYDRATION-PROGRESS-001` | The status reports per volume the HEAD-named chunks still to hydrate (`AbsentChunks`) and the chunks hydrated so far (`Hydration.Completed`, cumulative); a read of an un-hydrated chunk moves both by one, a repeat read neither. Observation only. | M5 hydration (reader; no transition) | `core/storage/chunk_layer.go` `Stats` (`absentHydratable`); `core/storage/chunk_hydration.go` `hydrationWorker` | `TestHydrationProgressCountersFollowFirstReads` (`core/frontend/durable/hydration_progress_test.go`) | — | ACTIVE | | `INV-CUT-READMISS-001` | A block fetched from HEAD after a move is installed only if it does not overwrite a newer local extent version; a newer WAL-only write still wins on reads, and HEAD's value may be installed beneath it as the backing value, which is correct if a crash loses that unsynced write. | M4 Holder (lazy restore) | `core/storage/chunk_layer.go` `OnReadMiss`, `installFetchedBlock`; `core/storage/walstore.go` `readFromExtent` | `TestChunkLayer_WALOnlyOverlapReadNeverReturnsUntouchedZero` (`core/storage/chunk_layer_races_test.go`); `TestWALStore_PostReadMissRechecksWALFormat` (`core/storage/walstore_read_miss_v3_test.go`; real-store v2/v3 dispatch) | — | ACTIVE | | `INV-CHUNK-LOCAL-BEFORE-FETCH-001` | A block that reaches the extent while its chunk is absent is local to the chunk layer before any fetch can install over it: a store opened for chunk use drains nothing to the extent and takes no BASE until its chunk layer attaches. | M4 Holder (lazy restore) | `core/frontend/durable/provider.go` (open and create of `walstore-chunk`, before Recover); `core/storage/walstore.go` `HoldExtentDrainUntilChunkLayer`, `writeExtentUnlocked` (refuses while held, the backstop); `core/storage/flusher.go` `flushOnceInternal` (every drain, the stop's included, checked with the snapshot under `store.mu`); `core/storage/base_install_v3.go` `BeginBaseInstall`; `core/storage/chunk_layer.go` `attachChunkLayerImpl` (releases the hold) | `TestReplayedWriteIsNotDrainedBeforeTheChunkLayerAttaches`, `TestACycleStartedBeforeTheHoldDoesNotDrainTheRecoveredWrite`, `TestAStopBeforeAttachDrainsNothing`, `TestABaseInstallIsRefusedWhileTheDrainIsHeld`, `TestAHeldStoreRefusesAnyExtentWriteUntilAttached`, `TestExtentWritersAreEnumerated` (`core/storage/chunk_replay_before_attach_test.go`); `TestProviderHoldsTheDrainOfAChunkStoreOnCreateAndOpen` (`core/frontend/durable/provider_drain_hold_test.go`) | — | ACTIVE | +| `INV-CUT-API-VERSION-001` | Cut replies carry integer version 1; clients send none. CLI accepts own/N-1 holders or valid unversioned initial 200, never newer holders. Unsupported versions name both versions and exit unknown 3: HTTP status cannot prove non-admission; no re-POST or outcome claim. | M5 response validation | `handleChunkCut`; `cutAPIAnswer`; `chunkObserveCut` | `TestManualCutAPIVersionCoversEveryCutAnswer`, `TestCutCLINewerClientAcceptsOwnAndOneOlderHolder`, `TestCutCLIOlderClientRefusesNewerHolder`, `TestCutCLIUnsupportedVersionNeverStartsAnotherCut`, `TestCutCLIInvalidUnversionedInitialTerminalAnswerIsUnknown`, `TestCutCLIUnsupportedInitialErrorNeverProvesNonAdmission`, `TestCutCLILegacyTerminalAnswerNeedsNoPolling` | CutTime Poll response validation; lifecycle unchanged; native qualification owed | STUB | +| `INV-CUT-HANDLE-LIFETIME-001` | A manual handle survives until its own Wc after terminal; send and later work never retire or replace it. Four retained handles per volume bound admission, with no eviction. The control owns and joins workers; observer cancellation does not cancel admitted work. | M5 manual admission / retained answer | `core/host/volume/manual_cut.go`; `core/storage/chunk_manual_cut.go` | `TestManualCutHandlesKeepLostTerminalRepliesUntilTheirOwnWindow`, `TestManualCutHTTPReturnsHandleAndCloseJoinsWorker`, `TestManualCutBusyNamesTheRunningCaptureWithoutQueueing`, `TestManualCutObserverCancellationDoesNotCancelAdmittedWork`, `TestManualCutDefaultPostUsesHandleAndPromptProgress`, `TestManualCutExplicitDeadlineCancelsTheHandleWorker` (`core/host/volume/manual_cut_test.go`); `TestManualCutCaptureAdmissionNeverQueuesAndNamesItsOwner` (`core/storage/chunk_manual_cut_test.go`) | CutTime r6 Admit/Poll/ReplyLost/Retire, supplied30/30; ledger465-467 | STUB | +| `INV-CUT-PUBLISH-SETTLE-001` | Pending proposals carry invocation tags. Inherited settlement renews W and sequence once before the own barrier, never supplying its result. Own read-back progress renews; a foreign HEAD terminates without renewal. Settlement silence is unknown, never cut_stalled. | M5 PublishLost/Settle/SettleStall | `chunk_manual_cut.go` `captureManualCut`; `chunk_layer.go` `resolvePendingWithProgress`; `chunkObserveCut` | `TestManualCutSettlesLostPublicationWithoutUploadingAgain`, `TestManualCutUnansweredSettlementIsUnknownNeverStalled`, `TestManualCutForeignHeadFenceTerminatesSettlement`, `TestManualCutInheritedPublicationCannotReplaceItsOwnBarrier`, `TestManualCutPendingProposalsHaveDistinctInvocationTags`, `TestManualCutInheritedSettlementRenewsBeforeOwnWorkExceedsTheWindow`, `TestCutCLISettlementUnknownEndsWithoutRepostingOrWaitingAnotherWindow` | CutTime r8c NoFalseFailure, OwnResult, NoRetryAfterFence, SettleInherited; supplied BFS 46/46 | STUB | +| `INV-CUT-PROGRESS-WINDOW-001` | A cut has no total cap. Only completed own-plan upload/verification/adoption steps renew W; failed, conflicted or timed-out calls do not. Each call has a deadline. Silence before uncertain publication yields cut_stalled and retains work. Uncertain publication follows INV-CUT-PUBLISH-SETTLE-001. | M5 Copy/Upload/Verify/Publish | `core/storage/cut_progress_window.go`; `core/storage/chunk_upload.go`; `core/frontend/chunkstore/cut_verification_window.go`; `layout.allOwnedBySession`; `DurableProvider.chunkCutContext`; `StatusServer.handleChunkCut` | `TestManualCutProgressingBeyondFiveMinutesFinishesWithOneAdmission`, `TestManualCutCallTimeoutRetriesWithoutEndingTheWindow`, `TestManualCutSilenceReturnsTypedStallAtItsWindow`, `TestManualCutStallRetryKeepsProgressAndReportsAttemptCounters`, `TestManualCutTimedOutCallsDoNotRenewProgress` (`core/host/volume/cut_progress_window_test.go`); `TestCutVerification262144ObjectsAfterUploadRenewsTheWindow`, `TestCutVerificationConflictedAdoptionsDoNotRenewTheWindow`, `TestCutVerificationTimeoutRetriesTheIndividualLookup`, `TestCutVerificationRetriesTheProductionGRPCDeadline` (`core/frontend/chunkstore/cut_verification_window_test.go`); `TestCutSilenceWindowIncludesUploadWithBackgroundCaller`; `TestCutWindowErrorPreservesCallerDeadlineAfterWorkerCancellation` | CutWindow r1 Complete/CallTimeout/Fail/Tick/Retry/Publish; CutTime r6 Complete, own per-object set; supplied 30/30 | ACTIVE | +| `INV-CLI-CUT-PROGRESS-WINDOW-001` | The CLI POSTs once, then polls its in-memory cut ID. Only a strictly rising own sequence renews Wc. Silence, restart or the absolute deadline returns unknown; cut_stalled returns failure. Admission cut_busy is retryable. No re-POST or persisted cut receipt. | Cut CLI Admission/Busy/Polling/Success/Failed/Unknown | `cmd/sw-block/cut_progress_poll.go` | `TestCutCLIStartsOnceThenOnlyPollsTheReturnedID`, `TestCutCLIProgressingFor46MinutesPollsOneCutID`, `TestCutCLIRestartLosesTheHandleWithoutClaimingFailure`, `TestCutCLIBusyIsDistinctAndDoesNotStartAnotherCut`, `TestCutCLIUnchangedSequenceCannotRenewItsWindow`, `TestCutCLIAbsoluteDeadlineEndsAProgressingCut`, `TestCutCLIUnansweredRequestEndsUnknownWithinItsOwnWindow`, `TestCutCLIForeignSequenceCannotRenewItsWindow`, `TestCutCLIStalledAnswerIsAFailure` (`cmd/sw-block/cut_progress_poll_test.go`); `TestOpsChunk_OversizedResponseIsRefused`, `TestOpsChunk_LostResultFailsTheCommand`, `TestOpsChunk_HTTPCommandsSendSpecRequests`, `TestOpsChunk_HTTPFailureIsTyped`, `TestOpsChunk_ErrorsAreJSONOnStdout` (`cmd/sw-block/chunk_output_test.go`, `cmd/sw-block/chunk_test.go`) | CutTime r6 458-467 Poll/InProgress/CliSilent/CliGiveUp/HolderRestart/Retire/ReplyLost; supplied BFS 30/30 in docs/spec/cuttime | STUB | | `INV-CUT-TIMER-RESTART-001` | A successful cut of any kind restarts the periodic timer, which runs on in-process monotonic time (a restart starts a fresh schedule; wall-clock steps move nothing). | M5 periodic trigger (before Admit) | `core/frontend/durable/provider_chunk.go` `chunkLoop` | `TestWALStoreChunk_ExplicitCutRestartsTheTimer`, `TestWALStoreChunk_ExplicitCutOverlappingTheTimerRestartsIt` (`core/frontend/durable/provider_chunk_sched_test.go`); `TestCutPolicy_TimerRunsOnObservationTime`, `TestCutPolicy_StaggerPreservesExplicitTimerReset` (`core/frontend/durable/cut_policy_test.go`) | — | ACTIVE | | `INV-CUT-TIMER-SKIP-001` | A periodic cut decided from an older last cut is skipped under the capture lock: no automatic cut follows another within the interval. | M5 periodic trigger (before Admit) | `core/storage/chunk_periodic_cut.go` `CutUnlessCutSince`; `core/frontend/durable/provider_chunk.go` `chunkLoop` | `TestChunkPeriodicCut_SkipsAfterANewerCut`, `TestChunkPeriodicCut_SkipsANewerCutWithAnOlderStamp` (`core/storage/chunk_periodic_cut_test.go`); `TestWALStoreChunk_ExplicitCutOverlappingTheTimerRestartsIt` (`core/frontend/durable/provider_chunk_sched_test.go`) | — | ACTIVE | | `INV-CUT-TIMER-SLOT-WAIT-001` | A periodic cut refused for held host slots, pending urgent work or an earlier ticket is a wait, not a failure: no backoff or minimum spacing; it retries at the next poll in ticket order, and status reports the wait until any later cut succeeds. Other errors keep the backoff. | M5 periodic trigger (before Admit) | `core/frontend/durable/provider_chunk.go` `cutPolicy.after`, `chunkLoop`; `core/hostlimit/limiter.go` `ErrSlotsHeld` | `TestCutPolicy_HostSlotBusyIsAWaitNotAFailure`, `TestCutPolicy_SuccessDuringSlotWaitEndsTheWait`, `TestCutWaitSlot_StatusEndsTheWaitAfterALaterCut`, `TestCutPolicy_TicketOrderWaitBound` (`core/frontend/durable/cut_policy_test.go`); `TestTimerCutRunsSoonAfterHostSlotFrees`, `TestSlotWaitEndsWithASuccessfulDetachSeal` (`core/frontend/durable/host_slot_wait_test.go`); `TestAdmitClosedDuringPoolAcquisitionIsRevoked` (`core/hostlimit/limiter_test.go`) | — | ACTIVE | -| `INV-CLI-CHUNK-LOOP-001` | Above the per-request bound, sw-block ops chunk snapshot\|cut\|detach repeats the SAME request (same name and request id) only after a retryable or outcome_unknown answer. | client (no state machine): the CLI side of M5 cut requests | `cmd/sw-block/chunk_loop.go` `chunkPostLoop`; `cmd/sw-block/chunk.go` `chunkPostUntil` | `TestChunkSnapshotRepeatsTimedOutRequestsWithTheSameBody`, `TestChunkSnapshotLoopReusesTheGeneratedRequestID`, `TestChunkLoopRepeatsAnOutcomeUnknownNotMarkedRetryable` (`cmd/sw-block`) | — | ACTIVE | -| `INV-CLI-CHUNK-LOOP-002` | Above the per-request bound, sw-block ops chunk snapshot\|cut\|detach stops at the first definite answer (success or non-retryable refusal). | client (no state machine): the CLI side of M5 cut requests | `cmd/sw-block/chunk_loop.go` `chunkPostLoop` | `TestChunkLoopStopsOnANonRetryableRefusal`, `TestChunkDetachOutcomeUnknownSettles` (`cmd/sw-block`) | — | ACTIVE | -| `INV-CLI-CHUNK-LOOP-003` | Cut, detach and synchronous snapshot admission never start a request after --timeout and refuse a non-positive bound. After asynchronous snapshot admission, observation uses bounded calls and keeps the same ID without an overall deadline. | client (no state machine): the CLI side of M5 cut requests | `cmd/sw-block/chunk_loop.go` `chunkPostLoop`; `cmd/sw-block/chunk.go` `chunkPostUntil` | `TestChunkLoopEndsAtTheTimeout`, `TestChunkLoopHeldProgressReadSendsNoRequestAfterTheTimeout`, `TestChunkLoopSlowAnswersAreBoundedByTheTimeout`, `TestChunkNonPositiveTimeoutIsRefused` (`cmd/sw-block`) | — | ACTIVE | -| `INV-CLI-CHUNK-LOOP-004` | Above the per-request bound, a sw-block ops chunk snapshot\|cut\|detach request that ended before its own deadline is repeated only after a backoff (no hot loop). | client (no state machine): the CLI side of M5 cut requests | `cmd/sw-block/chunk_loop.go` `chunkPostLoop` | `TestChunkLoopPauseDoublesToItsCap`, `TestChunkLoopEndsAtTheTimeout` (`cmd/sw-block`) | — | ACTIVE | +| `INV-CLI-CHUNK-LOOP-001` | Above the per-request bound, sw-block ops chunk snapshot\|detach repeats the SAME request (same name and request id) only after a retryable or outcome_unknown answer. Manual cut uses the separate one-POST/read-only-poll contract. | client (no state machine): the CLI side of M5 requests | `cmd/sw-block/chunk_loop.go` `chunkPostLoop`; `cmd/sw-block/chunk.go` `chunkPostUntil` | `TestChunkSnapshotRepeatsTimedOutRequestsWithTheSameBody`, `TestChunkSnapshotLoopReusesTheGeneratedRequestID`, `TestChunkLoopRepeatsAnOutcomeUnknownNotMarkedRetryable` (`cmd/sw-block`) | — | ACTIVE | +| `INV-CLI-CHUNK-LOOP-002` | Above the per-request bound, sw-block ops chunk snapshot\|detach stops at the first definite answer (success or non-retryable refusal). | client (no state machine): the CLI side of M5 cut requests | `cmd/sw-block/chunk_loop.go` `chunkPostLoop` | `TestChunkLoopStopsOnANonRetryableRefusal`, `TestChunkDetachOutcomeUnknownSettles` (`cmd/sw-block`) | — | ACTIVE | +| `INV-CLI-CHUNK-LOOP-003` | Detach and synchronous snapshot admission obey a positive total --timeout. Async snapshot observation keeps the same ID with bounded calls and no total deadline. Manual cut uses the separate inactivity-window contract. | client (no state machine): the CLI side of M5 cut requests | `cmd/sw-block/chunk_loop.go` `chunkPostLoop`; `cmd/sw-block/chunk.go` `chunkPostUntil` | `TestChunkLoopEndsAtTheTimeout`, `TestChunkLoopHeldProgressReadSendsNoRequestAfterTheTimeout`, `TestChunkLoopSlowAnswersAreBoundedByTheTimeout`, `TestChunkNonPositiveTimeoutIsRefused` (`cmd/sw-block`) | — | ACTIVE | +| `INV-CLI-CHUNK-LOOP-004` | Above the per-request bound, a sw-block ops chunk snapshot\|detach request that ended before its own deadline is repeated only after a backoff (no hot loop). | client (no state machine): the CLI side of M5 cut requests | `cmd/sw-block/chunk_loop.go` `chunkPostLoop` | `TestChunkLoopPauseDoublesToItsCap`, `TestChunkLoopEndsAtTheTimeout` (`cmd/sw-block`) | — | ACTIVE | +Cut-window wording is split between the short ledger statement and the detailed transition/grid rows: own-plan completion is counted once per object per attempt. This does not weaken conflict nonrenewal or cancellation, fencing and admission authority. The legacy CLI total-timeout rows exclude manual cut because it now has its own observation contract. + A guest read has a cooperative arrival budget; internal contextless readers keep the owned fill timeout (default 30 s). With five immediate host retries, cold fills slower than roughly 20–24 s can still end in guest EIO despite shared work; retry-delay advertisement remains separate. A changed generation replaces its promise without abandoning the old worker. `AllBlocks` returns an error and no partial image on a failed read; the rebuild sender propagates it before sending blocks. @@ -1372,7 +1405,7 @@ Notes: | `INV-SNAPK-RESTORE-ORDER-001` | Master checks the source HEAD and named snapshot and refuses RF>1 before persisting. The target binds source layout id, snapshot, request id and VOLUME geometry as not-ready; then AddDependent, copy root/segments, create VOLUME and unclaimed HEAD, and mark ready. A retry keeps the binding. | M9 source HEAD, dependents | `core/lifecycle/store.go` `CreateVolume`; `core/host/master/services.go` `CreateVolume`; `core/frontend/chunkstore/layout/create.go` `CreateTarget`; `cmd/sw-block/chunk_b.go` `chunkRestore` | `TestRestoreRequestBindsTargetName`, `TestRestoreCreateVolumePersistsRequestBeforeTargetAndHealsRetry`, `TestOpsChunkRestoreUsesOnlyMasterCreate`, `TestCreateTarget`, `TestRunAddDependent_RefusesAForeignSource` | — (the snapshot kernel model is not in this repository) | ACTIVE | | `INV-SNAPK-SNAP-DELETE-001` | A named snapshot leaves HEAD by one conditional update, refused while it has dependents; the automatic delete (retention) also refuses a snapshot pinned at its time. | M9 idle → idle | `core/frontend/chunkstore/layout` `snapshots.go` `Head.DeleteSnapshot`, `Head.RetireSnapshot` | `TestDeleteSnapshot_Closure`, `TestRetireSnapshot_Closure`, `TestRunRetireSnapshot_InterruptAtEveryStep` | — (the snapshot kernel model is not in this repository) | ACTIVE | | `INV-SNAP-OP-RECEIPT-001` | A snapshot operation receipt survives reopening its volume store; changed intent is refused, terminal outcomes are immutable, and a stale owner or revision cannot advance the receipt. | M9 operation receipt | `LayoutStore.CreateSnapshotOperation`, `AdvanceSnapshotOperation` (create coupling, process-owned executor and compact index wired; native qualification pending) | `TestSnapshotOperationReceiptSurvivesReopenAndRejectsChangedIntent`, `TestSnapshotOperationStallReadmissionFencesOldOwner`, `TestSnapshotOperationSplitPublishReadmissionSettlesOneBinding` | SnapOps rows 211–219 and index-first rows 231–240; native qualification pending | STUB | -| `INV-SNAP-OP-TERMINAL-WRITERS-001` | Create success settles a HEAD binding; create refusal is a pre-provider HEAD conflict. An initial-absence delete records not_found and can never execute. Provider failures never create terminal refusal. | M9 operation terminal outcome | `LayoutStore.SettleSnapshotOperationFromHead`, `chunkControl.snapshotOperationAttempt`, `refuseInitiallyAbsentDelete` | `TestSnapshotOperationTerminalWriterEnumeration`, `TestSnapshotOperationAppliedAnswerFailureNeverBecomesRefused`, `TestSnapshotOperationFencedFailurePreservesPublishedBinding`, `TestSnapshotDeleteInitiallyAbsentIsImmutableRefusal` | SnapDelete.Admit; SnapOps row 218 and index-first rows 231–240 | STUB | +| `INV-SNAP-OP-TERMINAL-WRITERS-001` | Create success settles a HEAD binding; create refusal is a pre-provider HEAD conflict. An initial-absence delete records not_found and can never execute. Provider failures never create terminal refusal. | M9 operation terminal outcome | `LayoutStore.SettleSnapshotOperationFromHead`, `chunkControl.snapshotOperationAttempt`, `refuseInitiallyAbsentDelete` | `TestSnapshotOperationTerminalWriterEnumeration`, `TestSnapshotOperationAppliedAnswerFailureNeverBecomesRefused`, `TestSnapshotOperationFencedFailurePreservesPublishedBinding`, `TestSnapshotOperationUnknownAuthorityLossKeepsReceiptForReadmission`, `TestSnapshotDeleteInitiallyAbsentIsImmutableRefusal` | SnapDelete.Admit; SnapOps row 218 and index-first rows 231–240 | STUB | | `INV-SNAP-OP-WORKER-001` | A synchronous retry of an in-flight operation reads its receipt and replays a terminal outcome or refuses retryably, without starting another provider attempt. Changed intent still refuses before work. | M9 operation executor | `chunkControl.Snapshot`, `snapshotOperationInFlight`, process-local `opJobs` | `TestSnapshotOperationSynchronousRetryDoesNotDuplicateAsyncWorker` | SnapOps.Start; complete executor qualification pending | STUB | | `INV-SNAP-OP-CAPACITY-001` | At 4096 nonterminal receipts, new snapshot-operation admission refuses retryably without a record; retained accepted and stalled operations still replay after reopening. | M9 operation admission | `LayoutStore.CreateSnapshotOperation`, compact index CAS | `TestSnapshotOperationRetirementFullPendingRefusesWithoutLosingReceipt` | SnapOps index-first rows 231–240; native qualification pending | STUB | | `INV-SNAP-OP-CONCURRENT-CAPACITY-001` | Concurrent admissions through independent volume stores share the durable 4096-record limit; with 4095 pending receipts, only one new request is admitted. | M9 operation admission | `LayoutStore.CreateSnapshotOperation`, `writeOperationIndex` | `TestSnapshotOperationRetirementConcurrentAdmissionsShareLastSlot` | SnapOps index-first rows 231–240 | STUB | @@ -1470,9 +1503,16 @@ One row per wait in the data and control paths. Guest-visible rows on one path m | `cmd/blockvolume/main.go` `runVolume`, the receive of `stopWait` after the frontends started (when `awaitFrontendStart` released on first serving) | the one result of the `waitWorkspaceStop` goroutine (its only producer, a channel of capacity one it sends to exactly once) | the process lifetime, as `waitWorkspaceStop` | the process exit owner (`superviseProcess`) | shutdown with the handed-back lease drain request | none | no (the targets serve until the stop) | | `core/frontend/durable/provider_startup.go` `watchChunkFence` (one goroutine per attached chunk layer, started when the layer attaches) | the 50 ms ticker (then reads the layer's latched fence flag) or provider close (`closeCtx`) | the attached layer's lifetime: it returns at provider close, when the layer is no longer the volume's, or after publishing a fence; Close joins it (`p.inflight`) | `DurableProvider.Close` (cancels `closeCtx`, then waits `p.inflight`) | none: the ticker is its poll, not a deadline; a HEAD fence is published at most 50 ms after the layer latches it (I/O is refused from the latch) | none while waiting (`p.mu` only briefly to check the handle and publish) | no | | `cmd/blockvolume/process_exit.go` `watchChunkRuntimeFence` (one goroutine from `runVolume`, workspace chunk primaries) | the provider's runtime-fence wakeup (capacity one, `ChunkRuntimeFenceUpdates`), the process outcome (`e.done`) or the watch context | the process lifetime: it returns after choosing 78 `head_fenced`, when another outcome is chosen, or when `runVolume` cancels its watch context | the process exit owner (`superviseProcess`) | none | none | no | +| `core/host/volume/chunk_control.go` `handleChunkCut` initial observation | terminal result or completed-step signal | at most requested W_cut after capture admission | completed worker / progress signal / timer / request cancellation | 202 in_progress with cut ID, sequence; cancellation ends only HTTP observation | no control/storage lock held | no | +| `core/storage/chunk_manual_cut.go` `captureMutex.Lock` internal callers | current capture owner releases; same waiting contract as the prior mutex; manual admission uses nonblocking tryManual instead | capture owner Unlock broadcasts; existing operation contexts bound their work, no independent mutex deadline | the existing capture owner | no timer or new refusal in this internal path | condition wait releases metadata mutex; caller's pre-existing outer lock order unchanged | no additional guest-visible wait | | `core/frontend/durable/provider_chunk.go` `chunkAuthorityWait` (one goroutine per recovery of a workspace chunk primary awaiting authority) | a healthy projection (own assignment and a lease grant), then the HEAD claim | none while blockmaster gives no reply or refuses the node's credentials or identity (it serves nothing and holds no lease); otherwise max(the first reply after the local open and recovery, the master's barrier time) + 30 s; without a master wait, 30 s for assignment; attach attempts have per-fetch bounds and progress, never a total deadline | the host's contact observations (`core/host/volume/master_wait.go`), provider Close, a later recovery | exit 75 `assignment_timeout`; 78 `moved` or `deleted` at once on a typed refusal | none: the bound is read on the 20 ms poll without `p.mu` or `h.attachMu` | no (no target listens) | -| `core/frontend/chunkstore/layout/commit.go` `allOwnedBySession`, admission (`sem <-`, on the commit caller's goroutine) | a free slot among `commitVerifyParallel` (32) object lookups in flight | one lookup's duration: each admitted lookup honours the commit's context (`ObjectStore.Stat` returns on cancellation) and frees its slot when it returns | the admitted lookup's goroutine (`<-sem` on return) | none of its own: the caller's context ends the lookups; once any lookup fails, no further one is admitted | the caller's `LayoutRemote.mu` (`core/frontend/chunkstore/layout_remote.go` `CASHead`, `CommitPendingSnapshot` hold it across `RunCommit`); no HEAD-store lock | indirect: within the cut or snapshot deadline (5 min) | -| `core/frontend/chunkstore/layout/commit.go` `allOwnedBySession`, join (`wg.Wait`) | every admitted lookup to return | the slowest admitted lookup, bounded by the commit's context | `allOwnedBySession` (it admitted them; it returns only after the join, so none outlives the call) | none of its own, as the admission row | the caller's `LayoutRemote.mu`, as the admission row | indirect: within the cut or snapshot deadline (5 min) | +| `core/frontend/chunkstore/layout/commit.go` `allOwnedBySession`, admission (`sem <-`, on the commit caller's goroutine) | a free slot among `commitVerifyParallel` (32) object lookups in flight | one lookup's duration: each admitted lookup honours the commit's context (`ObjectStore.Stat` returns on cancellation) and frees its slot when it returns | the admitted lookup's goroutine (`<-sem` on return) | none of its own: the caller's context ends the lookups; once any lookup fails, no further one is admitted | the caller's `LayoutRemote.mu` (`core/frontend/chunkstore/layout_remote.go` `CASHead`, `CommitPendingSnapshot` hold it across `RunCommit`); no HEAD-store lock | indirect: cut inactivity window (5 min by default); snapshot retains its caller deadline | +| `core/frontend/chunkstore/layout/commit.go` `allOwnedBySession`, join (`wg.Wait`) | every admitted lookup to return | the slowest admitted lookup, bounded by the commit's context | `allOwnedBySession` (it admitted them; it returns only after the join, so none outlives the call) | none of its own, as the admission row | the caller's `LayoutRemote.mu`, as the admission row | indirect: cut inactivity window (5 min by default); snapshot retains its caller deadline | + +| Site | Waits for | Bound | Ending owner | On expiry | Locks held | Guest I/O paused | +|---|---|---|---|---|---|---| +| `cmd/sw-block/cut_progress_poll.go` `chunkObserveCut`, HTTP request/body | one same-ID re-poll answer | remaining Wc since the last own sequence rise, shortened by the chosen absolute deadline | CLI cancels its per-request context and closes the response body | unknown (exit 3); no new cut identity issued | none | no | +| `cmd/sw-block/cut_progress_poll.go` `chunkObserveCut`, poll pause | next re-poll opportunity | min(100 ms, remaining observation/deadline time) | CLI loop; synchronous sleep returns within that bound | next loop checks expiry before sending | none | no | Format v3 row 4 runs in production recovery (`WALStore.recoverV3`). Its typed scan result preserves trusted records, absolute end, highest LSN, contiguous frontier, trusted DurableLSN and stop cause separately. The W/BASE/fence owner (`WALStore.recoverV3`) must check R < W*, fence and publish bounds before readiness or append admission; neither codec nor scan success is readiness. The installed scan begins at max(BaseCursor, retainedTail). No ACTIVE v2 machine/guard is replaced by this step. @@ -1482,12 +1522,13 @@ One row per fixed time limit on a volume's path that surrounds, or once surround | Site | Limit | Inside the limit | Grows with the volume | Outside it, judged by progress | Test at 262,144 chunks | |---|---|---|---|---|---| +| `cmd/sw-block/cut_progress_poll.go` `chunkObserveCut` | Wc = requested cut window + 5 s slack; --timeout default 60 s; optional --deadline absolute | one POST then read-only GET observation of the same cut; no total cap | yes: cut work grows with C | no own sequence rise, silence or restart -> outcome_unknown exit 3; cut_stalled -> exit 1; admission cut_busy -> retryable exit 4. Four handles per volume, each retained until Wc after terminal; worker owned and joined by control; native qualification owed | transport controls in `cut_progress_poll_test.go`, including 46 simulated minutes; no native or size measurement claim | | `core/storage/chunk_head_belt.go` `casChunkHead`, applied by `LayoutRemote.commitStepLocked` | 2 s per attempt | one HEAD step: the HEAD read, the commit's decision from its plan, the conditional write | no | the commit's preparation (the previous manifest, the next root and segments, the plan) and its object lookups, under the cut's limit; a commit after a passed check reuses the preparation | `TestHolderCommitAtOneTiBKeepsItsPreparationOutOfTheHeadStep`, `TestCommitUpdateStepDoesNotRereadTheManifests` | | the same step, for a commit that was NOT checked first | 2 s per attempt | the step and the object lookups of every new chunk, and of a new root's segments and root even when no chunk is new | **yes** | nothing: no production caller commits without the check; a new caller must check first | none: a known gap, stated here so it is not claimed. Kept true by `TestEveryHeadCommitIsCheckedFirst`: every HEAD commit of the chunk layer (a cut's commit, a detach's cancellation, an unresolved cut's re-proposal) runs the object check before its CAS, and a new site fails until it does. `TestDetachCancellationAfterALostUpdateLooksUpNothingInTheHeadStep` measures the cancellation. The snapshot of an unchanged image commits under its caller's limit, not in this step | | `core/storage/chunk_head_belt.go` the chunk layer's HEAD reads: `confirmChunkHead` after a HEAD write, a no-op cut's authority read (`noopCutHead`), and `readChunkHead` when a write's outcome is settled | 2 s per remote call | the confirmation and a no-op cut over an unchanged HEAD read HEAD only (`GetHeadRoot`), no root and no segment; a settlement reads the whole manifest, one root fetch and one fetch per segment, each bounded on its own | the confirmation and the no-op read: no; a settlement's fetch count: **yes** | a settlement's read as a whole, under the cut's limit; a no-op cut over a changed HEAD reads the whole manifest the same way | `TestTheConfirmationAfterAHeadWriteReadsNoManifest`, `TestANoOpCutReadsNoManifestWhileHeadIsUnchanged` (count 0 fetches whatever the size), `TestAWholeHeadReadIsBoundedPerFetchWhenTheRemoteBoundsItsStep` | -| `DurableProvider.chunkCutContext` (`ChunkCutTimeout`) | 5 min per attempt | staging the changed chunks, the check, the commit | yes | uploads finished by an attempt are kept; the next attempt uploads only the rest (same process) | `TestACutAttemptThatRunsOutOfTimeLeavesUploadsTheNextAttemptKeeps` | +| `DurableProvider.chunkCutContext` (`ChunkCutTimeout`) | 5 min inactivity by default, renewed by completed payloads or verified/adopted own-plan objects; 30 s per upload/verification request | staging the changed chunks, the check, the commit; no total cap | yes | silence returns cut_stalled; uploads finished before it are kept for retry in this process | `TestManualCutProgressingBeyondFiveMinutesFinishesWithOneAdmission`, `TestManualCutStallRetryKeepsProgressAndReportsAttemptCounters`, `TestCutVerification262144ObjectsAfterUploadRenewsTheWindow` | | the cleaning pass (`boundedPass`) | the configured pass limit | listing and removing by page | yes | the pass resumes at its cursor; a session after a restart starts at the root page | the cleaning cursor's tests | -| `core/host/volume/chunk_control.go` `chunkContext` (a chunk control operation: a cut, a snapshot or a detach, each of which takes a cut; the chunk status read also runs under it and reads one HEAD) | 5 min, or the request's shorter limit | the operation, including the cut it takes | yes | the cut's uploads, as the cut's row: an attempt that runs out of time keeps what it uploaded | STUB: no test at the control operation's level yet | +| `core/host/volume/chunk_control.go` `chunkContext` (snapshot, detach and status; manual cut uses its own progress window) | 5 min, or the request's shorter limit | the snapshot or detach operation, including the cut it takes | yes | the cut's uploads, as the cut's row: an attempt that runs out of time keeps what it uploaded | STUB: no test at the control operation's level yet | | `core/host/volume/recovery_watchdog.go` (`--recover-timeout`), over `cmd/blockvolume/durable_startup.go` `openAndRecoverDurable` and the chunk layer's attach | 30 s without a new completed-work frontier, shared by recovery and attach | bounded local reads and final fence/publication; no total context around the per-entry recovery | the WAL scan, map copy and retained replay grow | a cumulative fixed-order phase/count high-water mark; repeated preparation cannot renew the clock; attach retries retain completed local recovery | `TestDurableStartup_LocalRecoveryWorkIsOutsideFixedDeadline`, `TestRecoveryMapCountsOneTiBEntriesWithoutATotalDeadline`, `TestRecoveryProgress_CountingEntriesOutliveTheTotalWindow`, `TestRecoveryReporterSlowReplayReportsBeforeTheEntryBatch`, `TestRecoveryProgress_RepeatedAttachPreparationDoesNotRenew`, `TestAttachProgressCountsEachAttemptFromZero` (attach integration); joint recovery+attach Linux qualification passed; ACTIVE (landed together); no 1 TiB time claim | | `DurableProvider.chunkAuthorityWait`, without a master wait | 30 s by default, checked between attempts | waiting for assignment; failed attempts check the same allowance before retrying | no | an admitted attach uses the same per-fetch bounds and recovery progress as lease mode | `TestDefaultAttachAt262144EntriesOutlivesAssignmentWait` (262144 real manifest entries, 27 segments; full run exceeds the shipped 30 s) | | `core/frontend/durable/provider_chunk.go` `chunkAttachTimeout` | 30 s around each remote call of an attach (the attach check, the layout Start, the root fetch and each segment fetch of the manifest read), never around the attempt | each object fetch bounded; the fetch count grows (27 segments at 1 TiB); judged by the window | **yes** (the fetch count) | each completed segment and the attach's local entries report RecoveryAttach, per attempt from zero, under the shared window above | `TestAttachReportsItsVolumeSizedLocalWork` (the counting test, 262144 entries), `TestAttachManifestReadBoundsEachFetch`, `TestAttachGetHeadBoundsTheHeadRead`, `TestAttachRemoteCallsCarryTheirOwnBound`, `TestAttachManifestReadCarriesThePerFetchRule`, `TestAttachProgressCountsEachAttemptFromZero`; joint recovery+attach Linux qualification passed; ACTIVE (landed together) | diff --git a/seaweed-block/docs/releases/v1.1.md b/seaweed-block/docs/releases/v1.1.md index 687396b197..d337455d7e 100644 --- a/seaweed-block/docs/releases/v1.1.md +++ b/seaweed-block/docs/releases/v1.1.md @@ -96,3 +96,11 @@ on a path v1.1 refuses or ships as a preview. v1.2 replaces them with progress w (`store_format_newer`, `head_newer_version`), which the unit does not restart. Maintenance cleaning now uses a one-minute inactivity window renewed by strict advances of the finite (phase, cursor) work position, with separate 30-second remote-request deadlines. A stalled pass reports `no_progress` and resumes at its existing cursor on the next pass; a large progressing pass has no total deadline. + +### Cut upload counters + +A cut answer's upload count and byte counters describe its final attempt, +not the total across earlier attempts. Completed uploads retained for reuse +are not uploaded again; `stagedChunksUsed` reports reused staged chunks. +Do not add that value to `uploadedChunks`: staging and upload can also occur +within the same attempt, so the values can overlap. diff --git a/seaweed-block/docs/spec/README.md b/seaweed-block/docs/spec/README.md index 2f8a917a2c..09af935123 100644 --- a/seaweed-block/docs/spec/README.md +++ b/seaweed-block/docs/spec/README.md @@ -714,3 +714,45 @@ separate refinement obligation: full volume identity, hash/context checking, read bounds, session exclusion, and the original mark/delete guards remain. Producer driver activation and final queue layout are not claimed by this integration; its new protocol rows remain dormant. + +### Cut progress window + +[CutWindow r1](cutwindow/CutWindow.tla) bounds silence by completed uploads, +with a separate deadline for each call and retained progress across retries. +The model owner's recorded breadth-first run passed all nine expected +configurations: safe_cut (533 states), five must-violate mutations and three +reachability witnesses. [Configurations](cutwindow/cfg) and +[results](cutwindow/results.txt) are committed; this records the completed +model run, rather than claiming a second run by this implementation. +The source model's LF-normalized SHA-256 was `01f748c95ce0f7b6bbe71e1c639600adf5acc4d4c398686550a76b4d88f62b3a`. +The committed copy removes internal provenance references in comments only. + +Projection: CutWindow.Start/CallTimeout -> chunk_upload.go per-call contexts and +cut_verification_window.go individual object verification/adoption requests; +Complete/Tick/Fail -> cut_progress_window.go; Retry/Publish -> the existing +retained-image and conditional-publication paths in chunk_layer.go. +The CLI's same-request progress observation remains an explicit incomplete +projection in cut-time-resource-grid.tsv; this core slice is not the complete +CLI time-contract fix. Remote adapters must honor cancellation and join owned +workers. Authority, storage durability and conditional HEAD publication are +separate existing proof obligations. + +### Cut CLI observation + +[CutTime r6](cuttime/CutTime.tla) adds completed per-object steps, immediate +manual-cut busy refusal, and one admission POST followed by read-only status +polls using the holder's in-memory cut ID. A restart loses that ID and answers +unknown, while stored immutable work remains adoptable. Only the observed +cut's sequence rises renew the CLI window; a selected deadline stays absolute. +[Configurations](cuttime/cfg), [supplied verdicts](cuttime/recorded-r6/verdicts.txt) +and [recorded coverage](cuttime/recorded-r6/coverage.txt) preserve the model +owner's 30/30 exhaustive results, with no bound verdict. This is not a new +implementation-side model run. CLI, server worker ownership and bounded terminal-handle retention have +focused projection controls; native/race and real CLI qualification remain owed. + +The supplied [CutTime r8b settlement refinement](cuttime/README.md) records +42/42 exhaustive outcomes, including four safe configurations and the +NoFalseFailure / settlement-sequence mutants. A lost manual publish answer +is settled inside the same progress window; completed reads renew both the +worker and its observed sequence. Only unanswered settlement ends unknown. +The checked-in verdicts are supplied model evidence, not a local rerun. diff --git a/seaweed-block/docs/spec/cuttime/CutTime.tla b/seaweed-block/docs/spec/cuttime/CutTime.tla new file mode 100644 index 0000000000..facd14b7b2 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/CutTime.tla @@ -0,0 +1,484 @@ +------------------------------ MODULE CutTime ------------------------------ +(***************************************************************************) +(* CutTime r8c: (1) a *) +(* settlement read that sees a FOREIGN HEAD (owner changed) is terminal *) +(* and not progress: landed -> published, else typed fenced (a definite *) +(* failure); never renew and retry (NoRetryAfterFence). (2) an INHERITED *) +(* pending proposal is settled before this call's own work and is never *) +(* this call's result (OwnResult). Mutants "fence_renews", *) +(* "inherited_as_own". *) +(* CutTime r8: the publish (HEAD write) *) +(* answer can be lost; it may or may not have landed. The worker settles *) +(* it itself (read-back) inside the window: landed -> published; not *) +(* landed -> the publish is retried, the uploads kept. Only a settlement *) +(* with no progress for W ends typed unknown. Never a failure once a *) +(* publish may have landed (NoFalseFailure). Mutants "settle_as_failed", *) +(* "settle_skip". *) +(* CutTime r7: Kind = "detach", a *) +(* plain detach waiting on its final cut. It is never refused cut_busy. *) +(* - A running SCHEDULED cut is PREEMPTED: cancelled, its completed *) +(* uploads stay staged and the detach's final cut reuses them. *) +(* - Behind a running MANUAL cut it WAITS; its sequence rises with each *) +(* completed step of that cut AND at that cut's end (either outcome), *) +(* then with its own final cut's steps, so the stop CLI keeps renewing. *) +(* The blocking cut has its own window W. *) +(* - Its own window starts when its own final cut is admitted. *) +(* A reserved detach slot (N = 4 cuts + 1 detach) is projection, not *) +(* state. Mutants: "queued_no_renew" (no rise while waiting), *) +(* "preempt_manual", "preempt_loses_uploads". *) +(* CutTime r6: the poll's *) +(* cut handle. A manual cut's handle is kept by cut id from admission; *) +(* once the cut ended it is retired ONLY when it has aged Wc (the *) +(* request's own CLI window), never on sending the terminal answer (a *) +(* reply can be lost and the CLI polls again) and never by a later cut. *) +(* At a per-volume cap a new manual cut is refused, retryable; nothing is *) +(* evicted (cap not modelled: refusals touch no state here). *) +(* CutTime r5: read-only polling replaces resubmission. *) +(* After CutWindow r1, cuts have no request id or *) +(* receipt, so the CLI POLLS a read-only status by the cut's in-memory id *) +(* (never re-POSTs: a re-POST would meet its own cut's lock as cut_busy). *) +(* A holder restart loses the id: the poll answers "unknown cut id" and *) +(* the CLI exits unknown (the steps stay in the store and are adopted by *) +(* a later cut). The V3 time contract for a cut and for the CLI *) +(* that waits on it. A cut works through U per-object steps of its own *) +(* set, fixed at the barrier (a payload upload, or a verification lookup *) +(* or adoption of one object), one request at a time, then *) +(* publishes. *) +(* - A MANUAL cut that finds another cut holding the volume's capture *) +(* lock does not queue: it is refused at once, typed cut_busy {running *) +(* cut id}, retryable. Otherwise it is admitted, and its *) +(* window starts at admission. Internal scheduled cuts keep their *) +(* queue (not modelled). *) +(* - Each request has its own per-call deadline P: a request that does *) +(* not answer is cancelled and retried later, never left running. *) +(* - The cut's no-progress window W_cut (W) is renewed ONLY by a *) +(* completed per-object step of this cut, once per object per attempt. *) +(* W steps with none fail the attempt, typed cut_stalled. NO total *) +(* bound. *) +(* - The cut call, then each CLI poll by cut id, is answered with the *) +(* terminal result (published, cut_stalled, cut_busy, unknown cut id) *) +(* or in_progress {cut id, sequence}. Only a rise of the *) +(* sequence renews the CLI's window Wc; no rise or no answer for Wc *) +(* gives exit unknown. --deadline DL (0 = none) is absolute. *) +(* - Prompt: TRUE, the server answers as soon as the sequence rises (or *) +(* the cut ended), else at the latest W after the request: then *) +(* Wc = W + slack suffices. FALSE needs Wc = 2W + slack. *) +(* - After the CLI answered, the background schedule retries a failed or *) +(* cancelled cut with the steps already done kept. *) +(* - P is the bound VolDelSweep's resweep window derives from. *) +(* *) +(* Break = "none", or ONE of: *) +(* "total_cap" a total bound around the cut (today's 5 min) *) +(* "attempt_renews" sending a request renews the window *) +(* "timeout_renews" a cancelled request renews the window *) +(* "window_not_reset" a completed step does not renew the window *) +(* "no_call_deadline" a request that does not answer stays in *) +(* flight *) +(* "retry_loses_progress" a retry starts the steps over *) +(* "cli_total_timeout" the CLI's --timeout is a total bound *) +(* "cli_no_window" only the server times out *) +(* "global_renews" a process-global counter renews the CLI *) +(* "cli_no_slack" the CLI's window equals W_cut *) +(* "queued_stalls" a manual cut queues behind the lock holder *) +(* with its window running, and answers *) +(* cut_stalled *) +(* "busy_when_free" cut_busy answered while no cut holds the lock *) +(* "repost" the CLI re-POSTs instead of polling: its own *) +(* running cut answers it cut_busy *) +(* "restart_as_failed" a holder restart answers cut_stalled (a *) +(* failure) instead of unknown *) +(* "forget_on_send" the handle is dropped when the terminal *) +(* answer is sent *) +(* "overwrite_next" a later manual cut overwrites the handle *) +(* "retire_early" the handle is retired before it aged Wc (a *) +(* guessed TTL) *) +(* and the cfg row mut_answer_late: Prompt = FALSE with Wc = W + 1. *) +(* *) +(* Bounded by construction: done and ever subsets of 1..U, inflight 0..U, *) +(* age 0..P+1, since 0..W, real 0..W+1, pollAge 0..W, lastSeq 0..U, *) +(* cliSince and realCli 0..Wc+1, total 0..TCap, attempts 1..MaxAtt; the *) +(* rest phases and Booleans. *) +(***************************************************************************) +EXTENDS Integers, FiniteSets + +CONSTANTS U, W, Wc, P, CapT, TCap, MaxAtt, DL, Prompt, Break, Kind, K + +Ups == 1..U +VARIABLES phase, done, ever, inflight, hung, age, since, real, total, attempts, other, + cli, link, pollOut, pollAge, lastSeq, cliSince, realCli, + early, cliEarly, linkLost, timedOutOnce, failedOnce, stallQueued, busyFalse, restarted, busyOwn, + handle, hAge, lostOnce, otherSteps, osince, queuedOnce, otherDone, manualPreempted, landed, landedEver, settleStalled, falseFail, + settleSteps, foreign, fencedSeen, inherited, inheritedLanded, inhSettled, ownPublished +vars == <> +\* restarted ... queuedOnce sit in both groups: every action that does not name them keeps them +cliVars == <> +restVars == <> +Ended == phase \in {"published", "failed", "unknownOutcome", "fenced"} +Min2(a, b) == IF a < b THEN a ELSE b +Waiting == cli = "waiting" +\* the request's sequence: its own cut's completed steps; for a queued detach also the blocking cut's (r7) +Seq == Cardinality(done) + (IF Break = "queued_no_renew" THEN 0 ELSE otherSteps) + + (IF Break = "settle_no_rise" THEN 0 ELSE settleSteps) \* (r8 BFS) a completed read-back renews AND rises + + (IF inhSettled THEN 1 ELSE 0) \* (r8c) settling an inherited proposal is a step too +DetachQ == Kind = "detach" /\ phase = "admitting" /\ other = "manual" \* a detach waiting behind a running MANUAL cut +OtherDue == DetachQ /\ osince >= W \* the blocking cut's own window ran out +CliWin == IF Break = "cli_no_slack" THEN W ELSE Wc +Terminal == phase \in {"published", "failed", "busy", "lost", "unknownOutcome", "fenced"} +Queued == phase = "admitting" /\ Break = "queued_stalls" + +Init == /\ phase = "admitting" /\ done = {} /\ ever = {} /\ inflight = 0 /\ hung = FALSE /\ age = 0 + /\ since = 0 /\ real = 0 /\ total = 0 /\ attempts = 1 /\ other \in {"none", "scheduled", "manual"} + \* a running scheduled cut may already have completed some uploads (staged, reusable) + /\ otherDone \in (IF Kind = "detach" /\ other = "scheduled" THEN SUBSET Ups ELSE {{}}) /\ manualPreempted = FALSE + /\ landed = FALSE /\ landedEver = FALSE /\ settleStalled = FALSE /\ falseFail = FALSE /\ settleSteps = 0 + \* (r8c) an earlier cut may have left an uncertain proposal pending; whether it landed is unknown to this call + /\ foreign = FALSE /\ fencedSeen = FALSE /\ inherited \in {"none", "pending"} /\ inheritedLanded \in BOOLEAN + /\ inhSettled = FALSE /\ ownPublished = FALSE + /\ cli = "waiting" /\ link = "up" /\ pollOut = TRUE /\ pollAge = 0 /\ lastSeq = 0 /\ cliSince = 0 /\ realCli = 0 + /\ early = FALSE /\ cliEarly = FALSE /\ linkLost = FALSE /\ timedOutOnce = FALSE /\ failedOnce = FALSE + /\ stallQueued = FALSE /\ busyFalse = FALSE /\ restarted = FALSE /\ busyOwn = FALSE + /\ handle = "none" /\ hAge = 0 /\ lostOnce = FALSE /\ otherSteps = 0 /\ osince = 0 /\ queuedOnce = FALSE + +\* ---- admission of the manual cut, or of a detach's final cut ---- +\* no other cut holds the capture lock: admitted; the window starts here +Admit == /\ phase = "admitting" /\ other = "none" /\ phase' = "uploading" /\ handle' = "held" + /\ since' = 0 /\ real' = 0 + /\ UNCHANGED <> + /\ UNCHANGED <> +\* (r7) the cut a queued detach waits on completes a step: its own window renews, and the detach's sequence rises +OtherStep == /\ DetachQ /\ otherSteps < K + /\ otherSteps' = otherSteps + 1 /\ osince' = 0 + /\ UNCHANGED <> + /\ UNCHANGED <> +\* another cut holds it: a manual cut is refused at once, typed cut_busy {running cut id}, retryable (a detach queues) +Busy == /\ phase = "admitting" /\ Break # "queued_stalls" /\ Kind = "cut" + /\ other # "none" \/ Break = "busy_when_free" + /\ phase' = "busy" /\ busyFalse' = (busyFalse \/ other = "none") + /\ UNCHANGED <> /\ UNCHANGED cliVars +\* (r7) a detach admission cancels a running SCHEDULED cut; its completed uploads stay staged and are reused +\* (mutants: the preempted cut's uploads are lost; a running MANUAL cut is preempted) +Preempt == /\ Kind = "detach" /\ phase = "admitting" + /\ other = "scheduled" \/ (Break = "preempt_manual" /\ other = "manual") + /\ other' = "none" /\ manualPreempted' = (manualPreempted \/ other = "manual") + /\ done' = (IF Break = "preempt_loses_uploads" THEN done ELSE done \cup otherDone) + /\ ever' = ever \cup otherDone + /\ UNCHANGED <> + /\ UNCHANGED <> +\* the other cut ends (published or failed) and releases the lock; for a detach waiting on it, that end is +\* progress of the work it waits on, so its sequence rises (else the CLI sees no rise for the blocker's last W +\* plus its own first step: up to 2W) +OtherEnd == /\ other # "none" /\ other' = "none" + /\ otherSteps' = (IF DetachQ THEN otherSteps + 1 ELSE otherSteps) + /\ UNCHANGED <> + /\ UNCHANGED <> + +\* ---- the cut ---- +\* a request for step u is sent; it may hang (no answer) +Start(u) == /\ phase = "uploading" /\ inflight = 0 /\ u \notin done + /\ inflight' = u /\ age' = 0 /\ hung' \in BOOLEAN + /\ since' = (IF Break = "attempt_renews" THEN 0 ELSE since) + /\ UNCHANGED <> /\ UNCHANGED cliVars + +\* the step completes: done and kept, the cut's window renewed +Complete == /\ phase = "uploading" /\ inflight # 0 /\ ~hung + /\ done' = done \cup {inflight} /\ ever' = ever \cup {inflight} /\ inflight' = 0 /\ age' = 0 + /\ since' = (IF Break = "window_not_reset" THEN since ELSE 0) + /\ real' = 0 + /\ UNCHANGED <> /\ UNCHANGED cliVars + +\* the per-call deadline cancels a request that has not answered; it is retried later +CallTimeout == /\ phase = "uploading" /\ inflight # 0 /\ age >= P /\ Break # "no_call_deadline" + /\ inflight' = 0 /\ age' = 0 /\ hung' = FALSE /\ timedOutOnce' = TRUE + /\ since' = (IF Break = "timeout_renews" THEN 0 ELSE since) + /\ UNCHANGED <> /\ UNCHANGED cliVars + +\* (r8c) an inherited pending proposal is settled BEFORE this call's own work; its outcome is never this call's result +\* (mutant inherited_as_own: a landed inherited proposal is returned as this call's published cut) +SettleInherited == /\ phase = "uploading" /\ inherited = "pending" /\ inflight = 0 + /\ inherited' = "none" /\ inhSettled' = TRUE /\ since' = 0 /\ real' = 0 + /\ phase' = (IF Break = "inherited_as_own" /\ inheritedLanded THEN "published" ELSE "uploading") + /\ UNCHANGED <> + /\ UNCHANGED <> + +\* every step done: the HEAD write publishes the cut, and its answer arrives (only after any inherited proposal is settled) +Publish == /\ phase = "uploading" /\ inflight = 0 /\ done = Ups /\ inherited = "none" /\ phase' = "published" + /\ ownPublished' = TRUE + /\ UNCHANGED <> + /\ UNCHANGED <> + +\* (r8) the HEAD write's answer is lost: it may or may not have landed. The worker settles it itself +\* (mutants: report it failed at once; report unknown without settling) +PublishLost == /\ phase = "uploading" /\ inflight = 0 /\ done = Ups /\ settleSteps < 2 \* bounded: at most 2 lost answers + /\ inherited = "none" + /\ landed' \in BOOLEAN /\ landedEver' = (landedEver \/ landed') + /\ foreign' \in BOOLEAN \* (r8c) the owner may have changed meanwhile (a fencing takeover) + /\ phase' = (IF Break = "settle_as_failed" THEN "failed" + ELSE IF Break = "settle_skip" THEN "unknownOutcome" ELSE "settling") + /\ UNCHANGED <> + /\ UNCHANGED <> +\* the settlement's read-back answers (a completed step: the window renews): landed -> published; not landed -> +\* the publish is retried, the uploads kept. (r8c) A FOREIGN HEAD (the owner changed) is terminal and no progress: +\* landed -> published; not landed -> typed fenced, a definite failure (it can never land). Mutant fence_renews: +\* a foreign not-landed read renews and retries. +Settle == /\ phase = "settling" + /\ phase' = (IF landed THEN "published" + ELSE IF foreign /\ Break # "fence_renews" THEN "fenced" ELSE "uploading") + /\ fencedSeen' = (fencedSeen \/ foreign) + /\ ownPublished' = (ownPublished \/ landed) + /\ IF foreign /\ Break # "fence_renews" + THEN UNCHANGED <> + ELSE since' = 0 /\ real' = 0 /\ settleSteps' = settleSteps + 1 \* the same step report renews and rises + /\ UNCHANGED <> + /\ UNCHANGED <> +\* the settlement makes no progress for W (the store does not answer): the outcome stays typed unknown +SettleStall == /\ phase = "settling" /\ since >= W + /\ phase' = "unknownOutcome" /\ settleStalled' = TRUE + /\ UNCHANGED <> + /\ UNCHANGED <> + +\* W steps with no completed step (or, in the mutant, the total bound): cut_stalled +CapDue == Break = "total_cap" /\ total >= CapT +Fail == /\ phase = "uploading" \/ Queued + /\ since >= W \/ CapDue + /\ phase' = "failed" /\ inflight' = 0 /\ age' = 0 /\ hung' = FALSE /\ failedOnce' = TRUE + /\ early' = (early \/ real < W) + /\ stallQueued' = (stallQueued \/ phase = "admitting") + /\ UNCHANGED <> /\ UNCHANGED cliVars + +\* the holder process restarts: the running cut dies and its in-memory id is gone; the steps already in the store stay +HolderRestart == /\ phase \in {"uploading", "settling"} /\ ~restarted + /\ phase' = (IF Break = "restart_as_failed" THEN "failed" ELSE "lost") + /\ inflight' = 0 /\ age' = 0 /\ hung' = FALSE /\ restarted' = TRUE + /\ UNCHANGED <> + /\ UNCHANGED <> + +\* after the CLI answered, the background schedule retries with the steps already done (adopted from the store) +Retry == /\ phase \in {"failed", "cancelled", "lost", "unknownOutcome"} /\ ~Waiting /\ attempts < MaxAtt + /\ attempts' = attempts + 1 /\ phase' = "uploading" /\ since' = 0 /\ real' = 0 + /\ done' = (IF Break = "retry_loses_progress" THEN {} ELSE done) + /\ UNCHANGED <> /\ UNCHANGED cliVars + +\* ---- the CLI: polls a read-only status by cut id; in_progress {cut id, sequence} or the terminal result ---- +Poll == /\ Waiting /\ ~pollOut /\ pollOut' = TRUE /\ pollAge' = 0 + /\ UNCHANGED restVars /\ UNCHANGED <> + +\* the server answers in_progress with this cut's sequence; only a rise renews the CLI's window +InProgress == /\ Waiting /\ pollOut /\ link = "up" /\ phase \in {"uploading", "admitting", "settling"} + /\ pollOut' = FALSE + /\ IF Seq > lastSeq + THEN lastSeq' = Seq /\ cliSince' = 0 /\ realCli' = 0 + ELSE UNCHANGED <> + /\ UNCHANGED restVars /\ UNCHANGED <> + +\* the CLI's requests stop getting answers (transport or server process gone), and stay so +LinkDrop == /\ Waiting /\ link = "up" /\ link' = "silent" /\ linkLost' = TRUE + /\ UNCHANGED restVars /\ UNCHANGED <> + +\* (mutant) another cut's completed step moves a process-global counter the CLI watches +OtherUpload == /\ Break = "global_renews" /\ Waiting /\ cliSince' = 0 + /\ UNCHANGED restVars /\ UNCHANGED <> + +\* the terminal answers over a live link: exit 0 published; exit 1 cut_stalled; a distinct retryable exit on cut_busy +Justified == real >= W \/ (DL > 0 /\ total >= DL) +CliOk == /\ Waiting /\ pollOut /\ link = "up" /\ phase = "published" /\ handle = "held" /\ cli' = "ok" + /\ UNCHANGED restVars /\ UNCHANGED <> +CliBusy == /\ Waiting /\ pollOut /\ link = "up" /\ phase = "busy" /\ cli' = "busy" + /\ UNCHANGED restVars /\ UNCHANGED <> +\* the holder restarted: the poll answers "unknown cut id"; the CLI exits unknown (the outcome is unknown) +CliUnknownId == /\ Waiting /\ pollOut /\ link = "up" /\ phase = "lost" /\ cli' = "unknown" + /\ UNCHANGED restVars /\ UNCHANGED <> +\* (mutant) the CLI re-POSTs the cut instead of polling: the request meets its own running cut's lock +RepostBusy == /\ Break = "repost" /\ Waiting /\ pollOut /\ link = "up" /\ phase = "uploading" + /\ cli' = "busy" /\ busyOwn' = TRUE + /\ UNCHANGED <> + /\ UNCHANGED <> +\* ---- the handle a poll reads (r6) ---- +\* a terminal answer is sent but lost on the way (the link stays up); the CLI polls again +ReplyLost == /\ Waiting /\ pollOut /\ link = "up" /\ Ended /\ handle = "held" + /\ pollOut' = FALSE /\ lostOnce' = TRUE + /\ handle' = (IF Break = "forget_on_send" THEN "gone" ELSE "held") + /\ UNCHANGED <> + /\ UNCHANGED <> +\* the ended cut's handle is retired once it aged Wc, the request's own CLI window (mutant: any time) +Retire == /\ handle = "held" /\ Ended /\ (hAge >= Wc \/ Break = "retire_early") /\ handle' = "gone" + /\ UNCHANGED <> + /\ UNCHANGED <> +\* (mutant) a later manual cut takes the slot and overwrites the ended cut's handle +OtherManual == /\ Break = "overwrite_next" /\ handle = "held" /\ Ended /\ handle' = "gone" + /\ UNCHANGED <> + /\ UNCHANGED <> +\* the poll finds no handle for the id: "unknown cut id"; the CLI exits unknown +CliGone == /\ Waiting /\ pollOut /\ link = "up" /\ Ended /\ handle = "gone" /\ cli' = "unknown" + /\ UNCHANGED restVars /\ UNCHANGED <> +\* (r8) the settlement stalled: the server's typed outcome-unknown answer; the CLI exits unknown +CliServerUnknown == /\ Waiting /\ pollOut /\ link = "up" /\ phase = "unknownOutcome" /\ handle = "held" /\ cli' = "unknown" + /\ UNCHANGED restVars /\ UNCHANGED <> +\* (r8c) the typed fenced answer: a definite failure (the proposal can never land); judged like cut_stalled +CliFenced == /\ Waiting /\ pollOut /\ link = "up" /\ phase = "fenced" /\ handle = "held" /\ cli' = "fenced" + /\ falseFail' = (falseFail \/ landedEver) + /\ UNCHANGED <> + /\ UNCHANGED <> +CliStalled == /\ Waiting /\ pollOut /\ link = "up" /\ phase = "failed" /\ handle = "held" /\ cli' = "stalled" + /\ cliEarly' = (cliEarly \/ ~Justified) + /\ falseFail' = (falseFail \/ landedEver) \* judged when the CLI answers: its own attempt (Retry needs ~Waiting) + /\ UNCHANGED <> + /\ UNCHANGED <> + +\* no rise of this cut's sequence (or no answer) for the CLI's window: exit typed unknown; the cut is not touched +CliSilentDue == Waiting /\ cliSince >= CliWin /\ Break # "cli_no_window" +CliSilent == /\ CliSilentDue /\ cli' = "unknown" + /\ UNCHANGED restVars /\ UNCHANGED <> + +\* the user's deadline, or (mutant) the --timeout as a total bound: the CLI exits; a live connection cancels the cut +CliDue == /\ Waiting + /\ (DL > 0 /\ total >= DL) \/ (Break = "cli_total_timeout" /\ total >= CapT) +CliGiveUp == /\ CliDue + /\ cli' = (IF DL > 0 /\ total >= DL THEN "deadline" ELSE "timeout") + /\ cliEarly' = (cliEarly \/ ~Justified) + /\ IF phase = "uploading" /\ link = "up" + THEN phase' = "cancelled" /\ inflight' = 0 /\ age' = 0 /\ hung' = FALSE + ELSE UNCHANGED <> + /\ UNCHANGED <> + /\ UNCHANGED <> + +\* ---- time ---- +\* an answer the server owes now: a terminal result; at the latest W after the request; with Prompt, a rise +AnswerDue == /\ Waiting /\ pollOut /\ link = "up" + /\ Terminal \/ pollAge >= W \/ (Prompt /\ Seq > lastSeq) +CliClocks == /\ cliSince' = (IF Waiting THEN Min2(cliSince + 1, Wc + 1) ELSE cliSince) + /\ realCli' = (IF Waiting THEN Min2(realCli + 1, Wc + 1) ELSE realCli) + /\ pollAge' = (IF Waiting /\ pollOut THEN Min2(pollAge + 1, W) ELSE pollAge) + /\ total' = Min2(total + 1, TCap) +\* every party answers its deadlines first; the admission answers at once (no waiting state) +TimeOK == /\ ~CapDue /\ ~CliDue /\ ~CliSilentDue /\ ~AnswerDue /\ ~(Waiting /\ ~pollOut) /\ ~OtherDue + /\ ~(phase = "admitting" /\ Break # "queued_stalls" /\ ~DetachQ) + +\* time passes while the cut works (in the mutant, also while it queues); a queued detach's own window has not started +Tick == /\ phase \in {"uploading", "settling"} \/ Queued \/ DetachQ + /\ since < W /\ TimeOK + /\ inflight = 0 \/ age < P \/ Break = "no_call_deadline" + /\ since' = (IF DetachQ THEN since ELSE since + 1) + /\ real' = (IF DetachQ THEN real ELSE Min2(real + 1, W + 1)) + /\ age' = (IF inflight # 0 THEN Min2(age + 1, P + 1) ELSE age) + /\ osince' = (IF DetachQ THEN Min2(osince + 1, W) ELSE osince) + /\ queuedOnce' = (queuedOnce \/ DetachQ) + /\ CliClocks + /\ UNCHANGED <> + +\* time passes for a CLI whose answer is lost after the cut ended (over a live link the answer comes first) +CliTick == /\ phase \notin {"uploading", "admitting", "settling"} /\ Waiting /\ TimeOK + /\ CliClocks + /\ hAge' = (IF handle = "held" /\ Ended THEN Min2(hAge + 1, Wc) ELSE hAge) + /\ UNCHANGED <> + +Next == \/ Admit \/ Busy \/ OtherEnd \/ OtherStep \/ Preempt + \/ \E u \in Ups : Start(u) + \/ Complete \/ CallTimeout \/ Publish \/ PublishLost \/ Settle \/ SettleStall \/ Fail \/ HolderRestart \/ Retry + \/ Poll \/ InProgress \/ LinkDrop \/ OtherUpload + \/ CliOk \/ CliBusy \/ CliUnknownId \/ RepostBusy \/ CliStalled \/ CliServerUnknown \/ CliSilent \/ CliGiveUp + \/ SettleInherited \/ CliFenced + \/ ReplyLost \/ Retire \/ OtherManual \/ CliGone + \/ Tick \/ CliTick +Spec == Init /\ [][Next]_vars + +\* ---- rules ---- +\* the cut answers cut_stalled only after W steps with no completed step, never on a total bound +NoEarlyFail == ~early +\* no attempt runs past W steps without a completed step (sending or cancelling a request is not progress) +NoSilentStall == phase = "uploading" => real <= W +\* no request outlives its per-call deadline: the bound VolDelSweep's resweep window derives from +NoLongCall == inflight # 0 => age <= P +\* steps done are never lost to a retry +ProgressKept == ever \subseteq done +\* the CLI fails only on cut_stalled after W, or at the deadline the user chose +CliNoEarlyExit == ~cliEarly +\* the CLI never waits past its window without a seen rise of THIS cut's sequence +CliNoSilentWait == Waiting => realCli <= Wc +\* the CLI answers unknown only when its requests really went unanswered, or the holder restarted (the id is gone) +CliUnknownOnlySilent == cli = "unknown" => (linkLost \/ restarted \/ settleStalled) +\* (r8) the CLI never reports a failure once a publish may have landed +NoFalseFailure == ~falseFail +\* (r8c) the CLI's success answer is this call's OWN proposal published, never an inherited one +OwnResult == cli = "ok" => ownPublished +\* (r8c) a settlement that saw a foreign HEAD never retries the publish (fence is terminal, not progress) +NoRetryAfterFence == fencedSeen => phase # "uploading" +\* the CLI never answers cut_busy because of its own running cut (it polls, never re-POSTs) +CliBusyNotOwn == ~busyOwn +\* (r7) a detach never preempts a running MANUAL cut (it waits behind it) +NoManualPreempt == ~manualPreempted +\* a cut that was never admitted never answers cut_stalled (waiting for the lock is not this cut's silence) +NoQueuedStall == ~stallQueued +\* cut_busy only while another cut holds the capture lock +BusyOnlyWhenHeld == ~busyFalse + +\* ---- witnesses ---- +WitSlowNoFail == ~(cli = "ok" /\ total >= TCap /\ ~failedOnce) \* a cut longer than any total bound, progressing: CLI exit 0 +WitTimedOutThenPub == ~(cli = "ok" /\ timedOutOnce) \* a hung request cancelled at P and retried: CLI exit 0 +WitCliStalled == ~(cli = "stalled") \* no progress for W: cut_stalled, CLI exit 1 +WitStalledRetryPub == ~(phase = "published" /\ cli = "stalled") \* the background retry keeps the steps and publishes +WitCliDeadline == ~(cli = "deadline" /\ phase = "cancelled") \* the user's deadline passes: CLI exits, cut cancelled +WitUnknownThenPub == ~(cli = "unknown" /\ phase = "published") \* requests unanswered: CLI unknown, the cut still publishes +WitBusy == ~(cli = "busy") \* another cut holds the lock: cut_busy at once, retryable exit +WitRestartUnknown == ~(cli = "unknown" /\ restarted /\ ~linkLost) \* the holder restarted: unknown cut id, CLI unknown over a live link +WitLostReplyThenOk == ~(cli = "ok" /\ lostOnce) \* the terminal reply was lost; the next poll still finds the handle +WitDetachAfterQueue == ~(cli = "ok" /\ queuedOnce /\ otherSteps >= 2) \* a detach waited behind a manual cut through its steps and end, then done +WitPreemptReuse == ~(cli = "ok" /\ otherDone # {} /\ Kind = "detach") \* a detach preempted a scheduled cut and reused its staged uploads +WitSettleThenOk == ~(cli = "ok" /\ landedEver) \* a lost publish answer that landed, settled by read-back: CLI exit 0 +WitSettleUnknown == ~(cli = "unknown" /\ settleStalled /\ ~linkLost /\ ~restarted) \* the settlement stalled for W: typed unknown over a live link +WitFenced == ~(cli = "fenced") \* a lost answer, a foreign HEAD, not landed: typed fenced +WitInheritedThenOwn == ~(cli = "ok" /\ inhSettled /\ inheritedLanded) \* an inherited proposal had landed; this call still published its own +============================================================================= diff --git a/seaweed-block/docs/spec/cuttime/README.md b/seaweed-block/docs/spec/cuttime/README.md new file mode 100644 index 0000000000..661e1def01 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/README.md @@ -0,0 +1,80 @@ +# CutTime r8c + +The supplied r8c refinement makes foreign-HEAD settlement terminal (NoRetryAfterFence) +and separates inherited recovery from the current invocation's result (OwnResult). +Its exhaustive BFS verdicts are preserved in `recorded-r8c/RESULT.txt`: 46/46, +four safe configurations, all expected mutant violations and witnesses, no bound. +No new local model run is claimed. The earlier r8b evidence remains recorded. + +Projection: `captureManualCut` settles an inherited proposal before calling +`captureInvocationLocked` for its own barrier. Each proposal records its creating +invocation's process-local tag; only that tag's landed proposal can answer this +call. A completed inherited settlement is one sequence/window step, never this +call's result. Failed inherited reads do not renew either. Own-proposal settlement +reads renew and rise only while publication authority is retained. A foreign HEAD +is terminal without renewal: a proved landed proposal returns its result; +otherwise the answer is definite `fenced`, without another publish attempt. +Unanswered settlement ends `outcome_unknown`, never `cut_stalled`. + +`TestManualCutForeignHeadFenceTerminatesSettlement` proves authoritative fencing +ends the worker and releases capture without foreign-read sequence renewal. +`TestManualCutInheritedPublicationCannotReplaceItsOwnBarrier` proves the completed +inherited step precedes the new barrier and cannot replace its result. +`TestManualCutPendingProposalsHaveDistinctInvocationTags` distinguishes inherited +and newly uncertain proposals. Landed/unapplied lost-answer, silence and CLI +terminal-unknown controls remain in place. The registered worker follows control +and layer cancellation and joins before close. Native/race qualification is owed. + +## Earlier r6 handle projection + +The model covers completed own-object steps, per-call deadlines, inactivity +windows, immediate capture-busy refusal, and one admission POST followed by +read-only polling. The running cut belongs to the control lifetime. A holder +restart loses its in-memory identity without claiming that publication failed. + +A manual handle survives from admission until its terminal answer has aged +its own Wc. Sending the answer never removes it; a later cut never overwrites +it. Four manual handles per volume bound the implementation. Capacity refusal +is immediate `cut_busy` with reason `handles_full`, with no eviction. Scheduled +cuts have no polling handles. The capacity number is a projection bound; +retention and lost-answer behavior are modeled by Retire and ReplyLost. + +`recorded-r6` preserves the supplied 30/30 exhaustive results, no bound verdict. +Safe configurations explored 18,019, 43,899 and 30,139 states. All 18 mutants +violated their intended invariants; all nine witnesses were reached. These are +supplied results, not a new implementation-side model run. Only provenance +comments and host labels were edited for publication. + +Projection: `manual_cut.go` implements Admit, InProgress, Poll, Retire and +terminal observation; the control root cancels and joins admitted workers. +`chunk_manual_cut.go` provides immediate capture admission and Busy identity. +`cut_progress_window.go` counts completed own-object steps without renewing +on reads. `TestManualCutHandlesKeepLostTerminalRepliesUntilTheirOwnWindow`, +`TestManualCutHTTPReturnsHandleAndCloseJoinsWorker`, +`TestManualCutBusyNamesTheRunningCaptureWithoutQueueing` and +`TestManualCutObserverCancellationDoesNotCancelAdmittedWork` cover retention, +restart, cancellation and admission. Native/race and real CLI qualification +remain owed; the PR remains Draft. + +Every manual POST enters the handle path; the observe opt-in and synchronous compatibility branch are removed. The CLI only polls after 202 and accepts a v1.0 holder's terminal answer directly. Upload and successful own-object verification completions share the same sequence/window update; `timeoutMs` supplies the observed cut's own window. + +Server boundary witnesses: `TestManualCutBusyNamesTheRunningCaptureWithoutQueueing` uses the real provider; `TestManualCutHTTPRetentionUsesUncappedClientWindow` keeps an HTTP handle through a ten-minute window plus slack (a five-minute-retention mutant fails); `TestManualCutServerCloseCancelsCaptureBeforeJoiningSnapshot` closes the actual server while a real snapshot waits behind the observed cut. Both workers join after the shared operation root is canceled. + +`TestManualCutRealAdmissionCloseRaceJoinsBothSidesOfReservation` gates the real provider before and after capture reservation, closes the server while admission is registered, and proves the reservation can be acquired again after joining. `TestManualCutRealPostGetReportsPromptOwnProgress` exercises production POST/GET with real uploads, same-id nondecreasing sequence, a prompt initial progress answer, and the terminal result. + +Default-route controls: `TestManualCutDefaultPostUsesHandleAndPromptProgress` proves a field-free POST allocates a handle and returns progress. `TestManualCutExplicitDeadlineCancelsTheHandleWorker` proves only the selected absolute deadline ends its owned work. `TestCutCLILegacyTerminalAnswerNeedsNoPolling` proves a terminal answer completes without polling or an opt-in field. + +Every cut response carries integer `apiVersion: 1`, including POST progress/terminal/refusal and GET status/unknown-ID answers. Requests accept no version field: there is no negotiation handshake. Compatibility is one direction: a newer CLI supports holders at its own response version N and N-1 (today 1 and 0); an older CLI refuses a newer holder. A valid unversioned synchronous 200 from an initial POST remains the v1.0 fallback; all other missing, malformed or unsupported versions return `unsupported_api_version`, naming the server and CLI versions, without another POST. This is a local protocol refusal and does not establish the cut outcome. An unsupported response always exits 3 (unknown), still typed `unsupported_api_version`: HTTP status cannot prove non-admission. Only a supported, explicit admission refusal can establish failure; no protocol-error path posts again. `TestManualCutAPIVersionCoversEveryCutAnswer`, `TestCutCLINewerClientAcceptsOwnAndOneOlderHolder`, `TestCutCLIOlderClientRefusesNewerHolder`, `TestCutCLIUnsupportedVersionNeverStartsAnotherCut` and the legacy-terminal control cover the boundary. CutTime remains r8c; no persisted format or lifecycle change. + +`TestManualCutInheritedSettlementRenewsBeforeOwnWorkExceedsTheWindow` covers +both initial inherited recovery and its retry path: recovery and the own upload +each take 600 ms with W=1 s, while their sum exceeds W. The own barrier sees +sequence 1, then the upload completes with a live window. Removing inherited +progress credit fails both cases; the production worker is restored afterward. + +CLI output controls use valid terminal answers (volume, cut position and HEAD +generation). A body at the response limit is relayed whole; an over-limit or +unreceived admission answer remains unknown, since publication may have occurred. +Typed terminal refusals and stdout write failures also report their causes on +stderr. The five `TestOpsChunk_*` output/request controls retain these proofs +under the polling protocol; no transport failure starts another cut. diff --git a/seaweed-block/docs/spec/cuttime/cfg/EXPECTED.txt b/seaweed-block/docs/spec/cuttime/cfg/EXPECTED.txt new file mode 100644 index 0000000000..f828c6b574 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/cfg/EXPECTED.txt @@ -0,0 +1,44 @@ +CutTime r8b (a lost publish answer settled by read-back; r2.942; detach: preempt a scheduled cut, wait behind a manual one; r2.939, r2.938; the poll handle; r2.931, r2.929): U = 2 per-object steps, W = 3 window steps, P = 2 per-call deadline, MaxAtt = 2; mutants' total bound CapT = 4; total capped at TCap = 4; DL = 0 (none) or 3 (deadline rows); Prompt = TRUE with Wc = 4 unless stated; every row starts with no other cut, a running scheduled cut, or a running manual cut; Kind = cut unless stated; K = 2 +safe_cut OK (NoEarlyFail, NoSilentStall, NoLongCall, ProgressKept, CliNoEarlyExit, CliNoSilentWait, CliUnknownOnlySilent, NoQueuedStall, BusyOnlyWhenHeld, CliBusyNotOwn, NoManualPreempt, NoFalseFailure) +safe_cut_deadline OK (the same rules, with the user's absolute deadline DL = 3) +safe_detach OK (the same rules, Kind = detach: preempts a scheduled cut, waits behind a manual one) +safe_cut_late OK (the same rules; Prompt = FALSE, the server answers only within W, with Wc = 7 = 2W + 1) +mut_answer_late CliUnknownOnlySilent (Prompt = FALSE with Wc = 4: a rise waits for a held request, unknown over a live link) +mut_total_cap NoEarlyFail (a total bound around the upload loop fails a cut that is still completing uploads) +mut_attempt_renews NoSilentStall (sending a request renews the window: a hung store keeps the cut silent past W) +mut_timeout_renews NoSilentStall (a cancelled request renews the window: the same) +mut_window_not_reset NoEarlyFail (a completed upload does not renew the window: cut_stalled right after progress) +mut_no_call_deadline NoLongCall (an upload request that does not answer stays in flight past P) +mut_retry_loses_progress ProgressKept (a retry starts the uploads over) +mut_cli_total_timeout CliNoEarlyExit (the CLI's --timeout as a total bound exits on a progressing cut) +mut_cli_no_window CliNoSilentWait (only the server times out: with requests unanswered the CLI waits past its window) +mut_global_renews CliNoSilentWait (a process-global counter renews the CLI's window: it waits on a dead transport) +mut_cli_no_slack CliUnknownOnlySilent (the CLI's window equals W_cut: unknown over a live link as cut_stalled arrives) +mut_queued_stalls NoQueuedStall (a manual cut queues behind the lock holder with its window running: cut_stalled, never admitted) +mut_busy_when_free BusyOnlyWhenHeld (cut_busy answered while no cut holds the lock) +mut_repost CliBusyNotOwn (the CLI re-POSTs instead of polling: its own running cut answers cut_busy) +mut_restart_as_failed CliNoEarlyExit (a holder restart answers cut_stalled instead of unknown) +mut_forget_on_send CliUnknownOnlySilent (the handle is dropped when the terminal answer is sent; the reply is lost; the next poll answers unknown) +mut_overwrite_next CliUnknownOnlySilent (a later manual cut overwrites the ended cut's handle) +mut_retire_early CliUnknownOnlySilent (the handle is retired before it aged Wc) +mut_queued_no_renew CliUnknownOnlySilent (detach: its sequence does not rise while it waits behind a manual cut; the stop CLI gives up over a live link) +mut_preempt_manual NoManualPreempt (detach: a running manual cut is preempted) +mut_preempt_loses_uploads ProgressKept (detach: the preempted scheduled cut's staged uploads are lost) +mut_settle_as_failed CliNoEarlyExit or NoFalseFailure (a lost publish answer reported as cut_stalled at once, though it may have landed) +mut_settle_as_failed_nff NoFalseFailure (the same mutant, single-rule cfg) +mut_settle_skip CliUnknownOnlySilent (a lost publish answer reported unknown at once, with no settlement) +mut_settle_no_rise CliUnknownOnlySilent (a completed read-back renews the server window but does not raise the CLI's sequence: the r8 az1 counterexample) +wit_slow_no_fail reached (longer than the total bound, progressing: CLI exit 0, no failure) +wit_timed_out_then_pub reached (a hung upload cancelled at P and retried: CLI exit 0) +wit_cli_stalled reached (no progress for W: cut_stalled, CLI exit 1) +wit_stalled_retry_pub reached (after cut_stalled, the background retry keeps the uploads done and publishes) +wit_cli_deadline reached (the user's deadline passes: the CLI exits, the cut is cancelled) +wit_unknown_then_pub reached (requests unanswered: CLI unknown after Wc; the cut still publishes) +wit_busy reached (another cut holds the lock: cut_busy at once, the CLI's retryable exit) +wit_restart_unknown reached (the holder restarts: the poll answers unknown cut id, the CLI exits unknown over a live link) +wit_lost_reply_then_ok reached (the terminal reply is lost; the next poll finds the handle; CLI exit 0) +wit_detach_after_queue reached (detach: waited behind a manual cut through its steps and its end, renewed by them, then done) +wit_preempt_reuse reached (detach: preempted a scheduled cut and reused its staged uploads, CLI exit 0) +wit_settle_then_ok reached (the publish answer was lost but it landed; the read-back settles it: CLI exit 0) +wit_settle_unknown reached (the settlement makes no progress for W: typed unknown over a live link) +Each config runs under timeout 1800 (run.sh); BOUND on expiry, never OK. diff --git a/seaweed-block/docs/spec/cuttime/cfg/mut_answer_late.cfg b/seaweed-block/docs/spec/cuttime/cfg/mut_answer_late.cfg new file mode 100644 index 0000000000..704133f94a --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/cfg/mut_answer_late.cfg @@ -0,0 +1,28 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + Wc = 4 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + DL = 0 + Prompt = FALSE + Break = "none" + Kind = "cut" + K = 2 +INVARIANT NoEarlyFail +INVARIANT NoSilentStall +INVARIANT NoLongCall +INVARIANT ProgressKept +INVARIANT CliNoEarlyExit +INVARIANT CliNoSilentWait +INVARIANT CliUnknownOnlySilent +INVARIANT NoQueuedStall +INVARIANT BusyOnlyWhenHeld +INVARIANT CliBusyNotOwn +INVARIANT NoManualPreempt +INVARIANT NoFalseFailure +INVARIANT OwnResult +INVARIANT NoRetryAfterFence diff --git a/seaweed-block/docs/spec/cuttime/cfg/mut_attempt_renews.cfg b/seaweed-block/docs/spec/cuttime/cfg/mut_attempt_renews.cfg new file mode 100644 index 0000000000..1ff6348479 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/cfg/mut_attempt_renews.cfg @@ -0,0 +1,28 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + Wc = 4 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + DL = 0 + Prompt = TRUE + Break = "attempt_renews" + Kind = "cut" + K = 2 +INVARIANT NoEarlyFail +INVARIANT NoSilentStall +INVARIANT NoLongCall +INVARIANT ProgressKept +INVARIANT CliNoEarlyExit +INVARIANT CliNoSilentWait +INVARIANT CliUnknownOnlySilent +INVARIANT NoQueuedStall +INVARIANT BusyOnlyWhenHeld +INVARIANT CliBusyNotOwn +INVARIANT NoManualPreempt +INVARIANT NoFalseFailure +INVARIANT OwnResult +INVARIANT NoRetryAfterFence diff --git a/seaweed-block/docs/spec/cuttime/cfg/mut_busy_when_free.cfg b/seaweed-block/docs/spec/cuttime/cfg/mut_busy_when_free.cfg new file mode 100644 index 0000000000..611c40fef1 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/cfg/mut_busy_when_free.cfg @@ -0,0 +1,28 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + Wc = 4 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + DL = 0 + Prompt = TRUE + Break = "busy_when_free" + Kind = "cut" + K = 2 +INVARIANT NoEarlyFail +INVARIANT NoSilentStall +INVARIANT NoLongCall +INVARIANT ProgressKept +INVARIANT CliNoEarlyExit +INVARIANT CliNoSilentWait +INVARIANT CliUnknownOnlySilent +INVARIANT NoQueuedStall +INVARIANT BusyOnlyWhenHeld +INVARIANT CliBusyNotOwn +INVARIANT NoManualPreempt +INVARIANT NoFalseFailure +INVARIANT OwnResult +INVARIANT NoRetryAfterFence diff --git a/seaweed-block/docs/spec/cuttime/cfg/mut_cli_no_slack.cfg b/seaweed-block/docs/spec/cuttime/cfg/mut_cli_no_slack.cfg new file mode 100644 index 0000000000..ec73971e7a --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/cfg/mut_cli_no_slack.cfg @@ -0,0 +1,28 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + Wc = 4 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + DL = 0 + Prompt = TRUE + Break = "cli_no_slack" + Kind = "cut" + K = 2 +INVARIANT NoEarlyFail +INVARIANT NoSilentStall +INVARIANT NoLongCall +INVARIANT ProgressKept +INVARIANT CliNoEarlyExit +INVARIANT CliNoSilentWait +INVARIANT CliUnknownOnlySilent +INVARIANT NoQueuedStall +INVARIANT BusyOnlyWhenHeld +INVARIANT CliBusyNotOwn +INVARIANT NoManualPreempt +INVARIANT NoFalseFailure +INVARIANT OwnResult +INVARIANT NoRetryAfterFence diff --git a/seaweed-block/docs/spec/cuttime/cfg/mut_cli_no_window.cfg b/seaweed-block/docs/spec/cuttime/cfg/mut_cli_no_window.cfg new file mode 100644 index 0000000000..5282a10949 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/cfg/mut_cli_no_window.cfg @@ -0,0 +1,28 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + Wc = 4 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + DL = 0 + Prompt = TRUE + Break = "cli_no_window" + Kind = "cut" + K = 2 +INVARIANT NoEarlyFail +INVARIANT NoSilentStall +INVARIANT NoLongCall +INVARIANT ProgressKept +INVARIANT CliNoEarlyExit +INVARIANT CliNoSilentWait +INVARIANT CliUnknownOnlySilent +INVARIANT NoQueuedStall +INVARIANT BusyOnlyWhenHeld +INVARIANT CliBusyNotOwn +INVARIANT NoManualPreempt +INVARIANT NoFalseFailure +INVARIANT OwnResult +INVARIANT NoRetryAfterFence diff --git a/seaweed-block/docs/spec/cuttime/cfg/mut_cli_total_timeout.cfg b/seaweed-block/docs/spec/cuttime/cfg/mut_cli_total_timeout.cfg new file mode 100644 index 0000000000..a231a2d50b --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/cfg/mut_cli_total_timeout.cfg @@ -0,0 +1,28 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + Wc = 4 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + DL = 0 + Prompt = TRUE + Break = "cli_total_timeout" + Kind = "cut" + K = 2 +INVARIANT NoEarlyFail +INVARIANT NoSilentStall +INVARIANT NoLongCall +INVARIANT ProgressKept +INVARIANT CliNoEarlyExit +INVARIANT CliNoSilentWait +INVARIANT CliUnknownOnlySilent +INVARIANT NoQueuedStall +INVARIANT BusyOnlyWhenHeld +INVARIANT CliBusyNotOwn +INVARIANT NoManualPreempt +INVARIANT NoFalseFailure +INVARIANT OwnResult +INVARIANT NoRetryAfterFence diff --git a/seaweed-block/docs/spec/cuttime/cfg/mut_fence_renews.cfg b/seaweed-block/docs/spec/cuttime/cfg/mut_fence_renews.cfg new file mode 100644 index 0000000000..178a4f9e8f --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/cfg/mut_fence_renews.cfg @@ -0,0 +1,28 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + Wc = 4 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + DL = 0 + Prompt = TRUE + Break = "fence_renews" + Kind = "cut" + K = 2 +INVARIANT NoEarlyFail +INVARIANT NoSilentStall +INVARIANT NoLongCall +INVARIANT ProgressKept +INVARIANT CliNoEarlyExit +INVARIANT CliNoSilentWait +INVARIANT CliUnknownOnlySilent +INVARIANT NoQueuedStall +INVARIANT BusyOnlyWhenHeld +INVARIANT CliBusyNotOwn +INVARIANT NoManualPreempt +INVARIANT NoFalseFailure +INVARIANT OwnResult +INVARIANT NoRetryAfterFence diff --git a/seaweed-block/docs/spec/cuttime/cfg/mut_forget_on_send.cfg b/seaweed-block/docs/spec/cuttime/cfg/mut_forget_on_send.cfg new file mode 100644 index 0000000000..517549746e --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/cfg/mut_forget_on_send.cfg @@ -0,0 +1,28 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + Wc = 4 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + DL = 0 + Prompt = TRUE + Break = "forget_on_send" + Kind = "cut" + K = 2 +INVARIANT NoEarlyFail +INVARIANT NoSilentStall +INVARIANT NoLongCall +INVARIANT ProgressKept +INVARIANT CliNoEarlyExit +INVARIANT CliNoSilentWait +INVARIANT CliUnknownOnlySilent +INVARIANT NoQueuedStall +INVARIANT BusyOnlyWhenHeld +INVARIANT CliBusyNotOwn +INVARIANT NoManualPreempt +INVARIANT NoFalseFailure +INVARIANT OwnResult +INVARIANT NoRetryAfterFence diff --git a/seaweed-block/docs/spec/cuttime/cfg/mut_global_renews.cfg b/seaweed-block/docs/spec/cuttime/cfg/mut_global_renews.cfg new file mode 100644 index 0000000000..37fe3abc31 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/cfg/mut_global_renews.cfg @@ -0,0 +1,28 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + Wc = 4 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + DL = 0 + Prompt = TRUE + Break = "global_renews" + Kind = "cut" + K = 2 +INVARIANT NoEarlyFail +INVARIANT NoSilentStall +INVARIANT NoLongCall +INVARIANT ProgressKept +INVARIANT CliNoEarlyExit +INVARIANT CliNoSilentWait +INVARIANT CliUnknownOnlySilent +INVARIANT NoQueuedStall +INVARIANT BusyOnlyWhenHeld +INVARIANT CliBusyNotOwn +INVARIANT NoManualPreempt +INVARIANT NoFalseFailure +INVARIANT OwnResult +INVARIANT NoRetryAfterFence diff --git a/seaweed-block/docs/spec/cuttime/cfg/mut_inherited_as_own.cfg b/seaweed-block/docs/spec/cuttime/cfg/mut_inherited_as_own.cfg new file mode 100644 index 0000000000..51e23e50d6 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/cfg/mut_inherited_as_own.cfg @@ -0,0 +1,28 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + Wc = 4 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + DL = 0 + Prompt = TRUE + Break = "inherited_as_own" + Kind = "cut" + K = 2 +INVARIANT NoEarlyFail +INVARIANT NoSilentStall +INVARIANT NoLongCall +INVARIANT ProgressKept +INVARIANT CliNoEarlyExit +INVARIANT CliNoSilentWait +INVARIANT CliUnknownOnlySilent +INVARIANT NoQueuedStall +INVARIANT BusyOnlyWhenHeld +INVARIANT CliBusyNotOwn +INVARIANT NoManualPreempt +INVARIANT NoFalseFailure +INVARIANT OwnResult +INVARIANT NoRetryAfterFence diff --git a/seaweed-block/docs/spec/cuttime/cfg/mut_no_call_deadline.cfg b/seaweed-block/docs/spec/cuttime/cfg/mut_no_call_deadline.cfg new file mode 100644 index 0000000000..ad480b04b9 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/cfg/mut_no_call_deadline.cfg @@ -0,0 +1,28 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + Wc = 4 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + DL = 0 + Prompt = TRUE + Break = "no_call_deadline" + Kind = "cut" + K = 2 +INVARIANT NoEarlyFail +INVARIANT NoSilentStall +INVARIANT NoLongCall +INVARIANT ProgressKept +INVARIANT CliNoEarlyExit +INVARIANT CliNoSilentWait +INVARIANT CliUnknownOnlySilent +INVARIANT NoQueuedStall +INVARIANT BusyOnlyWhenHeld +INVARIANT CliBusyNotOwn +INVARIANT NoManualPreempt +INVARIANT NoFalseFailure +INVARIANT OwnResult +INVARIANT NoRetryAfterFence diff --git a/seaweed-block/docs/spec/cuttime/cfg/mut_overwrite_next.cfg b/seaweed-block/docs/spec/cuttime/cfg/mut_overwrite_next.cfg new file mode 100644 index 0000000000..cbf03984b8 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/cfg/mut_overwrite_next.cfg @@ -0,0 +1,28 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + Wc = 4 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + DL = 0 + Prompt = TRUE + Break = "overwrite_next" + Kind = "cut" + K = 2 +INVARIANT NoEarlyFail +INVARIANT NoSilentStall +INVARIANT NoLongCall +INVARIANT ProgressKept +INVARIANT CliNoEarlyExit +INVARIANT CliNoSilentWait +INVARIANT CliUnknownOnlySilent +INVARIANT NoQueuedStall +INVARIANT BusyOnlyWhenHeld +INVARIANT CliBusyNotOwn +INVARIANT NoManualPreempt +INVARIANT NoFalseFailure +INVARIANT OwnResult +INVARIANT NoRetryAfterFence diff --git a/seaweed-block/docs/spec/cuttime/cfg/mut_preempt_loses_uploads.cfg b/seaweed-block/docs/spec/cuttime/cfg/mut_preempt_loses_uploads.cfg new file mode 100644 index 0000000000..90e80b9a11 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/cfg/mut_preempt_loses_uploads.cfg @@ -0,0 +1,28 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + Wc = 4 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + DL = 0 + Prompt = TRUE + Break = "preempt_loses_uploads" + Kind = "detach" + K = 2 +INVARIANT NoEarlyFail +INVARIANT NoSilentStall +INVARIANT NoLongCall +INVARIANT ProgressKept +INVARIANT CliNoEarlyExit +INVARIANT CliNoSilentWait +INVARIANT CliUnknownOnlySilent +INVARIANT NoQueuedStall +INVARIANT BusyOnlyWhenHeld +INVARIANT CliBusyNotOwn +INVARIANT NoManualPreempt +INVARIANT NoFalseFailure +INVARIANT OwnResult +INVARIANT NoRetryAfterFence diff --git a/seaweed-block/docs/spec/cuttime/cfg/mut_preempt_manual.cfg b/seaweed-block/docs/spec/cuttime/cfg/mut_preempt_manual.cfg new file mode 100644 index 0000000000..17f5e84ea7 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/cfg/mut_preempt_manual.cfg @@ -0,0 +1,28 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + Wc = 4 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + DL = 0 + Prompt = TRUE + Break = "preempt_manual" + Kind = "detach" + K = 2 +INVARIANT NoEarlyFail +INVARIANT NoSilentStall +INVARIANT NoLongCall +INVARIANT ProgressKept +INVARIANT CliNoEarlyExit +INVARIANT CliNoSilentWait +INVARIANT CliUnknownOnlySilent +INVARIANT NoQueuedStall +INVARIANT BusyOnlyWhenHeld +INVARIANT CliBusyNotOwn +INVARIANT NoManualPreempt +INVARIANT NoFalseFailure +INVARIANT OwnResult +INVARIANT NoRetryAfterFence diff --git a/seaweed-block/docs/spec/cuttime/cfg/mut_queued_no_renew.cfg b/seaweed-block/docs/spec/cuttime/cfg/mut_queued_no_renew.cfg new file mode 100644 index 0000000000..d70dbf11d5 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/cfg/mut_queued_no_renew.cfg @@ -0,0 +1,28 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + Wc = 4 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + DL = 0 + Prompt = TRUE + Break = "queued_no_renew" + Kind = "detach" + K = 2 +INVARIANT NoEarlyFail +INVARIANT NoSilentStall +INVARIANT NoLongCall +INVARIANT ProgressKept +INVARIANT CliNoEarlyExit +INVARIANT CliNoSilentWait +INVARIANT CliUnknownOnlySilent +INVARIANT NoQueuedStall +INVARIANT BusyOnlyWhenHeld +INVARIANT CliBusyNotOwn +INVARIANT NoManualPreempt +INVARIANT NoFalseFailure +INVARIANT OwnResult +INVARIANT NoRetryAfterFence diff --git a/seaweed-block/docs/spec/cuttime/cfg/mut_queued_stalls.cfg b/seaweed-block/docs/spec/cuttime/cfg/mut_queued_stalls.cfg new file mode 100644 index 0000000000..efb129615d --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/cfg/mut_queued_stalls.cfg @@ -0,0 +1,28 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + Wc = 4 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + DL = 0 + Prompt = TRUE + Break = "queued_stalls" + Kind = "cut" + K = 2 +INVARIANT NoEarlyFail +INVARIANT NoSilentStall +INVARIANT NoLongCall +INVARIANT ProgressKept +INVARIANT CliNoEarlyExit +INVARIANT CliNoSilentWait +INVARIANT CliUnknownOnlySilent +INVARIANT NoQueuedStall +INVARIANT BusyOnlyWhenHeld +INVARIANT CliBusyNotOwn +INVARIANT NoManualPreempt +INVARIANT NoFalseFailure +INVARIANT OwnResult +INVARIANT NoRetryAfterFence diff --git a/seaweed-block/docs/spec/cuttime/cfg/mut_repost.cfg b/seaweed-block/docs/spec/cuttime/cfg/mut_repost.cfg new file mode 100644 index 0000000000..f240d5f679 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/cfg/mut_repost.cfg @@ -0,0 +1,28 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + Wc = 4 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + DL = 0 + Prompt = TRUE + Break = "repost" + Kind = "cut" + K = 2 +INVARIANT NoEarlyFail +INVARIANT NoSilentStall +INVARIANT NoLongCall +INVARIANT ProgressKept +INVARIANT CliNoEarlyExit +INVARIANT CliNoSilentWait +INVARIANT CliUnknownOnlySilent +INVARIANT NoQueuedStall +INVARIANT BusyOnlyWhenHeld +INVARIANT CliBusyNotOwn +INVARIANT NoManualPreempt +INVARIANT NoFalseFailure +INVARIANT OwnResult +INVARIANT NoRetryAfterFence diff --git a/seaweed-block/docs/spec/cuttime/cfg/mut_restart_as_failed.cfg b/seaweed-block/docs/spec/cuttime/cfg/mut_restart_as_failed.cfg new file mode 100644 index 0000000000..e14e9c3e39 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/cfg/mut_restart_as_failed.cfg @@ -0,0 +1,28 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + Wc = 4 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + DL = 0 + Prompt = TRUE + Break = "restart_as_failed" + Kind = "cut" + K = 2 +INVARIANT NoEarlyFail +INVARIANT NoSilentStall +INVARIANT NoLongCall +INVARIANT ProgressKept +INVARIANT CliNoEarlyExit +INVARIANT CliNoSilentWait +INVARIANT CliUnknownOnlySilent +INVARIANT NoQueuedStall +INVARIANT BusyOnlyWhenHeld +INVARIANT CliBusyNotOwn +INVARIANT NoManualPreempt +INVARIANT NoFalseFailure +INVARIANT OwnResult +INVARIANT NoRetryAfterFence diff --git a/seaweed-block/docs/spec/cuttime/cfg/mut_retire_early.cfg b/seaweed-block/docs/spec/cuttime/cfg/mut_retire_early.cfg new file mode 100644 index 0000000000..f3fc7d09a7 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/cfg/mut_retire_early.cfg @@ -0,0 +1,28 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + Wc = 4 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + DL = 0 + Prompt = TRUE + Break = "retire_early" + Kind = "cut" + K = 2 +INVARIANT NoEarlyFail +INVARIANT NoSilentStall +INVARIANT NoLongCall +INVARIANT ProgressKept +INVARIANT CliNoEarlyExit +INVARIANT CliNoSilentWait +INVARIANT CliUnknownOnlySilent +INVARIANT NoQueuedStall +INVARIANT BusyOnlyWhenHeld +INVARIANT CliBusyNotOwn +INVARIANT NoManualPreempt +INVARIANT NoFalseFailure +INVARIANT OwnResult +INVARIANT NoRetryAfterFence diff --git a/seaweed-block/docs/spec/cuttime/cfg/mut_retry_loses_progress.cfg b/seaweed-block/docs/spec/cuttime/cfg/mut_retry_loses_progress.cfg new file mode 100644 index 0000000000..b39534bbcf --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/cfg/mut_retry_loses_progress.cfg @@ -0,0 +1,28 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + Wc = 4 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + DL = 0 + Prompt = TRUE + Break = "retry_loses_progress" + Kind = "cut" + K = 2 +INVARIANT NoEarlyFail +INVARIANT NoSilentStall +INVARIANT NoLongCall +INVARIANT ProgressKept +INVARIANT CliNoEarlyExit +INVARIANT CliNoSilentWait +INVARIANT CliUnknownOnlySilent +INVARIANT NoQueuedStall +INVARIANT BusyOnlyWhenHeld +INVARIANT CliBusyNotOwn +INVARIANT NoManualPreempt +INVARIANT NoFalseFailure +INVARIANT OwnResult +INVARIANT NoRetryAfterFence diff --git a/seaweed-block/docs/spec/cuttime/cfg/mut_settle_as_failed.cfg b/seaweed-block/docs/spec/cuttime/cfg/mut_settle_as_failed.cfg new file mode 100644 index 0000000000..24a8842f7e --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/cfg/mut_settle_as_failed.cfg @@ -0,0 +1,28 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + Wc = 4 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + DL = 0 + Prompt = TRUE + Break = "settle_as_failed" + Kind = "cut" + K = 2 +INVARIANT NoEarlyFail +INVARIANT NoSilentStall +INVARIANT NoLongCall +INVARIANT ProgressKept +INVARIANT CliNoEarlyExit +INVARIANT CliNoSilentWait +INVARIANT CliUnknownOnlySilent +INVARIANT NoQueuedStall +INVARIANT BusyOnlyWhenHeld +INVARIANT CliBusyNotOwn +INVARIANT NoManualPreempt +INVARIANT NoFalseFailure +INVARIANT OwnResult +INVARIANT NoRetryAfterFence diff --git a/seaweed-block/docs/spec/cuttime/cfg/mut_settle_as_failed_nff.cfg b/seaweed-block/docs/spec/cuttime/cfg/mut_settle_as_failed_nff.cfg new file mode 100644 index 0000000000..9afe8ffd0a --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/cfg/mut_settle_as_failed_nff.cfg @@ -0,0 +1,15 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + Wc = 4 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + DL = 0 + Prompt = TRUE + Break = "settle_as_failed" + Kind = "cut" + K = 2 +INVARIANT NoFalseFailure diff --git a/seaweed-block/docs/spec/cuttime/cfg/mut_settle_no_rise.cfg b/seaweed-block/docs/spec/cuttime/cfg/mut_settle_no_rise.cfg new file mode 100644 index 0000000000..c04288abc2 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/cfg/mut_settle_no_rise.cfg @@ -0,0 +1,28 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + Wc = 4 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + DL = 0 + Prompt = TRUE + Break = "settle_no_rise" + Kind = "cut" + K = 2 +INVARIANT NoEarlyFail +INVARIANT NoSilentStall +INVARIANT NoLongCall +INVARIANT ProgressKept +INVARIANT CliNoEarlyExit +INVARIANT CliNoSilentWait +INVARIANT CliUnknownOnlySilent +INVARIANT NoQueuedStall +INVARIANT BusyOnlyWhenHeld +INVARIANT CliBusyNotOwn +INVARIANT NoManualPreempt +INVARIANT NoFalseFailure +INVARIANT OwnResult +INVARIANT NoRetryAfterFence diff --git a/seaweed-block/docs/spec/cuttime/cfg/mut_settle_skip.cfg b/seaweed-block/docs/spec/cuttime/cfg/mut_settle_skip.cfg new file mode 100644 index 0000000000..9fe0de1e15 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/cfg/mut_settle_skip.cfg @@ -0,0 +1,28 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + Wc = 4 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + DL = 0 + Prompt = TRUE + Break = "settle_skip" + Kind = "cut" + K = 2 +INVARIANT NoEarlyFail +INVARIANT NoSilentStall +INVARIANT NoLongCall +INVARIANT ProgressKept +INVARIANT CliNoEarlyExit +INVARIANT CliNoSilentWait +INVARIANT CliUnknownOnlySilent +INVARIANT NoQueuedStall +INVARIANT BusyOnlyWhenHeld +INVARIANT CliBusyNotOwn +INVARIANT NoManualPreempt +INVARIANT NoFalseFailure +INVARIANT OwnResult +INVARIANT NoRetryAfterFence diff --git a/seaweed-block/docs/spec/cuttime/cfg/mut_timeout_renews.cfg b/seaweed-block/docs/spec/cuttime/cfg/mut_timeout_renews.cfg new file mode 100644 index 0000000000..b4883de8ce --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/cfg/mut_timeout_renews.cfg @@ -0,0 +1,28 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + Wc = 4 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + DL = 0 + Prompt = TRUE + Break = "timeout_renews" + Kind = "cut" + K = 2 +INVARIANT NoEarlyFail +INVARIANT NoSilentStall +INVARIANT NoLongCall +INVARIANT ProgressKept +INVARIANT CliNoEarlyExit +INVARIANT CliNoSilentWait +INVARIANT CliUnknownOnlySilent +INVARIANT NoQueuedStall +INVARIANT BusyOnlyWhenHeld +INVARIANT CliBusyNotOwn +INVARIANT NoManualPreempt +INVARIANT NoFalseFailure +INVARIANT OwnResult +INVARIANT NoRetryAfterFence diff --git a/seaweed-block/docs/spec/cuttime/cfg/mut_total_cap.cfg b/seaweed-block/docs/spec/cuttime/cfg/mut_total_cap.cfg new file mode 100644 index 0000000000..349f7e8213 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/cfg/mut_total_cap.cfg @@ -0,0 +1,28 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + Wc = 4 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + DL = 0 + Prompt = TRUE + Break = "total_cap" + Kind = "cut" + K = 2 +INVARIANT NoEarlyFail +INVARIANT NoSilentStall +INVARIANT NoLongCall +INVARIANT ProgressKept +INVARIANT CliNoEarlyExit +INVARIANT CliNoSilentWait +INVARIANT CliUnknownOnlySilent +INVARIANT NoQueuedStall +INVARIANT BusyOnlyWhenHeld +INVARIANT CliBusyNotOwn +INVARIANT NoManualPreempt +INVARIANT NoFalseFailure +INVARIANT OwnResult +INVARIANT NoRetryAfterFence diff --git a/seaweed-block/docs/spec/cuttime/cfg/mut_window_not_reset.cfg b/seaweed-block/docs/spec/cuttime/cfg/mut_window_not_reset.cfg new file mode 100644 index 0000000000..5ed84d415b --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/cfg/mut_window_not_reset.cfg @@ -0,0 +1,28 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + Wc = 4 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + DL = 0 + Prompt = TRUE + Break = "window_not_reset" + Kind = "cut" + K = 2 +INVARIANT NoEarlyFail +INVARIANT NoSilentStall +INVARIANT NoLongCall +INVARIANT ProgressKept +INVARIANT CliNoEarlyExit +INVARIANT CliNoSilentWait +INVARIANT CliUnknownOnlySilent +INVARIANT NoQueuedStall +INVARIANT BusyOnlyWhenHeld +INVARIANT CliBusyNotOwn +INVARIANT NoManualPreempt +INVARIANT NoFalseFailure +INVARIANT OwnResult +INVARIANT NoRetryAfterFence diff --git a/seaweed-block/docs/spec/cuttime/cfg/safe_cut.cfg b/seaweed-block/docs/spec/cuttime/cfg/safe_cut.cfg new file mode 100644 index 0000000000..6de1812107 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/cfg/safe_cut.cfg @@ -0,0 +1,28 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + Wc = 4 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + DL = 0 + Prompt = TRUE + Break = "none" + Kind = "cut" + K = 2 +INVARIANT NoEarlyFail +INVARIANT NoSilentStall +INVARIANT NoLongCall +INVARIANT ProgressKept +INVARIANT CliNoEarlyExit +INVARIANT CliNoSilentWait +INVARIANT CliUnknownOnlySilent +INVARIANT NoQueuedStall +INVARIANT BusyOnlyWhenHeld +INVARIANT CliBusyNotOwn +INVARIANT NoManualPreempt +INVARIANT NoFalseFailure +INVARIANT OwnResult +INVARIANT NoRetryAfterFence diff --git a/seaweed-block/docs/spec/cuttime/cfg/safe_cut_deadline.cfg b/seaweed-block/docs/spec/cuttime/cfg/safe_cut_deadline.cfg new file mode 100644 index 0000000000..4cc7c9c651 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/cfg/safe_cut_deadline.cfg @@ -0,0 +1,28 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + Wc = 4 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + DL = 3 + Prompt = TRUE + Break = "none" + Kind = "cut" + K = 2 +INVARIANT NoEarlyFail +INVARIANT NoSilentStall +INVARIANT NoLongCall +INVARIANT ProgressKept +INVARIANT CliNoEarlyExit +INVARIANT CliNoSilentWait +INVARIANT CliUnknownOnlySilent +INVARIANT NoQueuedStall +INVARIANT BusyOnlyWhenHeld +INVARIANT CliBusyNotOwn +INVARIANT NoManualPreempt +INVARIANT NoFalseFailure +INVARIANT OwnResult +INVARIANT NoRetryAfterFence diff --git a/seaweed-block/docs/spec/cuttime/cfg/safe_cut_late.cfg b/seaweed-block/docs/spec/cuttime/cfg/safe_cut_late.cfg new file mode 100644 index 0000000000..a1c4b243ba --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/cfg/safe_cut_late.cfg @@ -0,0 +1,28 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + Wc = 7 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + DL = 0 + Prompt = FALSE + Break = "none" + Kind = "cut" + K = 2 +INVARIANT NoEarlyFail +INVARIANT NoSilentStall +INVARIANT NoLongCall +INVARIANT ProgressKept +INVARIANT CliNoEarlyExit +INVARIANT CliNoSilentWait +INVARIANT CliUnknownOnlySilent +INVARIANT NoQueuedStall +INVARIANT BusyOnlyWhenHeld +INVARIANT CliBusyNotOwn +INVARIANT NoManualPreempt +INVARIANT NoFalseFailure +INVARIANT OwnResult +INVARIANT NoRetryAfterFence diff --git a/seaweed-block/docs/spec/cuttime/cfg/safe_detach.cfg b/seaweed-block/docs/spec/cuttime/cfg/safe_detach.cfg new file mode 100644 index 0000000000..78d984340e --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/cfg/safe_detach.cfg @@ -0,0 +1,28 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + Wc = 4 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + DL = 0 + Prompt = TRUE + Break = "none" + Kind = "detach" + K = 2 +INVARIANT NoEarlyFail +INVARIANT NoSilentStall +INVARIANT NoLongCall +INVARIANT ProgressKept +INVARIANT CliNoEarlyExit +INVARIANT CliNoSilentWait +INVARIANT CliUnknownOnlySilent +INVARIANT NoQueuedStall +INVARIANT BusyOnlyWhenHeld +INVARIANT CliBusyNotOwn +INVARIANT NoManualPreempt +INVARIANT NoFalseFailure +INVARIANT OwnResult +INVARIANT NoRetryAfterFence diff --git a/seaweed-block/docs/spec/cuttime/cfg/wit_busy.cfg b/seaweed-block/docs/spec/cuttime/cfg/wit_busy.cfg new file mode 100644 index 0000000000..d389657d58 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/cfg/wit_busy.cfg @@ -0,0 +1,15 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + Wc = 4 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + DL = 0 + Prompt = TRUE + Break = "none" + Kind = "cut" + K = 2 +INVARIANT WitBusy diff --git a/seaweed-block/docs/spec/cuttime/cfg/wit_cli_deadline.cfg b/seaweed-block/docs/spec/cuttime/cfg/wit_cli_deadline.cfg new file mode 100644 index 0000000000..9a5100574e --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/cfg/wit_cli_deadline.cfg @@ -0,0 +1,15 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + Wc = 4 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + DL = 3 + Prompt = TRUE + Break = "none" + Kind = "cut" + K = 2 +INVARIANT WitCliDeadline diff --git a/seaweed-block/docs/spec/cuttime/cfg/wit_cli_stalled.cfg b/seaweed-block/docs/spec/cuttime/cfg/wit_cli_stalled.cfg new file mode 100644 index 0000000000..6bf5a2d17d --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/cfg/wit_cli_stalled.cfg @@ -0,0 +1,15 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + Wc = 4 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + DL = 0 + Prompt = TRUE + Break = "none" + Kind = "cut" + K = 2 +INVARIANT WitCliStalled diff --git a/seaweed-block/docs/spec/cuttime/cfg/wit_detach_after_queue.cfg b/seaweed-block/docs/spec/cuttime/cfg/wit_detach_after_queue.cfg new file mode 100644 index 0000000000..5f73636524 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/cfg/wit_detach_after_queue.cfg @@ -0,0 +1,15 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + Wc = 4 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + DL = 0 + Prompt = TRUE + Break = "none" + Kind = "detach" + K = 2 +INVARIANT WitDetachAfterQueue diff --git a/seaweed-block/docs/spec/cuttime/cfg/wit_fenced.cfg b/seaweed-block/docs/spec/cuttime/cfg/wit_fenced.cfg new file mode 100644 index 0000000000..533a2dca25 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/cfg/wit_fenced.cfg @@ -0,0 +1,15 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + Wc = 4 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + DL = 0 + Prompt = TRUE + Break = "none" + Kind = "cut" + K = 2 +INVARIANT WitFenced diff --git a/seaweed-block/docs/spec/cuttime/cfg/wit_inherited_then_own.cfg b/seaweed-block/docs/spec/cuttime/cfg/wit_inherited_then_own.cfg new file mode 100644 index 0000000000..ff9f4a3313 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/cfg/wit_inherited_then_own.cfg @@ -0,0 +1,15 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + Wc = 4 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + DL = 0 + Prompt = TRUE + Break = "none" + Kind = "cut" + K = 2 +INVARIANT WitInheritedThenOwn diff --git a/seaweed-block/docs/spec/cuttime/cfg/wit_lost_reply_then_ok.cfg b/seaweed-block/docs/spec/cuttime/cfg/wit_lost_reply_then_ok.cfg new file mode 100644 index 0000000000..83198c9eab --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/cfg/wit_lost_reply_then_ok.cfg @@ -0,0 +1,15 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + Wc = 4 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + DL = 0 + Prompt = TRUE + Break = "none" + Kind = "cut" + K = 2 +INVARIANT WitLostReplyThenOk diff --git a/seaweed-block/docs/spec/cuttime/cfg/wit_preempt_reuse.cfg b/seaweed-block/docs/spec/cuttime/cfg/wit_preempt_reuse.cfg new file mode 100644 index 0000000000..13a7e6535c --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/cfg/wit_preempt_reuse.cfg @@ -0,0 +1,15 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + Wc = 4 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + DL = 0 + Prompt = TRUE + Break = "none" + Kind = "detach" + K = 2 +INVARIANT WitPreemptReuse diff --git a/seaweed-block/docs/spec/cuttime/cfg/wit_restart_unknown.cfg b/seaweed-block/docs/spec/cuttime/cfg/wit_restart_unknown.cfg new file mode 100644 index 0000000000..90ad3ceb69 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/cfg/wit_restart_unknown.cfg @@ -0,0 +1,15 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + Wc = 4 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + DL = 0 + Prompt = TRUE + Break = "none" + Kind = "cut" + K = 2 +INVARIANT WitRestartUnknown diff --git a/seaweed-block/docs/spec/cuttime/cfg/wit_settle_then_ok.cfg b/seaweed-block/docs/spec/cuttime/cfg/wit_settle_then_ok.cfg new file mode 100644 index 0000000000..63403d7143 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/cfg/wit_settle_then_ok.cfg @@ -0,0 +1,15 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + Wc = 4 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + DL = 0 + Prompt = TRUE + Break = "none" + Kind = "cut" + K = 2 +INVARIANT WitSettleThenOk diff --git a/seaweed-block/docs/spec/cuttime/cfg/wit_settle_unknown.cfg b/seaweed-block/docs/spec/cuttime/cfg/wit_settle_unknown.cfg new file mode 100644 index 0000000000..99fe9d9219 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/cfg/wit_settle_unknown.cfg @@ -0,0 +1,15 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + Wc = 4 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + DL = 0 + Prompt = TRUE + Break = "none" + Kind = "cut" + K = 2 +INVARIANT WitSettleUnknown diff --git a/seaweed-block/docs/spec/cuttime/cfg/wit_slow_no_fail.cfg b/seaweed-block/docs/spec/cuttime/cfg/wit_slow_no_fail.cfg new file mode 100644 index 0000000000..b870b64a02 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/cfg/wit_slow_no_fail.cfg @@ -0,0 +1,15 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + Wc = 4 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + DL = 0 + Prompt = TRUE + Break = "none" + Kind = "cut" + K = 2 +INVARIANT WitSlowNoFail diff --git a/seaweed-block/docs/spec/cuttime/cfg/wit_stalled_retry_pub.cfg b/seaweed-block/docs/spec/cuttime/cfg/wit_stalled_retry_pub.cfg new file mode 100644 index 0000000000..1fdcc4be34 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/cfg/wit_stalled_retry_pub.cfg @@ -0,0 +1,15 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + Wc = 4 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + DL = 0 + Prompt = TRUE + Break = "none" + Kind = "cut" + K = 2 +INVARIANT WitStalledRetryPub diff --git a/seaweed-block/docs/spec/cuttime/cfg/wit_timed_out_then_pub.cfg b/seaweed-block/docs/spec/cuttime/cfg/wit_timed_out_then_pub.cfg new file mode 100644 index 0000000000..ca579869ff --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/cfg/wit_timed_out_then_pub.cfg @@ -0,0 +1,15 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + Wc = 4 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + DL = 0 + Prompt = TRUE + Break = "none" + Kind = "cut" + K = 2 +INVARIANT WitTimedOutThenPub diff --git a/seaweed-block/docs/spec/cuttime/cfg/wit_unknown_then_pub.cfg b/seaweed-block/docs/spec/cuttime/cfg/wit_unknown_then_pub.cfg new file mode 100644 index 0000000000..2ca3919132 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/cfg/wit_unknown_then_pub.cfg @@ -0,0 +1,15 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + Wc = 4 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + DL = 0 + Prompt = TRUE + Break = "none" + Kind = "cut" + K = 2 +INVARIANT WitUnknownThenPub diff --git a/seaweed-block/docs/spec/cuttime/recorded-r5/RESULT.txt b/seaweed-block/docs/spec/cuttime/recorded-r5/RESULT.txt new file mode 100644 index 0000000000..4ec4d7b6ff --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r5/RESULT.txt @@ -0,0 +1,26 @@ +safe_cut want=OK got=OK states=[15901 distinct states found] PASS +safe_cut_deadline want=OK got=OK states=[38870 distinct states found] PASS +safe_cut_late want=OK got=OK states=[22836 distinct states found] PASS +mut_answer_late want=violated got=CliUnknownOnlySilent states=[3733 distinct states found] PASS +mut_attempt_renews want=violated got=NoSilentStall states=[773 distinct states found] PASS +mut_busy_when_free want=violated got=BusyOnlyWhenHeld states=[35 distinct states found] PASS +mut_cli_no_slack want=violated got=CliUnknownOnlySilent states=[442 distinct states found] PASS +mut_cli_no_window want=violated got=CliNoSilentWait states=[814 distinct states found] PASS +mut_cli_total_timeout want=violated got=CliNoEarlyExit states=[780 distinct states found] PASS +mut_global_renews want=violated got=CliNoSilentWait states=[1324 distinct states found] PASS +mut_no_call_deadline want=violated got=NoLongCall states=[195 distinct states found] PASS +mut_queued_stalls want=violated got=NoQueuedStall states=[289 distinct states found] PASS +mut_repost want=violated got=CliBusyNotOwn states=[36 distinct states found] PASS +mut_restart_as_failed want=violated got=CliNoEarlyExit states=[80 distinct states found] PASS +mut_retry_loses_progress want=violated got=ProgressKept states=[259 distinct states found] PASS +mut_timeout_renews want=violated got=NoSilentStall states=[1058 distinct states found] PASS +mut_total_cap want=violated got=NoEarlyFail states=[1822 distinct states found] PASS +mut_window_not_reset want=violated got=NoEarlyFail states=[840 distinct states found] PASS +wit_busy want=violated got=WitBusy states=[50 distinct states found] PASS +wit_cli_deadline want=violated got=WitCliDeadline states=[430 distinct states found] PASS +wit_cli_stalled want=violated got=WitCliStalled states=[851 distinct states found] PASS +wit_restart_unknown want=violated got=WitRestartUnknown states=[93 distinct states found] PASS +wit_slow_no_fail want=violated got=WitSlowNoFail states=[7035 distinct states found] PASS +wit_stalled_retry_pub want=violated got=WitStalledRetryPub states=[8137 distinct states found] PASS +wit_timed_out_then_pub want=violated got=WitTimedOutThenPub states=[4093 distinct states found] PASS +wit_unknown_then_pub want=violated got=WitUnknownThenPub states=[1401 distinct states found] PASS diff --git a/seaweed-block/docs/spec/cuttime/recorded-r5/coverage.txt b/seaweed-block/docs/spec/cuttime/recorded-r5/coverage.txt new file mode 100644 index 0000000000..0ea92ebd8e --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r5/coverage.txt @@ -0,0 +1,10 @@ +NoEarlyFail mut_total_cap, mut_window_not_reset +NoSilentStall mut_attempt_renews, mut_timeout_renews +NoLongCall mut_no_call_deadline +ProgressKept mut_retry_loses_progress +CliNoEarlyExit mut_cli_total_timeout, mut_restart_as_failed +CliNoSilentWait mut_cli_no_window, mut_global_renews +CliUnknownOnlySilent mut_answer_late, mut_cli_no_slack +NoQueuedStall mut_queued_stalls +BusyOnlyWhenHeld mut_busy_when_free +CliBusyNotOwn mut_repost diff --git a/seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_answer_late.txt b/seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_answer_late.txt new file mode 100644 index 0000000000..ae9de4530d --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_answer_late.txt @@ -0,0 +1,340 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 110 and seed 280013079473926721 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 2513235] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file recorded-model/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 20:41:59) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 20:41:59. +Error: Invariant CliUnknownOnlySilent is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 3: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 4: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 1 +/\ pollAge = 1 +/\ ever = {} +/\ total = 1 +/\ real = 1 +/\ pollOut = TRUE +/\ since = 1 +/\ age = 1 + +State 5: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 1 +/\ pollAge = 1 +/\ ever = {} +/\ total = 1 +/\ real = 1 +/\ pollOut = FALSE +/\ since = 1 +/\ age = 1 + +State 6: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 1 +/\ pollAge = 0 +/\ ever = {} +/\ total = 1 +/\ real = 1 +/\ pollOut = TRUE +/\ since = 1 +/\ age = 1 + +State 7: +/\ phase = "uploading" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 1 +/\ pollAge = 0 +/\ ever = {1} +/\ total = 1 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 8: +/\ phase = "uploading" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 2 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 2 +/\ pollAge = 1 +/\ ever = {1} +/\ total = 2 +/\ real = 1 +/\ pollOut = TRUE +/\ since = 1 +/\ age = 0 + +State 9: +/\ phase = "uploading" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ pollAge = 2 +/\ ever = {1} +/\ total = 3 +/\ real = 2 +/\ pollOut = TRUE +/\ since = 2 +/\ age = 0 + +State 10: +/\ phase = "uploading" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 4 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 4 +/\ pollAge = 3 +/\ ever = {1} +/\ total = 4 +/\ real = 3 +/\ pollOut = TRUE +/\ since = 3 +/\ age = 0 + +State 11: +/\ phase = "uploading" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "unknown" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 4 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 4 +/\ pollAge = 3 +/\ ever = {1} +/\ total = 4 +/\ real = 3 +/\ pollOut = TRUE +/\ since = 3 +/\ age = 0 + +7843 states generated, 3733 distinct states found, 1480 states left on queue. +The depth of the complete state graph search is 11. +The average outdegree of the complete state graph is 2 (minimum is 0, the maximum 7 and the 95th percentile is 4). +Finished in 00s at (2026-12-02 20:41:59) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_attempt_renews.txt b/seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_attempt_renews.txt new file mode 100644 index 0000000000..b4f5d8159b --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_attempt_renews.txt @@ -0,0 +1,253 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 55 and seed 1494419925941784077 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 2513276] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file recorded-model/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 20:42:00) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 20:42:00. +Error: Invariant NoSilentStall is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 3: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "silent" +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 4: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "silent" +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 1 +/\ pollAge = 1 +/\ ever = {} +/\ total = 1 +/\ real = 1 +/\ pollOut = TRUE +/\ since = 1 +/\ age = 0 + +State 5: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "silent" +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 2 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 2 +/\ pollAge = 2 +/\ ever = {} +/\ total = 2 +/\ real = 2 +/\ pollOut = TRUE +/\ since = 2 +/\ age = 0 + +State 6: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "silent" +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 2 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 2 +/\ pollAge = 2 +/\ ever = {} +/\ total = 2 +/\ real = 2 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 7: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "silent" +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ pollAge = 3 +/\ ever = {} +/\ total = 3 +/\ real = 3 +/\ pollOut = TRUE +/\ since = 1 +/\ age = 1 + +State 8: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "silent" +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 4 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 4 +/\ pollAge = 3 +/\ ever = {} +/\ total = 4 +/\ real = 4 +/\ pollOut = TRUE +/\ since = 2 +/\ age = 2 + +1438 states generated, 773 distinct states found, 340 states left on queue. +The depth of the complete state graph search is 9. +The average outdegree of the complete state graph is 2 (minimum is 0, the maximum 8 and the 95th percentile is 5). +Finished in 00s at (2026-12-02 20:42:00) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_busy_when_free.txt b/seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_busy_when_free.txt new file mode 100644 index 0000000000..29a44caefb --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_busy_when_free.txt @@ -0,0 +1,79 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 74 and seed -2451533168003359416 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 2513317] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file recorded-model/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 20:42:01) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 20:42:01. +Error: Invariant BusyOnlyWhenHeld is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = TRUE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +43 states generated, 35 distinct states found, 24 states left on queue. +The depth of the complete state graph search is 4. +The average outdegree of the complete state graph is 3 (minimum is 1, the maximum 8 and the 95th percentile is 8). +Finished in 00s at (2026-12-02 20:42:01) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_cli_no_slack.txt b/seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_cli_no_slack.txt new file mode 100644 index 0000000000..e7711ad802 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_cli_no_slack.txt @@ -0,0 +1,195 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 52 and seed 6234864391439972264 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 2513358] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file recorded-model/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 20:42:02) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 20:42:02. +Error: Invariant CliUnknownOnlySilent is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 3: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 1 +/\ pollAge = 1 +/\ ever = {} +/\ total = 1 +/\ real = 1 +/\ pollOut = TRUE +/\ since = 1 +/\ age = 0 + +State 4: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 2 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 2 +/\ pollAge = 2 +/\ ever = {} +/\ total = 2 +/\ real = 2 +/\ pollOut = TRUE +/\ since = 2 +/\ age = 0 + +State 5: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ pollAge = 3 +/\ ever = {} +/\ total = 3 +/\ real = 3 +/\ pollOut = TRUE +/\ since = 3 +/\ age = 0 + +State 6: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "unknown" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ pollAge = 3 +/\ ever = {} +/\ total = 3 +/\ real = 3 +/\ pollOut = TRUE +/\ since = 3 +/\ age = 0 + +810 states generated, 442 distinct states found, 209 states left on queue. +The depth of the complete state graph search is 8. +The average outdegree of the complete state graph is 2 (minimum is 0, the maximum 7 and the 95th percentile is 5). +Finished in 00s at (2026-12-02 20:42:02) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_cli_no_window.txt b/seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_cli_no_window.txt new file mode 100644 index 0000000000..66d1177e2a --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_cli_no_window.txt @@ -0,0 +1,253 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 96 and seed 4175346121731813629 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 2513400] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file recorded-model/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 20:42:03) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 20:42:03. +Error: Invariant CliNoSilentWait is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 3: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "silent" +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 4: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "silent" +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 1 +/\ pollAge = 1 +/\ ever = {} +/\ total = 1 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 5: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "silent" +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 2 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 2 +/\ pollAge = 2 +/\ ever = {} +/\ total = 2 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 6: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "silent" +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 3 +/\ pollAge = 3 +/\ ever = {} +/\ total = 3 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 7: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "silent" +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 4 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 4 +/\ pollAge = 3 +/\ ever = {} +/\ total = 4 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 8: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "silent" +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 5 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 5 +/\ pollAge = 3 +/\ ever = {} +/\ total = 4 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +1582 states generated, 814 distinct states found, 350 states left on queue. +The depth of the complete state graph search is 9. +The average outdegree of the complete state graph is 2 (minimum is 0, the maximum 7 and the 95th percentile is 5). +Finished in 00s at (2026-12-02 20:42:03) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_cli_total_timeout.txt b/seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_cli_total_timeout.txt new file mode 100644 index 0000000000..fac2a843f3 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_cli_total_timeout.txt @@ -0,0 +1,253 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 75 and seed 5137826134122098777 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 2513441] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file recorded-model/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 20:42:04) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 20:42:04. +Error: Invariant CliNoEarlyExit is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 3: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "silent" +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 4: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "silent" +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 1 +/\ pollAge = 1 +/\ ever = {} +/\ total = 1 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 5: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "silent" +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 2 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 2 +/\ pollAge = 2 +/\ ever = {} +/\ total = 2 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 6: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "silent" +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 3 +/\ pollAge = 3 +/\ ever = {} +/\ total = 3 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 7: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "silent" +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 4 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 4 +/\ pollAge = 3 +/\ ever = {} +/\ total = 4 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 8: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = TRUE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "silent" +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "timeout" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 4 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 4 +/\ pollAge = 3 +/\ ever = {} +/\ total = 4 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +1531 states generated, 780 distinct states found, 333 states left on queue. +The depth of the complete state graph search is 9. +The average outdegree of the complete state graph is 2 (minimum is 0, the maximum 8 and the 95th percentile is 4). +Finished in 00s at (2026-12-02 20:42:04) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_global_renews.txt b/seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_global_renews.txt new file mode 100644 index 0000000000..97d42417fb --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_global_renews.txt @@ -0,0 +1,282 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 65 and seed 6836348540324853618 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 2513483] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file recorded-model/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 20:42:05) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 20:42:05. +Error: Invariant CliNoSilentWait is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 3: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "silent" +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 4: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "silent" +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 1 +/\ pollAge = 1 +/\ ever = {} +/\ total = 1 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 5: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "silent" +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 1 +/\ pollAge = 1 +/\ ever = {} +/\ total = 1 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 6: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "silent" +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 2 +/\ pollAge = 2 +/\ ever = {} +/\ total = 2 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 7: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "silent" +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 2 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 3 +/\ pollAge = 3 +/\ ever = {} +/\ total = 3 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 8: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "silent" +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 4 +/\ pollAge = 3 +/\ ever = {} +/\ total = 4 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 9: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "silent" +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 4 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 5 +/\ pollAge = 3 +/\ ever = {} +/\ total = 4 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +2918 states generated, 1324 distinct states found, 663 states left on queue. +The depth of the complete state graph search is 9. +The average outdegree of the complete state graph is 2 (minimum is 0, the maximum 8 and the 95th percentile is 5). +Finished in 00s at (2026-12-02 20:42:05) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_no_call_deadline.txt b/seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_no_call_deadline.txt new file mode 100644 index 0000000000..8b7e8d3955 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_no_call_deadline.txt @@ -0,0 +1,195 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 114 and seed 2408686192782804830 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 2513525] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file recorded-model/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 20:42:05) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 20:42:06. +Error: Invariant NoLongCall is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 3: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = TRUE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 4: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = TRUE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 1 +/\ pollAge = 1 +/\ ever = {} +/\ total = 1 +/\ real = 1 +/\ pollOut = TRUE +/\ since = 1 +/\ age = 1 + +State 5: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = TRUE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 2 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 2 +/\ pollAge = 2 +/\ ever = {} +/\ total = 2 +/\ real = 2 +/\ pollOut = TRUE +/\ since = 2 +/\ age = 2 + +State 6: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = TRUE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ pollAge = 3 +/\ ever = {} +/\ total = 3 +/\ real = 3 +/\ pollOut = TRUE +/\ since = 3 +/\ age = 3 + +363 states generated, 195 distinct states found, 96 states left on queue. +The depth of the complete state graph search is 7. +The average outdegree of the complete state graph is 2 (minimum is 0, the maximum 7 and the 95th percentile is 5). +Finished in 00s at (2026-12-02 20:42:06) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_queued_stalls.txt b/seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_queued_stalls.txt new file mode 100644 index 0000000000..0da7e55aa6 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_queued_stalls.txt @@ -0,0 +1,166 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 130 and seed 7691171659833969150 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 2513566] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file recorded-model/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 20:42:06) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 20:42:07. +Error: Invariant NoQueuedStall is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 1 +/\ pollAge = 1 +/\ ever = {} +/\ total = 1 +/\ real = 1 +/\ pollOut = TRUE +/\ since = 1 +/\ age = 0 + +State 3: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 2 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 2 +/\ pollAge = 2 +/\ ever = {} +/\ total = 2 +/\ real = 2 +/\ pollOut = TRUE +/\ since = 2 +/\ age = 0 + +State 4: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ pollAge = 3 +/\ ever = {} +/\ total = 3 +/\ real = 3 +/\ pollOut = TRUE +/\ since = 3 +/\ age = 0 + +State 5: +/\ phase = "failed" +/\ done = {} +/\ stallQueued = TRUE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = TRUE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ pollAge = 3 +/\ ever = {} +/\ total = 3 +/\ real = 3 +/\ pollOut = TRUE +/\ since = 3 +/\ age = 0 + +540 states generated, 289 distinct states found, 146 states left on queue. +The depth of the complete state graph search is 7. +The average outdegree of the complete state graph is 2 (minimum is 0, the maximum 8 and the 95th percentile is 5). +Finished in 00s at (2026-12-02 20:42:07) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_repost.txt b/seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_repost.txt new file mode 100644 index 0000000000..a34c4fe21a --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_repost.txt @@ -0,0 +1,108 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 12 and seed -4140477462773921768 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 2513608] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file recorded-model/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 20:42:07) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 20:42:07. +Error: Invariant CliBusyNotOwn is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 3: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "busy" +/\ busyOwn = TRUE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +48 states generated, 36 distinct states found, 19 states left on queue. +The depth of the complete state graph search is 4. +The average outdegree of the complete state graph is 2 (minimum is 0, the maximum 3 and the 95th percentile is 3). +Finished in 00s at (2026-12-02 20:42:07) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_restart_as_failed.txt b/seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_restart_as_failed.txt new file mode 100644 index 0000000000..2586863938 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_restart_as_failed.txt @@ -0,0 +1,137 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 6 and seed -1634963690360910101 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 2513650] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file recorded-model/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 20:42:08) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 20:42:08. +Error: Invariant CliNoEarlyExit is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 3: +/\ phase = "failed" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = TRUE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 4: +/\ phase = "failed" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = TRUE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = TRUE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "stalled" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +133 states generated, 80 distinct states found, 42 states left on queue. +The depth of the complete state graph search is 5. +The average outdegree of the complete state graph is 2 (minimum is 0, the maximum 8 and the 95th percentile is 6). +Finished in 00s at (2026-12-02 20:42:08) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_retry_loses_progress.txt b/seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_retry_loses_progress.txt new file mode 100644 index 0000000000..e65665c946 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_retry_loses_progress.txt @@ -0,0 +1,224 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 81 and seed 7797453497601085 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 2513691] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file recorded-model/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 20:42:09) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 20:42:09. +Error: Invariant ProgressKept is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 3: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 4: +/\ phase = "uploading" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {1} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 5: +/\ phase = "lost" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = TRUE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {1} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 6: +/\ phase = "lost" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = TRUE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "unknown" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {1} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 7: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 2 +/\ hung = FALSE +/\ link = "up" +/\ restarted = TRUE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "unknown" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {1} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +461 states generated, 259 distinct states found, 127 states left on queue. +The depth of the complete state graph search is 7. +The average outdegree of the complete state graph is 2 (minimum is 0, the maximum 7 and the 95th percentile is 5). +Finished in 00s at (2026-12-02 20:42:09) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_timeout_renews.txt b/seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_timeout_renews.txt new file mode 100644 index 0000000000..3bc4e67250 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_timeout_renews.txt @@ -0,0 +1,282 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 25 and seed -2579216970477022738 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 2513733] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file recorded-model/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 20:42:10) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 20:42:10. +Error: Invariant NoSilentStall is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 3: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = TRUE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 4: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = TRUE +/\ link = "silent" +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 5: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = TRUE +/\ link = "silent" +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 1 +/\ pollAge = 1 +/\ ever = {} +/\ total = 1 +/\ real = 1 +/\ pollOut = TRUE +/\ since = 1 +/\ age = 1 + +State 6: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = TRUE +/\ link = "silent" +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 2 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 2 +/\ pollAge = 2 +/\ ever = {} +/\ total = 2 +/\ real = 2 +/\ pollOut = TRUE +/\ since = 2 +/\ age = 2 + +State 7: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "silent" +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 2 +/\ timedOutOnce = TRUE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 2 +/\ pollAge = 2 +/\ ever = {} +/\ total = 2 +/\ real = 2 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 8: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "silent" +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = TRUE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ pollAge = 3 +/\ ever = {} +/\ total = 3 +/\ real = 3 +/\ pollOut = TRUE +/\ since = 1 +/\ age = 0 + +State 9: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "silent" +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 4 +/\ timedOutOnce = TRUE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 4 +/\ pollAge = 3 +/\ ever = {} +/\ total = 4 +/\ real = 4 +/\ pollOut = TRUE +/\ since = 2 +/\ age = 0 + +2071 states generated, 1058 distinct states found, 463 states left on queue. +The depth of the complete state graph search is 9. +The average outdegree of the complete state graph is 2 (minimum is 0, the maximum 7 and the 95th percentile is 5). +Finished in 00s at (2026-12-02 20:42:10) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_total_cap.txt b/seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_total_cap.txt new file mode 100644 index 0000000000..1030111fd6 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_total_cap.txt @@ -0,0 +1,311 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 22 and seed -7902050195742249817 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 2513775] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file recorded-model/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 20:42:11) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 20:42:11. +Error: Invariant NoEarlyFail is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 3: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 4: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "silent" +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 5: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "silent" +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 1 +/\ pollAge = 1 +/\ ever = {} +/\ total = 1 +/\ real = 1 +/\ pollOut = TRUE +/\ since = 1 +/\ age = 1 + +State 6: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "silent" +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 2 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 2 +/\ pollAge = 2 +/\ ever = {} +/\ total = 2 +/\ real = 2 +/\ pollOut = TRUE +/\ since = 2 +/\ age = 2 + +State 7: +/\ phase = "uploading" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "silent" +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 2 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 2 +/\ pollAge = 2 +/\ ever = {1} +/\ total = 2 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 8: +/\ phase = "uploading" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "silent" +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ pollAge = 3 +/\ ever = {1} +/\ total = 3 +/\ real = 1 +/\ pollOut = TRUE +/\ since = 1 +/\ age = 0 + +State 9: +/\ phase = "uploading" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "silent" +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 4 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 4 +/\ pollAge = 3 +/\ ever = {1} +/\ total = 4 +/\ real = 2 +/\ pollOut = TRUE +/\ since = 2 +/\ age = 0 + +State 10: +/\ phase = "failed" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "silent" +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = TRUE +/\ inflight = 0 +/\ cliSince = 4 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = TRUE +/\ other = "none" +/\ realCli = 4 +/\ pollAge = 3 +/\ ever = {1} +/\ total = 4 +/\ real = 2 +/\ pollOut = TRUE +/\ since = 2 +/\ age = 0 + +3707 states generated, 1822 distinct states found, 722 states left on queue. +The depth of the complete state graph search is 11. +The average outdegree of the complete state graph is 2 (minimum is 0, the maximum 8 and the 95th percentile is 4). +Finished in 00s at (2026-12-02 20:42:11) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_window_not_reset.txt b/seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_window_not_reset.txt new file mode 100644 index 0000000000..be6c31a832 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r5/out-mut_window_not_reset.txt @@ -0,0 +1,282 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 18 and seed 8547046980146537379 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 2513816] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file recorded-model/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 20:42:12) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 20:42:12. +Error: Invariant NoEarlyFail is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 3: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 4: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "silent" +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 5: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "silent" +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 1 +/\ pollAge = 1 +/\ ever = {} +/\ total = 1 +/\ real = 1 +/\ pollOut = TRUE +/\ since = 1 +/\ age = 1 + +State 6: +/\ phase = "uploading" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "silent" +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 1 +/\ pollAge = 1 +/\ ever = {1} +/\ total = 1 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 1 +/\ age = 0 + +State 7: +/\ phase = "uploading" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "silent" +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 2 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 2 +/\ pollAge = 2 +/\ ever = {1} +/\ total = 2 +/\ real = 1 +/\ pollOut = TRUE +/\ since = 2 +/\ age = 0 + +State 8: +/\ phase = "uploading" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "silent" +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ pollAge = 3 +/\ ever = {1} +/\ total = 3 +/\ real = 2 +/\ pollOut = TRUE +/\ since = 3 +/\ age = 0 + +State 9: +/\ phase = "failed" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "silent" +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = TRUE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = TRUE +/\ other = "none" +/\ realCli = 3 +/\ pollAge = 3 +/\ ever = {1} +/\ total = 3 +/\ real = 2 +/\ pollOut = TRUE +/\ since = 3 +/\ age = 0 + +1613 states generated, 840 distinct states found, 360 states left on queue. +The depth of the complete state graph search is 9. +The average outdegree of the complete state graph is 2 (minimum is 0, the maximum 7 and the 95th percentile is 5). +Finished in 00s at (2026-12-02 20:42:12) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r5/out-safe_cut.txt b/seaweed-block/docs/spec/cuttime/recorded-r5/out-safe_cut.txt new file mode 100644 index 0000000000..dfac0e434d --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r5/out-safe_cut.txt @@ -0,0 +1,23 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 45 and seed 8585125391442751493 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 2513084] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file recorded-model/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 20:41:54) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 20:41:55. +Model checking completed. No error has been found. + Estimates of the probability that TLC did not check all reachable states + because two distinct states had the same fingerprint: + calculated (optimistic): val = 1.9E-11 +37521 states generated, 15901 distinct states found, 0 states left on queue. +The depth of the complete state graph search is 26. +The average outdegree of the complete state graph is 1 (minimum is 0, the maximum 7 and the 95th percentile is 3). +Finished in 00s at (2026-12-02 20:41:55) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r5/out-safe_cut_deadline.txt b/seaweed-block/docs/spec/cuttime/recorded-r5/out-safe_cut_deadline.txt new file mode 100644 index 0000000000..bffc445b39 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r5/out-safe_cut_deadline.txt @@ -0,0 +1,23 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 27 and seed -3015119116551790657 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 2513134] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file recorded-model/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 20:41:56) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 20:41:56. +Model checking completed. No error has been found. + Estimates of the probability that TLC did not check all reachable states + because two distinct states had the same fingerprint: + calculated (optimistic): val = 9.7E-11 +84967 states generated, 38870 distinct states found, 0 states left on queue. +The depth of the complete state graph search is 26. +The average outdegree of the complete state graph is 1 (minimum is 0, the maximum 8 and the 95th percentile is 4). +Finished in 01s at (2026-12-02 20:41:57) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r5/out-safe_cut_late.txt b/seaweed-block/docs/spec/cuttime/recorded-r5/out-safe_cut_late.txt new file mode 100644 index 0000000000..cac62c1a7c --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r5/out-safe_cut_late.txt @@ -0,0 +1,23 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 94 and seed 700654479658853680 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 2513184] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file recorded-model/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 20:41:57) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 20:41:58. +Model checking completed. No error has been found. + Estimates of the probability that TLC did not check all reachable states + because two distinct states had the same fingerprint: + calculated (optimistic): val = 4.3E-11 +57314 states generated, 22836 distinct states found, 0 states left on queue. +The depth of the complete state graph search is 27. +The average outdegree of the complete state graph is 1 (minimum is 0, the maximum 8 and the 95th percentile is 3). +Finished in 00s at (2026-12-02 20:41:58) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r5/out-wit_busy.txt b/seaweed-block/docs/spec/cuttime/recorded-r5/out-wit_busy.txt new file mode 100644 index 0000000000..a2480b6351 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r5/out-wit_busy.txt @@ -0,0 +1,108 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 65 and seed 8329595248835825465 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 2513857] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file recorded-model/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 20:42:13) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 20:42:13. +Error: Invariant WitBusy is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 3: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "busy" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +77 states generated, 50 distinct states found, 29 states left on queue. +The depth of the complete state graph search is 5. +The average outdegree of the complete state graph is 3 (minimum is 0, the maximum 8 and the 95th percentile is 8). +Finished in 00s at (2026-12-02 20:42:13) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r5/out-wit_cli_deadline.txt b/seaweed-block/docs/spec/cuttime/recorded-r5/out-wit_cli_deadline.txt new file mode 100644 index 0000000000..8167f768d2 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r5/out-wit_cli_deadline.txt @@ -0,0 +1,195 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 91 and seed 8219572715188354794 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 2513898] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file recorded-model/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 20:42:14) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 20:42:14. +Error: Invariant WitCliDeadline is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 3: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 1 +/\ pollAge = 1 +/\ ever = {} +/\ total = 1 +/\ real = 1 +/\ pollOut = TRUE +/\ since = 1 +/\ age = 0 + +State 4: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 2 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 2 +/\ pollAge = 2 +/\ ever = {} +/\ total = 2 +/\ real = 2 +/\ pollOut = TRUE +/\ since = 2 +/\ age = 0 + +State 5: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ pollAge = 3 +/\ ever = {} +/\ total = 3 +/\ real = 3 +/\ pollOut = TRUE +/\ since = 3 +/\ age = 0 + +State 6: +/\ phase = "cancelled" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "deadline" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ pollAge = 3 +/\ ever = {} +/\ total = 3 +/\ real = 3 +/\ pollOut = TRUE +/\ since = 3 +/\ age = 0 + +801 states generated, 430 distinct states found, 197 states left on queue. +The depth of the complete state graph search is 8. +The average outdegree of the complete state graph is 2 (minimum is 0, the maximum 8 and the 95th percentile is 4). +Finished in 00s at (2026-12-02 20:42:14) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r5/out-wit_cli_stalled.txt b/seaweed-block/docs/spec/cuttime/recorded-r5/out-wit_cli_stalled.txt new file mode 100644 index 0000000000..22418b09f2 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r5/out-wit_cli_stalled.txt @@ -0,0 +1,224 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 48 and seed 2501691565555896291 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 2513939] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file recorded-model/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 20:42:15) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 20:42:15. +Error: Invariant WitCliStalled is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 3: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 1 +/\ pollAge = 1 +/\ ever = {} +/\ total = 1 +/\ real = 1 +/\ pollOut = TRUE +/\ since = 1 +/\ age = 0 + +State 4: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 2 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 2 +/\ pollAge = 2 +/\ ever = {} +/\ total = 2 +/\ real = 2 +/\ pollOut = TRUE +/\ since = 2 +/\ age = 0 + +State 5: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ pollAge = 3 +/\ ever = {} +/\ total = 3 +/\ real = 3 +/\ pollOut = TRUE +/\ since = 3 +/\ age = 0 + +State 6: +/\ phase = "failed" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = TRUE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ pollAge = 3 +/\ ever = {} +/\ total = 3 +/\ real = 3 +/\ pollOut = TRUE +/\ since = 3 +/\ age = 0 + +State 7: +/\ phase = "failed" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "stalled" +/\ busyOwn = FALSE +/\ failedOnce = TRUE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ pollAge = 3 +/\ ever = {} +/\ total = 3 +/\ real = 3 +/\ pollOut = TRUE +/\ since = 3 +/\ age = 0 + +1648 states generated, 851 distinct states found, 363 states left on queue. +The depth of the complete state graph search is 9. +The average outdegree of the complete state graph is 2 (minimum is 0, the maximum 8 and the 95th percentile is 5). +Finished in 00s at (2026-12-02 20:42:15) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r5/out-wit_restart_unknown.txt b/seaweed-block/docs/spec/cuttime/recorded-r5/out-wit_restart_unknown.txt new file mode 100644 index 0000000000..7dcddb790b --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r5/out-wit_restart_unknown.txt @@ -0,0 +1,166 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 121 and seed 4150404087366978728 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 2513980] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file recorded-model/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 20:42:16) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 20:42:16. +Error: Invariant WitRestartUnknown is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 3: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 4: +/\ phase = "lost" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = TRUE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 5: +/\ phase = "lost" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = TRUE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "unknown" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +152 states generated, 93 distinct states found, 48 states left on queue. +The depth of the complete state graph search is 6. +The average outdegree of the complete state graph is 2 (minimum is 0, the maximum 6 and the 95th percentile is 5). +Finished in 00s at (2026-12-02 20:42:16) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r5/out-wit_slow_no_fail.txt b/seaweed-block/docs/spec/cuttime/recorded-r5/out-wit_slow_no_fail.txt new file mode 100644 index 0000000000..d9bd712cfe --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r5/out-wit_slow_no_fail.txt @@ -0,0 +1,427 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 19 and seed -3874497009180308668 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 2514022] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file recorded-model/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 20:42:16) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 20:42:17. +Error: Invariant WitSlowNoFail is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 3: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 4: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 1 +/\ pollAge = 1 +/\ ever = {} +/\ total = 1 +/\ real = 1 +/\ pollOut = TRUE +/\ since = 1 +/\ age = 1 + +State 5: +/\ phase = "uploading" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 1 +/\ pollAge = 1 +/\ ever = {1} +/\ total = 1 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 6: +/\ phase = "uploading" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 2 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 1 +/\ pollAge = 1 +/\ ever = {1} +/\ total = 1 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 7: +/\ phase = "uploading" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 1 +/\ pollAge = 1 +/\ ever = {1, 2} +/\ total = 1 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 8: +/\ phase = "uploading" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 2 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 1 +/\ ever = {1, 2} +/\ total = 1 +/\ real = 0 +/\ pollOut = FALSE +/\ since = 0 +/\ age = 0 + +State 9: +/\ phase = "uploading" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 2 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {1, 2} +/\ total = 1 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 10: +/\ phase = "uploading" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 2 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 1 +/\ pollAge = 1 +/\ ever = {1, 2} +/\ total = 2 +/\ real = 1 +/\ pollOut = TRUE +/\ since = 1 +/\ age = 0 + +State 11: +/\ phase = "uploading" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 2 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 2 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 2 +/\ pollAge = 2 +/\ ever = {1, 2} +/\ total = 3 +/\ real = 2 +/\ pollOut = TRUE +/\ since = 2 +/\ age = 0 + +State 12: +/\ phase = "uploading" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 2 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ pollAge = 3 +/\ ever = {1, 2} +/\ total = 4 +/\ real = 3 +/\ pollOut = TRUE +/\ since = 3 +/\ age = 0 + +State 13: +/\ phase = "published" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 2 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ pollAge = 3 +/\ ever = {1, 2} +/\ total = 4 +/\ real = 3 +/\ pollOut = TRUE +/\ since = 3 +/\ age = 0 + +State 14: +/\ phase = "published" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 2 +/\ cli = "ok" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ pollAge = 3 +/\ ever = {1, 2} +/\ total = 4 +/\ real = 3 +/\ pollOut = TRUE +/\ since = 3 +/\ age = 0 + +15384 states generated, 7035 distinct states found, 1794 states left on queue. +The depth of the complete state graph search is 14. +The average outdegree of the complete state graph is 1 (minimum is 0, the maximum 7 and the 95th percentile is 4). +Finished in 00s at (2026-12-02 20:42:17) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r5/out-wit_stalled_retry_pub.txt b/seaweed-block/docs/spec/cuttime/recorded-r5/out-wit_stalled_retry_pub.txt new file mode 100644 index 0000000000..dabb853668 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r5/out-wit_stalled_retry_pub.txt @@ -0,0 +1,398 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 76 and seed 5715123472687606501 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 2514063] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file recorded-model/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 20:42:17) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 20:42:18. +Error: Invariant WitStalledRetryPub is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 3: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 1 +/\ pollAge = 1 +/\ ever = {} +/\ total = 1 +/\ real = 1 +/\ pollOut = TRUE +/\ since = 1 +/\ age = 0 + +State 4: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 2 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 2 +/\ pollAge = 2 +/\ ever = {} +/\ total = 2 +/\ real = 2 +/\ pollOut = TRUE +/\ since = 2 +/\ age = 0 + +State 5: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ pollAge = 3 +/\ ever = {} +/\ total = 3 +/\ real = 3 +/\ pollOut = TRUE +/\ since = 3 +/\ age = 0 + +State 6: +/\ phase = "failed" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = TRUE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ pollAge = 3 +/\ ever = {} +/\ total = 3 +/\ real = 3 +/\ pollOut = TRUE +/\ since = 3 +/\ age = 0 + +State 7: +/\ phase = "failed" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "stalled" +/\ busyOwn = FALSE +/\ failedOnce = TRUE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ pollAge = 3 +/\ ever = {} +/\ total = 3 +/\ real = 3 +/\ pollOut = TRUE +/\ since = 3 +/\ age = 0 + +State 8: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 2 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "stalled" +/\ busyOwn = FALSE +/\ failedOnce = TRUE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ pollAge = 3 +/\ ever = {} +/\ total = 3 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 9: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 2 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "stalled" +/\ busyOwn = FALSE +/\ failedOnce = TRUE +/\ inflight = 1 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ pollAge = 3 +/\ ever = {} +/\ total = 3 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 10: +/\ phase = "uploading" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 2 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "stalled" +/\ busyOwn = FALSE +/\ failedOnce = TRUE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ pollAge = 3 +/\ ever = {1} +/\ total = 3 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 11: +/\ phase = "uploading" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 2 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "stalled" +/\ busyOwn = FALSE +/\ failedOnce = TRUE +/\ inflight = 2 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ pollAge = 3 +/\ ever = {1} +/\ total = 3 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 12: +/\ phase = "uploading" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 2 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "stalled" +/\ busyOwn = FALSE +/\ failedOnce = TRUE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ pollAge = 3 +/\ ever = {1, 2} +/\ total = 3 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 13: +/\ phase = "published" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 2 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "stalled" +/\ busyOwn = FALSE +/\ failedOnce = TRUE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ pollAge = 3 +/\ ever = {1, 2} +/\ total = 3 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +17730 states generated, 8137 distinct states found, 1985 states left on queue. +The depth of the complete state graph search is 15. +The average outdegree of the complete state graph is 1 (minimum is 0, the maximum 8 and the 95th percentile is 4). +Finished in 00s at (2026-12-02 20:42:18) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r5/out-wit_timed_out_then_pub.txt b/seaweed-block/docs/spec/cuttime/recorded-r5/out-wit_timed_out_then_pub.txt new file mode 100644 index 0000000000..50c8f0b918 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r5/out-wit_timed_out_then_pub.txt @@ -0,0 +1,369 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 84 and seed 7352268218141554689 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 2514104] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file recorded-model/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 20:42:18) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 20:42:19. +Error: Invariant WitTimedOutThenPub is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 3: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = TRUE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 4: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = TRUE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 1 +/\ pollAge = 1 +/\ ever = {} +/\ total = 1 +/\ real = 1 +/\ pollOut = TRUE +/\ since = 1 +/\ age = 1 + +State 5: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = TRUE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 2 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 2 +/\ pollAge = 2 +/\ ever = {} +/\ total = 2 +/\ real = 2 +/\ pollOut = TRUE +/\ since = 2 +/\ age = 2 + +State 6: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 2 +/\ timedOutOnce = TRUE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 2 +/\ pollAge = 2 +/\ ever = {} +/\ total = 2 +/\ real = 2 +/\ pollOut = TRUE +/\ since = 2 +/\ age = 0 + +State 7: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 2 +/\ timedOutOnce = TRUE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 2 +/\ pollAge = 2 +/\ ever = {} +/\ total = 2 +/\ real = 2 +/\ pollOut = TRUE +/\ since = 2 +/\ age = 0 + +State 8: +/\ phase = "uploading" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 2 +/\ timedOutOnce = TRUE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 2 +/\ pollAge = 2 +/\ ever = {1} +/\ total = 2 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 9: +/\ phase = "uploading" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 2 +/\ cliSince = 2 +/\ timedOutOnce = TRUE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 2 +/\ pollAge = 2 +/\ ever = {1} +/\ total = 2 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 10: +/\ phase = "uploading" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 2 +/\ timedOutOnce = TRUE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 2 +/\ pollAge = 2 +/\ ever = {1, 2} +/\ total = 2 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 11: +/\ phase = "published" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 2 +/\ timedOutOnce = TRUE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 2 +/\ pollAge = 2 +/\ ever = {1, 2} +/\ total = 2 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 12: +/\ phase = "published" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "ok" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 2 +/\ timedOutOnce = TRUE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 2 +/\ pollAge = 2 +/\ ever = {1, 2} +/\ total = 2 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +8722 states generated, 4093 distinct states found, 1335 states left on queue. +The depth of the complete state graph search is 12. +The average outdegree of the complete state graph is 1 (minimum is 0, the maximum 7 and the 95th percentile is 4). +Finished in 00s at (2026-12-02 20:42:19) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r5/out-wit_unknown_then_pub.txt b/seaweed-block/docs/spec/cuttime/recorded-r5/out-wit_unknown_then_pub.txt new file mode 100644 index 0000000000..a0ba07d37b --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r5/out-wit_unknown_then_pub.txt @@ -0,0 +1,311 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 108 and seed -7006478842729984216 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 2514146] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file recorded-model/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 20:42:20) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 20:42:20. +Error: Invariant WitUnknownThenPub is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 3: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 4: +/\ phase = "uploading" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {1} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 5: +/\ phase = "uploading" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 2 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {1} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 6: +/\ phase = "uploading" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {1, 2} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 7: +/\ phase = "lost" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = TRUE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {1, 2} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 8: +/\ phase = "lost" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hung = FALSE +/\ link = "up" +/\ restarted = TRUE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "unknown" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {1, 2} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 9: +/\ phase = "uploading" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 2 +/\ hung = FALSE +/\ link = "up" +/\ restarted = TRUE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "unknown" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {1, 2} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 10: +/\ phase = "published" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 2 +/\ hung = FALSE +/\ link = "up" +/\ restarted = TRUE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "unknown" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ pollAge = 0 +/\ ever = {1, 2} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +2783 states generated, 1401 distinct states found, 567 states left on queue. +The depth of the complete state graph search is 10. +The average outdegree of the complete state graph is 2 (minimum is 0, the maximum 7 and the 95th percentile is 4). +Finished in 00s at (2026-12-02 20:42:20) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r5/verdicts.txt b/seaweed-block/docs/spec/cuttime/recorded-r5/verdicts.txt new file mode 100644 index 0000000000..f681f2bb32 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r5/verdicts.txt @@ -0,0 +1,26 @@ +safe_cut: OK +safe_cut_deadline: OK +safe_cut_late: OK +mut_answer_late: Invariant CliUnknownOnlySilent is violated. +mut_attempt_renews: Invariant NoSilentStall is violated. +mut_busy_when_free: Invariant BusyOnlyWhenHeld is violated. +mut_cli_no_slack: Invariant CliUnknownOnlySilent is violated. +mut_cli_no_window: Invariant CliNoSilentWait is violated. +mut_cli_total_timeout: Invariant CliNoEarlyExit is violated. +mut_global_renews: Invariant CliNoSilentWait is violated. +mut_no_call_deadline: Invariant NoLongCall is violated. +mut_queued_stalls: Invariant NoQueuedStall is violated. +mut_repost: Invariant CliBusyNotOwn is violated. +mut_restart_as_failed: Invariant CliNoEarlyExit is violated. +mut_retry_loses_progress: Invariant ProgressKept is violated. +mut_timeout_renews: Invariant NoSilentStall is violated. +mut_total_cap: Invariant NoEarlyFail is violated. +mut_window_not_reset: Invariant NoEarlyFail is violated. +wit_busy: Invariant WitBusy is violated. +wit_cli_deadline: Invariant WitCliDeadline is violated. +wit_cli_stalled: Invariant WitCliStalled is violated. +wit_restart_unknown: Invariant WitRestartUnknown is violated. +wit_slow_no_fail: Invariant WitSlowNoFail is violated. +wit_stalled_retry_pub: Invariant WitStalledRetryPub is violated. +wit_timed_out_then_pub: Invariant WitTimedOutThenPub is violated. +wit_unknown_then_pub: Invariant WitUnknownThenPub is violated. diff --git a/seaweed-block/docs/spec/cuttime/recorded-r6/RESULT.txt b/seaweed-block/docs/spec/cuttime/recorded-r6/RESULT.txt new file mode 100644 index 0000000000..d1ecb4e4fa --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r6/RESULT.txt @@ -0,0 +1,30 @@ +safe_cut want=OK got=OK states=[18019 distinct states found] PASS +safe_cut_deadline want=OK got=OK states=[43899 distinct states found] PASS +safe_cut_late want=OK got=OK states=[30139 distinct states found] PASS +mut_answer_late want=violated got=CliUnknownOnlySilent states=[3892 distinct states found] PASS +mut_attempt_renews want=violated got=NoSilentStall states=[779 distinct states found] PASS +mut_busy_when_free want=violated got=BusyOnlyWhenHeld states=[31 distinct states found] PASS +mut_cli_no_slack want=violated got=CliUnknownOnlySilent states=[424 distinct states found] PASS +mut_cli_no_window want=violated got=CliNoSilentWait states=[764 distinct states found] PASS +mut_cli_total_timeout want=violated got=CliNoEarlyExit states=[729 distinct states found] PASS +mut_forget_on_send want=violated got=CliUnknownOnlySilent states=[1416 distinct states found] PASS +mut_global_renews want=violated got=CliNoSilentWait states=[1854 distinct states found] PASS +mut_no_call_deadline want=violated got=NoLongCall states=[192 distinct states found] PASS +mut_overwrite_next want=violated got=CliUnknownOnlySilent states=[866 distinct states found] PASS +mut_queued_stalls want=violated got=NoQueuedStall states=[260 distinct states found] PASS +mut_repost want=violated got=CliBusyNotOwn states=[34 distinct states found] PASS +mut_restart_as_failed want=violated got=CliNoEarlyExit states=[88 distinct states found] PASS +mut_retire_early want=violated got=CliUnknownOnlySilent states=[855 distinct states found] PASS +mut_retry_loses_progress want=violated got=ProgressKept states=[245 distinct states found] PASS +mut_timeout_renews want=violated got=NoSilentStall states=[1107 distinct states found] PASS +mut_total_cap want=violated got=NoEarlyFail states=[1690 distinct states found] PASS +mut_window_not_reset want=violated got=NoEarlyFail states=[887 distinct states found] PASS +wit_busy want=violated got=WitBusy states=[44 distinct states found] PASS +wit_cli_deadline want=violated got=WitCliDeadline states=[513 distinct states found] PASS +wit_cli_stalled want=violated got=WitCliStalled states=[845 distinct states found] PASS +wit_lost_reply_then_ok want=violated got=WitLostReplyThenOk states=[1478 distinct states found] PASS +wit_restart_unknown want=violated got=WitRestartUnknown states=[84 distinct states found] PASS +wit_slow_no_fail want=violated got=WitSlowNoFail states=[7069 distinct states found] PASS +wit_stalled_retry_pub want=violated got=WitStalledRetryPub states=[8445 distinct states found] PASS +wit_timed_out_then_pub want=violated got=WitTimedOutThenPub states=[4239 distinct states found] PASS +wit_unknown_then_pub want=violated got=WitUnknownThenPub states=[1459 distinct states found] PASS diff --git a/seaweed-block/docs/spec/cuttime/recorded-r6/coverage.txt b/seaweed-block/docs/spec/cuttime/recorded-r6/coverage.txt new file mode 100644 index 0000000000..75f809ebfc --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r6/coverage.txt @@ -0,0 +1,10 @@ +NoEarlyFail mut_total_cap, mut_window_not_reset +NoSilentStall mut_attempt_renews, mut_timeout_renews +NoLongCall mut_no_call_deadline +ProgressKept mut_retry_loses_progress +CliNoEarlyExit mut_cli_total_timeout, mut_restart_as_failed +CliNoSilentWait mut_cli_no_window, mut_global_renews +CliUnknownOnlySilent mut_answer_late, mut_cli_no_slack, mut_forget_on_send, mut_overwrite_next, mut_retire_early +NoQueuedStall mut_queued_stalls +BusyOnlyWhenHeld mut_busy_when_free +CliBusyNotOwn mut_repost diff --git a/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_answer_late.txt b/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_answer_late.txt new file mode 100644 index 0000000000..9e9c8295c0 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_answer_late.txt @@ -0,0 +1,373 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 9 and seed 338827297138807345 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 401720] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file /home/swtest/c01-tlc-ct6/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 21:08:40) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 21:08:40. +Error: Invariant CliUnknownOnlySilent is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "none" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 3: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 4: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 1 +/\ handle = "held" +/\ pollAge = 1 +/\ ever = {} +/\ total = 1 +/\ real = 1 +/\ pollOut = TRUE +/\ since = 1 +/\ age = 1 + +State 5: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 1 +/\ handle = "held" +/\ pollAge = 1 +/\ ever = {} +/\ total = 1 +/\ real = 1 +/\ pollOut = FALSE +/\ since = 1 +/\ age = 1 + +State 6: +/\ phase = "uploading" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 1 +/\ handle = "held" +/\ pollAge = 1 +/\ ever = {1} +/\ total = 1 +/\ real = 0 +/\ pollOut = FALSE +/\ since = 0 +/\ age = 0 + +State 7: +/\ phase = "uploading" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 1 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {1} +/\ total = 1 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 8: +/\ phase = "uploading" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 2 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 2 +/\ handle = "held" +/\ pollAge = 1 +/\ ever = {1} +/\ total = 2 +/\ real = 1 +/\ pollOut = TRUE +/\ since = 1 +/\ age = 0 + +State 9: +/\ phase = "uploading" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ handle = "held" +/\ pollAge = 2 +/\ ever = {1} +/\ total = 3 +/\ real = 2 +/\ pollOut = TRUE +/\ since = 2 +/\ age = 0 + +State 10: +/\ phase = "uploading" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 4 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 4 +/\ handle = "held" +/\ pollAge = 3 +/\ ever = {1} +/\ total = 4 +/\ real = 3 +/\ pollOut = TRUE +/\ since = 3 +/\ age = 0 + +State 11: +/\ phase = "uploading" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "unknown" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 4 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 4 +/\ handle = "held" +/\ pollAge = 3 +/\ ever = {1} +/\ total = 4 +/\ real = 3 +/\ pollOut = TRUE +/\ since = 3 +/\ age = 0 + +8150 states generated, 3892 distinct states found, 1533 states left on queue. +The depth of the complete state graph search is 11. +The average outdegree of the complete state graph is 2 (minimum is 0, the maximum 7 and the 95th percentile is 4). +Finished in 00s at (2026-12-02 21:08:40) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_attempt_renews.txt b/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_attempt_renews.txt new file mode 100644 index 0000000000..de072edfa3 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_attempt_renews.txt @@ -0,0 +1,277 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 109 and seed -8273198866143330124 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 401761] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file /home/swtest/c01-tlc-ct6/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 21:08:41) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 21:08:41. +Error: Invariant NoSilentStall is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "none" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 3: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "silent" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 4: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "silent" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 1 +/\ handle = "held" +/\ pollAge = 1 +/\ ever = {} +/\ total = 1 +/\ real = 1 +/\ pollOut = TRUE +/\ since = 1 +/\ age = 0 + +State 5: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "silent" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 2 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 2 +/\ handle = "held" +/\ pollAge = 2 +/\ ever = {} +/\ total = 2 +/\ real = 2 +/\ pollOut = TRUE +/\ since = 2 +/\ age = 0 + +State 6: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "silent" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 2 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 2 +/\ handle = "held" +/\ pollAge = 2 +/\ ever = {} +/\ total = 2 +/\ real = 2 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 7: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "silent" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ handle = "held" +/\ pollAge = 3 +/\ ever = {} +/\ total = 3 +/\ real = 3 +/\ pollOut = TRUE +/\ since = 1 +/\ age = 1 + +State 8: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "silent" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 4 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 4 +/\ handle = "held" +/\ pollAge = 3 +/\ ever = {} +/\ total = 4 +/\ real = 4 +/\ pollOut = TRUE +/\ since = 2 +/\ age = 2 + +1438 states generated, 779 distinct states found, 348 states left on queue. +The depth of the complete state graph search is 9. +The average outdegree of the complete state graph is 2 (minimum is 0, the maximum 7 and the 95th percentile is 5). +Finished in 00s at (2026-12-02 21:08:41) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_busy_when_free.txt b/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_busy_when_free.txt new file mode 100644 index 0000000000..a34e22ff12 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_busy_when_free.txt @@ -0,0 +1,85 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 73 and seed -491609226175859221 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 401803] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file /home/swtest/c01-tlc-ct6/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 21:08:42) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 21:08:42. +Error: Invariant BusyOnlyWhenHeld is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "none" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = TRUE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "none" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +40 states generated, 31 distinct states found, 20 states left on queue. +The depth of the complete state graph search is 4. +The average outdegree of the complete state graph is 3 (minimum is 0, the maximum 7 and the 95th percentile is 7). +Finished in 00s at (2026-12-02 21:08:42) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_cli_no_slack.txt b/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_cli_no_slack.txt new file mode 100644 index 0000000000..cda9d217e3 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_cli_no_slack.txt @@ -0,0 +1,213 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 85 and seed 8550602877709749960 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 401844] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file /home/swtest/c01-tlc-ct6/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 21:08:42) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 21:08:43. +Error: Invariant CliUnknownOnlySilent is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "none" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 3: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 1 +/\ handle = "held" +/\ pollAge = 1 +/\ ever = {} +/\ total = 1 +/\ real = 1 +/\ pollOut = TRUE +/\ since = 1 +/\ age = 0 + +State 4: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 2 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 2 +/\ handle = "held" +/\ pollAge = 2 +/\ ever = {} +/\ total = 2 +/\ real = 2 +/\ pollOut = TRUE +/\ since = 2 +/\ age = 0 + +State 5: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ handle = "held" +/\ pollAge = 3 +/\ ever = {} +/\ total = 3 +/\ real = 3 +/\ pollOut = TRUE +/\ since = 3 +/\ age = 0 + +State 6: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "unknown" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ handle = "held" +/\ pollAge = 3 +/\ ever = {} +/\ total = 3 +/\ real = 3 +/\ pollOut = TRUE +/\ since = 3 +/\ age = 0 + +770 states generated, 424 distinct states found, 204 states left on queue. +The depth of the complete state graph search is 8. +The average outdegree of the complete state graph is 2 (minimum is 0, the maximum 7 and the 95th percentile is 5). +Finished in 00s at (2026-12-02 21:08:43) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_cli_no_window.txt b/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_cli_no_window.txt new file mode 100644 index 0000000000..963fceff35 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_cli_no_window.txt @@ -0,0 +1,277 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 22 and seed -3817361081439875651 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 401885] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file /home/swtest/c01-tlc-ct6/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 21:08:43) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 21:08:44. +Error: Invariant CliNoSilentWait is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 0 +/\ handle = "none" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 0 +/\ handle = "none" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 3: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "silent" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 0 +/\ handle = "none" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 4: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "silent" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 1 +/\ handle = "none" +/\ pollAge = 1 +/\ ever = {} +/\ total = 1 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 5: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "silent" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 2 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 2 +/\ handle = "none" +/\ pollAge = 2 +/\ ever = {} +/\ total = 2 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 6: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "silent" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 3 +/\ handle = "none" +/\ pollAge = 3 +/\ ever = {} +/\ total = 3 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 7: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "silent" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 4 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 4 +/\ handle = "none" +/\ pollAge = 3 +/\ ever = {} +/\ total = 4 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 8: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "silent" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 5 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 5 +/\ handle = "none" +/\ pollAge = 3 +/\ ever = {} +/\ total = 4 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +1503 states generated, 764 distinct states found, 324 states left on queue. +The depth of the complete state graph search is 9. +The average outdegree of the complete state graph is 2 (minimum is 0, the maximum 8 and the 95th percentile is 5). +Finished in 00s at (2026-12-02 21:08:44) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_cli_total_timeout.txt b/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_cli_total_timeout.txt new file mode 100644 index 0000000000..b8ca01f783 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_cli_total_timeout.txt @@ -0,0 +1,277 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 52 and seed -3215035929988245121 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 401926] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file /home/swtest/c01-tlc-ct6/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 21:08:44) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 21:08:45. +Error: Invariant CliNoEarlyExit is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 0 +/\ handle = "none" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 0 +/\ handle = "none" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 3: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "silent" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 0 +/\ handle = "none" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 4: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "silent" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 1 +/\ handle = "none" +/\ pollAge = 1 +/\ ever = {} +/\ total = 1 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 5: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "silent" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 2 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 2 +/\ handle = "none" +/\ pollAge = 2 +/\ ever = {} +/\ total = 2 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 6: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "silent" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 3 +/\ handle = "none" +/\ pollAge = 3 +/\ ever = {} +/\ total = 3 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 7: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "silent" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 4 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 4 +/\ handle = "none" +/\ pollAge = 3 +/\ ever = {} +/\ total = 4 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 8: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = TRUE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "silent" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "timeout" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 4 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 4 +/\ handle = "none" +/\ pollAge = 3 +/\ ever = {} +/\ total = 4 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +1405 states generated, 729 distinct states found, 324 states left on queue. +The depth of the complete state graph search is 9. +The average outdegree of the complete state graph is 2 (minimum is 0, the maximum 8 and the 95th percentile is 5). +Finished in 00s at (2026-12-02 21:08:45) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_forget_on_send.txt b/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_forget_on_send.txt new file mode 100644 index 0000000000..7f03c0970b --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_forget_on_send.txt @@ -0,0 +1,341 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 13 and seed -5284753882303467709 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 401967] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file /home/swtest/c01-tlc-ct6/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 21:08:45) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 21:08:45. +Error: Invariant CliUnknownOnlySilent is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "none" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 3: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 4: +/\ phase = "uploading" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {1} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 5: +/\ phase = "uploading" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 2 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {1} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 6: +/\ phase = "uploading" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {1, 2} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 7: +/\ phase = "published" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {1, 2} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 8: +/\ phase = "published" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = TRUE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "gone" +/\ pollAge = 0 +/\ ever = {1, 2} +/\ total = 0 +/\ real = 0 +/\ pollOut = FALSE +/\ since = 0 +/\ age = 0 + +State 9: +/\ phase = "published" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = TRUE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "gone" +/\ pollAge = 0 +/\ ever = {1, 2} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 10: +/\ phase = "published" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = TRUE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "unknown" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "gone" +/\ pollAge = 0 +/\ ever = {1, 2} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +2822 states generated, 1416 distinct states found, 574 states left on queue. +The depth of the complete state graph search is 10. +The average outdegree of the complete state graph is 2 (minimum is 0, the maximum 8 and the 95th percentile is 4). +Finished in 00s at (2026-12-02 21:08:46) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_global_renews.txt b/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_global_renews.txt new file mode 100644 index 0000000000..8b1223cd3d --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_global_renews.txt @@ -0,0 +1,309 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 7 and seed -2099642536674512876 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 402009] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file /home/swtest/c01-tlc-ct6/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 21:08:46) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 21:08:46. +Error: Invariant CliNoSilentWait is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 0 +/\ handle = "none" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 0 +/\ handle = "none" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 3: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "silent" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 0 +/\ handle = "none" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 4: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "silent" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 1 +/\ handle = "none" +/\ pollAge = 1 +/\ ever = {} +/\ total = 1 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 5: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "silent" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 1 +/\ handle = "none" +/\ pollAge = 1 +/\ ever = {} +/\ total = 1 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 6: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "silent" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 2 +/\ handle = "none" +/\ pollAge = 2 +/\ ever = {} +/\ total = 2 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 7: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "silent" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 2 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 3 +/\ handle = "none" +/\ pollAge = 3 +/\ ever = {} +/\ total = 3 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 8: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "silent" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 4 +/\ handle = "none" +/\ pollAge = 3 +/\ ever = {} +/\ total = 4 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 9: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "silent" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 4 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 5 +/\ handle = "none" +/\ pollAge = 3 +/\ ever = {} +/\ total = 4 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +4258 states generated, 1854 distinct states found, 925 states left on queue. +The depth of the complete state graph search is 10. +The average outdegree of the complete state graph is 2 (minimum is 0, the maximum 8 and the 95th percentile is 5). +Finished in 00s at (2026-12-02 21:08:47) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_no_call_deadline.txt b/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_no_call_deadline.txt new file mode 100644 index 0000000000..2805cfe86c --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_no_call_deadline.txt @@ -0,0 +1,213 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 75 and seed -6867239112806336991 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 402050] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file /home/swtest/c01-tlc-ct6/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 21:08:47) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 21:08:47. +Error: Invariant NoLongCall is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "none" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 3: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 4: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 1 +/\ handle = "held" +/\ pollAge = 1 +/\ ever = {} +/\ total = 1 +/\ real = 1 +/\ pollOut = TRUE +/\ since = 1 +/\ age = 1 + +State 5: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 2 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 2 +/\ handle = "held" +/\ pollAge = 2 +/\ ever = {} +/\ total = 2 +/\ real = 2 +/\ pollOut = TRUE +/\ since = 2 +/\ age = 2 + +State 6: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ handle = "held" +/\ pollAge = 3 +/\ ever = {} +/\ total = 3 +/\ real = 3 +/\ pollOut = TRUE +/\ since = 3 +/\ age = 3 + +355 states generated, 192 distinct states found, 99 states left on queue. +The depth of the complete state graph search is 7. +The average outdegree of the complete state graph is 2 (minimum is 0, the maximum 8 and the 95th percentile is 5). +Finished in 00s at (2026-12-02 21:08:47) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_overwrite_next.txt b/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_overwrite_next.txt new file mode 100644 index 0000000000..da9e9e2c43 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_overwrite_next.txt @@ -0,0 +1,309 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 16 and seed 4141376782343851747 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 402091] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file /home/swtest/c01-tlc-ct6/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 21:08:48) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 21:08:48. +Error: Invariant CliUnknownOnlySilent is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "none" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 3: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 4: +/\ phase = "uploading" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {1} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 5: +/\ phase = "uploading" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 2 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {1} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 6: +/\ phase = "uploading" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {1, 2} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 7: +/\ phase = "published" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {1, 2} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 8: +/\ phase = "published" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "gone" +/\ pollAge = 0 +/\ ever = {1, 2} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 9: +/\ phase = "published" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "unknown" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "gone" +/\ pollAge = 0 +/\ ever = {1, 2} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +1667 states generated, 866 distinct states found, 380 states left on queue. +The depth of the complete state graph search is 9. +The average outdegree of the complete state graph is 2 (minimum is 0, the maximum 7 and the 95th percentile is 5). +Finished in 00s at (2026-12-02 21:08:48) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_queued_stalls.txt b/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_queued_stalls.txt new file mode 100644 index 0000000000..7b6928351d --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_queued_stalls.txt @@ -0,0 +1,181 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 121 and seed -987434406710851984 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 402132] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file /home/swtest/c01-tlc-ct6/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 21:08:49) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 21:08:49. +Error: Invariant NoQueuedStall is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "none" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 1 +/\ handle = "none" +/\ pollAge = 1 +/\ ever = {} +/\ total = 1 +/\ real = 1 +/\ pollOut = TRUE +/\ since = 1 +/\ age = 0 + +State 3: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 2 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 2 +/\ handle = "none" +/\ pollAge = 2 +/\ ever = {} +/\ total = 2 +/\ real = 2 +/\ pollOut = TRUE +/\ since = 2 +/\ age = 0 + +State 4: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ handle = "none" +/\ pollAge = 3 +/\ ever = {} +/\ total = 3 +/\ real = 3 +/\ pollOut = TRUE +/\ since = 3 +/\ age = 0 + +State 5: +/\ phase = "failed" +/\ done = {} +/\ stallQueued = TRUE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = TRUE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ handle = "none" +/\ pollAge = 3 +/\ ever = {} +/\ total = 3 +/\ real = 3 +/\ pollOut = TRUE +/\ since = 3 +/\ age = 0 + +487 states generated, 260 distinct states found, 130 states left on queue. +The depth of the complete state graph search is 7. +The average outdegree of the complete state graph is 2 (minimum is 0, the maximum 7 and the 95th percentile is 5). +Finished in 00s at (2026-12-02 21:08:49) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_repost.txt b/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_repost.txt new file mode 100644 index 0000000000..452de015c1 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_repost.txt @@ -0,0 +1,117 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 72 and seed 8917589061358093442 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 402173] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file /home/swtest/c01-tlc-ct6/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 21:08:50) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 21:08:50. +Error: Invariant CliBusyNotOwn is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "none" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 3: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "busy" +/\ busyOwn = TRUE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +42 states generated, 34 distinct states found, 19 states left on queue. +The depth of the complete state graph search is 4. +The average outdegree of the complete state graph is 2 (minimum is 0, the maximum 3 and the 95th percentile is 3). +Finished in 00s at (2026-12-02 21:08:50) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_restart_as_failed.txt b/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_restart_as_failed.txt new file mode 100644 index 0000000000..d71ac0cc77 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_restart_as_failed.txt @@ -0,0 +1,149 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 73 and seed -4983968146057506772 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 402214] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file /home/swtest/c01-tlc-ct6/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 21:08:51) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 21:08:51. +Error: Invariant CliNoEarlyExit is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "none" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 3: +/\ phase = "failed" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = TRUE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 4: +/\ phase = "failed" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = TRUE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = TRUE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "stalled" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +143 states generated, 88 distinct states found, 45 states left on queue. +The depth of the complete state graph search is 6. +The average outdegree of the complete state graph is 2 (minimum is 0, the maximum 8 and the 95th percentile is 6). +Finished in 00s at (2026-12-02 21:08:51) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_retire_early.txt b/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_retire_early.txt new file mode 100644 index 0000000000..750cf4230f --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_retire_early.txt @@ -0,0 +1,309 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 88 and seed 7091627107453054402 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 402256] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file /home/swtest/c01-tlc-ct6/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 21:08:52) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 21:08:52. +Error: Invariant CliUnknownOnlySilent is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "none" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 3: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 4: +/\ phase = "uploading" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {1} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 5: +/\ phase = "uploading" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 2 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {1} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 6: +/\ phase = "uploading" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {1, 2} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 7: +/\ phase = "published" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {1, 2} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 8: +/\ phase = "published" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "gone" +/\ pollAge = 0 +/\ ever = {1, 2} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 9: +/\ phase = "published" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "unknown" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "gone" +/\ pollAge = 0 +/\ ever = {1, 2} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +1651 states generated, 855 distinct states found, 376 states left on queue. +The depth of the complete state graph search is 9. +The average outdegree of the complete state graph is 2 (minimum is 0, the maximum 7 and the 95th percentile is 5). +Finished in 00s at (2026-12-02 21:08:52) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_retry_loses_progress.txt b/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_retry_loses_progress.txt new file mode 100644 index 0000000000..7b54102c10 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_retry_loses_progress.txt @@ -0,0 +1,245 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 17 and seed -365409383110953073 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 402297] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file /home/swtest/c01-tlc-ct6/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 21:08:53) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 21:08:53. +Error: Invariant ProgressKept is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "none" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 3: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 4: +/\ phase = "uploading" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {1} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 5: +/\ phase = "lost" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = TRUE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {1} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 6: +/\ phase = "lost" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = TRUE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "unknown" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {1} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 7: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 2 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = TRUE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "unknown" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {1} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +441 states generated, 245 distinct states found, 119 states left on queue. +The depth of the complete state graph search is 7. +The average outdegree of the complete state graph is 2 (minimum is 0, the maximum 8 and the 95th percentile is 5). +Finished in 00s at (2026-12-02 21:08:53) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_timeout_renews.txt b/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_timeout_renews.txt new file mode 100644 index 0000000000..4b5d45410d --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_timeout_renews.txt @@ -0,0 +1,309 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 49 and seed -4520668873969213545 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 402338] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file /home/swtest/c01-tlc-ct6/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 21:08:54) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 21:08:54. +Error: Invariant NoSilentStall is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "none" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 3: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 4: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "silent" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 5: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "silent" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 1 +/\ handle = "held" +/\ pollAge = 1 +/\ ever = {} +/\ total = 1 +/\ real = 1 +/\ pollOut = TRUE +/\ since = 1 +/\ age = 1 + +State 6: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "silent" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 2 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 2 +/\ handle = "held" +/\ pollAge = 2 +/\ ever = {} +/\ total = 2 +/\ real = 2 +/\ pollOut = TRUE +/\ since = 2 +/\ age = 2 + +State 7: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "silent" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 2 +/\ timedOutOnce = TRUE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 2 +/\ handle = "held" +/\ pollAge = 2 +/\ ever = {} +/\ total = 2 +/\ real = 2 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 8: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "silent" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = TRUE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ handle = "held" +/\ pollAge = 3 +/\ ever = {} +/\ total = 3 +/\ real = 3 +/\ pollOut = TRUE +/\ since = 1 +/\ age = 0 + +State 9: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "silent" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 4 +/\ timedOutOnce = TRUE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 4 +/\ handle = "held" +/\ pollAge = 3 +/\ ever = {} +/\ total = 4 +/\ real = 4 +/\ pollOut = TRUE +/\ since = 2 +/\ age = 0 + +2165 states generated, 1107 distinct states found, 481 states left on queue. +The depth of the complete state graph search is 9. +The average outdegree of the complete state graph is 2 (minimum is 0, the maximum 8 and the 95th percentile is 5). +Finished in 00s at (2026-12-02 21:08:54) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_total_cap.txt b/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_total_cap.txt new file mode 100644 index 0000000000..b9c74992c8 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_total_cap.txt @@ -0,0 +1,341 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 106 and seed -477332445250595941 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 402380] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file /home/swtest/c01-tlc-ct6/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 21:08:55) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 21:08:55. +Error: Invariant NoEarlyFail is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "none" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 3: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 4: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "silent" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 5: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "silent" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 1 +/\ handle = "held" +/\ pollAge = 1 +/\ ever = {} +/\ total = 1 +/\ real = 1 +/\ pollOut = TRUE +/\ since = 1 +/\ age = 1 + +State 6: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "silent" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 2 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 2 +/\ handle = "held" +/\ pollAge = 2 +/\ ever = {} +/\ total = 2 +/\ real = 2 +/\ pollOut = TRUE +/\ since = 2 +/\ age = 2 + +State 7: +/\ phase = "uploading" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "silent" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 2 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 2 +/\ handle = "held" +/\ pollAge = 2 +/\ ever = {1} +/\ total = 2 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 8: +/\ phase = "uploading" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "silent" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ handle = "held" +/\ pollAge = 3 +/\ ever = {1} +/\ total = 3 +/\ real = 1 +/\ pollOut = TRUE +/\ since = 1 +/\ age = 0 + +State 9: +/\ phase = "uploading" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "silent" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 4 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 4 +/\ handle = "held" +/\ pollAge = 3 +/\ ever = {1} +/\ total = 4 +/\ real = 2 +/\ pollOut = TRUE +/\ since = 2 +/\ age = 0 + +State 10: +/\ phase = "failed" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "silent" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = TRUE +/\ inflight = 0 +/\ cliSince = 4 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = TRUE +/\ other = "none" +/\ realCli = 4 +/\ handle = "held" +/\ pollAge = 3 +/\ ever = {1} +/\ total = 4 +/\ real = 2 +/\ pollOut = TRUE +/\ since = 2 +/\ age = 0 + +3371 states generated, 1690 distinct states found, 695 states left on queue. +The depth of the complete state graph search is 10. +The average outdegree of the complete state graph is 2 (minimum is 0, the maximum 7 and the 95th percentile is 4). +Finished in 00s at (2026-12-02 21:08:55) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_window_not_reset.txt b/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_window_not_reset.txt new file mode 100644 index 0000000000..3d1681bc8c --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r6/out-mut_window_not_reset.txt @@ -0,0 +1,309 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 102 and seed -2085068960749222383 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 402421] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file /home/swtest/c01-tlc-ct6/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 21:08:56) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 21:08:56. +Error: Invariant NoEarlyFail is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "none" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 3: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 4: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "silent" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 5: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "silent" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 1 +/\ handle = "held" +/\ pollAge = 1 +/\ ever = {} +/\ total = 1 +/\ real = 1 +/\ pollOut = TRUE +/\ since = 1 +/\ age = 1 + +State 6: +/\ phase = "uploading" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "silent" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 1 +/\ handle = "held" +/\ pollAge = 1 +/\ ever = {1} +/\ total = 1 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 1 +/\ age = 0 + +State 7: +/\ phase = "uploading" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "silent" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 2 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 2 +/\ handle = "held" +/\ pollAge = 2 +/\ ever = {1} +/\ total = 2 +/\ real = 1 +/\ pollOut = TRUE +/\ since = 2 +/\ age = 0 + +State 8: +/\ phase = "uploading" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "silent" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ handle = "held" +/\ pollAge = 3 +/\ ever = {1} +/\ total = 3 +/\ real = 2 +/\ pollOut = TRUE +/\ since = 3 +/\ age = 0 + +State 9: +/\ phase = "failed" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "silent" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = TRUE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = TRUE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = TRUE +/\ other = "none" +/\ realCli = 3 +/\ handle = "held" +/\ pollAge = 3 +/\ ever = {1} +/\ total = 3 +/\ real = 2 +/\ pollOut = TRUE +/\ since = 3 +/\ age = 0 + +1701 states generated, 887 distinct states found, 380 states left on queue. +The depth of the complete state graph search is 9. +The average outdegree of the complete state graph is 2 (minimum is 0, the maximum 7 and the 95th percentile is 5). +Finished in 00s at (2026-12-02 21:08:56) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r6/out-safe_cut.txt b/seaweed-block/docs/spec/cuttime/recorded-r6/out-safe_cut.txt new file mode 100644 index 0000000000..6eddfbb6b4 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r6/out-safe_cut.txt @@ -0,0 +1,23 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 113 and seed 1570076084288316622 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 401568] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file /home/swtest/c01-tlc-ct6/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 21:08:35) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 21:08:35. +Model checking completed. No error has been found. + Estimates of the probability that TLC did not check all reachable states + because two distinct states had the same fingerprint: + calculated (optimistic): val = 2.3E-11 +41486 states generated, 18019 distinct states found, 0 states left on queue. +The depth of the complete state graph search is 26. +The average outdegree of the complete state graph is 1 (minimum is 0, the maximum 7 and the 95th percentile is 3). +Finished in 00s at (2026-12-02 21:08:35) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r6/out-safe_cut_deadline.txt b/seaweed-block/docs/spec/cuttime/recorded-r6/out-safe_cut_deadline.txt new file mode 100644 index 0000000000..887050c2aa --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r6/out-safe_cut_deadline.txt @@ -0,0 +1,24 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 1 and seed -6990943509427229531 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 401619] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file /home/swtest/c01-tlc-ct6/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 21:08:36) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 21:08:36. +Model checking completed. No error has been found. + Estimates of the probability that TLC did not check all reachable states + because two distinct states had the same fingerprint: + calculated (optimistic): val = 1.2E-10 + based on the actual fingerprints: val = 9.5E-12 +95769 states generated, 43899 distinct states found, 0 states left on queue. +The depth of the complete state graph search is 26. +The average outdegree of the complete state graph is 1 (minimum is 0, the maximum 8 and the 95th percentile is 4). +Finished in 01s at (2026-12-02 21:08:37) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r6/out-safe_cut_late.txt b/seaweed-block/docs/spec/cuttime/recorded-r6/out-safe_cut_late.txt new file mode 100644 index 0000000000..6c18b1fedb --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r6/out-safe_cut_late.txt @@ -0,0 +1,23 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 50 and seed -249876136520255291 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 401670] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file /home/swtest/c01-tlc-ct6/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 21:08:38) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 21:08:38. +Model checking completed. No error has been found. + Estimates of the probability that TLC did not check all reachable states + because two distinct states had the same fingerprint: + calculated (optimistic): val = 6.5E-11 +70147 states generated, 30139 distinct states found, 0 states left on queue. +The depth of the complete state graph search is 35. +The average outdegree of the complete state graph is 1 (minimum is 0, the maximum 8 and the 95th percentile is 3). +Finished in 01s at (2026-12-02 21:08:39) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r6/out-wit_busy.txt b/seaweed-block/docs/spec/cuttime/recorded-r6/out-wit_busy.txt new file mode 100644 index 0000000000..4e45769809 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r6/out-wit_busy.txt @@ -0,0 +1,117 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 47 and seed 8743369290109485634 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 402462] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file /home/swtest/c01-tlc-ct6/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 21:08:56) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 21:08:57. +Error: Invariant WitBusy is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 0 +/\ handle = "none" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 0 +/\ handle = "none" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 3: +/\ phase = "busy" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "busy" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "running" +/\ realCli = 0 +/\ handle = "none" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +69 states generated, 44 distinct states found, 25 states left on queue. +The depth of the complete state graph search is 4. +The average outdegree of the complete state graph is 2 (minimum is 0, the maximum 8 and the 95th percentile is 8). +Finished in 00s at (2026-12-02 21:08:57) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r6/out-wit_cli_deadline.txt b/seaweed-block/docs/spec/cuttime/recorded-r6/out-wit_cli_deadline.txt new file mode 100644 index 0000000000..36cdfd300b --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r6/out-wit_cli_deadline.txt @@ -0,0 +1,213 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 96 and seed 5300822494000505735 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 402504] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file /home/swtest/c01-tlc-ct6/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 21:08:57) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 21:08:57. +Error: Invariant WitCliDeadline is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "none" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 3: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 1 +/\ handle = "held" +/\ pollAge = 1 +/\ ever = {} +/\ total = 1 +/\ real = 1 +/\ pollOut = TRUE +/\ since = 1 +/\ age = 0 + +State 4: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 2 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 2 +/\ handle = "held" +/\ pollAge = 2 +/\ ever = {} +/\ total = 2 +/\ real = 2 +/\ pollOut = TRUE +/\ since = 2 +/\ age = 0 + +State 5: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ handle = "held" +/\ pollAge = 3 +/\ ever = {} +/\ total = 3 +/\ real = 3 +/\ pollOut = TRUE +/\ since = 3 +/\ age = 0 + +State 6: +/\ phase = "cancelled" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "deadline" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ handle = "held" +/\ pollAge = 3 +/\ ever = {} +/\ total = 3 +/\ real = 3 +/\ pollOut = TRUE +/\ since = 3 +/\ age = 0 + +951 states generated, 513 distinct states found, 245 states left on queue. +The depth of the complete state graph search is 8. +The average outdegree of the complete state graph is 2 (minimum is 0, the maximum 7 and the 95th percentile is 5). +Finished in 00s at (2026-12-02 21:08:58) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r6/out-wit_cli_stalled.txt b/seaweed-block/docs/spec/cuttime/recorded-r6/out-wit_cli_stalled.txt new file mode 100644 index 0000000000..653074d055 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r6/out-wit_cli_stalled.txt @@ -0,0 +1,245 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 49 and seed 1126404732543748818 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 402545] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file /home/swtest/c01-tlc-ct6/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 21:08:58) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 21:08:58. +Error: Invariant WitCliStalled is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "none" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 3: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 1 +/\ handle = "held" +/\ pollAge = 1 +/\ ever = {} +/\ total = 1 +/\ real = 1 +/\ pollOut = TRUE +/\ since = 1 +/\ age = 0 + +State 4: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 2 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 2 +/\ handle = "held" +/\ pollAge = 2 +/\ ever = {} +/\ total = 2 +/\ real = 2 +/\ pollOut = TRUE +/\ since = 2 +/\ age = 0 + +State 5: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ handle = "held" +/\ pollAge = 3 +/\ ever = {} +/\ total = 3 +/\ real = 3 +/\ pollOut = TRUE +/\ since = 3 +/\ age = 0 + +State 6: +/\ phase = "failed" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = TRUE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ handle = "held" +/\ pollAge = 3 +/\ ever = {} +/\ total = 3 +/\ real = 3 +/\ pollOut = TRUE +/\ since = 3 +/\ age = 0 + +State 7: +/\ phase = "failed" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "stalled" +/\ busyOwn = FALSE +/\ failedOnce = TRUE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ handle = "held" +/\ pollAge = 3 +/\ ever = {} +/\ total = 3 +/\ real = 3 +/\ pollOut = TRUE +/\ since = 3 +/\ age = 0 + +1645 states generated, 845 distinct states found, 361 states left on queue. +The depth of the complete state graph search is 9. +The average outdegree of the complete state graph is 2 (minimum is 0, the maximum 7 and the 95th percentile is 5). +Finished in 00s at (2026-12-02 21:08:59) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r6/out-wit_lost_reply_then_ok.txt b/seaweed-block/docs/spec/cuttime/recorded-r6/out-wit_lost_reply_then_ok.txt new file mode 100644 index 0000000000..5c99b36503 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r6/out-wit_lost_reply_then_ok.txt @@ -0,0 +1,341 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 13 and seed -948135478304558444 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 402586] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file /home/swtest/c01-tlc-ct6/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 21:08:59) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 21:08:59. +Error: Invariant WitLostReplyThenOk is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "none" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 3: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 4: +/\ phase = "uploading" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {1} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 5: +/\ phase = "uploading" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 2 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {1} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 6: +/\ phase = "uploading" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {1, 2} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 7: +/\ phase = "published" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {1, 2} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 8: +/\ phase = "published" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = TRUE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {1, 2} +/\ total = 0 +/\ real = 0 +/\ pollOut = FALSE +/\ since = 0 +/\ age = 0 + +State 9: +/\ phase = "published" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = TRUE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {1, 2} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 10: +/\ phase = "published" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = TRUE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "ok" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {1, 2} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +2911 states generated, 1478 distinct states found, 604 states left on queue. +The depth of the complete state graph search is 10. +The average outdegree of the complete state graph is 2 (minimum is 0, the maximum 7 and the 95th percentile is 4). +Finished in 00s at (2026-12-02 21:08:59) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r6/out-wit_restart_unknown.txt b/seaweed-block/docs/spec/cuttime/recorded-r6/out-wit_restart_unknown.txt new file mode 100644 index 0000000000..c9862c0817 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r6/out-wit_restart_unknown.txt @@ -0,0 +1,149 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 20 and seed -837441020605523665 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 402627] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file /home/swtest/c01-tlc-ct6/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 21:09:00) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 21:09:00. +Error: Invariant WitRestartUnknown is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "none" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 3: +/\ phase = "lost" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = TRUE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 4: +/\ phase = "lost" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = TRUE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "unknown" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +138 states generated, 84 distinct states found, 44 states left on queue. +The depth of the complete state graph search is 6. +The average outdegree of the complete state graph is 2 (minimum is 0, the maximum 8 and the 95th percentile is 6). +Finished in 00s at (2026-12-02 21:09:00) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r6/out-wit_slow_no_fail.txt b/seaweed-block/docs/spec/cuttime/recorded-r6/out-wit_slow_no_fail.txt new file mode 100644 index 0000000000..23915ede03 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r6/out-wit_slow_no_fail.txt @@ -0,0 +1,469 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 63 and seed 6325116719934122788 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 402668] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file /home/swtest/c01-tlc-ct6/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 21:09:01) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 21:09:01. +Error: Invariant WitSlowNoFail is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "none" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 3: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 4: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 1 +/\ handle = "held" +/\ pollAge = 1 +/\ ever = {} +/\ total = 1 +/\ real = 1 +/\ pollOut = TRUE +/\ since = 1 +/\ age = 1 + +State 5: +/\ phase = "uploading" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 1 +/\ handle = "held" +/\ pollAge = 1 +/\ ever = {1} +/\ total = 1 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 6: +/\ phase = "uploading" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 2 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 1 +/\ handle = "held" +/\ pollAge = 1 +/\ ever = {1} +/\ total = 1 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 7: +/\ phase = "uploading" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 1 +/\ handle = "held" +/\ pollAge = 1 +/\ ever = {1, 2} +/\ total = 1 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 8: +/\ phase = "uploading" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 2 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 1 +/\ ever = {1, 2} +/\ total = 1 +/\ real = 0 +/\ pollOut = FALSE +/\ since = 0 +/\ age = 0 + +State 9: +/\ phase = "uploading" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 2 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {1, 2} +/\ total = 1 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 10: +/\ phase = "uploading" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 2 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 1 +/\ handle = "held" +/\ pollAge = 1 +/\ ever = {1, 2} +/\ total = 2 +/\ real = 1 +/\ pollOut = TRUE +/\ since = 1 +/\ age = 0 + +State 11: +/\ phase = "uploading" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 2 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 2 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 2 +/\ handle = "held" +/\ pollAge = 2 +/\ ever = {1, 2} +/\ total = 3 +/\ real = 2 +/\ pollOut = TRUE +/\ since = 2 +/\ age = 0 + +State 12: +/\ phase = "uploading" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 2 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ handle = "held" +/\ pollAge = 3 +/\ ever = {1, 2} +/\ total = 4 +/\ real = 3 +/\ pollOut = TRUE +/\ since = 3 +/\ age = 0 + +State 13: +/\ phase = "published" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 2 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ handle = "held" +/\ pollAge = 3 +/\ ever = {1, 2} +/\ total = 4 +/\ real = 3 +/\ pollOut = TRUE +/\ since = 3 +/\ age = 0 + +State 14: +/\ phase = "published" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 2 +/\ cli = "ok" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ handle = "held" +/\ pollAge = 3 +/\ ever = {1, 2} +/\ total = 4 +/\ real = 3 +/\ pollOut = TRUE +/\ since = 3 +/\ age = 0 + +14956 states generated, 7069 distinct states found, 1925 states left on queue. +The depth of the complete state graph search is 14. +The average outdegree of the complete state graph is 1 (minimum is 0, the maximum 7 and the 95th percentile is 4). +Finished in 00s at (2026-12-02 21:09:01) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r6/out-wit_stalled_retry_pub.txt b/seaweed-block/docs/spec/cuttime/recorded-r6/out-wit_stalled_retry_pub.txt new file mode 100644 index 0000000000..3744010c6f --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r6/out-wit_stalled_retry_pub.txt @@ -0,0 +1,437 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 90 and seed -7244593405565575014 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 402710] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file /home/swtest/c01-tlc-ct6/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 21:09:02) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 21:09:02. +Error: Invariant WitStalledRetryPub is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "none" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 3: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 1 +/\ handle = "held" +/\ pollAge = 1 +/\ ever = {} +/\ total = 1 +/\ real = 1 +/\ pollOut = TRUE +/\ since = 1 +/\ age = 0 + +State 4: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 2 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 2 +/\ handle = "held" +/\ pollAge = 2 +/\ ever = {} +/\ total = 2 +/\ real = 2 +/\ pollOut = TRUE +/\ since = 2 +/\ age = 0 + +State 5: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ handle = "held" +/\ pollAge = 3 +/\ ever = {} +/\ total = 3 +/\ real = 3 +/\ pollOut = TRUE +/\ since = 3 +/\ age = 0 + +State 6: +/\ phase = "failed" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = TRUE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ handle = "held" +/\ pollAge = 3 +/\ ever = {} +/\ total = 3 +/\ real = 3 +/\ pollOut = TRUE +/\ since = 3 +/\ age = 0 + +State 7: +/\ phase = "failed" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "stalled" +/\ busyOwn = FALSE +/\ failedOnce = TRUE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ handle = "held" +/\ pollAge = 3 +/\ ever = {} +/\ total = 3 +/\ real = 3 +/\ pollOut = TRUE +/\ since = 3 +/\ age = 0 + +State 8: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 2 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "stalled" +/\ busyOwn = FALSE +/\ failedOnce = TRUE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ handle = "held" +/\ pollAge = 3 +/\ ever = {} +/\ total = 3 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 9: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 2 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "stalled" +/\ busyOwn = FALSE +/\ failedOnce = TRUE +/\ inflight = 1 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ handle = "held" +/\ pollAge = 3 +/\ ever = {} +/\ total = 3 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 10: +/\ phase = "uploading" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 2 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "stalled" +/\ busyOwn = FALSE +/\ failedOnce = TRUE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ handle = "held" +/\ pollAge = 3 +/\ ever = {1} +/\ total = 3 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 11: +/\ phase = "uploading" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 2 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "stalled" +/\ busyOwn = FALSE +/\ failedOnce = TRUE +/\ inflight = 2 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ handle = "held" +/\ pollAge = 3 +/\ ever = {1} +/\ total = 3 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 12: +/\ phase = "uploading" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 2 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "stalled" +/\ busyOwn = FALSE +/\ failedOnce = TRUE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ handle = "held" +/\ pollAge = 3 +/\ ever = {1, 2} +/\ total = 3 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 13: +/\ phase = "published" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 2 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "stalled" +/\ busyOwn = FALSE +/\ failedOnce = TRUE +/\ inflight = 0 +/\ cliSince = 3 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 3 +/\ handle = "held" +/\ pollAge = 3 +/\ ever = {1, 2} +/\ total = 3 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +17929 states generated, 8445 distinct states found, 2144 states left on queue. +The depth of the complete state graph search is 15. +The average outdegree of the complete state graph is 1 (minimum is 0, the maximum 8 and the 95th percentile is 4). +Finished in 00s at (2026-12-02 21:09:03) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r6/out-wit_timed_out_then_pub.txt b/seaweed-block/docs/spec/cuttime/recorded-r6/out-wit_timed_out_then_pub.txt new file mode 100644 index 0000000000..766f292eac --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r6/out-wit_timed_out_then_pub.txt @@ -0,0 +1,405 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 16 and seed -4602959628407287439 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 402752] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file /home/swtest/c01-tlc-ct6/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 21:09:03) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 21:09:03. +Error: Invariant WitTimedOutThenPub is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "none" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 3: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 4: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 1 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 1 +/\ handle = "held" +/\ pollAge = 1 +/\ ever = {} +/\ total = 1 +/\ real = 1 +/\ pollOut = TRUE +/\ since = 1 +/\ age = 1 + +State 5: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 2 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 2 +/\ handle = "held" +/\ pollAge = 2 +/\ ever = {} +/\ total = 2 +/\ real = 2 +/\ pollOut = TRUE +/\ since = 2 +/\ age = 2 + +State 6: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 2 +/\ timedOutOnce = TRUE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 2 +/\ handle = "held" +/\ pollAge = 2 +/\ ever = {} +/\ total = 2 +/\ real = 2 +/\ pollOut = TRUE +/\ since = 2 +/\ age = 0 + +State 7: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 2 +/\ timedOutOnce = TRUE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 2 +/\ handle = "held" +/\ pollAge = 2 +/\ ever = {} +/\ total = 2 +/\ real = 2 +/\ pollOut = TRUE +/\ since = 2 +/\ age = 0 + +State 8: +/\ phase = "uploading" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 2 +/\ timedOutOnce = TRUE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 2 +/\ handle = "held" +/\ pollAge = 2 +/\ ever = {1} +/\ total = 2 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 9: +/\ phase = "uploading" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 2 +/\ cliSince = 2 +/\ timedOutOnce = TRUE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 2 +/\ handle = "held" +/\ pollAge = 2 +/\ ever = {1} +/\ total = 2 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 10: +/\ phase = "uploading" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 2 +/\ timedOutOnce = TRUE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 2 +/\ handle = "held" +/\ pollAge = 2 +/\ ever = {1, 2} +/\ total = 2 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 11: +/\ phase = "published" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 2 +/\ timedOutOnce = TRUE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 2 +/\ handle = "held" +/\ pollAge = 2 +/\ ever = {1, 2} +/\ total = 2 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 12: +/\ phase = "published" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "ok" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 2 +/\ timedOutOnce = TRUE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 2 +/\ handle = "held" +/\ pollAge = 2 +/\ ever = {1, 2} +/\ total = 2 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +8989 states generated, 4239 distinct states found, 1380 states left on queue. +The depth of the complete state graph search is 12. +The average outdegree of the complete state graph is 1 (minimum is 0, the maximum 8 and the 95th percentile is 4). +Finished in 00s at (2026-12-02 21:09:04) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r6/out-wit_unknown_then_pub.txt b/seaweed-block/docs/spec/cuttime/recorded-r6/out-wit_unknown_then_pub.txt new file mode 100644 index 0000000000..bbd8f4af11 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r6/out-wit_unknown_then_pub.txt @@ -0,0 +1,341 @@ +TLC2 Version 2.19 of 08 August 2024 (rev: 5a47802) +Running breadth-first search Model-Checking with fp 71 and seed 5868847761078655247 with 4 workers on 8 cores with 14288MB heap and 64MB offheap memory [pid: 402794] (Linux 7.0.0-1020-azure amd64, Ubuntu 17.0.21.1 x86_64, MSBDiskFPSet, DiskStateQueue). +Parsing file /home/swtest/c01-tlc-ct6/CutTime.tla +Parsing file /tmp/Integers.tla +Parsing file /tmp/FiniteSets.tla +Parsing file /tmp/Naturals.tla +Parsing file /tmp/Sequences.tla +Semantic processing of module Naturals +Semantic processing of module Integers +Semantic processing of module Sequences +Semantic processing of module FiniteSets +Semantic processing of module CutTime +Starting... (2026-12-02 21:09:04) +Computing initial states... +Finished computing initial states: 2 distinct states generated at 2026-12-02 21:09:04. +Error: Invariant WitUnknownThenPub is violated. +Error: The behavior up to this point is: +State 1: +/\ phase = "admitting" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "none" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 2: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 3: +/\ phase = "uploading" +/\ done = {} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 1 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 4: +/\ phase = "uploading" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {1} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 5: +/\ phase = "uploading" +/\ done = {1} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 2 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {1} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 6: +/\ phase = "uploading" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = FALSE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {1, 2} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 7: +/\ phase = "lost" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = TRUE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "waiting" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {1, 2} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 8: +/\ phase = "lost" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 1 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = TRUE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "unknown" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {1, 2} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 9: +/\ phase = "uploading" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 2 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = TRUE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "unknown" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {1, 2} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +State 10: +/\ phase = "published" +/\ done = {1, 2} +/\ stallQueued = FALSE +/\ cliEarly = FALSE +/\ attempts = 2 +/\ hAge = 0 +/\ hung = FALSE +/\ link = "up" +/\ lostOnce = FALSE +/\ restarted = TRUE +/\ linkLost = FALSE +/\ lastSeq = 0 +/\ cli = "unknown" +/\ busyOwn = FALSE +/\ failedOnce = FALSE +/\ inflight = 0 +/\ cliSince = 0 +/\ timedOutOnce = FALSE +/\ busyFalse = FALSE +/\ early = FALSE +/\ other = "none" +/\ realCli = 0 +/\ handle = "held" +/\ pollAge = 0 +/\ ever = {1, 2} +/\ total = 0 +/\ real = 0 +/\ pollOut = TRUE +/\ since = 0 +/\ age = 0 + +2902 states generated, 1459 distinct states found, 593 states left on queue. +The depth of the complete state graph search is 10. +The average outdegree of the complete state graph is 2 (minimum is 0, the maximum 7 and the 95th percentile is 4). +Finished in 00s at (2026-12-02 21:09:05) diff --git a/seaweed-block/docs/spec/cuttime/recorded-r6/verdicts.txt b/seaweed-block/docs/spec/cuttime/recorded-r6/verdicts.txt new file mode 100644 index 0000000000..7810236f35 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r6/verdicts.txt @@ -0,0 +1,30 @@ +safe_cut: OK +safe_cut_deadline: OK +safe_cut_late: OK +mut_answer_late: Invariant CliUnknownOnlySilent is violated. +mut_attempt_renews: Invariant NoSilentStall is violated. +mut_busy_when_free: Invariant BusyOnlyWhenHeld is violated. +mut_cli_no_slack: Invariant CliUnknownOnlySilent is violated. +mut_cli_no_window: Invariant CliNoSilentWait is violated. +mut_cli_total_timeout: Invariant CliNoEarlyExit is violated. +mut_forget_on_send: Invariant CliUnknownOnlySilent is violated. +mut_global_renews: Invariant CliNoSilentWait is violated. +mut_no_call_deadline: Invariant NoLongCall is violated. +mut_overwrite_next: Invariant CliUnknownOnlySilent is violated. +mut_queued_stalls: Invariant NoQueuedStall is violated. +mut_repost: Invariant CliBusyNotOwn is violated. +mut_restart_as_failed: Invariant CliNoEarlyExit is violated. +mut_retire_early: Invariant CliUnknownOnlySilent is violated. +mut_retry_loses_progress: Invariant ProgressKept is violated. +mut_timeout_renews: Invariant NoSilentStall is violated. +mut_total_cap: Invariant NoEarlyFail is violated. +mut_window_not_reset: Invariant NoEarlyFail is violated. +wit_busy: Invariant WitBusy is violated. +wit_cli_deadline: Invariant WitCliDeadline is violated. +wit_cli_stalled: Invariant WitCliStalled is violated. +wit_lost_reply_then_ok: Invariant WitLostReplyThenOk is violated. +wit_restart_unknown: Invariant WitRestartUnknown is violated. +wit_slow_no_fail: Invariant WitSlowNoFail is violated. +wit_stalled_retry_pub: Invariant WitStalledRetryPub is violated. +wit_timed_out_then_pub: Invariant WitTimedOutThenPub is violated. +wit_unknown_then_pub: Invariant WitUnknownThenPub is violated. diff --git a/seaweed-block/docs/spec/cuttime/recorded-r8b/RESULT.txt b/seaweed-block/docs/spec/cuttime/recorded-r8b/RESULT.txt new file mode 100644 index 0000000000..378186d7df --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r8b/RESULT.txt @@ -0,0 +1,42 @@ +safe_cut want=OK got=OK states=[59245 distinct states found] PASS +safe_cut_deadline want=OK got=OK states=[161650 distinct states found] PASS +safe_cut_late want=OK got=OK states=[110875 distinct states found] PASS +safe_detach want=OK got=OK states=[1094641 distinct states found] PASS +mut_answer_late want=violated got=CliUnknownOnlySilent states=[4459 distinct states found] PASS +mut_attempt_renews want=violated got=NoSilentStall states=[786 distinct states found] PASS +mut_busy_when_free want=violated got=BusyOnlyWhenHeld states=[33 distinct states found] PASS +mut_cli_no_slack want=violated got=CliUnknownOnlySilent states=[432 distinct states found] PASS +mut_cli_no_window want=violated got=CliNoSilentWait states=[589 distinct states found] PASS +mut_cli_total_timeout want=violated got=CliNoEarlyExit states=[590 distinct states found] PASS +mut_forget_on_send want=violated got=CliUnknownOnlySilent states=[1534 distinct states found] PASS +mut_global_renews want=violated got=CliNoSilentWait states=[1266 distinct states found] PASS +mut_no_call_deadline want=violated got=NoLongCall states=[204 distinct states found] PASS +mut_overwrite_next want=violated got=CliUnknownOnlySilent states=[1078 distinct states found] PASS +mut_preempt_loses_uploads want=violated got=ProgressKept states=[37 distinct states found] PASS +mut_preempt_manual want=violated got=NoManualPreempt states=[48 distinct states found] PASS +mut_queued_no_renew want=violated got=CliUnknownOnlySilent states=[9759 distinct states found] PASS +mut_queued_stalls want=violated got=NoQueuedStall states=[296 distinct states found] PASS +mut_repost want=violated got=CliBusyNotOwn states=[48 distinct states found] PASS +mut_restart_as_failed want=violated got=CliNoEarlyExit states=[95 distinct states found] PASS +mut_retire_early want=violated got=CliUnknownOnlySilent states=[1026 distinct states found] PASS +mut_retry_loses_progress want=violated got=ProgressKept states=[292 distinct states found] PASS +mut_settle_as_failed want=violated got=CliNoEarlyExit states=[543 distinct states found] PASS +mut_settle_as_failed_nff want=violated got=NoFalseFailure states=[612 distinct states found] PASS +mut_settle_no_rise want=violated got=CliUnknownOnlySilent states=[20880 distinct states found] PASS +mut_settle_skip want=violated got=CliUnknownOnlySilent states=[536 distinct states found] PASS +mut_timeout_renews want=violated got=NoSilentStall states=[1303 distinct states found] PASS +mut_total_cap want=violated got=NoEarlyFail states=[2020 distinct states found] PASS +mut_window_not_reset want=violated got=NoEarlyFail states=[931 distinct states found] PASS +wit_busy want=violated got=WitBusy states=[46 distinct states found] PASS +wit_cli_deadline want=violated got=WitCliDeadline states=[569 distinct states found] PASS +wit_cli_stalled want=violated got=WitCliStalled states=[1002 distinct states found] PASS +wit_detach_after_queue want=violated got=WitDetachAfterQueue states=[23535 distinct states found] PASS +wit_lost_reply_then_ok want=violated got=WitLostReplyThenOk states=[1552 distinct states found] PASS +wit_preempt_reuse want=violated got=WitPreemptReuse states=[633 distinct states found] PASS +wit_restart_unknown want=violated got=WitRestartUnknown states=[89 distinct states found] PASS +wit_settle_then_ok want=violated got=WitSettleThenOk states=[988 distinct states found] PASS +wit_settle_unknown want=violated got=WitSettleUnknown states=[8590 distinct states found] PASS +wit_slow_no_fail want=violated got=WitSlowNoFail states=[9667 distinct states found] PASS +wit_stalled_retry_pub want=violated got=WitStalledRetryPub states=[11601 distinct states found] PASS +wit_timed_out_then_pub want=violated got=WitTimedOutThenPub states=[5009 distinct states found] PASS +wit_unknown_then_pub want=violated got=WitUnknownThenPub states=[1584 distinct states found] PASS diff --git a/seaweed-block/docs/spec/cuttime/recorded-r8c/RESULT.txt b/seaweed-block/docs/spec/cuttime/recorded-r8c/RESULT.txt new file mode 100644 index 0000000000..0d20df6029 --- /dev/null +++ b/seaweed-block/docs/spec/cuttime/recorded-r8c/RESULT.txt @@ -0,0 +1,46 @@ +safe_cut want=OK got=OK states=[484108 distinct states found] PASS +safe_cut_deadline want=OK got=OK states=[1383924 distinct states found] PASS +safe_cut_late want=OK got=OK states=[924372 distinct states found] PASS +safe_detach want=OK got=OK states=[8680292 distinct states found] PASS +mut_answer_late want=violated got=CliUnknownOnlySilent states=[19194 distinct states found] PASS +mut_attempt_renews want=violated got=NoSilentStall states=[3479 distinct states found] PASS +mut_busy_when_free want=violated got=BusyOnlyWhenHeld states=[32 distinct states found] PASS +mut_cli_no_slack want=violated got=CliUnknownOnlySilent states=[1213 distinct states found] PASS +mut_cli_no_window want=violated got=CliNoSilentWait states=[2401 distinct states found] PASS +mut_cli_total_timeout want=violated got=CliNoEarlyExit states=[2450 distinct states found] PASS +mut_fence_renews want=violated got=NoRetryAfterFence states=[2606 distinct states found] PASS +mut_forget_on_send want=violated got=CliUnknownOnlySilent states=[7650 distinct states found] PASS +mut_global_renews want=violated got=CliNoSilentWait states=[7180 distinct states found] PASS +mut_inherited_as_own want=violated got=OwnResult states=[269 distinct states found] PASS +mut_no_call_deadline want=violated got=NoLongCall states=[710 distinct states found] PASS +mut_overwrite_next want=violated got=CliUnknownOnlySilent states=[4038 distinct states found] PASS +mut_preempt_loses_uploads want=violated got=ProgressKept states=[72 distinct states found] PASS +mut_preempt_manual want=violated got=NoManualPreempt states=[36 distinct states found] PASS +mut_queued_no_renew want=violated got=CliUnknownOnlySilent states=[31118 distinct states found] PASS +mut_queued_stalls want=violated got=NoQueuedStall states=[419 distinct states found] PASS +mut_repost want=violated got=CliBusyNotOwn states=[100 distinct states found] PASS +mut_restart_as_failed want=violated got=CliNoEarlyExit states=[213 distinct states found] PASS +mut_retire_early want=violated got=CliUnknownOnlySilent states=[4368 distinct states found] PASS +mut_retry_loses_progress want=violated got=ProgressKept states=[1339 distinct states found] PASS +mut_settle_as_failed want=violated got=CliNoEarlyExit states=[2434 distinct states found] PASS +mut_settle_as_failed_nff want=violated got=NoFalseFailure states=[2642 distinct states found] PASS +mut_settle_no_rise want=violated got=CliUnknownOnlySilent states=[147556 distinct states found] PASS +mut_settle_skip want=violated got=CliUnknownOnlySilent states=[2417 distinct states found] PASS +mut_timeout_renews want=violated got=NoSilentStall states=[5124 distinct states found] PASS +mut_total_cap want=violated got=NoEarlyFail states=[6986 distinct states found] PASS +mut_window_not_reset want=violated got=NoEarlyFail states=[3844 distinct states found] PASS +wit_busy want=violated got=WitBusy states=[100 distinct states found] PASS +wit_cli_deadline want=violated got=WitCliDeadline states=[1206 distinct states found] PASS +wit_cli_stalled want=violated got=WitCliStalled states=[2380 distinct states found] PASS +wit_detach_after_queue want=violated got=WitDetachAfterQueue states=[102974 distinct states found] PASS +wit_fenced want=violated got=WitFenced states=[4888 distinct states found] PASS +wit_inherited_then_own want=violated got=WitInheritedThenOwn states=[5647 distinct states found] PASS +wit_lost_reply_then_ok want=violated got=WitLostReplyThenOk states=[8338 distinct states found] PASS +wit_preempt_reuse want=violated got=WitPreemptReuse states=[2243 distinct states found] PASS +wit_restart_unknown want=violated got=WitRestartUnknown states=[189 distinct states found] PASS +wit_settle_then_ok want=violated got=WitSettleThenOk states=[4690 distinct states found] PASS +wit_settle_unknown want=violated got=WitSettleUnknown states=[56235 distinct states found] PASS +wit_slow_no_fail want=violated got=WitSlowNoFail states=[59353 distinct states found] PASS +wit_stalled_retry_pub want=violated got=WitStalledRetryPub states=[53938 distinct states found] PASS +wit_timed_out_then_pub want=violated got=WitTimedOutThenPub states=[26181 distinct states found] PASS +wit_unknown_then_pub want=violated got=WitUnknownThenPub states=[8635 distinct states found] PASS diff --git a/seaweed-block/docs/spec/cutwindow/CutWindow.tla b/seaweed-block/docs/spec/cutwindow/CutWindow.tla new file mode 100644 index 0000000000..d9a3ead67a --- /dev/null +++ b/seaweed-block/docs/spec/cutwindow/CutWindow.tla @@ -0,0 +1,105 @@ +------------------------------ MODULE CutWindow ------------------------------ +(***************************************************************************) +(* The cut as a no-progress window (2026-12-02; the V3 *) +(* time contract: no fixed total bound around work that grows). A cut *) +(* uploads U objects, one request at a time, then publishes. Each request *) +(* has a per-call deadline P: a request that does not answer is cancelled *) +(* and retried, never left running. The attempt's window W is renewed by *) +(* each COMPLETED upload; W steps with none fail the attempt (no_progress) *) +(* and the next attempt continues with the uploads already done (progress *) +(* kept). There is no total bound: a long cut that keeps completing *) +(* uploads never fails. The per-call deadline is also the bound the *) +(* resweep window derives from: no request of a cut lands later than P *) +(* after it was sent. *) +(* *) +(* Break = "none", or ONE of: *) +(* "total_cap" a fixed total bound fails even a progressing *) +(* cut (today's defaultChunkCutTimeout) *) +(* "window_not_reset" a completed upload does not renew the window *) +(* "timeout_renews" a cancelled request renews the window, so a *) +(* hung store keeps the cut alive forever *) +(* "no_call_deadline" a request that does not answer stays in *) +(* flight *) +(* "retry_loses_progress" a new attempt starts the uploads over *) +(* *) +(* Bounded by construction: done and ever subsets of 1..U, inflight 0..U, *) +(* age 0..P+1, since 0..W, real 0..W+1, total 0..TCap, attempts 0..MaxAtt. *) +(***************************************************************************) +EXTENDS Integers, FiniteSets + +CONSTANTS U, W, P, CapT, TCap, MaxAtt, Break + +Ups == 1..U +VARIABLES phase, done, ever, inflight, hung, age, since, real, total, attempts, early, timedOutOnce, failedOnce +vars == <> +Min2(a, b) == IF a < b THEN a ELSE b + +Init == /\ phase = "uploading" /\ done = {} /\ ever = {} /\ inflight = 0 /\ hung = FALSE /\ age = 0 + /\ since = 0 /\ real = 0 /\ total = 0 /\ attempts = 1 + /\ early = FALSE /\ timedOutOnce = FALSE /\ failedOnce = FALSE + +\* a request for upload u is sent; it may hang (no answer) +Start(u) == /\ phase = "uploading" /\ inflight = 0 /\ u \notin done + /\ inflight' = u /\ age' = 0 /\ hung' \in BOOLEAN + /\ UNCHANGED <> + +\* the request answers: the upload is done and kept (staged), the window renewed +Complete == /\ phase = "uploading" /\ inflight # 0 /\ ~hung + /\ done' = done \cup {inflight} /\ ever' = ever \cup {inflight} /\ inflight' = 0 /\ age' = 0 + /\ since' = (IF Break = "window_not_reset" THEN since ELSE 0) + /\ real' = 0 + /\ UNCHANGED <> + +\* the per-call deadline cancels a request that has not answered; it is retried later +CallTimeout == /\ phase = "uploading" /\ inflight # 0 /\ age >= P /\ Break # "no_call_deadline" + /\ inflight' = 0 /\ age' = 0 /\ hung' = FALSE /\ timedOutOnce' = TRUE + /\ since' = (IF Break = "timeout_renews" THEN 0 ELSE since) + /\ UNCHANGED <> + +\* every upload done: the HEAD write publishes the cut +Publish == /\ phase = "uploading" /\ inflight = 0 /\ done = Ups /\ phase' = "published" + /\ UNCHANGED <> + +CapDue == Break = "total_cap" /\ total >= CapT + +\* time passes; the code answers its deadlines first +Tick == /\ phase = "uploading" + /\ since < W /\ ~CapDue + /\ inflight = 0 \/ age < P \/ Break = "no_call_deadline" + /\ since' = since + 1 + /\ real' = Min2(real + 1, W + 1) + /\ total' = Min2(total + 1, TCap) + /\ age' = (IF inflight # 0 THEN Min2(age + 1, P + 1) ELSE age) + /\ UNCHANGED <> + +\* W steps with no completed upload (or, in the mutant, the total cap): the attempt fails no_progress +Fail == /\ phase = "uploading" /\ (since >= W \/ CapDue) + /\ phase' = "failed" /\ inflight' = 0 /\ age' = 0 /\ hung' = FALSE /\ failedOnce' = TRUE + /\ early' = (early \/ real < W) + /\ UNCHANGED <> + +\* the next attempt continues with the uploads already done +Retry == /\ phase = "failed" /\ attempts < MaxAtt /\ attempts' = attempts + 1 + /\ phase' = "uploading" /\ since' = 0 /\ real' = 0 + /\ done' = (IF Break = "retry_loses_progress" THEN {} ELSE done) + /\ UNCHANGED <> + +Next == \/ \E u \in Ups : Start(u) + \/ Complete \/ CallTimeout \/ Publish \/ Tick \/ Fail \/ Retry +Spec == Init /\ [][Next]_vars + +\* ---- rules ---- +\* an attempt fails no_progress only after W steps with no completed upload (never on a total bound) +NoEarlyFail == ~early +\* no attempt stays silent past W steps without a completed upload (a cancelled request is not progress) +NoSilentStall == phase = "uploading" => real <= W +\* no request outlives its per-call deadline: the bound the resweep window derives from +NoLongCall == inflight # 0 => age <= P +\* uploads done are never lost to a retry +ProgressKept == ever \subseteq done + +\* ---- witnesses ---- +WitSlowNoFail == ~(phase = "published" /\ total >= TCap /\ ~failedOnce) \* a long cut, still progressing: published, no failure +WitTimedOutThenPub == ~(phase = "published" /\ timedOutOnce) \* a hung request cancelled, the cut still published +WitFailRetryPub == ~(phase = "published" /\ failedOnce) \* a no-progress failure, a retry with progress kept, published +============================================================================= diff --git a/seaweed-block/docs/spec/cutwindow/cfg/mut_no_call_deadline.cfg b/seaweed-block/docs/spec/cutwindow/cfg/mut_no_call_deadline.cfg new file mode 100644 index 0000000000..eb8ce8f94c --- /dev/null +++ b/seaweed-block/docs/spec/cutwindow/cfg/mut_no_call_deadline.cfg @@ -0,0 +1,13 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + Break = "no_call_deadline" +INVARIANT NoEarlyFail +INVARIANT NoSilentStall +INVARIANT NoLongCall +INVARIANT ProgressKept diff --git a/seaweed-block/docs/spec/cutwindow/cfg/mut_retry_loses_progress.cfg b/seaweed-block/docs/spec/cutwindow/cfg/mut_retry_loses_progress.cfg new file mode 100644 index 0000000000..75783bd59d --- /dev/null +++ b/seaweed-block/docs/spec/cutwindow/cfg/mut_retry_loses_progress.cfg @@ -0,0 +1,13 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + Break = "retry_loses_progress" +INVARIANT NoEarlyFail +INVARIANT NoSilentStall +INVARIANT NoLongCall +INVARIANT ProgressKept diff --git a/seaweed-block/docs/spec/cutwindow/cfg/mut_timeout_renews.cfg b/seaweed-block/docs/spec/cutwindow/cfg/mut_timeout_renews.cfg new file mode 100644 index 0000000000..fb5cee6a3a --- /dev/null +++ b/seaweed-block/docs/spec/cutwindow/cfg/mut_timeout_renews.cfg @@ -0,0 +1,13 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + Break = "timeout_renews" +INVARIANT NoEarlyFail +INVARIANT NoSilentStall +INVARIANT NoLongCall +INVARIANT ProgressKept diff --git a/seaweed-block/docs/spec/cutwindow/cfg/mut_total_cap.cfg b/seaweed-block/docs/spec/cutwindow/cfg/mut_total_cap.cfg new file mode 100644 index 0000000000..45482c1648 --- /dev/null +++ b/seaweed-block/docs/spec/cutwindow/cfg/mut_total_cap.cfg @@ -0,0 +1,13 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + Break = "total_cap" +INVARIANT NoEarlyFail +INVARIANT NoSilentStall +INVARIANT NoLongCall +INVARIANT ProgressKept diff --git a/seaweed-block/docs/spec/cutwindow/cfg/mut_window_not_reset.cfg b/seaweed-block/docs/spec/cutwindow/cfg/mut_window_not_reset.cfg new file mode 100644 index 0000000000..9a6da7a27f --- /dev/null +++ b/seaweed-block/docs/spec/cutwindow/cfg/mut_window_not_reset.cfg @@ -0,0 +1,13 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + Break = "window_not_reset" +INVARIANT NoEarlyFail +INVARIANT NoSilentStall +INVARIANT NoLongCall +INVARIANT ProgressKept diff --git a/seaweed-block/docs/spec/cutwindow/cfg/safe_cut.cfg b/seaweed-block/docs/spec/cutwindow/cfg/safe_cut.cfg new file mode 100644 index 0000000000..562e981e74 --- /dev/null +++ b/seaweed-block/docs/spec/cutwindow/cfg/safe_cut.cfg @@ -0,0 +1,13 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + Break = "none" +INVARIANT NoEarlyFail +INVARIANT NoSilentStall +INVARIANT NoLongCall +INVARIANT ProgressKept diff --git a/seaweed-block/docs/spec/cutwindow/cfg/wit_fail_retry_pub.cfg b/seaweed-block/docs/spec/cutwindow/cfg/wit_fail_retry_pub.cfg new file mode 100644 index 0000000000..585979d60b --- /dev/null +++ b/seaweed-block/docs/spec/cutwindow/cfg/wit_fail_retry_pub.cfg @@ -0,0 +1,10 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + Break = "none" +INVARIANT WitFailRetryPub diff --git a/seaweed-block/docs/spec/cutwindow/cfg/wit_slow_no_fail.cfg b/seaweed-block/docs/spec/cutwindow/cfg/wit_slow_no_fail.cfg new file mode 100644 index 0000000000..7b1a27d267 --- /dev/null +++ b/seaweed-block/docs/spec/cutwindow/cfg/wit_slow_no_fail.cfg @@ -0,0 +1,10 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + Break = "none" +INVARIANT WitSlowNoFail diff --git a/seaweed-block/docs/spec/cutwindow/cfg/wit_timed_out_then_pub.cfg b/seaweed-block/docs/spec/cutwindow/cfg/wit_timed_out_then_pub.cfg new file mode 100644 index 0000000000..470b416147 --- /dev/null +++ b/seaweed-block/docs/spec/cutwindow/cfg/wit_timed_out_then_pub.cfg @@ -0,0 +1,10 @@ +SPECIFICATION Spec +CONSTANTS + U = 2 + W = 3 + P = 2 + CapT = 4 + TCap = 4 + MaxAtt = 2 + Break = "none" +INVARIANT WitTimedOutThenPub diff --git a/seaweed-block/docs/spec/cutwindow/results.txt b/seaweed-block/docs/spec/cutwindow/results.txt new file mode 100644 index 0000000000..e5d9ae8823 --- /dev/null +++ b/seaweed-block/docs/spec/cutwindow/results.txt @@ -0,0 +1,9 @@ +safe_cut want=OK got=OK states=[533 distinct states found] PASS +mut_no_call_deadline want=violated got=NoLongCall states=[66 distinct states found] PASS +mut_retry_loses_progress want=violated got=ProgressKept states=[212 distinct states found] PASS +mut_timeout_renews want=violated got=NoSilentStall states=[220 distinct states found] PASS +mut_total_cap want=violated got=NoEarlyFail states=[273 distinct states found] PASS +mut_window_not_reset want=violated got=NoEarlyFail states=[159 distinct states found] PASS +wit_fail_retry_pub want=violated got=WitFailRetryPub states=[419 distinct states found] PASS +wit_slow_no_fail want=violated got=WitSlowNoFail states=[318 distinct states found] PASS +wit_timed_out_then_pub want=violated got=WitTimedOutThenPub states=[389 distinct states found] PASS diff --git a/seaweed-block/docs/status-schema.md b/seaweed-block/docs/status-schema.md index e40feaa5dc..442c3488c8 100644 --- a/seaweed-block/docs/status-schema.md +++ b/seaweed-block/docs/status-schema.md @@ -357,15 +357,15 @@ Durable store state of the served volume. Go type `volume.durableStatusBody`. | `Volumes[].Chunk.Stats.LastCut.SyncNs` | int64 | (group of `BarrierPauseNs`) BarrierPauseNs is the guest pause: from the capture barrier's Lock request to the start of its Unlock (BarrierReleaseNs below is the rest). LockWaitNs is its first part, the wait for writers already holding the capture barrier shared. | | `Volumes[].Chunk.Stats.LastCut.CopyNs` | int64 | (group of `BarrierPauseNs`) BarrierPauseNs is the guest pause: from the capture barrier's Lock request to the start of its Unlock (BarrierReleaseNs below is the rest). LockWaitNs is its first part, the wait for writers already holding the capture barrier shared. | | `Volumes[].Chunk.Stats.LastCut.CandidateChunks` | int | (group of `BarrierPauseNs`) BarrierPauseNs is the guest pause: from the capture barrier's Lock request to the start of its Unlock (BarrierReleaseNs below is the rest). LockWaitNs is its first part, the wait for writers already holding the capture barrier shared. | -| `Volumes[].Chunk.Stats.LastCut.UploadedChunks` | int | (group of `BarrierPauseNs`) BarrierPauseNs is the guest pause: from the capture barrier's Lock request to the start of its Unlock (BarrierReleaseNs below is the rest). LockWaitNs is its first part, the wait for writers already holding the capture barrier shared. | -| `Volumes[].Chunk.Stats.LastCut.UploadedBytes` | int64 | (group of `BarrierPauseNs`) BarrierPauseNs is the guest pause: from the capture barrier's Lock request to the start of its Unlock (BarrierReleaseNs below is the rest). LockWaitNs is its first part, the wait for writers already holding the capture barrier shared. | -| `Volumes[].Chunk.Stats.LastCut.ZeroedChunks` | int | (group of `BarrierPauseNs`) BarrierPauseNs is the guest pause: from the capture barrier's Lock request to the start of its Unlock (BarrierReleaseNs below is the rest). LockWaitNs is its first part, the wait for writers already holding the capture barrier shared. | -| `Volumes[].Chunk.Stats.LastCut.UnchangedChunks` | int | (group of `BarrierPauseNs`) BarrierPauseNs is the guest pause: from the capture barrier's Lock request to the start of its Unlock (BarrierReleaseNs below is the rest). LockWaitNs is its first part, the wait for writers already holding the capture barrier shared. | -| `Volumes[].Chunk.Stats.LastCut.UploadNs` | int64 | (group of `BarrierPauseNs`) BarrierPauseNs is the guest pause: from the capture barrier's Lock request to the start of its Unlock (BarrierReleaseNs below is the rest). LockWaitNs is its first part, the wait for writers already holding the capture barrier shared. | -| `Volumes[].Chunk.Stats.LastCut.CASNs` | int64 | (group of `BarrierPauseNs`) BarrierPauseNs is the guest pause: from the capture barrier's Lock request to the start of its Unlock (BarrierReleaseNs below is the rest). LockWaitNs is its first part, the wait for writers already holding the capture barrier shared. | -| `Volumes[].Chunk.Stats.LastCut.MapPersistNs` | int64 | (group of `BarrierPauseNs`) BarrierPauseNs is the guest pause: from the capture barrier's Lock request to the start of its Unlock (BarrierReleaseNs below is the rest). LockWaitNs is its first part, the wait for writers already holding the capture barrier shared. | -| `Volumes[].Chunk.Stats.LastCut.CASResult` | string | (group of `BarrierPauseNs`) BarrierPauseNs is the guest pause: from the capture barrier's Lock request to the start of its Unlock (BarrierReleaseNs below is the rest). LockWaitNs is its first part, the wait for writers already holding the capture barrier shared. | -| `Volumes[].Chunk.Stats.LastCut.TotalNs` | int64 | (group of `BarrierPauseNs`) BarrierPauseNs is the guest pause: from the capture barrier's Lock request to the start of its Unlock (BarrierReleaseNs below is the rest). LockWaitNs is its first part, the wait for writers already holding the capture barrier shared. | +| `Volumes[].Chunk.Stats.LastCut.UploadedChunks` | int | UploadedChunks and UploadedBytes describe this attempt only; payloads retained from previous attempts are reported by StagedChunksUsed. | +| `Volumes[].Chunk.Stats.LastCut.UploadedBytes` | int64 | (group of `UploadedChunks`) UploadedChunks and UploadedBytes describe this attempt only; payloads retained from previous attempts are reported by StagedChunksUsed. | +| `Volumes[].Chunk.Stats.LastCut.ZeroedChunks` | int | (group of `UploadedChunks`) UploadedChunks and UploadedBytes describe this attempt only; payloads retained from previous attempts are reported by StagedChunksUsed. | +| `Volumes[].Chunk.Stats.LastCut.UnchangedChunks` | int | (group of `UploadedChunks`) UploadedChunks and UploadedBytes describe this attempt only; payloads retained from previous attempts are reported by StagedChunksUsed. | +| `Volumes[].Chunk.Stats.LastCut.UploadNs` | int64 | (group of `UploadedChunks`) UploadedChunks and UploadedBytes describe this attempt only; payloads retained from previous attempts are reported by StagedChunksUsed. | +| `Volumes[].Chunk.Stats.LastCut.CASNs` | int64 | (group of `UploadedChunks`) UploadedChunks and UploadedBytes describe this attempt only; payloads retained from previous attempts are reported by StagedChunksUsed. | +| `Volumes[].Chunk.Stats.LastCut.MapPersistNs` | int64 | (group of `UploadedChunks`) UploadedChunks and UploadedBytes describe this attempt only; payloads retained from previous attempts are reported by StagedChunksUsed. | +| `Volumes[].Chunk.Stats.LastCut.CASResult` | string | (group of `UploadedChunks`) UploadedChunks and UploadedBytes describe this attempt only; payloads retained from previous attempts are reported by StagedChunksUsed. | +| `Volumes[].Chunk.Stats.LastCut.TotalNs` | int64 | (group of `UploadedChunks`) UploadedChunks and UploadedBytes describe this attempt only; payloads retained from previous attempts are reported by StagedChunksUsed. | | `Volumes[].Chunk.Stats.LastCut.BarrierReleaseNs` | int64 | BarrierReleaseNs is the barrier's release, outside the guest pause: the Unlock (which wakes each guest writer parked on the barrier), releasing the flusher hold and waking the flusher. A failed sync's exit splits the same way. | | `Volumes[].Chunk.Stats.LastCut.StageRounds` | int | Pre-copy (staging by the copy-on-write side budget, M5 Stage): StageRounds staging rounds staged StagedChunks chunks outside the barrier; StagedChunksUsed of the uploads in HEAD came from staging. BarrierCopyChunks were copied under the barrier. BarrierOverBound: more than the legacy fixture BarrierBound; always false in production, where that bound is zero. | | `Volumes[].Chunk.Stats.LastCut.StagedChunks` | int | (group of `StageRounds`) Pre-copy (staging by the copy-on-write side budget, M5 Stage): StageRounds staging rounds staged StagedChunks chunks outside the barrier; StagedChunksUsed of the uploads in HEAD came from staging. BarrierCopyChunks were copied under the barrier. BarrierOverBound: more than the legacy fixture BarrierBound; always false in production, where that bound is zero. | diff --git a/seaweed-block/docs/time-bounds.tsv b/seaweed-block/docs/time-bounds.tsv index 00de06a2eb..e5968c7381 100644 --- a/seaweed-block/docs/time-bounds.tsv +++ b/seaweed-block/docs/time-bounds.tsv @@ -34,10 +34,10 @@ cmd/sparrow/s5_bootstrap.go runS5Bootstrap context.WithTimeout 1 54 per-call NON cmd/sparrow/s7_restart_smoke.go runS7RestartSmoke context.WithTimeout 1 69 per-call NONE: no model row maps this file yet test-harness binary: one bounded step cmd/sparrow/s7_restart_smoke.go runS7RestartSmoke time.Now().Add 1 84 per-call NONE: no model row maps this file yet test-harness binary: one bounded wait cmd/sw-block/catalog_snapshot_operation.go chunkCatalogSnapshotDeleteAnswer time.After 1 49 control-timer NONE: no model row maps this file yet retry pause inside the snapshot-delete command's window -cmd/sw-block/chunk.go refuseUnlessSingleFilerWithin context.WithTimeout 1 68 per-call NONE: no model row maps this file yet the single-filer start check, bounded by --timeout and by its caller's pass -cmd/sw-block/chunk.go chunkPost time.Now().Add 1 153 pending-fix NONE: no model row maps this file yet CLI chunk POST observation deadline (manual cut and its waiters); fix #964 (poll by cut id) -cmd/sw-block/chunk.go chunkPostUntil context.WithDeadline 1 168 pending-fix NONE: no model row maps this file yet CLI manual-cut observation total; fix #964 (poll by cut id) -cmd/sw-block/chunk.go chunkSnapshot time.Now().Add 1 280 control-timer NONE: no model row maps this file yet snapshot expiry: a timestamp (validity, expiry or due time), not a wait +cmd/sw-block/chunk.go refuseUnlessSingleFilerWithin context.WithTimeout 1 68 per-call CutTime.Poll the single-filer start check, bounded by --timeout and by its caller's pass +cmd/sw-block/chunk.go chunkPost time.Now().Add 1 153 pending-fix CutTime.Poll remaining snapshot/detach HTTP waiter bound; fix #979 (manual cuts use chunkObserveCut) +cmd/sw-block/chunk.go chunkPostUntil context.WithDeadline 1 168 pending-fix CutTime.Poll remaining snapshot/detach HTTP waiter bound; fix #979 (manual cuts use chunkObserveCut) +cmd/sw-block/chunk.go chunkSnapshot time.Now().Add 1 289 control-timer CutTime.Poll snapshot expiry: a timestamp (validity, expiry or due time), not a wait cmd/sw-block/chunk_b.go volumeFlags.ref context.WithTimeout 1 100 per-call NONE: no model row maps this file yet one CLI request (operator --timeout) cmd/sw-block/chunk_b.go bCommand.run context.WithTimeout 1 158 pending-fix NONE: no model row maps this file yet unmeasured: applies each catalog command's own budget (its newBCommand row); open while snapshot delete and retain are unmeasured cmd/sw-block/chunk_b.go chunkSnapshots newBCommand 1 174 per-call NONE: no model row maps this file yet lists one volume's snapshot names from one HEAD read (30 s) @@ -50,8 +50,8 @@ cmd/sw-block/chunk_b.go chunkRestore context.WithTimeout 1 376 ruled-total NONE: cmd/sw-block/chunk_b.go chunkRelease newBCommand 1 415 per-call NONE: no model row maps this file yet releases one restore target from its source (30 s) cmd/sw-block/chunk_b.go chunkRetain newBCommand 1 473 pending-fix NONE: no model row maps this file yet unmeasured: retain retires expired snapshots under 5 min; a measurement at the cap or a window is owed cmd/sw-block/chunk_diag.go diagWriter.close time.NewTimer 1 68 per-call NONE: no model row maps this file yet drain of one diagnostics writer on close -cmd/sw-block/chunk_loop.go chunkPostLoop time.Now().Add 1 75 pending-fix NONE: no model row maps this file yet CLI cut retry loop's one absolute end; fix #964 -cmd/sw-block/chunk_loop.go chunkStats context.WithDeadline 1 184 per-call NONE: no model row maps this file yet one CLI request (operator --timeout) +cmd/sw-block/chunk_loop.go chunkPostLoop time.Now().Add 1 72 pending-fix NONE: no model row maps this file yet CLI cut retry loop's one absolute end; fix #964 +cmd/sw-block/chunk_loop.go chunkStats context.WithDeadline 1 181 per-call NONE: no model row maps this file yet one CLI request (operator --timeout) cmd/sw-block/chunk_verify.go chunkVerify context.WithTimeoutCause 1 94 availability-contract NONE: no model row maps this file yet the operator's optional --deadline (off by default), an absolute total the operator chooses cmd/sw-block/chunk_verify.go chunkVerify watchVerifyProgress 1 97 no-progress-window NONE: no model row maps this file yet verify's --timeout: the pass ends only after that long with no object read completed (each read renews it) cmd/sw-block/chunk_volume_delete.go chunkVolumeDelete newBCommand 1 35 no-progress-window NONE: no model row maps this file yet growing command: no total; the budget is one sweep and the no-progress window @@ -60,6 +60,7 @@ cmd/sw-block/chunk_volume_delete.go deleteVolumeWithProgress time.NewTimer 1 203 cmd/sw-block/cluster_format.go runClusterFormatLevel context.WithTimeout 1 75 per-call NONE: no model row maps this file yet one CLI request (operator --timeout) cmd/sw-block/cluster_format.go runClusterFinalizeFormat context.WithTimeout 1 158 per-call NONE: no model row maps this file yet one CLI request (operator --timeout) cmd/sw-block/cluster_format.go runClusterRetireHost context.WithTimeout 1 295 per-call NONE: no model row maps this file yet one CLI request (operator --timeout) +cmd/sw-block/cut_progress_poll.go chunkObserveCut context.WithDeadline 1 61 no-progress-window CutTime.Poll; CutTime.CliSilent observation deadline renewed only by a strict sequence rise, or shortened by the user-chosen absolute deadline cmd/sw-block/failover.go runOpsFailover context.WithTimeout 1 102 per-call NONE: no model row maps this file yet one CLI request (operator --timeout) cmd/sw-block/log_collect.go inspectionShell.collectLogs context.WithTimeout 1 197 per-call NONE: no model row maps this file yet one CLI request (operator --timeout) cmd/sw-block/main.go runOpsStatus context.WithTimeout 1 904 per-call NONE: no model row maps this file yet one CLI request (operator --timeout) @@ -152,12 +153,12 @@ core/frontend/chunkstore/startup_head_probe.go BCatalog.checkConditionalHead con core/frontend/chunkstore/startup_head_probe.go BCatalog.checkConditionalHead context.WithTimeout 2 129 per-call NONE: no model row maps this file yet one conditional HEAD probe at startup core/frontend/chunkstore/swfs.go newBlobHTTPClient http.Client.Timeout 1 93 per-call VolumeCreate.Land one HTTP request core/frontend/durable/chunk_snapshot_schedule.go DurableProvider.chunkSnapshotLoop time.NewTimer 1 288 control-timer NONE: no model row maps this file yet snapshot schedule timer -core/frontend/durable/chunk_snapshot_schedule.go DurableProvider.chunkSnapshotLoop boundedPass 1 321 pending-fix NONE: no model row maps this file yet scheduled snapshot's fixed total (two cut bounds); removed by #964 +core/frontend/durable/chunk_snapshot_schedule.go DurableProvider.chunkSnapshotLoop boundedPass 1 318 no-progress-window NONE: no model row maps this file yet zero total timeout: joins authority watcher under the shared completed-cut-step progress window core/frontend/durable/hold_kzhold.go DurableProvider.HoldBeforeChunkFreshRetireForTest time.Now().Add 1 21 per-call NONE: no model row maps this file yet a test seam's bounded hold core/frontend/durable/maintenance_progress.go maintenancePass time.AfterFunc 1 29 no-progress-window CutTime.Complete; CutTime.Fail; CutTime.Tick the maintenance pass's window: renewed by each completed step, no total core/frontend/durable/precopy_admission.go StorageBackend.admitPrecopy context.WithDeadline 1 145 per-call NONE: no model row maps this file yet one RPC or request -core/frontend/durable/provider.go DurableProvider.waitHealthy context.WithTimeout 1 900 per-call NONE: no model row maps this file yet one provider open, bounded by OpenTimeout -core/frontend/durable/provider.go DurableProvider.waitHealthy time.After 1 910 control-timer NONE: no model row maps this file yet health poll +core/frontend/durable/provider.go DurableProvider.waitHealthy context.WithTimeout 1 901 per-call NONE: no model row maps this file yet one provider open, bounded by OpenTimeout +core/frontend/durable/provider.go DurableProvider.waitHealthy time.After 1 911 control-timer NONE: no model row maps this file yet health poll core/frontend/durable/provider_chunk.go DurableProvider.chunkAuthorityWait time.After 1 360 control-timer EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume attach retry pause core/frontend/durable/provider_chunk.go DurableProvider.newChunkLayer context.WithTimeout 1 496 per-call EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume attach: one geometry check, one HEAD claim core/frontend/durable/provider_chunk.go DurableProvider.newChunkLayer context.WithTimeout 2 515 per-call EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume attach: one geometry check, one HEAD claim @@ -168,13 +169,12 @@ core/frontend/durable/provider_chunk.go DurableProvider.chunkMaintenanceLoop tim core/frontend/durable/provider_chunk.go DurableProvider.chunkMaintenanceLoop time.NewTimer 1 1336 control-timer EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume poll or delay timer core/frontend/durable/provider_chunk.go DurableProvider.chunkMaintenanceLoop boundedPass 1 1348 per-call EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume snapshot-name probe: one bounded listing that grows with snapshot names, not with chunks core/frontend/durable/provider_chunk.go DurableProvider.chunkMaintenanceLoop time.NewTimer 2 1419 control-timer EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume poll or delay timer -core/frontend/durable/provider_chunk.go boundedPass context.WithTimeout 1 1490 pending-fix EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume maintenance pass total (retention plus cleaning); fix #969 (no-progress window per object) -core/frontend/durable/provider_chunk.go DurableProvider.chunkCutContext context.WithTimeout 1 1606 pending-fix EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume the cut's fixed total around changed-chunk uploads; fix #964 (cut progress window) -core/frontend/durable/provider_chunk.go DurableProvider.detachVolume time.AfterFunc 1 1755 availability-contract EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume detach freeze and settle budget: the guest-visible freeze is bounded by contract -core/frontend/durable/provider_chunk.go DurableProvider.detachVolume time.AfterFunc 2 1768 availability-contract EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume detach freeze and settle budget: the guest-visible freeze is bounded by contract -core/frontend/durable/provider_chunk.go DurableProvider.detachVolume context.WithDeadline 1 1892 availability-contract EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume detach freeze and settle budget: the guest-visible freeze is bounded by contract -core/frontend/durable/provider_chunk.go DurableProvider.retryUnknownDetach time.After 1 1970 control-timer EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume detach retry backoff -core/frontend/durable/provider_chunk.go DurableProvider.retryUnknownDetach context.WithTimeout 1 1980 per-call EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume one detach retry attempt +core/frontend/durable/provider_chunk.go boundedPass context.WithTimeout 1 1493 pending-fix EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume maintenance pass total (retention plus cleaning); fix #969 (no-progress window per object) +core/frontend/durable/provider_chunk.go DurableProvider.detachVolume time.AfterFunc 1 1787 availability-contract EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume detach freeze and settle budget: the guest-visible freeze is bounded by contract +core/frontend/durable/provider_chunk.go DurableProvider.detachVolume time.AfterFunc 2 1800 availability-contract EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume detach freeze and settle budget: the guest-visible freeze is bounded by contract +core/frontend/durable/provider_chunk.go DurableProvider.detachVolume context.WithDeadline 1 1924 availability-contract EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume detach freeze and settle budget: the guest-visible freeze is bounded by contract +core/frontend/durable/provider_chunk.go DurableProvider.retryUnknownDetach time.After 1 2002 control-timer EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume detach retry backoff +core/frontend/durable/provider_chunk.go DurableProvider.retryUnknownDetach context.WithTimeout 1 2012 per-call EngineAdapter.SettleResume; EngineAdapter.StartStop; HolderInterface.StopBegin; StopAndRestart.SendDetach; StopAndRestart.SettleResume one detach retry attempt core/frontend/durable/storage_adapter.go StorageBackend.admitAfterAttachUnqueued context.WithTimeout 1 767 per-call EngineAdapter.GuestWrite; HolderInterface.Write; WALHold.Resubmit one RPC or request core/frontend/iscsi/session.go Session.collectWriteData SetReadDeadline 1 470 per-call NONE: no model row maps this file yet one connection exchange or frame core/frontend/memback/provider.go Provider.Open time.After 1 69 control-timer NONE: no model row maps this file yet open poll @@ -196,14 +196,16 @@ core/host/master/services.go services.deleteHolderEvidence context.WithTimeout 1 core/host/master/workspace_service.go services.AckWorkspaceRevoked context.WithTimeout 1 236 per-call FormatGate.Place; MoveAdmission.ReadForMove; StopAndRestart.ReadClean one RPC or request core/host/master/workspace_service.go services.MoveWorkspace context.WithTimeout 1 355 per-call FormatGate.Place; MoveAdmission.ReadForMove; StopAndRestart.ReadClean one RPC or request core/host/master/workspace_service.go services.PreviewWorkspaceMove context.WithTimeout 1 623 per-call FormatGate.Place; MoveAdmission.ReadForMove; StopAndRestart.ReadClean one RPC or request -core/host/volume/chunk_control.go chunkContext context.WithTimeout 1 524 pending-fix SnapOps.Start HTTP chunk handlers' default 5 min total (manual cut, snapshot, backup); fix #964 and its waiter follow-up -core/host/volume/chunk_control.go StatusServer.handleChunkDetach context.WithTimeout 1 713 pending-fix SnapOps.Start a cut waiter's fixed total; fix follows the cut window of #964 (one waiter PR for snapshot, backup, plain detach and stop) -core/host/volume/chunk_control.go chunkControl.snapshotOperationAttempt context.WithTimeout 1 946 per-call SnapOps.Start one RPC or request -core/host/volume/chunk_control.go chunkControl.deleteSnapshotOperation time.Now().Add 1 1079 pending-fix SnapOps.Start unmeasured: the holder's snapshot-delete resume loop (30 s) around intent preparation; a measurement at the cap or a window is owed -core/host/volume/chunk_control.go chunkControl.deleteSnapshotOperation time.After 1 1102 control-timer SnapOps.Start resume loop poll +core/host/volume/chunk_control.go chunkContext context.WithTimeout 1 571 pending-fix SnapOps.Start HTTP chunk handlers' default 5 min total (manual cut, snapshot, backup); fix #964 and its waiter follow-up +core/host/volume/chunk_control.go StatusServer.handleChunkCut time.NewTimer 1 626 per-call CutTime.InProgress one POST observation answers by W or earlier on a sequence rise or terminal result; worker owns the independent cut window +core/host/volume/chunk_control.go StatusServer.handleChunkDetach context.WithTimeout 1 798 pending-fix SnapOps.Start a cut waiter's fixed total; fix follows the cut window of #964 (one waiter PR for snapshot, backup, plain detach and stop) +core/host/volume/chunk_control.go chunkControl.snapshotOperationAttempt context.WithTimeout 1 1032 per-call SnapOps.Start one RPC or request +core/host/volume/chunk_control.go chunkControl.deleteSnapshotOperation time.Now().Add 1 1166 pending-fix SnapOps.Start unmeasured: the holder's snapshot-delete resume loop (30 s) around intent preparation; a measurement at the cap or a window is owed +core/host/volume/chunk_control.go chunkControl.deleteSnapshotOperation time.After 1 1189 control-timer SnapOps.Start resume loop poll core/host/volume/host.go Host.runRoleRetry time.After 1 550 control-timer FormatGate.Downgrade; FormatGate.Upgrade role retry delay core/host/volume/host.go Host.runHeartbeat context.WithTimeout 1 792 per-call FormatGate.Downgrade; FormatGate.Upgrade one RPC or request core/host/volume/host.go Host.runSubscribe time.After 1 962 control-timer FormatGate.Downgrade; FormatGate.Upgrade subscribe retry backoff +core/host/volume/manual_cut.go chunkControl.startManualCut context.WithDeadline 1 84 availability-contract CutTime.Admit optional absolute deadline chosen by the caller, independent of the cut inactivity window core/host/volume/peer_command_executor.go PeerCommandExecutor.afterSessionClose context.WithTimeout 1 115 per-call NONE: no model row maps this file yet one RPC or request core/host/volume/peer_command_executor.go PeerCommandExecutor.PublishHealthy context.WithTimeout 1 197 per-call NONE: no model row maps this file yet one RPC or request core/host/volume/probe_round.go Host.runProbeRounds time.After 1 45 control-timer FencingRound.Answer probe retry backoff @@ -246,11 +248,15 @@ core/storage/chunk_head_belt.go confirmChunkTakeover time.NewTimer 1 171 availab core/storage/chunk_hydrate_all.go chunkLayerImpl.HydrateAllAt time.NewTimer 1 68 control-timer NONE: no model row maps this file yet hydration pacing and retry backoff core/storage/chunk_hydrate_all.go chunkLayerImpl.HydrateAllAt time.NewTimer 2 104 control-timer NONE: no model row maps this file yet hydration pacing and retry backoff core/storage/chunk_hydration.go chunkLayerImpl.hydrationWorker context.WithTimeout 1 212 per-call NONE: no model row maps this file yet one chunk fetch +core/storage/chunk_manual_cut.go chunkLayerImpl.captureManualCut time.NewTimer 1 172 control-timer CutTime.Settle unavailable settlement read backoff; no progress credit core/storage/chunk_precopy.go chunkLayerImpl.precopyDetach context.WithTimeout 1 157 ruled-total NONE: no model row maps this file yet docs/releases/v1.1.md: "Precopy detach keeps its fixed budgets; it is refused in v1.1" core/storage/chunk_precopy.go chunkLayerImpl.precopyDetach context.WithTimeout 2 203 ruled-total NONE: no model row maps this file yet docs/releases/v1.1.md: "Precopy detach keeps its fixed budgets; it is refused in v1.1" core/storage/chunk_upgrade_pass.go upgradePass.Run time.NewTimer 1 356 control-timer NONE: no model row maps this file yet upgrade-pass pacing pause -core/storage/chunk_upload.go chunkLayerImpl.putCapturedWith context.WithTimeout 1 25 pending-fix NONE: no model row maps this file yet a 30 s total over one object's upload retries (it wraps the retry loop and its backoff); fix #964 (a per-request deadline and the cut's no-progress window) -core/storage/chunk_upload.go chunkLayerImpl.putCapturedWith time.NewTimer 1 55 control-timer NONE: no model row maps this file yet upload retry backoff +core/storage/chunk_upload.go chunkLayerImpl.putCapturedWith context.WithTimeout 1 34 per-call CutWindow.CallTimeout; CutWindow.Start one immutable PUT or verification GET inside the cut inactivity window; no total retry deadline +core/storage/chunk_upload.go chunkLayerImpl.putCapturedWith context.WithTimeout 2 46 per-call CutWindow.CallTimeout; CutWindow.Start one immutable PUT or verification GET inside the cut inactivity window; no total retry deadline +core/storage/chunk_upload.go chunkLayerImpl.putCapturedWith time.NewTimer 1 59 control-timer CutWindow.CallTimeout; CutWindow.Start same-object upload retry backoff; no progress credit +core/storage/cut_progress_window.go WithCutProgressWindow time.AfterFunc 1 40 no-progress-window CutWindow.Tick; CutWindow.Complete completed-own-object inactivity window; no total cut bound +core/storage/cut_progress_window.go RunCutRequest context.WithTimeout 1 132 per-call CutWindow.CallTimeout one metadata request inside the cut inactivity window core/storage/group_commit.go GroupCommitter.Run time.NewTimer 1 81 control-timer NONE: no model row maps this file yet group commit batching delay core/storage/wal_admission.go walAdmission.acquireContext time.NewTimer 1 128 per-call WALHold.Arrive one write's admission wait, under its command budget core/storage/wal_admission.go walAdmission.acquireContext time.After 1 239 control-timer WALHold.Arrive admission re-check poll From 563d3ef35d4709e3dca10f9c3d66bc0bd8fc7cdf Mon Sep 17 00:00:00 2001 From: Ping Qiu Date: Thu, 3 Dec 2026 03:04:21 -0800 Subject: [PATCH 09/66] ci: unit job cap 60 min, enough for a storage + durable PR (#978) Interim merge note (spec trace workflow startup_failure since 22:45Z): CI configuration only (unit job cap 40 -> 60 min), released by the release lead after the run-time growth that motivated the earlier hold was fixed separately. go test (linux) and process-level tests (real binaries) passed on 6d4d8e61 against the current main head f41132c1; spec-trace-check.sh and public-text-check.sh run locally: both pass. --- seaweed-block/.github/workflows/test.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/seaweed-block/.github/workflows/test.yml b/seaweed-block/.github/workflows/test.yml index 2fc36d0531..5b9a6f3d50 100644 --- a/seaweed-block/.github/workflows/test.yml +++ b/seaweed-block/.github/workflows/test.yml @@ -40,8 +40,11 @@ jobs: # it is the merge gate, and the organization's shared GitHub-hosted queue held # it 30-55 minutes before it started. A PR from a fork never runs there. runs-on: ${{ (github.event_name == 'push' || (github.event.pull_request.head.repo.full_name == github.repository)) && 'tp04-seaweed-block' || 'ubuntu-latest' }} + # unit: a PR touching core/storage and core/frontend/durable adds both packages to the + # default step (measured 32 min on the self-hosted runner) before the v3-tagged step + # (measured 7-8 min), so 40 min cancelled the job; 60 min is about 1.5x that sum. # process: 44 tests in 4 parallel shards of about 13 min each (55 min in sequence). - timeout-minutes: ${{ matrix.suite == 'unit' && 40 || 90 }} + timeout-minutes: ${{ matrix.suite == 'unit' && 60 || 90 }} env: # Pure-Go build: no package in the default build needs cgo, and the # hosted runner should not depend on a C toolchain being present. From 87fe509c4d5c06d1af52746d03797b5b41a00f61 Mon Sep 17 00:00:00 2001 From: pingqiu-cpu Date: Thu, 3 Dec 2026 03:39:48 -0800 Subject: [PATCH 10/66] Normalize chunk CLI transport and snapshot-absence errors (#979) Merge note (pull_request_target spec-trace workflow has a startup_failure on every branch since 2026-12-02 22:45Z, so its checks run locally): - Test run 47093927493 succeeded (go test (linux), process-level tests (real binaries)) on head 9ea5ef4a against main f2bad6fb, the current main head. - spec-trace-check.sh and public-text-check.sh, run with the main branch's scripts against this head and body: both exit 0. - Code review ACCEPT on 9ea5ef4a (transport classifier sweep, caller cancel kept canceled, registry rows refreshed); runtime source ACCEPT earlier on 196693f3. --- .../sw-block/catalog_error_contract_test.go | 118 ++++++++++++ .../sw-block/catalog_snapshot_operation.go | 14 +- .../catalog_snapshot_operation_test.go | 2 +- seaweed-block/cmd/sw-block/chunk.go | 11 +- seaweed-block/cmd/sw-block/chunk_b.go | 8 +- .../cmd/sw-block/chunk_caller_cancel_test.go | 69 +++++++ .../cmd/sw-block/chunk_start_check_test.go | 5 +- seaweed-block/cmd/sw-block/chunk_transport.go | 56 ++++++ .../sw-block/chunk_transport_matrix_test.go | 177 ++++++++++++++++++ .../cmd/sw-block/chunk_typed_codes_test.go | 4 +- seaweed-block/cmd/sw-block/chunk_verify.go | 8 + .../cmd/sw-block/chunk_verify_test.go | 5 +- .../cmd/sw-block/chunk_volume_delete.go | 2 +- .../chunk_volume_delete_progress_test.go | 12 +- .../core/frontend/chunkstore/layout/delete.go | 2 +- .../core/frontend/chunkstore/single_filer.go | 24 ++- .../frontend/chunkstore/single_filer_test.go | 19 ++ seaweed-block/docs/design/invariants.md | 2 + seaweed-block/docs/time-bounds.tsv | 38 ++-- seaweed-block/docs/volume-lifecycle.md | 2 +- 20 files changed, 533 insertions(+), 45 deletions(-) create mode 100644 seaweed-block/cmd/sw-block/catalog_error_contract_test.go create mode 100644 seaweed-block/cmd/sw-block/chunk_caller_cancel_test.go create mode 100644 seaweed-block/cmd/sw-block/chunk_transport.go create mode 100644 seaweed-block/cmd/sw-block/chunk_transport_matrix_test.go diff --git a/seaweed-block/cmd/sw-block/catalog_error_contract_test.go b/seaweed-block/cmd/sw-block/catalog_error_contract_test.go new file mode 100644 index 0000000000..5fae9cbee2 --- /dev/null +++ b/seaweed-block/cmd/sw-block/catalog_error_contract_test.go @@ -0,0 +1,118 @@ +package main + +import ( + "bytes" + "context" + "errors" + "fmt" + "net" + "testing" + + "github.com/seaweedfs/seaweed-block/core/frontend/chunkstore" + "github.com/seaweedfs/seaweed-block/core/frontend/chunkstore/filerpb" + "github.com/seaweedfs/seaweed-block/core/frontend/chunkstore/layout" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type unavailableCatalogRead struct{ *memChunkStore } + +func (s unavailableCatalogRead) LookupEntry(context.Context, string, string) (*filerpb.Entry, error) { + return nil, fmt.Errorf("chunkstore: lookup HEAD: %w", status.Error(codes.Unavailable, "connection refused")) +} + +func TestOpsChunkCatalogUnavailableIsTyped(t *testing.T) { + mem := newMemChunkStore() + useMemChunkStore(t, mem) + v := cliVolume(t, mem, "unreachable", "daily") + dialChunkFiler = func(string) (chunkstore.Filer, func() error, error) { + return unavailableCatalogRead{mem}, func() error { return nil }, nil + } + for _, command := range []string{"snapshots", "show"} { + code, out, _ := runChunk(cliArgs(command, volArgs("volume", v))...) + e := chunkErrorOut(t, out) + if code != chunkExitFailed || e.Code != chunkstore.CodeRemoteUnavailable || !e.Retryable { + t.Fatalf("%s: exit=%d answer=%+v", command, code, e) + } + } +} + +func TestSnapshotDeleteAbsentCLIUsesContractCodeAndKeepsReceipt(t *testing.T) { + ctx := context.Background() + mem := newMemChunkStore() + useMemChunkStore(t, mem) + v := cliVolume(t, mem, "absent-contract", "daily") + cat, _ := chunkstore.NewBCatalog(mem, mem, defaultChunkPathCLI) + st, _ := cat.Store(v) + h, _, err := st.ReadHead(ctx) + if err != nil { + t.Fatal(err) + } + snap := h.Snapshots["daily"] + snap.Gen = h.Gen + 1 + h.Version = layout.HeadVersion1 + h.Snapshots["daily"] = snap + if err := st.UpdateHead(ctx, h.Gen, h, layout.CauseCommit); err != nil { + t.Fatal(err) + } + args := cliArgs("snapshot-delete", volArgs("volume", v), []string{"--name", "missing", "--request-id", "absence"}) + for i := 0; i < 2; i++ { + code, out, _ := runChunk(args...) + e := chunkErrorOut(t, out) + if code != chunkExitFailed || e.Code != chunkstore.CodeSnapshotNotFound || e.Retryable { + t.Errorf("attempt %d: exit=%d answer=%+v", i, code, e) + } + op, found, err := st.ReadSnapshotOperation(ctx, "absence", "delete") + if err != nil || !found || op.ErrorCode != "not_found" || op.State != "refused" || op.TargetGeneration == nil || *op.TargetGeneration != 0 { + t.Fatalf("changed durable absence fact: %+v found=%v err=%v", op, found, err) + } + + if i == 0 { + // A later incarnation must not turn replay of the absence into a + // successful deletion or change its captured zero generation. + h, _, err = st.ReadHead(ctx) + if err != nil { + t.Fatal(err) + } + replacement := h.Snapshots["daily"] + replacement.Gen = h.Gen + 1 + h.Snapshots["missing"] = replacement + if err := st.UpdateHead(ctx, h.Gen, h, layout.CauseCommit); err != nil { + t.Fatal(err) + } + } else { + h, _, err = st.ReadHead(ctx) + if err != nil || h.Snapshots["missing"].Gen == 0 { + t.Fatalf("replay removed replacement: %+v %v", h, err) + } + } + } +} + +func TestCatalogTransportClassificationKeepsDefiniteAnswers(t *testing.T) { + unavailable := status.Error(codes.Unavailable, "disconnected") + for _, tc := range []struct { + name string + err error + code string + retry bool + }{ + {"wrapped", fmt.Errorf("lookup: %w", unavailable), "remote_unavailable", true}, + {"deadline", errors.Join(context.DeadlineExceeded, unavailable), "deadline_exceeded", true}, + {"caller cancellation", errors.Join(context.Canceled, unavailable), "canceled", false}, + {"identity", errors.Join(layout.ErrIdentity, unavailable), "identity_mismatch", false}, + {"catalog", &chunkstore.CatalogError{Code: "outcome_unknown", Retryable: true, Err: unavailable}, "outcome_unknown", true}, + {"permission", status.Error(codes.PermissionDenied, "refused"), "internal", false}, + {"unknown", errors.New("unexpected implementation error"), "internal", false}, + {"address syntax", &net.AddrError{Err: "missing port", Addr: "filer"}, "internal", false}, + } { + t.Run(tc.name, func(t *testing.T) { + var out, diag bytes.Buffer + exit := chunkResult("snapshots", nil, tc.err, &out, &diag) + e := chunkErrorOut(t, out.String()) + if exit != chunkExitFailed || e.Code != tc.code || e.Retryable != tc.retry { + t.Fatalf("exit=%d answer=%+v", exit, e) + } + }) + } +} diff --git a/seaweed-block/cmd/sw-block/catalog_snapshot_operation.go b/seaweed-block/cmd/sw-block/catalog_snapshot_operation.go index eb0e033dc9..4c769e22f5 100644 --- a/seaweed-block/cmd/sw-block/catalog_snapshot_operation.go +++ b/seaweed-block/cmd/sw-block/catalog_snapshot_operation.go @@ -33,7 +33,7 @@ func chunkRunCatalogSnapshotDelete(ctx context.Context, cat *chunkstore.BCatalog func chunkCatalogSnapshotDeleteAnswer(ctx context.Context, cat *chunkstore.BCatalog, volume chunkstore.VolumeRef, op chunkstore.SnapshotOperation, work chunkstore.SnapshotDeleteWork, noWait bool, stderr io.Writer) (any, error) { fmt.Fprintf(stderr, "snapshot-delete %s request id %s instance %s sequence %d; repeat with the same --request-id to resume\n", snapshotIncarnation(op), op.ID, op.Instance, op.Sequence) if op.State == "refused" { - return nil, &chunkstore.CatalogError{Code: op.ErrorCode, Message: op.ErrorMessage} + return nil, catalogSnapshotDeleteRefusal(op) } if noWait { return map[string]any{"operation_id": op.ID, "volume_id": op.VolumeID.String(), "incarnation": snapshotIncarnation(op), "instance": op.Instance, "sequence": op.Sequence, "state": op.State}, nil @@ -68,7 +68,7 @@ func chunkCatalogSnapshotDeleteAnswer(ctx context.Context, cat *chunkstore.BCata return nil, &chunkstore.CatalogError{Code: "no_progress", Message: err.Error() + "; resume with --request-id " + op.ID, Retryable: true, Err: err} } if answer.State == "refused" { - return nil, &chunkstore.CatalogError{Code: answer.ErrorCode, Message: answer.ErrorMessage} + return nil, catalogSnapshotDeleteRefusal(answer) } if answer.State != "succeeded" || len(answer.Result) == 0 || !json.Valid(answer.Result) { return nil, &chunkstore.CatalogError{Code: codeInternalCLI, Message: "operation has no terminal result"} @@ -104,3 +104,13 @@ func chunkAdmitCatalogSnapshotDelete(ctx context.Context, cat *chunkstore.BCatal } return chunkCatalogSnapshotDeleteAnswer(ctx, cat, volume, op, nil, noWait, stderr) } + +// The retained absence fact keeps its v1.1 receipt encoding. Only its CLI +// presentation uses the public snapshot error vocabulary, including replay. +func catalogSnapshotDeleteRefusal(op chunkstore.SnapshotOperation) error { + code := op.ErrorCode + if op.Verb == "delete" && op.State == "refused" && op.TargetGeneration != nil && *op.TargetGeneration == 0 && op.ErrorCode == "not_found" && op.ErrorStatus == 404 { + code = chunkstore.CodeSnapshotNotFound + } + return &chunkstore.CatalogError{Code: code, Message: op.ErrorMessage} +} diff --git a/seaweed-block/cmd/sw-block/catalog_snapshot_operation_test.go b/seaweed-block/cmd/sw-block/catalog_snapshot_operation_test.go index f1c93916e5..55c4071f26 100644 --- a/seaweed-block/cmd/sw-block/catalog_snapshot_operation_test.go +++ b/seaweed-block/cmd/sw-block/catalog_snapshot_operation_test.go @@ -289,7 +289,7 @@ func TestSnapshotDeletePublicInitiallyAbsentIsRetainedRefusal(t *testing.T) { } args := cliArgs("snapshot-delete", volArgs("volume", v), []string{"--name", "absent", "--request-id", "missing-delete", "--no-wait"}) code, out, _ := runChunk(args...) - if code != chunkExitFailed || chunkErrorOut(t, out).Code != "not_found" { + if code != chunkExitFailed || chunkErrorOut(t, out).Code != "snapshot_not_found" { t.Fatalf("absence reported accepted: %d %s", code, out) } op, found, err := st.ReadSnapshotOperation(ctx, "missing-delete", "delete") diff --git a/seaweed-block/cmd/sw-block/chunk.go b/seaweed-block/cmd/sw-block/chunk.go index 4ed08fb0e4..b0d6d15f1b 100644 --- a/seaweed-block/cmd/sw-block/chunk.go +++ b/seaweed-block/cmd/sw-block/chunk.go @@ -70,12 +70,14 @@ func refuseUnlessSingleFilerWithin(parent context.Context, name string, f chunks err := checkSingleFiler(ctx, f) if err != nil && parent.Err() != nil { if c := context.Cause(parent); c != nil && !errors.Is(err, c) { - err = fmt.Errorf("%w (%v)", err, c) + err = fmt.Errorf("%w (%w)", err, c) } } switch { case err == nil: return -1 + case chunkCanceled(err) || errors.Is(err, context.DeadlineExceeded) || errors.Is(err, errVerifyStalled) || chunkTransportFailure(err): + return chunkResult(name, nil, err, stdout, stderr) case errors.Is(err, chunkstore.ErrNotSingleFiler): return chunkFail(name, stdout, stderr, ops.VolumeStatusExitInvalid, codeBadRequestCLI, err.Error(), false) default: @@ -351,8 +353,12 @@ func chunkResult(name string, v any, err error, stdout, stderr io.Writer) int { switch { case errors.As(err, &ce): return chunkFail(name, stdout, stderr, chunkExitFailed, ce.Code, ce.Detail(), ce.Retryable) - case errors.Is(err, context.DeadlineExceeded): + case chunkCanceled(err): + return chunkFail(name, stdout, stderr, chunkExitFailed, codeCanceledCLI, "operation interrupted by its caller", false) + case errors.Is(err, context.DeadlineExceeded) || errors.Is(err, errVerifyStalled): return chunkFail(name, stdout, stderr, chunkExitFailed, chunkstore.CodeDeadlineExceeded, err.Error(), true) + case chunkTransportFailure(err): + return chunkFail(name, stdout, stderr, chunkExitFailed, codeUnavailableCLI, err.Error(), true) case layoutCode(err) != "": return chunkFail(name, stdout, stderr, chunkExitFailed, layoutCode(err), err.Error(), errors.Is(err, layout.ErrPrecondition) || errors.Is(err, layout.ErrBusy)) default: @@ -374,6 +380,7 @@ func chunkResult(name string, v any, err error, stdout, stderr io.Writer) int { // CLI-side error codes, the same as the routes' (B9 §2.2 and the rulings // of 2026-11-15). const ( + codeCanceledCLI = "canceled" codeBadRequestCLI = "bad_request" codeInternalCLI = "internal" codeUnavailableCLI = "remote_unavailable" diff --git a/seaweed-block/cmd/sw-block/chunk_b.go b/seaweed-block/cmd/sw-block/chunk_b.go index 4cd765bc66..3539f1040f 100644 --- a/seaweed-block/cmd/sw-block/chunk_b.go +++ b/seaweed-block/cmd/sw-block/chunk_b.go @@ -44,6 +44,9 @@ func bCatalog(name, filer, base string, writes bool, timeout time.Duration, stdo } f, closeFn, err := dialChunkFiler(filer) if err != nil { + if chunkCanceled(err) || chunkTransportFailure(err) { + return nil, nil, chunkResult(name, nil, err, stdout, stderr) + } return nil, nil, chunkFail(name, stdout, stderr, ops.VolumeStatusExitInvalid, codeBadRequestCLI, err.Error(), false) } fail := func(msg string) (*chunkstore.BCatalog, func() error, int) { @@ -142,6 +145,9 @@ func (c *bCommand) run(args []string, writes bool, refs func() error, do func(co return chunkFail(name, c.stdout, c.stderr, ops.VolumeStatusExitInvalid, codeBadRequestCLI, err.Error(), false) } if err := refs(); err != nil { + if chunkCanceled(err) || chunkTransportFailure(err) { + return chunkResult(name, nil, err, c.stdout, c.stderr) + } if status.Code(err) == codes.NotFound { // the master does not know the volume return chunkFail(name, c.stdout, c.stderr, chunkExitFailed, "volume_not_found", err.Error(), false) } @@ -391,8 +397,6 @@ func chunkRestore(args []string, stdout, stderr io.Writer) int { return chunkFail("restore", stdout, stderr, chunkExitFailed, layoutCode(layout.ErrForeignSource), err.Error(), false) } return chunkFail("restore", stdout, stderr, chunkExitFailed, "not_admitted", err.Error(), false) - case codes.Unavailable, codes.DeadlineExceeded: - return chunkFail("restore", stdout, stderr, chunkExitFailed, codeUnavailableCLI, err.Error(), true) default: return chunkResult("restore", nil, err, stdout, stderr) } diff --git a/seaweed-block/cmd/sw-block/chunk_caller_cancel_test.go b/seaweed-block/cmd/sw-block/chunk_caller_cancel_test.go new file mode 100644 index 0000000000..cc69bae1a4 --- /dev/null +++ b/seaweed-block/cmd/sw-block/chunk_caller_cancel_test.go @@ -0,0 +1,69 @@ +package main + +import ( + "bytes" + "context" + "encoding/json" + "github.com/seaweedfs/seaweed-block/core/frontend/chunkstore" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" + "testing" + "time" + + "google.golang.org/grpc" + "google.golang.org/grpc/credentials/insecure" + "google.golang.org/grpc/health/grpc_health_v1" +) + +// A real gRPC call canceled by its caller keeps a cancellation answer. +func TestChunkCallerCancelIsNotTransport(t *testing.T) { + conn, err := grpc.NewClient("127.0.0.1:1", grpc.WithTransportCredentials(insecure.NewCredentials())) + if err != nil { + t.Fatal(err) + } + defer conn.Close() + ctx, cancel := context.WithCancel(context.Background()) + cancel() + _, err = grpc_health_v1.NewHealthClient(conn).Check(ctx, &grpc_health_v1.HealthCheckRequest{}, grpc.WaitForReady(true)) + t.Logf("canceled call: %v; transport=%t", err, chunkTransportFailure(err)) + if chunkTransportFailure(err) { + t.Errorf("caller cancellation classified as a remote transport failure") + } + var out, diag bytes.Buffer + if exit := chunkResult("snapshots", nil, err, &out, &diag); exit != chunkExitFailed { + t.Fatalf("exit=%d", exit) + } + answer := chunkErrorOut(t, out.String()) + if answer.Code != "canceled" || answer.Retryable { + t.Fatalf("canceled call: %+v", answer) + } +} + +func TestChunkCensusKeepsItsParentCancellationCause(t *testing.T) { + previous := checkSingleFiler + t.Cleanup(func() { checkSingleFiler = previous }) + checkSingleFiler = func(context.Context, chunkstore.Filer) error { return status.Error(codes.Canceled, "context canceled") } + for _, tc := range []struct { + name string + cause error + code string + retry bool + }{ + {"caller", context.Canceled, "canceled", false}, + {"deadline", context.DeadlineExceeded, "deadline_exceeded", true}, + {"pass silence", errVerifyStalled, "deadline_exceeded", true}, + } { + t.Run(tc.name, func(t *testing.T) { + ctx, cancel := context.WithCancelCause(context.Background()) + cancel(tc.cause) + var out, diag bytes.Buffer + if exit := refuseUnlessSingleFilerWithin(ctx, "verify", nil, time.Second, &out, &diag); exit != chunkExitFailed { + t.Fatalf("exit=%d", exit) + } + var answer chunkErrBody + if err := json.Unmarshal(out.Bytes(), &answer); err != nil || answer.Code != tc.code || answer.Retryable != tc.retry { + t.Fatalf("answer=%+v error=%v", answer, err) + } + }) + } +} diff --git a/seaweed-block/cmd/sw-block/chunk_start_check_test.go b/seaweed-block/cmd/sw-block/chunk_start_check_test.go index dcf835144a..1a7341b7eb 100644 --- a/seaweed-block/cmd/sw-block/chunk_start_check_test.go +++ b/seaweed-block/cmd/sw-block/chunk_start_check_test.go @@ -138,8 +138,9 @@ func TestOpsChunk_StartCheckIsBoundedByTheTimeout(t *testing.T) { case <-time.After(5 * time.Second): t.Fatalf("%s: a stalled start check held the command past its 200ms --timeout", name) } - if code == 0 || !strings.Contains(out.String(), "remote_unavailable") || !strings.Contains(out.String(), `"retryable":true`) { - t.Errorf("%s: exit %d, out %q; want a retryable remote_unavailable refusal", name, code, out.String()) + answer := chunkErrorOut(t, out.String()) + if code != chunkExitFailed || answer.Code != chunkstore.CodeDeadlineExceeded || !answer.Retryable { + t.Errorf("%s: exit %d, out %q; want a retryable deadline_exceeded refusal for the caller's timeout", name, code, out.String()) } } } diff --git a/seaweed-block/cmd/sw-block/chunk_transport.go b/seaweed-block/cmd/sw-block/chunk_transport.go new file mode 100644 index 0000000000..1641c2d5b7 --- /dev/null +++ b/seaweed-block/cmd/sw-block/chunk_transport.go @@ -0,0 +1,56 @@ +package main + +import ( + "context" + "errors" + "github.com/seaweedfs/seaweed-block/core/frontend/chunkstore" + "github.com/seaweedfs/seaweed-block/core/frontend/chunkstore/layout" + "net" + + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +// chunkTransportFailure classifies transport provenance, never diagnostic text. +// Cancellation and wrapped caller deadlines are not remote failures. A gRPC +// DeadlineExceeded status alone can be a remote request timeout; callers with +// their own context must retain its cause separately. +// Known catalog/kernel outcomes keep priority in chunkResult. +func chunkTransportFailure(err error) bool { + if err == nil || errors.Is(err, context.Canceled) || errors.Is(err, context.DeadlineExceeded) { + return false + } + var catalog *chunkstore.CatalogError + if errors.As(err, &catalog) { + return catalog.Code == chunkstore.CodeRemoteUnavailable + } + // ErrHolderActive also wraps an unanswered NoLiveLease check. That + // wrapper is a refusal to proceed, not proof that a live holder exists. + if layoutCode(err) != "" && !errors.Is(err, layout.ErrHolderActive) { + return false + } + switch status.Code(err) { + case codes.Unavailable, codes.DeadlineExceeded: + return true + } + var address *net.AddrError + var syntax *net.ParseError + if errors.As(err, &address) || errors.As(err, &syntax) { + return false + } + var network net.Error + return errors.As(err, &network) +} + +// gRPC cancellation does not wrap context.Canceled. Keep it distinct from an +// unavailable remote, including when a boundary has wrapped the status. +func chunkCanceled(err error) bool { + var catalog *chunkstore.CatalogError + if errors.Is(err, context.DeadlineExceeded) || errors.Is(err, errVerifyStalled) { + return false + } + if errors.As(err, &catalog) || (layoutCode(err) != "" && !errors.Is(err, layout.ErrHolderActive)) { + return false + } + return errors.Is(err, context.Canceled) || status.Code(err) == codes.Canceled +} diff --git a/seaweed-block/cmd/sw-block/chunk_transport_matrix_test.go b/seaweed-block/cmd/sw-block/chunk_transport_matrix_test.go new file mode 100644 index 0000000000..8cee3d11b2 --- /dev/null +++ b/seaweed-block/cmd/sw-block/chunk_transport_matrix_test.go @@ -0,0 +1,177 @@ +package main + +import ( + "bytes" + "context" + "fmt" + "google.golang.org/grpc" + "net" + "sync/atomic" + "testing" + "time" + + "github.com/seaweedfs/seaweed-block/core/frontend/chunkstore" + "github.com/seaweedfs/seaweed-block/core/frontend/chunkstore/filerpb" + "github.com/seaweedfs/seaweed-block/core/frontend/chunkstore/layout" + "github.com/seaweedfs/seaweed-block/core/rpc/control" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +type transportLookupStore struct { + *memChunkStore + failure error + calls *atomic.Int64 +} + +func (s transportLookupStore) LookupEntry(context.Context, string, string) (*filerpb.Entry, error) { + s.calls.Add(1) + return nil, s.failure +} + +// Every ops chunk command that reaches a filer/master: resolve, lazy dial, +// topology census and metadata reads are separate boundaries. Restore is a +// single master RPC and never opens a filer. Holder-only HTTP commands are +// covered separately by TestOpsChunk_ErrorsAreJSONOnStdout. +func TestOpsChunkTransportFailureMatrix(t *testing.T) { + for _, failure := range []struct { + name string + err error + }{ + {"unavailable", status.Error(codes.Unavailable, "connection refused")}, + {"rpc-deadline", status.Error(codes.DeadlineExceeded, "remote request expired")}, + {"rpc-canceled", status.Error(codes.Canceled, "RPC interrupted")}, + {"network", &net.OpError{Op: "dial", Net: "tcp", Err: fmt.Errorf("connection refused")}}, + } { + for _, phase := range []string{"resolve", "dial", "census", "read", "restore", "reserve", "no-lease"} { + for _, command := range []string{"snapshots", "show", "usage", "snapshot-delete", "retain", "retain-dry", "release", "volume-delete", "verify", "restore"} { + if (phase == "reserve" || phase == "no-lease") && (command != "volume-delete" || failure.name == "network") { + continue + } + if (command == "restore") != (phase == "restore") { + continue + } + if phase == "census" && (command == "snapshots" || command == "show" || command == "usage" || command == "retain-dry") { + continue + } + t.Run(failure.name+"/"+phase+"/"+command, func(t *testing.T) { + mem := newMemChunkStore() + useMemChunkStore(t, mem) + v := cliVolume(t, mem, "transport-source", "daily") + target := chunkstore.VolumeRef{Name: "target", ID: layout.VolumeID{2}} + var args []string + switch command { + case "restore": + args = cliArgs("restore", []string{"--source", v.Name, "--target", target.Name, "--snapshot", "daily"}) + case "release": + args = cliArgs("release", volArgs("source", v), volArgs("target", target)) + case "snapshot-delete": + args = cliArgs(command, volArgs("volume", v), []string{"--name", "daily"}) + case "volume-delete": + args = cliArgs(command, volArgs("volume", v), []string{"--request-id", "delete", "--timeout", "20ms"}) + case "retain-dry": + args = cliArgs("retain", volArgs("volume", v), []string{"--dry-run"}) + default: + args = cliArgs(command, volArgs("volume", v)) + } + var calls atomic.Int64 + switch phase { + case "reserve", "no-lease": + addr := startTransportAuthority(t, &transportAuthority{failure: failure.err, phase: phase, calls: &calls}) + args = cliArgs("volume-delete", volArgs("volume", v), []string{"--request-id", "delete", "--master", addr, "--timeout", "20ms"}) + + case "resolve": + resolveVolumeID = func(context.Context, string, string) (layout.VolumeID, error) { + calls.Add(1) + return layout.VolumeID{}, failure.err + } + case "dial": + dialChunkFiler = func(string) (chunkstore.Filer, func() error, error) { calls.Add(1); return nil, nil, failure.err } + case "census": + checkSingleFiler = func(context.Context, chunkstore.Filer) error { + calls.Add(1) + return fmt.Errorf("%w: configuration: %w", chunkstore.ErrNotSingleFiler, failure.err) + } + case "read": + dialChunkFiler = func(string) (chunkstore.Filer, func() error, error) { + return transportLookupStore{mem, failure.err, &calls}, func() error { return nil }, nil + } + case "restore": + restoreCreateRPC = func(context.Context, string, *control.CreateVolumeRequest) (*control.CreateVolumeResponse, error) { + calls.Add(1) + return nil, failure.err + } + } + var out, diag bytes.Buffer + exit := runOpsChunk(args, &out, &diag) + e := chunkErrorOut(t, out.String()) + wantCode, wantRetry := "remote_unavailable", true + if failure.name == "rpc-canceled" { + wantCode, wantRetry = "canceled", false + } + if calls.Load() == 0 || exit != 1 || e.Code != wantCode || e.Retryable != wantRetry { + t.Errorf("calls=%d exit=%d answer=%+v", calls.Load(), exit, e) + } + }) + } + } + } +} + +// Exercise the real lazy gRPC client and census wrapper, not a seam returning +// an already-classified error. No process is listening at this address. +func TestOpsChunkVerifyUnreachableCensusPreservesTransport(t *testing.T) { + listener, err := net.Listen("tcp", "127.0.0.1:0") + if err != nil { + t.Fatal(err) + } + addr := listener.Addr().String() + if err := listener.Close(); err != nil { + t.Fatal(err) + } + // Bound the real census call separately from the pass inactivity window, + // so the test observes the unreachable remote, not a racing pass cancel. + previousCheck := checkSingleFiler + t.Cleanup(func() { checkSingleFiler = previousCheck }) + checkSingleFiler = func(ctx context.Context, f chunkstore.Filer) error { + call, cancel := context.WithTimeout(ctx, 50*time.Millisecond) + defer cancel() + return previousCheck(call, f) + } + code, out, _ := runChunk("verify", "--volume", "v1", "--chunk-filer", addr, "--timeout", "5s") + e := chunkErrorOut(t, out) + if code != 1 || e.Code != "remote_unavailable" || !e.Retryable { + t.Fatalf("exit=%d answer=%+v", code, e) + } +} + +type transportAuthority struct { + control.UnimplementedLifecycleServiceServer + failure error + phase string + calls *atomic.Int64 +} + +func (s *transportAuthority) ReserveVolumeDeletion(context.Context, *control.MarkVolumeDeletingRequest) (*control.MarkVolumeDeletingResponse, error) { + if s.phase == "reserve" { + s.calls.Add(1) + return nil, s.failure + } + return &control.MarkVolumeDeletingResponse{Known: true}, nil +} +func (s *transportAuthority) CheckVolumeNoLiveLease(context.Context, *control.MarkVolumeDeletingRequest) (*control.MarkVolumeDeletingResponse, error) { + s.calls.Add(1) + return nil, s.failure +} +func startTransportAuthority(t *testing.T, s *transportAuthority) string { + t.Helper() + listener, err := net.Listen("tcp", "127.0.0.1:0") + if err != nil { + t.Fatal(err) + } + server := grpc.NewServer() + control.RegisterLifecycleServiceServer(server, s) + go func() { _ = server.Serve(listener) }() + t.Cleanup(server.Stop) + return listener.Addr().String() +} diff --git a/seaweed-block/cmd/sw-block/chunk_typed_codes_test.go b/seaweed-block/cmd/sw-block/chunk_typed_codes_test.go index b1fb8c2a9d..9409ecb260 100644 --- a/seaweed-block/cmd/sw-block/chunk_typed_codes_test.go +++ b/seaweed-block/cmd/sw-block/chunk_typed_codes_test.go @@ -26,7 +26,7 @@ func jsonCode(t *testing.T, out []byte) string { // master refused for a foreign source is restore_source_not_own (from its // typed reason; an untyped FailedPrecondition stays not_admitted), and a // volume the master does not know is volume_not_found (any other resolve -// failure stays bad_request). +// transport failure is retryable remote_unavailable). func TestOpsChunkTypedRefusalCodes(t *testing.T) { prevRestore, prevResolve := restoreCreateRPC, resolveVolumeID t.Cleanup(func() { restoreCreateRPC, resolveVolumeID = prevRestore, prevResolve }) @@ -55,7 +55,7 @@ func TestOpsChunkTypedRefusalCodes(t *testing.T) { code string }{ {"unknown volume", status.Error(codes.NotFound, "volume not found"), chunkExitFailed, "volume_not_found"}, - {"master unreachable", status.Error(codes.Unavailable, "connection refused"), 2, codeBadRequestCLI}, + {"master unreachable", status.Error(codes.Unavailable, "connection refused"), chunkExitFailed, codeUnavailableCLI}, } { resolveVolumeID = func(context.Context, string, string) (layout.VolumeID, error) { return layout.VolumeID{}, c.err } var out, errs bytes.Buffer diff --git a/seaweed-block/cmd/sw-block/chunk_verify.go b/seaweed-block/cmd/sw-block/chunk_verify.go index 279daae6c1..ffd8b46ed9 100644 --- a/seaweed-block/cmd/sw-block/chunk_verify.go +++ b/seaweed-block/cmd/sw-block/chunk_verify.go @@ -114,6 +114,9 @@ func chunkVerify(args []string, stdout, stderr io.Writer) int { } f, closeFn, err := dialChunkFiler(filer) if err != nil { + if chunkCanceled(err) || chunkTransportFailure(err) { + return verifyIncomplete(layout.VerifyResult{}, err, stdout, stderr) + } return usage(err.Error()) } defer closeFn() @@ -277,6 +280,11 @@ func verifyIncomplete(res layout.VerifyResult, err error, stdout, stderr io.Writ Verify layout.VerifyResult `json:"verify"` }{Verify: res} body.Code, body.Message = codeInternalCLI, err.Error() + if chunkCanceled(err) { + body.Code, body.Message = codeCanceledCLI, "operation interrupted by its caller" + } else if chunkTransportFailure(err) { + body.Code, body.Retryable = codeUnavailableCLI, true + } if errors.Is(err, context.DeadlineExceeded) || errors.Is(err, errVerifyStalled) { body.Code, body.Retryable = chunkstore.CodeDeadlineExceeded, true } diff --git a/seaweed-block/cmd/sw-block/chunk_verify_test.go b/seaweed-block/cmd/sw-block/chunk_verify_test.go index 4ac1cd30f0..f82f068b02 100644 --- a/seaweed-block/cmd/sw-block/chunk_verify_test.go +++ b/seaweed-block/cmd/sw-block/chunk_verify_test.go @@ -232,8 +232,9 @@ func TestOpsChunk_VerifyStartCheckIsBoundedByTheTimeout(t *testing.T) { case <-time.After(5 * time.Second): t.Fatalf("a stalled start check held verify past its 200ms --timeout") } - if code == 0 || !strings.Contains(out.String(), "remote_unavailable") || !strings.Contains(out.String(), `"retryable":true`) { - t.Errorf("verify: exit %d, out %q; want a retryable remote_unavailable refusal", code, out.String()) + answer := chunkErrorOut(t, out.String()) + if code != chunkExitFailed || answer.Code != chunkstore.CodeDeadlineExceeded || !answer.Retryable { + t.Errorf("verify: exit %d, out %q; want a retryable deadline_exceeded refusal for the caller's timeout", code, out.String()) } } diff --git a/seaweed-block/cmd/sw-block/chunk_volume_delete.go b/seaweed-block/cmd/sw-block/chunk_volume_delete.go index fe1a7089ca..f3587f6ed3 100644 --- a/seaweed-block/cmd/sw-block/chunk_volume_delete.go +++ b/seaweed-block/cmd/sw-block/chunk_volume_delete.go @@ -115,7 +115,7 @@ func deleteVolumeWithProgress(ctx context.Context, cat *chunkstore.BCatalog, ref skippedSet := map[layout.RootName]bool{} var lastErr error stalled := func(err error) error { - return &chunkstore.CatalogError{Code: "unavailable", Retryable: true, Message: fmt.Sprintf("deleted %d of %d objects; no progress at %s; retry with the same --request-id", len(done), total, object), Err: err} + return &chunkstore.CatalogError{Code: codeUnavailableCLI, Retryable: true, Message: fmt.Sprintf("deleted %d of %d objects; no progress at %s; retry with the same --request-id", len(done), total, object), Err: err} } // stderr is the command's diagWriter: its writes never block, so a slow // stderr delays neither a sweep, the retry window nor the answer. diff --git a/seaweed-block/cmd/sw-block/chunk_volume_delete_progress_test.go b/seaweed-block/cmd/sw-block/chunk_volume_delete_progress_test.go index 28cce3db9b..2f3c454476 100644 --- a/seaweed-block/cmd/sw-block/chunk_volume_delete_progress_test.go +++ b/seaweed-block/cmd/sw-block/chunk_volume_delete_progress_test.go @@ -70,7 +70,7 @@ func TestVolumeDeleteContinuesAcrossTransientObjectFailures(t *testing.T) { code, out, logs := runChunk(cliArgs("volume-delete", volArgs("volume", v), []string{"--master", addr, "--request-id", "delete-progress", "--timeout", "150ms"})...) if stuck { e := chunkErrorOut(t, out) - if code != 1 || e.Code != "unavailable" || !e.Retryable || !strings.Contains(e.Message, "deleted 0 of") || !strings.Contains(e.Message, "/") || !strings.Contains(e.Message, "object deadline") { + if code != 1 || e.Code != "remote_unavailable" || !e.Retryable || !strings.Contains(e.Message, "deleted 0 of") || !strings.Contains(e.Message, "/") || !strings.Contains(e.Message, "object deadline") { t.Fatalf("stalled delete: code=%d out=%s logs=%s", code, out, logs) } if time.Since(started) > 3*time.Second { @@ -151,7 +151,7 @@ func TestVolumeDeleteRefreshesAnExpiredSweepAndWaitsFromLastRemoval(t *testing.T return } e := chunkErrorOut(t, out) - if code != 1 || e.Code != "unavailable" || !e.Retryable || !strings.Contains(e.Message, "deleted 1 of 2") || !strings.Contains(e.Message, "stalled after first removal") { + if code != 1 || e.Code != "remote_unavailable" || !e.Retryable || !strings.Contains(e.Message, "deleted 1 of 2") || !strings.Contains(e.Message, "stalled after first removal") { t.Fatalf("stall after progress: %d %s", code, out) } if elapsed := time.Since(f.removedAt); elapsed < bound || elapsed > bound+2*time.Second { @@ -182,8 +182,8 @@ func TestVolumeDeleteReportsAStalledStoreWhileItWaits(t *testing.T) { } addr := startFakeLifecycle(t, &fakeLifecycle{}) code, out, logs := runChunk(cliArgs("volume-delete", volArgs("volume", v), []string{"--master", addr, "--request-id", "stalled", "--timeout", "800ms"})...) - if e := chunkErrorOut(t, out); code != 1 || e.Code != "unavailable" { - t.Fatalf("stalled store: code=%d out=%s logs=%s; want the bounded unavailable answer", code, out, logs) + if e := chunkErrorOut(t, out); code != 1 || e.Code != "remote_unavailable" { + t.Fatalf("stalled store: code=%d out=%s logs=%s; want the bounded remote_unavailable answer", code, out, logs) } var stall string for _, l := range strings.Split(logs, "\n") { @@ -267,7 +267,7 @@ func TestVolumeDeleteAnswerDoesNotWaitOnAStuckStderr(t *testing.T) { t.Cleanup(func() { close(stuck.release) }) code, out, took := runVolumeDelete(t, "stuck-stderr", stuck, bound, 10*time.Second) fast, got := chunkErrorOut(t, fastOut), chunkErrorOut(t, out) - if code != fastCode || got.Code != fast.Code || got.Retryable != fast.Retryable || got.Code != "unavailable" { + if code != fastCode || got.Code != fast.Code || got.Retryable != fast.Retryable || got.Code != "remote_unavailable" { t.Fatalf("stuck stderr changed the answer: exit %d %+v, with a fast stderr exit %d %+v", code, got, fastCode, fast) } if took > bound+time.Second { @@ -281,7 +281,7 @@ func TestVolumeDeleteAnswerDoesNotWaitOnAStuckStderr(t *testing.T) { func TestVolumeDeleteNeverWritesStderrConcurrently(t *testing.T) { slow := &overlapStderr{delay: time.Second} code, out, _ := runVolumeDelete(t, "overlap-stderr", slow, 400*time.Millisecond, 10*time.Second) - if e := chunkErrorOut(t, out); code != 1 || e.Code != "unavailable" { + if e := chunkErrorOut(t, out); code != 1 || e.Code != "remote_unavailable" { t.Fatalf("answer %d %+v", code, e) } time.Sleep(1500 * time.Millisecond) // any write still in flight lands now diff --git a/seaweed-block/core/frontend/chunkstore/layout/delete.go b/seaweed-block/core/frontend/chunkstore/layout/delete.go index 21c4cd1c0d..51acbb8ad2 100644 --- a/seaweed-block/core/frontend/chunkstore/layout/delete.go +++ b/seaweed-block/core/frontend/chunkstore/layout/delete.go @@ -132,7 +132,7 @@ func RunMarkDeleting(ctx context.Context, st HeadStore, auth DeleteAuthority) (H return next, changed, err } if err := auth.NoLiveLease(ctx); err != nil { - return Head{}, false, fmt.Errorf("%w: %v", ErrHolderActive, err) + return Head{}, false, fmt.Errorf("%w: %w", ErrHolderActive, err) } return next, true, nil }) diff --git a/seaweed-block/core/frontend/chunkstore/single_filer.go b/seaweed-block/core/frontend/chunkstore/single_filer.go index c647da98bd..793be2c260 100644 --- a/seaweed-block/core/frontend/chunkstore/single_filer.go +++ b/seaweed-block/core/frontend/chunkstore/single_filer.go @@ -47,14 +47,15 @@ func (c *SWFS) CheckSingleFiler(ctx context.Context) error { // The dial is lazy and the filer may still be starting: wait for it, within the bound. cfg, err := c.fc.GetFilerConfiguration(ctx, &filerpb.GetFilerConfigurationRequest{}, grpc.WaitForReady(true)) if err != nil { - return fmt.Errorf("%w: filer %s configuration: %v", ErrNotSingleFiler, c.cfg.FilerGRPC, err) + return fmt.Errorf("%w: filer %s configuration: %w", ErrNotSingleFiler, c.cfg.FilerGRPC, err) } if len(cfg.GetMasters()) == 0 { return fmt.Errorf("%w: filer %s reports no master, cannot list its group", ErrNotSingleFiler, c.cfg.FilerGRPC) } var tried, unanswered []string + var observationErr error for { - ok, err := c.singleFilerRound(ctx, cfg, &tried, &unanswered) + ok, err := c.singleFilerRound(ctx, cfg, &tried, &unanswered, &observationErr) if ok || err != nil { return err } @@ -64,7 +65,11 @@ func (c *SWFS) CheckSingleFiler(ctx context.Context) error { if len(unanswered) > 0 { missing = "; every master must answer, these did not: " + strings.Join(unanswered, ", ") + " (rerun when they answer)" } - return fmt.Errorf("%w: could not confirm filer %s as the only filer within %s: %s%s", ErrNotSingleFiler, c.cfg.FilerGRPC, singleFilerWait, strings.Join(tried, "; "), missing) + failure := fmt.Errorf("%w: could not confirm filer %s as the only filer within %s: %s%s", ErrNotSingleFiler, c.cfg.FilerGRPC, singleFilerWait, strings.Join(tried, "; "), missing) + if observationErr != nil { + return fmt.Errorf("%w: %w", failure, observationErr) + } + return failure case <-time.After(singleFilerRetry): } } @@ -73,7 +78,8 @@ func (c *SWFS) CheckSingleFiler(ctx context.Context) error { // singleFilerRound requires all configured masters to answer and agree. // A follower's list cannot confirm or refuse the census: only the leader // owns the registered filer list. Unknown views retry, never admit. -func (c *SWFS) singleFilerRound(ctx context.Context, cfg *filerpb.GetFilerConfigurationResponse, tried, unanswered *[]string) (bool, error) { +func (c *SWFS) singleFilerRound(ctx context.Context, cfg *filerpb.GetFilerConfigurationResponse, tried, unanswered *[]string, observationErr *error) (bool, error) { + *observationErr = nil *tried, *unanswered = (*tried)[:0], (*unanswered)[:0] leader := "" reports := make(map[string]string) @@ -90,6 +96,7 @@ func (c *SWFS) singleFilerRound(ctx context.Context, cfg *filerpb.GetFilerConfig reported, err := masterLeader(actx, addr) cancel() if err != nil { + *observationErr = err *tried = append(*tried, fmt.Sprintf("%s: leader report: %v", addr, err)) *unanswered = append(*unanswered, addr) complete = false @@ -112,6 +119,9 @@ func (c *SWFS) singleFilerRound(ctx context.Context, cfg *filerpb.GetFilerConfig own, err := masterLeader(actx, leader) cancel() if err != nil || own != leader { + if err != nil { + *observationErr = err + } *tried = append(*tried, fmt.Sprintf("leader %s self-report %q: %v", leader, own, err)) return false, nil } @@ -120,6 +130,9 @@ func (c *SWFS) singleFilerRound(ctx context.Context, cfg *filerpb.GetFilerConfig nodes, err := listFilers(actx, leader, cfg.GetFilerGroup()) cancel() if err != nil || ctx.Err() != nil { + if err != nil { + *observationErr = err + } *tried = append(*tried, fmt.Sprintf("leader %s list: %v", leader, err)) return false, nil } @@ -130,6 +143,9 @@ func (c *SWFS) singleFilerRound(ctx context.Context, cfg *filerpb.GetFilerConfig confirmed, err := masterLeader(actx, leader) cancel() if err != nil || confirmed != leader || ctx.Err() != nil { + if err != nil { + *observationErr = err + } *tried = append(*tried, fmt.Sprintf("leader %s after list reports %q: %v", leader, confirmed, err)) return false, nil } diff --git a/seaweed-block/core/frontend/chunkstore/single_filer_test.go b/seaweed-block/core/frontend/chunkstore/single_filer_test.go index 7b006e06da..75386c2a70 100644 --- a/seaweed-block/core/frontend/chunkstore/single_filer_test.go +++ b/seaweed-block/core/frontend/chunkstore/single_filer_test.go @@ -489,3 +489,22 @@ func TestSingleFilerCensusUsesTheAgreedLeader(t *testing.T) { refusedAtBound(t, "master never answers", c) }) } + +func TestCheckSingleFilerKeepsTransportCause(t *testing.T) { + shortBounds(t) + t.Run("configuration", func(t *testing.T) { + c, _ := startConfigFiler(t, &configFiler{err: status.Error(codes.Unavailable, "filer unavailable")}) + err := c.CheckSingleFiler(context.Background()) + if !errors.Is(err, ErrNotSingleFiler) || status.Code(err) != codes.Unavailable { + t.Fatalf("lost configuration failure provenance: %v", err) + } + }) + t.Run("master-round", func(t *testing.T) { + c, _ := startConfigFiler(t, &configFiler{masters: []string{deadAddress(t)}}) + err := c.CheckSingleFiler(context.Background()) + code := status.Code(err) + if !errors.Is(err, ErrNotSingleFiler) || (code != codes.Unavailable && code != codes.DeadlineExceeded) { + t.Fatalf("lost master failure provenance: %v", err) + } + }) +} diff --git a/seaweed-block/docs/design/invariants.md b/seaweed-block/docs/design/invariants.md index f2fdf7ef2b..63ca2c663c 100644 --- a/seaweed-block/docs/design/invariants.md +++ b/seaweed-block/docs/design/invariants.md @@ -1186,6 +1186,7 @@ Notes: | `INV-CUT-TIMER-RESTART-001` | A successful cut of any kind restarts the periodic timer, which runs on in-process monotonic time (a restart starts a fresh schedule; wall-clock steps move nothing). | M5 periodic trigger (before Admit) | `core/frontend/durable/provider_chunk.go` `chunkLoop` | `TestWALStoreChunk_ExplicitCutRestartsTheTimer`, `TestWALStoreChunk_ExplicitCutOverlappingTheTimerRestartsIt` (`core/frontend/durable/provider_chunk_sched_test.go`); `TestCutPolicy_TimerRunsOnObservationTime`, `TestCutPolicy_StaggerPreservesExplicitTimerReset` (`core/frontend/durable/cut_policy_test.go`) | — | ACTIVE | | `INV-CUT-TIMER-SKIP-001` | A periodic cut decided from an older last cut is skipped under the capture lock: no automatic cut follows another within the interval. | M5 periodic trigger (before Admit) | `core/storage/chunk_periodic_cut.go` `CutUnlessCutSince`; `core/frontend/durable/provider_chunk.go` `chunkLoop` | `TestChunkPeriodicCut_SkipsAfterANewerCut`, `TestChunkPeriodicCut_SkipsANewerCutWithAnOlderStamp` (`core/storage/chunk_periodic_cut_test.go`); `TestWALStoreChunk_ExplicitCutOverlappingTheTimerRestartsIt` (`core/frontend/durable/provider_chunk_sched_test.go`) | — | ACTIVE | | `INV-CUT-TIMER-SLOT-WAIT-001` | A periodic cut refused for held host slots, pending urgent work or an earlier ticket is a wait, not a failure: no backoff or minimum spacing; it retries at the next poll in ticket order, and status reports the wait until any later cut succeeds. Other errors keep the backoff. | M5 periodic trigger (before Admit) | `core/frontend/durable/provider_chunk.go` `cutPolicy.after`, `chunkLoop`; `core/hostlimit/limiter.go` `ErrSlotsHeld` | `TestCutPolicy_HostSlotBusyIsAWaitNotAFailure`, `TestCutPolicy_SuccessDuringSlotWaitEndsTheWait`, `TestCutWaitSlot_StatusEndsTheWaitAfterALaterCut`, `TestCutPolicy_TicketOrderWaitBound` (`core/frontend/durable/cut_policy_test.go`); `TestTimerCutRunsSoonAfterHostSlotFrees`, `TestSlotWaitEndsWithASuccessfulDetachSeal` (`core/frontend/durable/host_slot_wait_test.go`); `TestAdmitClosedDuringPoolAcquisitionIsRevoked` (`core/hostlimit/limiter_test.go`) | — | ACTIVE | +| `INV-CLI-CATALOG-ERROR-001` | The chunk CLI reports filer/master transport failures as retryable remote_unavailable (exit 1), including census, dial, resolve and read failures; configuration refusals stay distinct. An absent v1.1 delete reports snapshot_not_found; its not_found receipt stays unchanged. | M9 client error projection; M4 census refusal, no transition change | `cmd/sw-block/chunk_transport.go` `chunkTransportFailure`; `cmd/sw-block/chunk.go` `chunkResult`; `cmd/sw-block/catalog_snapshot_operation.go` `catalogSnapshotDeleteRefusal`; `core/frontend/chunkstore/single_filer.go` `CheckSingleFiler`; `core/frontend/chunkstore/layout/delete.go` `RunMarkDeleting` | `TestOpsChunkTransportFailureMatrix`, `TestOpsChunkVerifyUnreachableCensusPreservesTransport`, `TestCheckSingleFilerKeepsTransportCause`; `TestOpsChunkCatalogUnavailableIsTyped`, `TestCatalogTransportClassificationKeepsDefiniteAnswers`, `TestSnapshotDeleteAbsentCLIUsesContractCodeAndKeepsReceipt` | SnapOps.Poll; r2.972 | STUB | | `INV-CLI-CHUNK-LOOP-001` | Above the per-request bound, sw-block ops chunk snapshot\|detach repeats the SAME request (same name and request id) only after a retryable or outcome_unknown answer. Manual cut uses the separate one-POST/read-only-poll contract. | client (no state machine): the CLI side of M5 requests | `cmd/sw-block/chunk_loop.go` `chunkPostLoop`; `cmd/sw-block/chunk.go` `chunkPostUntil` | `TestChunkSnapshotRepeatsTimedOutRequestsWithTheSameBody`, `TestChunkSnapshotLoopReusesTheGeneratedRequestID`, `TestChunkLoopRepeatsAnOutcomeUnknownNotMarkedRetryable` (`cmd/sw-block`) | — | ACTIVE | | `INV-CLI-CHUNK-LOOP-002` | Above the per-request bound, sw-block ops chunk snapshot\|detach stops at the first definite answer (success or non-retryable refusal). | client (no state machine): the CLI side of M5 cut requests | `cmd/sw-block/chunk_loop.go` `chunkPostLoop` | `TestChunkLoopStopsOnANonRetryableRefusal`, `TestChunkDetachOutcomeUnknownSettles` (`cmd/sw-block`) | — | ACTIVE | | `INV-CLI-CHUNK-LOOP-003` | Detach and synchronous snapshot admission obey a positive total --timeout. Async snapshot observation keeps the same ID with bounded calls and no total deadline. Manual cut uses the separate inactivity-window contract. | client (no state machine): the CLI side of M5 cut requests | `cmd/sw-block/chunk_loop.go` `chunkPostLoop`; `cmd/sw-block/chunk.go` `chunkPostUntil` | `TestChunkLoopEndsAtTheTimeout`, `TestChunkLoopHeldProgressReadSendsNoRequestAfterTheTimeout`, `TestChunkLoopSlowAnswersAreBoundedByTheTimeout`, `TestChunkNonPositiveTimeoutIsRefused` (`cmd/sw-block`) | — | ACTIVE | @@ -1197,6 +1198,7 @@ A guest read has a cooperative arrival budget; internal contextless readers keep Notes: +- `INV-CLI-CATALOG-ERROR-001`: Linux qualification remains pending; native CLI and receipt controls alone do not activate this row. A failed NoLiveLease observation keeps its transport cause under ErrHolderActive: the wrapper refuses progress but does not prove a live holder. Typed transport failures remain retryable; actual authority refusals stay definite. The existing volume-delete retry window now presents its exhausted remote failure as remote_unavailable rather than unavailable. - `INV-CUT-TIMER-RESTART-001`, `INV-CUT-TIMER-SKIP-001`: cuts are identified and ordered by the layer's in-process `CutSeq`, never by the `LastCutNs` wall stamp: a `CutSeq` not seen before is a success at the moment it is observed, and a periodic decision is skipped once `CutSeq` has moved; at start the existing value is not new, so a restart keeps the startup phase. The scheduled-snapshot worker (`INV-SNAP-SCHEDULED-KEEP-001`) runs on the same monotonic time: a new attachment seeds its due time at the next stable per-volume grid slot after HEAD's newest scheduled snapshot, or is due immediately without scheduled history. Future creation times are clamped to now. A re-armed loop on the same handle keeps its schedule (failures, retry time); a restart restores the last success and overdue age from HEAD. Tests: `TestScheduledSnapshotLoop_TakesEachSlotOnMonotonicTime`, `_RearmKeepsTheSchedule`, `_OverdueWithNoSuccess`, `TestSnapshotSchedule_SlotsAreOffsetPerVolume`. - Not reachable in this release: `INV-WS-FREEZE-ACCOUNTING-001` (except its estimate and quiesce-slack report, which every successful cut returns) and `INV-CUT-PRECOPY-001`. `/chunk/detach` refuses `frozen` (`INV-CUT-FROZEN-DETACH-REFUSED-001`) and blockvolume refuses `--chunk-detach-precopy` (`INV-CUT-PRECOPY-FLAG-REFUSED-001`), so neither the frozen admission nor the pre-copy admission runs in a released process. Their code is kept and their tests below the HTTP handler still assert them, so their status stays ACTIVE. For the same reason the pre-copy policy that `INV-CUT-PLAIN-DETACH-001` keeps for an absent or false `plain` field is always off. `INV-WS-FREEZE-REFUSAL-001` stays reachable: its HTTP400 validation runs before the refusal. So do `INV-WS-FREEZE-REFUSAL-INPUTS-001` and `INV-WS-FREEZE-REFUSAL-PRECEDENCE-001`. - `INV-WS-FREEZE-REFUSAL-001`: a generic `bad_request` is not proof of a clean refusal. The validation also refuses a non-frozen request that carries a freeze origin (`handleChunkDetach`). `INV-WS-FREEZE-REFUSAL-INPUTS-001` compares the caller's Unix-nanosecond origin with blockvolume's `time.Now`, with no skew bound. diff --git a/seaweed-block/docs/time-bounds.tsv b/seaweed-block/docs/time-bounds.tsv index e5968c7381..f140d2efaa 100644 --- a/seaweed-block/docs/time-bounds.tsv +++ b/seaweed-block/docs/time-bounds.tsv @@ -35,20 +35,20 @@ cmd/sparrow/s7_restart_smoke.go runS7RestartSmoke context.WithTimeout 1 69 per-c cmd/sparrow/s7_restart_smoke.go runS7RestartSmoke time.Now().Add 1 84 per-call NONE: no model row maps this file yet test-harness binary: one bounded wait cmd/sw-block/catalog_snapshot_operation.go chunkCatalogSnapshotDeleteAnswer time.After 1 49 control-timer NONE: no model row maps this file yet retry pause inside the snapshot-delete command's window cmd/sw-block/chunk.go refuseUnlessSingleFilerWithin context.WithTimeout 1 68 per-call CutTime.Poll the single-filer start check, bounded by --timeout and by its caller's pass -cmd/sw-block/chunk.go chunkPost time.Now().Add 1 153 pending-fix CutTime.Poll remaining snapshot/detach HTTP waiter bound; fix #979 (manual cuts use chunkObserveCut) -cmd/sw-block/chunk.go chunkPostUntil context.WithDeadline 1 168 pending-fix CutTime.Poll remaining snapshot/detach HTTP waiter bound; fix #979 (manual cuts use chunkObserveCut) -cmd/sw-block/chunk.go chunkSnapshot time.Now().Add 1 289 control-timer CutTime.Poll snapshot expiry: a timestamp (validity, expiry or due time), not a wait -cmd/sw-block/chunk_b.go volumeFlags.ref context.WithTimeout 1 100 per-call NONE: no model row maps this file yet one CLI request (operator --timeout) -cmd/sw-block/chunk_b.go bCommand.run context.WithTimeout 1 158 pending-fix NONE: no model row maps this file yet unmeasured: applies each catalog command's own budget (its newBCommand row); open while snapshot delete and retain are unmeasured -cmd/sw-block/chunk_b.go chunkSnapshots newBCommand 1 174 per-call NONE: no model row maps this file yet lists one volume's snapshot names from one HEAD read (30 s) -cmd/sw-block/chunk_b.go snapshotDeleteFormatLevel context.WithTimeout 1 215 per-call NONE: no model row maps this file yet one CLI request (operator --timeout) -cmd/sw-block/chunk_b.go chunkSnapshotDelete newBCommand 1 250 pending-fix NONE: no model row maps this file yet unmeasured: a snapshot delete stages intents across the snapshot's chunks under 30 s; a measurement at the cap or a window is owed -cmd/sw-block/chunk_b.go chunkShowContext newBCommand 1 315 per-call NONE: no model row maps this file yet one volume record and one HEAD read (30 s) -cmd/sw-block/chunk_b.go chunkUsage newBCommand 1 346 ruled-total NONE: no model row maps this file yet docs/releases/v1.1.md: "at the 1 TiB cap usage took 8.45 s against its 60 s default" -cmd/sw-block/chunk_b.go chunkRestore newBCommand 1 360 ruled-total NONE: no model row maps this file yet docs/releases/v1.1.md: "it took 0.42 s at the 1 TiB cap" -cmd/sw-block/chunk_b.go chunkRestore context.WithTimeout 1 376 ruled-total NONE: no model row maps this file yet docs/releases/v1.1.md: "it took 0.42 s at the 1 TiB cap" -cmd/sw-block/chunk_b.go chunkRelease newBCommand 1 415 per-call NONE: no model row maps this file yet releases one restore target from its source (30 s) -cmd/sw-block/chunk_b.go chunkRetain newBCommand 1 473 pending-fix NONE: no model row maps this file yet unmeasured: retain retires expired snapshots under 5 min; a measurement at the cap or a window is owed +cmd/sw-block/chunk.go chunkPost time.Now().Add 1 155 pending-fix CutTime.Poll remaining snapshot/detach HTTP waiter bound; fix #979 (manual cuts use chunkObserveCut) +cmd/sw-block/chunk.go chunkPostUntil context.WithDeadline 1 170 pending-fix CutTime.Poll remaining snapshot/detach HTTP waiter bound; fix #979 (manual cuts use chunkObserveCut) +cmd/sw-block/chunk.go chunkSnapshot time.Now().Add 1 291 control-timer CutTime.Poll snapshot expiry: a timestamp (validity, expiry or due time), not a wait +cmd/sw-block/chunk_b.go volumeFlags.ref context.WithTimeout 1 103 per-call NONE: no model row maps this file yet one CLI request (operator --timeout) +cmd/sw-block/chunk_b.go bCommand.run context.WithTimeout 1 164 pending-fix NONE: no model row maps this file yet unmeasured: applies each catalog command's own budget (its newBCommand row); open while snapshot delete and retain are unmeasured +cmd/sw-block/chunk_b.go chunkSnapshots newBCommand 1 180 per-call NONE: no model row maps this file yet lists one volume's snapshot names from one HEAD read (30 s) +cmd/sw-block/chunk_b.go snapshotDeleteFormatLevel context.WithTimeout 1 221 per-call NONE: no model row maps this file yet one CLI request (operator --timeout) +cmd/sw-block/chunk_b.go chunkSnapshotDelete newBCommand 1 256 pending-fix NONE: no model row maps this file yet unmeasured: a snapshot delete stages intents across the snapshot's chunks under 30 s; a measurement at the cap or a window is owed +cmd/sw-block/chunk_b.go chunkShowContext newBCommand 1 321 per-call NONE: no model row maps this file yet one volume record and one HEAD read (30 s) +cmd/sw-block/chunk_b.go chunkUsage newBCommand 1 352 ruled-total NONE: no model row maps this file yet docs/releases/v1.1.md: "at the 1 TiB cap usage took 8.45 s against its 60 s default" +cmd/sw-block/chunk_b.go chunkRestore newBCommand 1 366 ruled-total NONE: no model row maps this file yet docs/releases/v1.1.md: "it took 0.42 s at the 1 TiB cap" +cmd/sw-block/chunk_b.go chunkRestore context.WithTimeout 1 382 ruled-total NONE: no model row maps this file yet docs/releases/v1.1.md: "it took 0.42 s at the 1 TiB cap" +cmd/sw-block/chunk_b.go chunkRelease newBCommand 1 419 per-call NONE: no model row maps this file yet releases one restore target from its source (30 s) +cmd/sw-block/chunk_b.go chunkRetain newBCommand 1 477 pending-fix NONE: no model row maps this file yet unmeasured: retain retires expired snapshots under 5 min; a measurement at the cap or a window is owed cmd/sw-block/chunk_diag.go diagWriter.close time.NewTimer 1 68 per-call NONE: no model row maps this file yet drain of one diagnostics writer on close cmd/sw-block/chunk_loop.go chunkPostLoop time.Now().Add 1 72 pending-fix NONE: no model row maps this file yet CLI cut retry loop's one absolute end; fix #964 cmd/sw-block/chunk_loop.go chunkStats context.WithDeadline 1 181 per-call NONE: no model row maps this file yet one CLI request (operator --timeout) @@ -140,11 +140,11 @@ core/frontend/chunkstore/maintenance_request.go maintenanceCall context.WithTime core/frontend/chunkstore/maintenance_request.go maintenanceCall time.After 1 35 control-timer CutTime.CallTimeout retry pause after a timed-out maintenance read core/frontend/chunkstore/maintenance_request.go maintenanceMutation context.WithTimeout 1 51 per-call CutTime.CallTimeout one maintenance mutation request core/frontend/chunkstore/single_filer.go SWFS.CheckSingleFiler context.WithTimeout 1 45 per-call NONE: no model row maps this file yet one RPC or request -core/frontend/chunkstore/single_filer.go SWFS.CheckSingleFiler time.After 1 68 control-timer NONE: no model row maps this file yet single-filer check retry pause -core/frontend/chunkstore/single_filer.go SWFS.singleFilerRound context.WithTimeout 1 89 per-call NONE: no model row maps this file yet one RPC or request -core/frontend/chunkstore/single_filer.go SWFS.singleFilerRound context.WithTimeout 2 111 per-call NONE: no model row maps this file yet one RPC or request -core/frontend/chunkstore/single_filer.go SWFS.singleFilerRound context.WithTimeout 3 119 per-call NONE: no model row maps this file yet one RPC or request -core/frontend/chunkstore/single_filer.go SWFS.singleFilerRound context.WithTimeout 4 129 per-call NONE: no model row maps this file yet one RPC or request +core/frontend/chunkstore/single_filer.go SWFS.CheckSingleFiler time.After 1 73 control-timer NONE: no model row maps this file yet single-filer check retry pause +core/frontend/chunkstore/single_filer.go SWFS.singleFilerRound context.WithTimeout 1 95 per-call NONE: no model row maps this file yet one RPC or request +core/frontend/chunkstore/single_filer.go SWFS.singleFilerRound context.WithTimeout 2 118 per-call NONE: no model row maps this file yet one RPC or request +core/frontend/chunkstore/single_filer.go SWFS.singleFilerRound context.WithTimeout 3 129 per-call NONE: no model row maps this file yet one RPC or request +core/frontend/chunkstore/single_filer.go SWFS.singleFilerRound context.WithTimeout 4 142 per-call NONE: no model row maps this file yet one RPC or request core/frontend/chunkstore/startup_head_probe.go BCatalog.cleanStartupProbes context.WithTimeout 1 60 per-call NONE: no model row maps this file yet startup probe cleanup: one bounded step each core/frontend/chunkstore/startup_head_probe.go BCatalog.cleanStartupProbes time.NewTimer 1 83 per-call NONE: no model row maps this file yet startup probe cleanup: one bounded step each core/frontend/chunkstore/startup_head_probe.go BCatalog.cleanStartupProbes context.WithTimeout 2 92 per-call NONE: no model row maps this file yet startup probe cleanup: one bounded step each diff --git a/seaweed-block/docs/volume-lifecycle.md b/seaweed-block/docs/volume-lifecycle.md index c2e3777b1b..7e4ecf8a4c 100644 --- a/seaweed-block/docs/volume-lifecycle.md +++ b/seaweed-block/docs/volume-lifecycle.md @@ -529,7 +529,7 @@ A delete of a large volume may take several minutes or invocations. `--timeout` whole growing delete. Confirmed object removals extend that window. Progress on stderr reports `deleted N of M objects` for this invocation; stdout remains one JSON answer. A filer timeout or unavailable error is retried while progress -continues. If the no-progress window expires, the answer has `code: unavailable`, +continues. If the no-progress window expires, the answer has `code: remote_unavailable`, `retryable: true`, and the progress, blocked object and cause. Already-absent objects count as done. Permanent refusals retain their existing codes. Keep the `--request-id` and use the same one if you have to run the command again. From 9b48f286d9034c73b79109c701aa2e050002c7c2 Mon Sep 17 00:00:00 2001 From: pingqiu-cpu Date: Thu, 3 Dec 2026 04:20:37 -0800 Subject: [PATCH 11/66] fix(deploy): volume units order after blockmaster without starting it; document the iSCSI port SELinux label (#989) Merge note (pull_request_target spec-trace workflow has a startup_failure on every branch since 2026-12-02 22:45Z, so its checks run locally): - Test run 47101740814 succeeded (go test (linux), process-level tests (real binaries)) on head b894d640 against main 2d216e02, the current main head. - spec-trace-check.sh and public-text-check.sh, run with the main branch's scripts against this head and body: both exit 0. - Code review ACCEPT on b894d640 (light tier): blockvolume units order After the master without Wants, so a stopped master stays stopped; red test TestBlockvolumeUnitsOrderAfterTheMasterWithoutPullingItIn fails on the base. --- .../systemd/sw-blockvolume-ublk.service | 4 +- .../deploy/systemd/sw-blockvolume.service | 4 +- .../deploy/systemd/sw-blockvolume@.service | 4 +- seaweed-block/docs/standalone-deployment.md | 2 + .../blockvolume_unit_master_order_test.go | 50 +++++++++++++++++++ 5 files changed, 61 insertions(+), 3 deletions(-) create mode 100644 seaweed-block/internal/testops/blockvolume_unit_master_order_test.go diff --git a/seaweed-block/deploy/systemd/sw-blockvolume-ublk.service b/seaweed-block/deploy/systemd/sw-blockvolume-ublk.service index 283a4eb5e6..9d87e9a483 100644 --- a/seaweed-block/deploy/systemd/sw-blockvolume-ublk.service +++ b/seaweed-block/deploy/systemd/sw-blockvolume-ublk.service @@ -13,8 +13,10 @@ StartLimitIntervalSec=600 StartLimitBurst=10 Description=Seaweed Block volume over ublk (one replica, root) Documentation=https://github.com/seaweedfs/seaweed-block +# Ordered after blockmaster when both run on this host, never pulling it in: +# a master the operator stopped stays stopped when a volume starts. After=network-online.target sw-blockmaster.service -Wants=network-online.target sw-blockmaster.service +Wants=network-online.target Conflicts=sw-blockvolume.service [Service] diff --git a/seaweed-block/deploy/systemd/sw-blockvolume.service b/seaweed-block/deploy/systemd/sw-blockvolume.service index f6559580c5..8c59b8b6b7 100644 --- a/seaweed-block/deploy/systemd/sw-blockvolume.service +++ b/seaweed-block/deploy/systemd/sw-blockvolume.service @@ -11,8 +11,10 @@ StartLimitIntervalSec=600 StartLimitBurst=10 Description=Seaweed Block volume (one replica) Documentation=https://github.com/seaweedfs/seaweed-block +# Ordered after blockmaster when both run on this host, never pulling it in: +# a master the operator stopped stays stopped when a volume starts. After=network-online.target sw-blockmaster.service -Wants=network-online.target sw-blockmaster.service +Wants=network-online.target [Service] Type=simple diff --git a/seaweed-block/deploy/systemd/sw-blockvolume@.service b/seaweed-block/deploy/systemd/sw-blockvolume@.service index 21833571aa..26128b402e 100644 --- a/seaweed-block/deploy/systemd/sw-blockvolume@.service +++ b/seaweed-block/deploy/systemd/sw-blockvolume@.service @@ -13,8 +13,10 @@ StartLimitBurst=10 # per instance Description=Seaweed Block volume %i (one replica) Documentation=https://github.com/seaweedfs/seaweed-block +# Ordered after blockmaster when both run on this host, never pulling it in: +# a master the operator stopped stays stopped when a volume starts. After=network-online.target sw-blockmaster.service -Wants=network-online.target sw-blockmaster.service +Wants=network-online.target [Service] Type=simple diff --git a/seaweed-block/docs/standalone-deployment.md b/seaweed-block/docs/standalone-deployment.md index 9e50c2d8b1..8ae0aecb06 100644 --- a/seaweed-block/docs/standalone-deployment.md +++ b/seaweed-block/docs/standalone-deployment.md @@ -513,6 +513,8 @@ mini uses the commands of the sections below; the steps there remain the way to - It writes `/etc/sw-block/volumes/.env` (the keys of `deploy/config/blockvolume.env`), resolves the volume's layout id at `--master` (with `--chunk-filer`: walstore-chunk), runs `systemctl enable --now`, waits until `/status` reports the volume Healthy (`--wait`, default 2m), and prints the connect command. - The unit's volume id is its instance name; the local data goes to `/var/lib/sw-block-volume/` unless `--durable-root` says otherwise. - The same command again is safe. Other settings over an existing file are refused unless `--replace`, and `--replace` is refused while the unit runs. +- With `--iscsi-listen` on a port other than 3260, label the port for SELinux on each initiator host that logs in (EL9, enforcing): `sudo semanage port -a -t iscsi_port_t -p tcp ` (`semanage` is in `policycoreutils-python-utils`). Without it, `iscsiadm` discovery or login fails and the audit log shows an AVC denial for `iscsid` on that port. 3260 is labelled already. Each volume has its own iSCSI port, so label each one. +- The unit is ordered after `sw-blockmaster.service` when both run on the host, but does not start it: a master you stopped stays stopped when a volume starts or restarts. **`sudo sw-block volume stop [--force] [--no-cut] [--timeout 2m]`** 1. **Guests.** It refuses while a guest is connected (`/status/guests`: NVMe/TCP hosts and iSCSI sessions), unless `--force`. This protects a connected guest from I/O errors; it is not a completeness guarantee. A host that vanished (a killed VM, a partitioned host) still counts until its TCP connection closes: when you know nothing uses the volume, `--force` stops it. ublk and NVMe/RDMA guests are not counted. diff --git a/seaweed-block/internal/testops/blockvolume_unit_master_order_test.go b/seaweed-block/internal/testops/blockvolume_unit_master_order_test.go new file mode 100644 index 0000000000..5c65da8f8a --- /dev/null +++ b/seaweed-block/internal/testops/blockvolume_unit_master_order_test.go @@ -0,0 +1,50 @@ +package testops + +import ( + "strings" + "testing" +) + +// A volume unit starts after blockmaster when both run on the host, but +// never pulls it in: a master the operator stopped (or one that runs on +// another host) stays stopped when a volume starts or restarts. The network +// is still both ordered and pulled in. +func TestBlockvolumeUnitsOrderAfterTheMasterWithoutPullingItIn(t *testing.T) { + for _, name := range []string{"sw-blockvolume.service", "sw-blockvolume@.service", "sw-blockvolume-ublk.service"} { + t.Run(name, func(t *testing.T) { + body := readRepoFile(t, "deploy", "systemd", name) + section := "" + deps := map[string][]string{} + for _, line := range strings.Split(body, "\n") { + line = strings.TrimSpace(line) + if strings.HasPrefix(line, "[") { + section = line + continue + } + key, value, ok := strings.Cut(line, "=") + if ok && section == "[Unit]" { + deps[key] = append(deps[key], strings.Fields(value)...) + } + } + has := func(key, unit string) bool { + for _, u := range deps[key] { + if u == unit { + return true + } + } + return false + } + if !has("After", "sw-blockmaster.service") || !has("After", "network-online.target") { + t.Errorf("After=%v: want sw-blockmaster.service and network-online.target", deps["After"]) + } + if !has("Wants", "network-online.target") { + t.Errorf("Wants=%v: want network-online.target", deps["Wants"]) + } + for _, key := range []string{"Wants", "Requires", "Requisite", "BindsTo", "PartOf", "Upholds"} { + if has(key, "sw-blockmaster.service") { + t.Errorf("%s=%v pulls in sw-blockmaster.service: starting a volume would start a master the operator stopped", key, deps[key]) + } + } + }) + } +} From 687cc31e3248a28a298eb456d3b7b769fb5b727e Mon Sep 17 00:00:00 2001 From: pingqiu-cpu Date: Thu, 3 Dec 2026 04:46:04 -0800 Subject: [PATCH 12/66] fix(sw-block): volume commands say what they do; restore names an existing volume; a clean stop logs no cancelled closeout (#988) Merge note (pull_request_target spec-trace workflow has a startup_failure on every branch since 2026-12-02 22:45Z, so its checks run locally): - Test run 47104755157 succeeded (go test (linux), process-level tests (real binaries)) on head 9cf90ee1 against main e7606462, the current main head. - spec-trace-check.sh and public-text-check.sh, run with the main branch's scripts against this head and body: both exit 0. - Code review ACCEPT on d9ec654e (light tier): CLI help, hints, stop text and exit-code items; the stop line now says only what the cut guarantees. --- seaweed-block/cmd/blockvolume/process_exit.go | 11 +- .../process_exit_signal_closeout_test.go | 46 ++++++ seaweed-block/cmd/sw-block/volume_backup.go | 16 +- .../cmd/sw-block/volume_backup_test.go | 8 +- .../cmd/sw-block/volume_operator_text_test.go | 146 ++++++++++++++++++ seaweed-block/cmd/sw-block/volume_verbs.go | 80 ++++++++-- .../cmd/sw-block/volume_verbs_test.go | 5 +- .../host/master/restore_target_exists_test.go | 49 ++++++ seaweed-block/core/host/master/services.go | 3 + seaweed-block/docs/standalone-deployment.md | 8 +- seaweed-block/docs/time-bounds.tsv | 16 +- seaweed-block/docs/volume-lifecycle.md | 2 + 12 files changed, 348 insertions(+), 42 deletions(-) create mode 100644 seaweed-block/cmd/blockvolume/process_exit_signal_closeout_test.go create mode 100644 seaweed-block/cmd/sw-block/volume_operator_text_test.go create mode 100644 seaweed-block/core/host/master/restore_target_exists_test.go diff --git a/seaweed-block/cmd/blockvolume/process_exit.go b/seaweed-block/cmd/blockvolume/process_exit.go index 410264bafc..3c4d52f195 100644 --- a/seaweed-block/cmd/blockvolume/process_exit.go +++ b/seaweed-block/cmd/blockvolume/process_exit.go @@ -4,6 +4,7 @@ import ( "context" "errors" "fmt" + "io" "os" "os/signal" "sync" @@ -236,6 +237,9 @@ func waitWorkspaceStop(e *processExit, f flags, h *volume.Host, requests <-chan // An ACKed revocation completes with status zero. A failure to confirm that // ACK is retryable; a signal observed first still retains the signal status. // M2 Revoking -> Revoked; INV-WS-REVOKE-ACK-001, INV-WS-STARTUP-RETRY-001. +// closeoutLog receives the closeout's failure lines (os.Stderr; tests replace it). +var closeoutLog io.Writer = os.Stderr + func finishWorkspaceLease(e *processExit, f flags, h *volume.Host, done <-chan error) { if done == nil { return @@ -246,7 +250,12 @@ func finishWorkspaceLease(e *processExit, f flags, h *volume.Host, done <-chan e e.choose(workspaceExit{reason: "revoked"}) return } - fmt.Fprintln(os.Stderr, "blockvolume: workspace lease closeout:", err) + // A signal stopped the process: the lease worker's stop request ended + // with it (run's own shutdown closes the volume), so a cancelled stop is + // expected, not a closeout failure; the exit keeps the signal status. + if !(e.parent.Err() != nil && errors.Is(err, context.Canceled)) { + fmt.Fprintln(closeoutLog, "blockvolume: workspace lease closeout:", err) + } case <-time.After(workspaceLeaseCloseoutTimeout): fmt.Fprintln(os.Stderr, "blockvolume: workspace lease closeout deadline") } diff --git a/seaweed-block/cmd/blockvolume/process_exit_signal_closeout_test.go b/seaweed-block/cmd/blockvolume/process_exit_signal_closeout_test.go new file mode 100644 index 0000000000..9af0c58911 --- /dev/null +++ b/seaweed-block/cmd/blockvolume/process_exit_signal_closeout_test.go @@ -0,0 +1,46 @@ +package main + +import ( + "bytes" + "context" + "errors" + "fmt" + "strings" + "testing" +) + +// A clean stop (a signal) ends the lease worker's stop request with the +// process: its cancelled stop is not a closeout failure and prints none, +// and the exit stays the signal's. Control: any other closeout error, and +// a cancelled stop without a signal, still print the closeout line. +func TestACleanStopLogsNoCancelledCloseout(t *testing.T) { + var log bytes.Buffer + old := closeoutLog + closeoutLog = &log + t.Cleanup(func() { closeoutLog = old }) + + cancelled := fmt.Errorf("workspace lease fenced (revoked): stop failed: %w", context.Canceled) + run := func(signal bool, err error) workspaceExit { + log.Reset() + ctx, cancel := context.WithCancel(context.Background()) + defer cancel() + e := newProcessExit(ctx) + if signal { + cancel() + } + done := make(chan error, 1) + done <- err + finishWorkspaceLease(e, flags{}, nil, done) + return <-e.decision + } + + if out := run(true, cancelled); log.Len() != 0 || out.reason != "signal" { + t.Fatalf("signal + cancelled stop: logged %q, exit %+v; want no line and reason signal", log.String(), out) + } + if run(true, errors.New("ack refused")); !strings.Contains(log.String(), "blockvolume: workspace lease closeout: ack refused") { + t.Fatalf("signal + another error: logged %q; want the closeout line", log.String()) + } + if run(false, cancelled); !strings.Contains(log.String(), "blockvolume: workspace lease closeout:") { + t.Fatalf("no signal + cancelled stop: logged %q; want the closeout line", log.String()) + } +} diff --git a/seaweed-block/cmd/sw-block/volume_backup.go b/seaweed-block/cmd/sw-block/volume_backup.go index 862609e83e..e26686f4ed 100644 --- a/seaweed-block/cmd/sw-block/volume_backup.go +++ b/seaweed-block/cmd/sw-block/volume_backup.go @@ -96,12 +96,12 @@ func volumeBackup(ctx context.Context, env verbEnv, o backupOpts, stdout, stderr } e, err := readEnvFile(filepath.Join(env.EtcDir, o.Volume+".env")) if err != nil { - return refuse("settings", fmt.Sprintf("%v (was %s started with sudo sw-block volume start?)", err, o.Volume)) + return refuse("settings", fmt.Sprintf("%v (was %s started with sudo /usr/local/bin/sw-block volume start?)", err, o.Volume)) } if e["SWB_DURABLE_IMPL"] != "walstore-chunk" { return refuse("settings", o.Volume+" is walstore: it has no object store, so no snapshot (start it with --chunk-filer)") } - again := fmt.Sprintf("sudo sw-block volume backup %s --name %s", o.Volume, shQuote(o.Name)) + again := fmt.Sprintf("sudo /usr/local/bin/sw-block volume backup %s --name %s", o.Volume, shQuote(o.Name)) id := derivedID("backup", o.Volume, o.Name) if err := env.step(stdout, "snapshot", fmt.Sprintf("snapshot %s as %s (request %s)", o.Volume, shQuote(o.Name), id)); err != nil { fmt.Fprintf(stderr, "sw-block volume backup: snapshot: %v; a cut that timed out keeps what it uploaded; to finish, run the same command (it resumes the same request and reuses completed uploads): %s\n", err, again) @@ -111,7 +111,7 @@ func volumeBackup(ctx context.Context, env verbEnv, o backupOpts, stdout, stderr if refusal != nil { text := refusal.Code + ": " + refusal.Message if refusal.Code == "snapshot_name_taken" { - return refuse("snapshot", fmt.Sprintf("%s; choose a new snapshot name: sudo sw-block volume backup %s --name ", text, o.Volume)) + return refuse("snapshot", fmt.Sprintf("%s; choose a new snapshot name: sudo /usr/local/bin/sw-block volume backup %s --name ", text, o.Volume)) } return refuse("snapshot", fmt.Sprintf("%s; a cut that timed out keeps what it uploaded; after correcting the refusal, run the same command (it resumes the same request and reuses completed uploads): %s", text, again)) } @@ -121,7 +121,7 @@ func volumeBackup(ctx context.Context, env verbEnv, o backupOpts, stdout, stderr } fmt.Fprintf(stdout, "sw-block volume backup: snapshot %s of %s: head generation %d, cut LSN %d, at %s\n", shQuote(a.Name), o.Volume, *a.HeadGen, *a.CutLSN, time.Unix(0, *a.CreatedNs).UTC().Format(time.RFC3339)) - fmt.Fprintf(stdout, "Restore it into a new volume: sudo sw-block volume restore %s --snapshot %s --as [flags]\n", o.Volume, shQuote(a.Name)) + fmt.Fprintf(stdout, "Restore it into a new volume: sudo /usr/local/bin/sw-block volume restore %s --snapshot %s --as [flags]\n", o.Volume, shQuote(a.Name)) return 0 } @@ -243,12 +243,12 @@ func parseVolumeRestore(args []string, stderr io.Writer) (restoreOpts, error) { // restoreCommands are the two ways on after a failure, as exact commands. func restoreCommands(o restoreOpts, args []string) (again, abort string) { - abort = fmt.Sprintf("sudo sw-block volume restore %s --snapshot %s --as %s --abort", o.Source, shQuote(o.Snapshot), o.New.VolumeID) + abort = fmt.Sprintf("sudo /usr/local/bin/sw-block volume restore %s --snapshot %s --as %s --abort", o.Source, shQuote(o.Snapshot), o.New.VolumeID) q := make([]string, len(args)) for i, a := range args { q[i] = shQuote(a) } - return "sudo sw-block volume restore " + strings.Join(q, " "), abort + return "sudo /usr/local/bin/sw-block volume restore " + strings.Join(q, " "), abort } // volumeRestore restores a snapshot of a running volume into a new volume @@ -269,7 +269,7 @@ func volumeRestore(ctx context.Context, env verbEnv, o restoreOpts, args []strin } src, err := readEnvFile(filepath.Join(env.EtcDir, o.Source+".env")) if err != nil { - return refuse("settings", fmt.Sprintf("%v (was %s started with sudo sw-block volume start?)", err, o.Source)) + return refuse("settings", fmt.Sprintf("%v (was %s started with sudo /usr/local/bin/sw-block volume start?)", err, o.Source)) } if src["SWB_DURABLE_IMPL"] != "walstore-chunk" { return refuse("settings", o.Source+" is walstore: it has no snapshots to restore") @@ -362,7 +362,7 @@ func volumeRestore(ctx context.Context, env verbEnv, o restoreOpts, args []strin func volumeRestoreAbort(ctx context.Context, env verbEnv, o restoreOpts, stdout, stderr io.Writer) int { t := o.New.VolumeID unit := volumeUnit(t) - again := fmt.Sprintf("sudo sw-block volume restore %s --snapshot %s --as %s --abort", o.Source, shQuote(o.Snapshot), t) + again := fmt.Sprintf("sudo /usr/local/bin/sw-block volume restore %s --snapshot %s --as %s --abort", o.Source, shQuote(o.Snapshot), t) fail := func(step string, err error) int { fmt.Fprintf(stderr, "sw-block volume restore --abort: %s: %v; run it again: %s\n", step, err, again) return 1 diff --git a/seaweed-block/cmd/sw-block/volume_backup_test.go b/seaweed-block/cmd/sw-block/volume_backup_test.go index bebf56f740..abf488999f 100644 --- a/seaweed-block/cmd/sw-block/volume_backup_test.go +++ b/seaweed-block/cmd/sw-block/volume_backup_test.go @@ -442,7 +442,7 @@ func restoreArgs(h *fakeHost) []string { "--ctrl-addr", "10.0.0.7:9302", "--status-addr", h.addr(), "--nvme-listen", "10.0.0.7:4430", "--wait", "1s", "--timeout", "5s"} } -const abortCmd = "sudo sw-block volume restore vol-a --snapshot s1 --as vol-r --abort" +const abortCmd = "sudo /usr/local/bin/sw-block volume restore vol-a --snapshot s1 --as vol-r --abort" func restoreSetup(t *testing.T) (*fakeHost, verbEnv, *restoreMaster, *[]string) { h := newFakeHost(t) @@ -492,7 +492,7 @@ func TestVolumeBackupTakesOneSnapshotAndRerunReplays(t *testing.T) { t.Fatalf("no --name: %d %s (posts %d)", code, errs, sh.postCount()) } code, out, errs := runBackup(env, "vol-a", "--name", "backup-20261128T230000Z") - if code != 0 || !strings.Contains(out, "snapshot backup-20261128T230000Z of vol-a") || !strings.Contains(out, "sudo sw-block volume restore vol-a --snapshot backup-20261128T230000Z --as ") { + if code != 0 || !strings.Contains(out, "snapshot backup-20261128T230000Z of vol-a") || !strings.Contains(out, "sudo /usr/local/bin/sw-block volume restore vol-a --snapshot backup-20261128T230000Z --as ") { t.Fatalf("backup: %d\n%s\n%s", code, out, errs) } if got := sh.label("backup-20261128T230000Z"); got != backupTag(derivedID("backup", "vol-a", "backup-20261128T230000Z")) { @@ -529,7 +529,7 @@ func TestVolumeBackupInterruptedResumesWithTheSameCommand(t *testing.T) { if c == "refuse" { wantCode = 2 } - if code != wantCode || !strings.Contains(errs, "run the same command") || !strings.Contains(errs, "sudo sw-block volume backup vol-a --name nightly") || !strings.Contains(errs, "keeps what it uploaded") { + if code != wantCode || !strings.Contains(errs, "run the same command") || !strings.Contains(errs, "sudo /usr/local/bin/sw-block volume backup vol-a --name nightly") || !strings.Contains(errs, "keeps what it uploaded") { t.Fatalf("interrupted backup: %d %s", code, errs) } env.Step = nil @@ -653,7 +653,7 @@ func TestVolumeRestoreCrashTableBothWays(t *testing.T) { } m.failNext = r.fail code, _, errs := runRestore(env, restoreArgs(h)...) - if code != 1 || !strings.Contains(errs, "to finish, run the same command: sudo sw-block volume restore vol-a --snapshot s1 --as vol-r") || + if code != 1 || !strings.Contains(errs, "to finish, run the same command: sudo /usr/local/bin/sw-block volume restore vol-a --snapshot s1 --as vol-r") || !strings.Contains(errs, "to undo it: "+abortCmd) { t.Fatalf("interrupted restore: %d\n%s", code, errs) } diff --git a/seaweed-block/cmd/sw-block/volume_operator_text_test.go b/seaweed-block/cmd/sw-block/volume_operator_text_test.go new file mode 100644 index 0000000000..0078445fa1 --- /dev/null +++ b/seaweed-block/cmd/sw-block/volume_operator_text_test.go @@ -0,0 +1,146 @@ +package main + +import ( + "bytes" + "strings" + "testing" + "time" +) + +// --help prints the usage and the verb's flags to stdout and exits 0, for +// every verb, before (and without) the root check. +func TestVolumeHelpPrintsTheUsageWithoutRoot(t *testing.T) { + for _, verb := range []string{"start", "stop", "backup", "restore"} { + for _, help := range []string{"--help", "-h"} { + var out, errb bytes.Buffer + code := run([]string{"volume", verb, help}, &out, &errb) + if code != 0 || !strings.Contains(out.String(), "usage: sudo /usr/local/bin/sw-block volume start") || strings.Contains(errb.String(), "needs root") { + t.Fatalf("volume %s %s: %d stdout %q stderr %q; want 0 and the usage", verb, help, code, out.String(), errb.String()) + } + } + } + var out, errb bytes.Buffer + if code := run([]string{"volume", "start", "vol-a", "--help"}, &out, &errb); code != 0 || !strings.Contains(out.String(), "-server-id") { + t.Fatalf("volume start vol-a --help: %d %q %q; want 0 and start's flags", code, out.String(), errb.String()) + } +} + +// A start refused over another volume's settings prints no "+ write" step: +// only a start that writes the file says it writes it, and an identical +// re-run says it keeps it. +func TestARefusedStartPrintsNoSettingsWrite(t *testing.T) { + h := newFakeHost(t) + env := h.env(t) + v := h.spec(false) + if code, out, errs := runStart(env, v, startOpts{Wait: time.Second}); code != 0 || !strings.Contains(out, "+ write ") { + t.Fatalf("first start: %d %s %s; want a write step", code, out, errs) + } + other := v + other.NVMeListen = "10.0.0.7:4421" + code, out, errs := runStart(env, other, startOpts{Wait: time.Second}) + if code == 0 || !strings.Contains(errs, "--replace") { + t.Fatalf("other settings: %d %s; want a refusal", code, errs) + } + if strings.Contains(out, "+ write") || strings.Contains(out, "+ keep") { + t.Fatalf("a refused start printed a settings step:\n%s", out) + } + if code, out, errs := runStart(env, v, startOpts{Wait: time.Second}); code != 0 || strings.Contains(out, "+ write") || !strings.Contains(out, "+ keep ") { + t.Fatalf("identical re-run: %d %s %s; want a keep step and no write", code, out, errs) + } +} + +// With --iscsi-listen, start prints the iSCSI discovery and login, and +// "Before stopping" names the iSCSI logout next to the NVMe disconnect. +func TestAStartOverISCSIPrintsTheLoginAndTheLogout(t *testing.T) { + h := newFakeHost(t) + env := h.env(t) + stubResolve(t, "00112233445566778899aabbccddeeff", nil) + v := h.spec(true) + w := testSpecs()["with-iscsi"] + v.ISCSIListen, v.IQN = w.ISCSIListen, w.IQN + code, out, errs := runStart(env, v, startOpts{Wait: time.Second}) + if code != 0 { + t.Fatalf("start: %d %s", code, errs) + } + for _, want := range []string{ + "sudo iscsiadm -m discovery -t sendtargets -p 10.0.0.7:3260", + "sudo iscsiadm -m node -T iqn.2026-05.io.seaweedfs:vol-a -p 10.0.0.7:3260 --login", + "(over iSCSI: sudo iscsiadm -m node -T iqn.2026-05.io.seaweedfs:vol-a -p 10.0.0.7:3260 --logout)", + "sudo nvme disconnect -n nqn.2026-05.io.seaweedfs:vol-a", + } { + if !strings.Contains(out, want) { + t.Fatalf("output lacks %q:\n%s", want, out) + } + } + before := out[strings.Index(out, "Before stopping"):] + if !strings.Contains(before, "--logout") { + t.Fatalf("Before stopping does not name the iSCSI logout:\n%s", before) + } + // Control: without iSCSI, no iscsiadm line. + n := newFakeHost(t) + if code, out, errs := runStart(n.env(t), n.spec(false), startOpts{Wait: time.Second}); code != 0 || strings.Contains(out, "iscsiadm") { + t.Fatalf("NVMe-only start: %d %s %s; want no iscsiadm line", code, out, errs) + } +} + +// Every command line a verb prints for the operator names the absolute +// /usr/local/bin/sw-block: EL9's sudo resets PATH to its secure_path, which +// has no /usr/local/bin. +func TestVolumeHintsNameTheAbsolutePath(t *testing.T) { + h, env := startedHost(t, true) + _, startOut, _ := runStart(env, h.spec(true), startOpts{Wait: time.Second}) + _, stopOut, stopErr := runStop(env, stopOpts{Volume: "vol-a", Timeout: time.Second}) + all := startOut + stopOut + stopErr + volumeHelp() + if strings.Contains(all, "sudo sw-block") { + t.Fatalf("a hint names a bare sudo sw-block:\n%s", all) + } + if !strings.Contains(startOut, "sudo /usr/local/bin/sw-block volume stop vol-a") || !strings.Contains(stopOut, "sudo /usr/local/bin/sw-block volume start") { + t.Fatalf("the start or stop hint lacks the absolute path:\nstart:\n%s\nstop:\n%s", startOut, stopOut) + } + g := newFakeHost(t) + gEnv := g.env(t) + if code, _, errs := runStart(gEnv, g.spec(false), startOpts{Wait: time.Second}); code != 0 { + t.Fatalf("setup: %s", errs) + } + g.guests.Store(1) + if _, _, errs := runStop(gEnv, stopOpts{Volume: "vol-a", Timeout: time.Second}); strings.Contains(errs, "sudo sw-block") { + t.Fatalf("a refusal names a bare sudo sw-block: %s", errs) + } +} + +// The stop's closing line, printed after the unit stopped, speaks of the +// writes between the cut and the stop: with no guest counted, only one that +// connected after the check; with --force over a connected guest, that +// guest's. +func TestTheStopsClosingLineSpeaksOfTheStoppedUnit(t *testing.T) { + h, env := startedHost(t, true) + _, out, _ := runStop(env, stopOpts{Volume: "vol-a", Timeout: time.Second}) + last := lastLine(out) + if last != "recovery point in the object store: the cut at 2026-11-28T23:00:00Z; the unit is stopped, and a write acknowledged after the cut (only from a guest that connected after the check) is on this host's disk only" { + t.Fatalf("closing line %q", last) + } + if h.called("stop sw-blockvolume@vol-a.service") != 1 { + t.Fatal("the unit was not stopped") + } + f, fenv := startedHost(t, true) + f.guests.Store(2) + _, out, _ = runStop(fenv, stopOpts{Volume: "vol-a", Force: true, Timeout: time.Second}) + if last := lastLine(out); !strings.Contains(last, "writes a guest made after the cut (one was connected or could not be counted: --force) are on this host's disk only") { + t.Fatalf("--force closing line %q", last) + } + n, nenv := startedHost(t, true) + _, out, _ = runStop(nenv, stopOpts{Volume: "vol-a", NoCut: true, Timeout: time.Second}) + if last := lastLine(out); !strings.HasPrefix(last, "no cut taken (--no-cut): ") || !strings.HasSuffix(last, "; the unit is stopped, and writes acknowledged after it are on this host's disk only") || n.cuts.Load() != 0 { + t.Fatalf("--no-cut closing line %q (cuts %d)", last, n.cuts.Load()) + } + for _, o := range []string{out, volumeHelp()} { + if strings.Contains(o, "writes after it are on this host only") { + t.Fatalf("the old sentence is still printed:\n%s", o) + } + } +} + +func lastLine(out string) string { + lines := strings.Split(strings.TrimSpace(out), "\n") + return lines[len(lines)-1] +} diff --git a/seaweed-block/cmd/sw-block/volume_verbs.go b/seaweed-block/cmd/sw-block/volume_verbs.go index cebffb632c..ecd5fbe675 100644 --- a/seaweed-block/cmd/sw-block/volume_verbs.go +++ b/seaweed-block/cmd/sw-block/volume_verbs.go @@ -29,13 +29,20 @@ import ( // The sentence volume stop ends with (and the help and the page say): what // it promises, and only that. -const stopRecoveryPoint = "recovery point in the object store: the cut at %s; writes after it are on this host only" +// It is printed after the unit stopped, so it speaks of the writes between +// the cut and the stop, in the past: with no guest counted at the check, only +// a guest that connected after it can have made one. stopRecoveryPointForced +// closes a stop that went on with a guest connected or uncounted (--force). +const ( + stopRecoveryPoint = "recovery point in the object store: the cut at %s; the unit is stopped, and a write acknowledged after the cut (only from a guest that connected after the check) is on this host's disk only" + stopRecoveryPointForced = "recovery point in the object store: the cut at %s; the unit is stopped, and writes a guest made after the cut (one was connected or could not be counted: --force) are on this host's disk only" +) -const volumeUsage = `usage: sudo sw-block volume start [flags] - sudo sw-block volume stop [--force] [--no-cut] [--timeout 2m] - sudo sw-block volume backup --name S - sudo sw-block volume restore --snapshot S --as [start flags for ] - sudo sw-block volume restore --snapshot S --as --abort +const volumeUsage = `usage: sudo /usr/local/bin/sw-block volume start [flags] + sudo /usr/local/bin/sw-block volume stop [--force] [--no-cut] [--timeout 2m] + sudo /usr/local/bin/sw-block volume backup --name S + sudo /usr/local/bin/sw-block volume restore --snapshot S --as [start flags for ] + sudo /usr/local/bin/sw-block volume restore --snapshot S --as --abort start: an existing volume (in the cluster spec) as the systemd unit sw-blockvolume@: writes /etc/sw-block/volumes/.env, resolves @@ -103,6 +110,21 @@ func runVolume(args []string, stdout, stderr io.Writer) int { fmt.Fprintln(stderr, volumeHelp()) return ops.VolumeStatusExitInvalid } + if asksHelp(args[1:]) { // the usage and the verb's flags, to stdout; it needs no root + fmt.Fprintln(stdout, volumeHelp()) + fmt.Fprintln(stdout) + switch args[0] { + case "start": + _, _, _ = parseVolumeStart(args[1:], stdout) + case "stop": + _, _ = parseVolumeStop(args[1:], stdout) + case "backup": + _, _ = parseVolumeBackup(args[1:], stdout) + default: + _, _ = parseVolumeRestore(args[1:], stdout) + } + return 0 + } if os.Geteuid() != 0 { fmt.Fprintf(stderr, "sw-block volume %s: needs root (systemctl and /etc/sw-block): run with sudo\n", args[0]) return ops.VolumeStatusExitInvalid @@ -243,14 +265,13 @@ func volumeStart(ctx context.Context, env verbEnv, v volumeSpec, o startOpts, st v.LayoutID = id.String() } path := filepath.Join(env.EtcDir, v.VolumeID+".env") - if err := env.step(stdout, "settings", "write "+path); err != nil { - return fail("settings", err.Error(), "run the same command again") - } body := renderEnv("# sw-block volume start "+v.VolumeID+": settings of "+unit+"\n", v.env()) old, err := os.ReadFile(path) switch { case err == nil && string(old) == body: - fmt.Fprintln(stdout, " unchanged") + if err := env.step(stdout, "settings", "keep "+path+" (unchanged)"); err != nil { + return fail("settings", err.Error(), "run the same command again") + } case err == nil && !o.Replace: return fail("settings", path+" exists with other settings", "pass --replace to replace it (stop the volume first), or start another volume") case err != nil && !errors.Is(err, os.ErrNotExist): @@ -262,9 +283,12 @@ func volumeStart(ctx context.Context, env verbEnv, v volumeSpec, o startOpts, st return fail("settings", "cannot tell whether "+unit+" is stopped: "+serr.Error(), "check systemctl, then run the same command again") } if !unitStopped(st) { - return fail("settings", unit+" is "+st, "stop it first: sudo sw-block volume stop "+v.VolumeID) + return fail("settings", unit+" is "+st, "stop it first: sudo /usr/local/bin/sw-block volume stop "+v.VolumeID) } } + if err := env.step(stdout, "settings", "write "+path); err != nil { + return fail("settings", err.Error(), "run the same command again") + } if err := writeFileAtomic(path, []byte(body), 0o640); err != nil { return fail("settings", err.Error(), "") } @@ -299,12 +323,30 @@ func volumeStart(ctx context.Context, env verbEnv, v volumeSpec, o startOpts, st fmt.Fprintf(stdout, "Connect:\n sudo nvme connect -t tcp -a %s -s %s -n %s --ctrl-loss-tmo=180 --reconnect-delay=2\n", shQuote(hostOf(v.NVMeListen)), shQuote(portOf(v.NVMeListen)), shQuote(v.NQN)) if v.ISCSIListen != "" { - fmt.Fprintf(stdout, " sudo iscsiadm -m discovery -t sendtargets -p %s\n", shQuote(v.ISCSIListen)) + fmt.Fprintf(stdout, "Or over iSCSI:\n sudo iscsiadm -m discovery -t sendtargets -p %s\n sudo iscsiadm -m node -T %s -p %s --login\n", + shQuote(v.ISCSIListen), shQuote(v.IQN), shQuote(v.ISCSIListen)) + fmt.Fprintf(stdout, "Before stopping: unmount it, then sudo nvme disconnect -n %s (over iSCSI: sudo iscsiadm -m node -T %s -p %s --logout); then sudo /usr/local/bin/sw-block volume stop %s\n", + shQuote(v.NQN), shQuote(v.IQN), shQuote(v.ISCSIListen), v.VolumeID) + return 0 } - fmt.Fprintf(stdout, "Before stopping: unmount it, then sudo nvme disconnect -n %s; then sudo sw-block volume stop %s\n", shQuote(v.NQN), v.VolumeID) + fmt.Fprintf(stdout, "Before stopping: unmount it, then sudo nvme disconnect -n %s; then sudo /usr/local/bin/sw-block volume stop %s\n", shQuote(v.NQN), v.VolumeID) return 0 } +// asksHelp says whether args ask for the usage (-h, -help, --help, before +// any "--" terminator). +func asksHelp(args []string) bool { + for _, a := range args { + switch a { + case "--": + return false + case "-h", "-help", "--help": + return true + } + } + return false +} + func hostOf(addr string) string { if i := strings.LastIndex(addr, ":"); i >= 0 { return addr[:i] @@ -426,7 +468,7 @@ func volumeStop(ctx context.Context, env verbEnv, o stopOpts, stdout, stderr io. unit := volumeUnit(o.Volume) e, err := readEnvFile(filepath.Join(env.EtcDir, o.Volume+".env")) if err != nil { - return refuse("settings", fmt.Sprintf("%v (was %s started with sudo sw-block volume start?)", err, o.Volume)) + return refuse("settings", fmt.Sprintf("%v (was %s started with sudo /usr/local/bin/sw-block volume start?)", err, o.Volume)) } status := e["SWB_STATUS_ADDR"] st, serr := unitState(ctx, env, unit) @@ -472,7 +514,7 @@ func volumeStop(ctx context.Context, env verbEnv, o stopOpts, stdout, stderr io. final = "walstore: no object store; all data is on this host only" case o.NoCut: fmt.Fprintln(stdout, "+ no cut (--no-cut)") - final = "no cut taken (--no-cut): " + lastConfirmedCut(ctx, env, status, o.Volume) + "; writes after it are on this host only" + final = "no cut taken (--no-cut): " + lastConfirmedCut(ctx, env, status, o.Volume) + "; the unit is stopped, and writes acknowledged after it are on this host's disk only" default: if err := env.step(stdout, "cut", "cut "+o.Volume+" (publish to the object store)"); err != nil { return refuse("cut", err.Error()) @@ -487,7 +529,11 @@ func volumeStop(ctx context.Context, env verbEnv, o stopOpts, stdout, stderr io. "Or pass --no-cut to stop without a cut.", err, lastConfirmedCut(ctx, env, status, o.Volume))) } fmt.Fprintf(stdout, " cut: LSN %d, head generation %d (the time below is the request's start; the cut covers every write before it)\n", *res.CutLSN, *res.HeadGen) - final = fmt.Sprintf(stopRecoveryPoint, cutAt.UTC().Format(time.RFC3339)) + point := stopRecoveryPoint + if gerr != nil || g.Connected > 0 { // only with --force, which a connected or uncounted guest needs + point = stopRecoveryPointForced + } + final = fmt.Sprintf(point, cutAt.UTC().Format(time.RFC3339)) } return stopUnit(ctx, env, unit, o.Volume, final, stdout, stderr) } @@ -502,7 +548,7 @@ func stopUnit(ctx context.Context, env verbEnv, unit, volume, final string, stdo fmt.Fprintf(stderr, "sw-block volume stop: unit: %v: %s (see: journalctl -u %s; run the same command again)\n", err, out, unit) return 1 } - fmt.Fprintf(stdout, "sw-block volume stop: %s stopped; sudo sw-block volume start %s (the same flags) starts it again\n", unit, volume) + fmt.Fprintf(stdout, "sw-block volume stop: %s stopped; sudo /usr/local/bin/sw-block volume start %s (the same flags) starts it again\n", unit, volume) fmt.Fprintln(stdout, final) return 0 } diff --git a/seaweed-block/cmd/sw-block/volume_verbs_test.go b/seaweed-block/cmd/sw-block/volume_verbs_test.go index b910ebd9d5..db65dde0be 100644 --- a/seaweed-block/cmd/sw-block/volume_verbs_test.go +++ b/seaweed-block/cmd/sw-block/volume_verbs_test.go @@ -5,6 +5,7 @@ import ( "context" "encoding/json" "errors" + "fmt" "io" "net/http" "net/http/httptest" @@ -405,7 +406,7 @@ func TestVolumeStopCutsThenStopsAndSaysWhatItPromises(t *testing.T) { t.Fatalf("cuts %d, calls %v", h.cuts.Load(), h.calls) } lines := strings.Split(strings.TrimSpace(out), "\n") - if want := "recovery point in the object store: the cut at 2026-11-28T23:00:00Z; writes after it are on this host only"; lines[len(lines)-1] != want { + if want := fmt.Sprintf(stopRecoveryPoint, "2026-11-28T23:00:00Z"); lines[len(lines)-1] != want { t.Fatalf("last line %q; want %q", lines[len(lines)-1], want) } if strings.Index(out, "+ cut") > strings.Index(out, "+ systemctl stop") { @@ -774,7 +775,7 @@ func TestVolumeStopGuestConnectingAfterTheRead(t *testing.T) { return nil } code, out, errs := runStop(env, stopOpts{Volume: "vol-a", Timeout: time.Second}) - if code != 0 || !strings.Contains(out, "none connected (as counted") || !strings.Contains(out, "writes after it are on this host only") { + if code != 0 || !strings.Contains(out, "none connected (as counted") || !strings.Contains(out, "a write acknowledged after the cut (only from a guest that connected after the check) is on this host's disk only") { t.Fatalf("guest after the read: %d %s %s", code, out, errs) } } diff --git a/seaweed-block/core/host/master/restore_target_exists_test.go b/seaweed-block/core/host/master/restore_target_exists_test.go new file mode 100644 index 0000000000..5cdbaad896 --- /dev/null +++ b/seaweed-block/core/host/master/restore_target_exists_test.go @@ -0,0 +1,49 @@ +package master + +import ( + "context" + "encoding/json" + "os" + "path/filepath" + "strings" + "testing" + + "github.com/seaweedfs/seaweed-block/core/lifecycle" + control "github.com/seaweedfs/seaweed-block/core/rpc/control" + "google.golang.org/grpc/codes" + "google.golang.org/grpc/status" +) + +// A restore into a name that already holds a plain volume (a cluster-spec +// entry with size_bytes creates one, empty) is refused naming that cause and +// the cure, not "another restore request". Control: a target bound to +// another restore request is still refused as such. +func TestARestoreOverAPlainVolumeNamesTheRealCause(t *testing.T) { + dir := t.TempDir() + const id = "1234567890abcdef1234567890abcdef" + recs := map[string]lifecycle.VolumeSpec{ + "plain": {VolumeID: "plain", SizeBytes: 1 << 20, ReplicationFactor: 1, LayoutID: id}, + "target": {VolumeID: "target", SizeBytes: 1 << 20, ReplicationFactor: 1, LayoutID: id, SourceVolume: "source", SourceLayoutID: "fedcba0987654321fedcba0987654321", SourceSnapshot: "s1", CreateRequestID: "restore-1"}, + } + for name, spec := range recs { + raw, _ := json.Marshal(lifecycle.VolumeRecord{Spec: spec}) + if err := os.WriteFile(filepath.Join(dir, name+".json"), raw, 0600); err != nil { + t.Fatal(err) + } + } + store, err := lifecycle.OpenFileStore(dir) + if err != nil { + t.Fatal(err) + } + svc := newServices(&Host{lifecycle: &LifecycleStores{Volumes: store, Deletions: &lifecycle.DeletionReservationStore{}}}) + + _, err = svc.CreateVolume(context.Background(), &control.CreateVolumeRequest{VolumeId: "plain", SourceVolume: "source", SourceSnapshot: "s1", CreateRequestId: "restore-1"}) + if status.Code(err) != codes.AlreadyExists || !strings.Contains(err.Error(), "plain already exists as a volume") || !strings.Contains(err.Error(), "without size_bytes") || + strings.Contains(err.Error(), "another restore request") { + t.Fatalf("restore over a plain volume: %v; want AlreadyExists naming the existing volume", err) + } + _, err = svc.CreateVolume(context.Background(), &control.CreateVolumeRequest{VolumeId: "target", SourceVolume: "source", SourceSnapshot: "s1", CreateRequestId: "restore-2"}) + if status.Code(err) != codes.AlreadyExists || !strings.Contains(err.Error(), "bound to another restore request") { + t.Fatalf("restore over another restore's target: %v; want bound to another restore request", err) + } +} diff --git a/seaweed-block/core/host/master/services.go b/seaweed-block/core/host/master/services.go index cfe53f8e6f..94ae1810e6 100644 --- a/seaweed-block/core/host/master/services.go +++ b/seaweed-block/core/host/master/services.go @@ -90,6 +90,9 @@ func (s *services) CreateVolume(ctx context.Context, req *control.CreateVolumeRe // snapshot, which might itself be absent. if existing, ok := stores.Volumes.GetVolume(spec.VolumeID); ok { if existing.Spec.SourceVolume != spec.SourceVolume || existing.Spec.SourceSnapshot != spec.SourceSnapshot || existing.Spec.CreateRequestID != spec.CreateRequestID { + if existing.Spec.SourceVolume == "" && existing.Spec.SourceSnapshot == "" && existing.Spec.CreateRequestID == "" { + return nil, status.Errorf(codes.AlreadyExists, "create volume: %s already exists as a volume (for example a cluster-spec entry with size_bytes, which creates it empty); restore into a new name, listed in the cluster spec without size_bytes so the restore creates it", spec.VolumeID) + } return nil, status.Errorf(codes.AlreadyExists, "create volume: %s is bound to another restore request", spec.VolumeID) } } else if err := s.host.requireAssignmentProducer(spec.VolumeID); err != nil { diff --git a/seaweed-block/docs/standalone-deployment.md b/seaweed-block/docs/standalone-deployment.md index 8ae0aecb06..b980f8b4ed 100644 --- a/seaweed-block/docs/standalone-deployment.md +++ b/seaweed-block/docs/standalone-deployment.md @@ -524,9 +524,13 @@ mini uses the commands of the sections below; the steps there remain the way to Its output ends with what it promises, and only that: ```text -recovery point in the object store: the cut at