spec: ForkDelete model and its configurations (exhausted)

The fork/restore versus snapshot delete model this change rests on, byte for
byte as checked (sha256 c9c7c7fa), with its 28 configurations: 11 safe
(exhausted, no error, 18,672 to 15.7 M states, including every boundary
G = D + E + P), 12 reds and 5 witnesses each on its expected property.
README rows; the invariant rows drop the simulation tag.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
pingqiuandClaude Opus 5.5 committed 2026-11-21 01:22:15 -08:00
1 parent f676da0424
commit 5bb512d0f0
31 files changed
+845 -1

No files matched your search

+1 -1
View File
@@ -570,7 +570,7 @@ Notes:
| `INV-GC-CLOCK-SKEW-001` | Time-based GC eligibility subtracts configured pairwise clock skew (default one minute), plus one second for binding timestamps. Future valid intent/deletion stamps retain roots without blocking unrelated work. Future/backward or differently configured marks supply no elapsed coverage; malformed marks still refuse. This assumes clocks stay within the configured pairwise bound. | M6 intent expiry, deleting snapshot roots, bound → tombstoned | `core/frontend/chunkstore/gc.go` `oldEnough`, `run`; `gc_copy.go` `SweepCopies`, `snapshotAttemptHeads`; `gc_execution.go` `readMark`, `executeGC` | `TestGCSkewSnapshotDeleteGraceBothDirections`, `TestGCSkewIntentExpiryUsesConservativeAge`, `TestGCSkewFutureIntentKeepsRootsWithoutBlockingProgress`, `TestGCSkewPersistedCoverageAcrossHosts`, `TestGCSkewBindingAgeIncludesSecondResolution`, `TestGCSkewConfigAndMarkCoverage`, `TestGCSkewBackwardStepDiscardsCoverageAndPreviewDoesNotMutate`, `TestGCSkewFutureCopyDoesNotBlockOtherSettlement` (`core/frontend/chunkstore/gc_clock_skew_test.go`) | `GCClockSkew` `NoEarlyExpiry`, `FutureProtects`, `IndependentProgress`, `EventuallyEligibleAtBound` | ACTIVE |
| `INV-GC-GRACE-DEADLINE-001` | A GC collector cannot be built unless its grace period is at least the catalog operation deadline plus the clock skew bound plus the CAS apply bound (default: the operation deadline). | M6 GC configuration | `core/frontend/chunkstore/gc.go` `NewCollector` | `TestGC_GraceConstructorRequiresDeadlineSkewAndApplyBound` (`core/frontend/chunkstore/gc_volume_test.go`) | `RetentionGCTiming` `NoLiveDelete`; `ForkDelete` `NoGap` (G >= D + E + P) | ACTIVE |
| `INV-SNAP-EXPLICIT-DELETE-001` | A published snapshot is removed only by `DeleteSnapshot` or retention for its own attempt. | M6 snapshot: Published → Deleting | `core/frontend/chunkstore/catalog.go` `DeleteSnapshot`; `core/frontend/chunkstore/retention.go` `markDeleting` | `TestCatalog_DeleteMarksThenIdempotent` (`core/frontend/chunkstore/catalog_test.go`); `TestCatalog_RetainSkipsASameNameReplacement` (`core/frontend/chunkstore/retention_review_test.go`) | `ChunkLifecycleFixed` `SnapOnlyExplicitDelete` | ACTIVE |
| `INV-SNAP-DELETE-ANY-ORDER-001` | A snapshot can be deleted (explicitly or by retention) in any order with forks and restores: no fork claim refuses or delays it. A fork publishes only before its read time + deadline, and GC keeps a deleted attempt rooted for its grace (see note). | M6 snapshot: published → deleting, published → fork \| restore | `core/frontend/chunkstore/catalog.go` `Fork`, `readForkParent`, `DeleteSnapshot`; `core/frontend/chunkstore/retention.go` `markDeleting`; `core/frontend/chunkstore/gc.go` `NewCollector` | `TestSnapshotDelete_ForkRetryAfterDeleteRereadsTheParent`, `TestSnapshotDelete_DeleteDuringAForkInFlight`, `TestSnapshotDelete_UnknownPublishKeepsTheKeysWhileItsIntentExists` (`core/frontend/chunkstore/snapshot_delete_test.go`) | `ForkDelete` `NoGap` (simulation; exhaustive run pending) | ACTIVE |
| `INV-SNAP-DELETE-ANY-ORDER-001` | A snapshot can be deleted (explicitly or by retention) in any order with forks and restores: no fork claim refuses or delays it. A fork publishes only before its read time + deadline, and GC keeps a deleted attempt rooted for its grace (see note). | M6 snapshot: published → deleting, published → fork \| restore | `core/frontend/chunkstore/catalog.go` `Fork`, `readForkParent`, `DeleteSnapshot`; `core/frontend/chunkstore/retention.go` `markDeleting`; `core/frontend/chunkstore/gc.go` `NewCollector` | `TestSnapshotDelete_ForkRetryAfterDeleteRereadsTheParent`, `TestSnapshotDelete_DeleteDuringAForkInFlight`, `TestSnapshotDelete_UnknownPublishKeepsTheKeysWhileItsIntentExists` (`core/frontend/chunkstore/snapshot_delete_test.go`) | `ForkDelete` `NoGap` | ACTIVE |
| `INV-VOLDEL-COMMIT-001` | A volume delete commits only when no snapshot name record exists, and after its commit point no concurrent delete can roll it back. | M6 HEAD: deleting → purging | `core/frontend/chunkstore/volume_delete.go` `DeleteVolume`, `snapshotsBlock`, `commitHeadPurging` | `TestCatalog_DeleteVolumeRefusesWhileSnapshotsExist`, `TestCatalog_ConcurrentDeleteCannotRollBackACommittedOne` (`core/frontend/chunkstore/volume_delete_test.go`) | `ChunkLifecycleFixed` `CommitClean` | ACTIVE |
| `INV-VOLDEL-HELD-HEAD-001` | A delete marks HEAD `deleting` only while no holder holds it; an attach that reaches HEAD first wins. | M6 HEAD: detached → deleting | `core/frontend/chunkstore/volume_delete.go` `markHeadDeleting`, `headHeld` | `TestCatalog_DeleteVolumeLosesToAnAttachAtTheMark` (`core/frontend/chunkstore/volume_delete_test.go`) | — | ACTIVE |
| `INV-HEAD-DELETE-FROZEN-001` | Once HEAD is `deleting`, `purging` or `deleted`, `CASHead` refuses every claim or cut; only the delete's own transitions move it. | M6 HEAD: deleting \| purging \| deleted | `core/frontend/chunkstore/chunk_remote.go` `CASHead` | `TestCatalog_DeletedHeadCannotBeRevivedByAClaim` (`core/frontend/chunkstore/volume_delete_test.go`) | `ChunkLifecycleFixed` `NoPublishAfterCommit` | ACTIVE |
+305
View File
@@ -0,0 +1,305 @@
---------------------------- MODULE ForkDelete ----------------------------
(***************************************************************************)
(* Fork / restore versus snapshot delete with NO lock between them. *)
(* *)
(* Volume V has one published snapshot S naming the chunks 1..NC. A fork *)
(* creates a new volume T whose HEAD will name S's chunks. A delete of S *)
(* never waits for, and is never refused because of, a fork. Safety comes *)
(* from two time rules only: *)
(* (F) the fork reads S at its local time readAt and publishes T's HEAD *)
(* only if its local clock is still < readAt + D (checked right *)
(* before publishing: one atomic step, or, with PublishAtomic=FALSE, *)
(* a check step and a later publish step at most P ticks apart); *)
(* (G) the delete is stamped delAt on the catalog's local clock; GC keeps *)
(* S's chunks rooted while ITS local clock is < delAt + G. *)
(* GC is one atomic step deleting every chunk no root names. Roots: V's *)
(* HEAD (V may overwrite chunks), S while not deleted, S's deleted record *)
(* until the grace has passed, T's HEAD once published. *)
(* *)
(* Time: real time `now` ticks by 1. Actor a reads now + bias[a]; biases *)
(* are fixed at start in -E..E with pairwise difference <= E. Clocks do *)
(* not step and run at the same rate. *)
(* *)
(* Mutant switches are CONSTANTS; the design value is noted on each. *)
(***************************************************************************)
EXTENDS Integers, FiniteSets, TLC
CONSTANTS
NC, \* chunks 1..NC, all named by S (and by V's HEAD at start)
D, \* operation deadline of the fork (on the fork's clock)
G, \* GC grace after a delete (delAt on the catalog clock, compared on the GC clock)
E, \* pairwise clock skew bound
P, \* max ticks between the deadline check and the publish (PublishAtomic=FALSE only)
MaxNow, \* real-time bound
MaxAttempts, \* fork attempts (1 = no retry)
MaxReads, \* reads of T after its publish (witness only)
VCanOverwrite, \* [TRUE] V may stop naming chunks (nondeterministic action)
\* ---- design switches (design value in brackets) ----
PublishChecksDeadline, \* [TRUE] publish only if local clock < readAt + D
DeletedRecordRooted, \* [TRUE] deleted S roots its chunks until the grace has passed
PublishAtomic, \* [TRUE] check + publish in one step; FALSE: two steps <= P ticks apart
RetryAfterDelete \* [TRUE] a retry re-reads S (fails if deleted); FALSE: reuses old chunk set
ASSUME NC \in Nat /\ D \in Nat /\ G \in Nat /\ E \in Nat /\ P \in Nat /\ MaxNow \in Nat
Chunks == 1..NC
SChunks == Chunks
Actors == {"F", "C", "GC"} \* fork process, catalog (stamps delete), garbage collector
NoTime == -1000
FStates == {"idle", "read", "created", "checked", "published", "failed", "crashed", "notfound"}
VARIABLES
now, \* real time
bias, \* actor -> clock bias (fixed after Init)
vNames, \* chunks V's HEAD still names
sDeleted, \* S has been deleted
delAt, \* catalog-local time stamped on the delete (NoTime before)
exists, \* chunk -> still stored
fst, \* fork state
attempts, \* fork attempts started
readAt, \* fork-local time of the current attempt's read
readSet, \* chunk set held by the fork (from the last real read of S)
haveRead, \* some attempt has read S successfully
checkAt, \* real time of the deadline check (two-step publish only)
tPub, \* T's HEAD is published
tHead, \* chunks named by T's HEAD
nReads, \* reads of T done
\* ---- history (witnesses / trace readability) ----
pubAfterDel, \* T's HEAD was published after S was deleted
lateReadOK, \* T read all its chunks after the grace passed, with V no longer naming them
deadlineLoss, \* a fork attempt failed cleanly on the deadline
retryNotFound, \* a retry got "snapshot not found"
lastAct \* name of the last action (for traces)
forkVars == <<fst, attempts, readAt, readSet, haveRead, checkAt>>
tVars == <<tPub, tHead, nReads>>
histVars == <<pubAfterDel, lateReadOK, deadlineLoss, retryNotFound>>
vars == <<now, bias, vNames, sDeleted, delAt, exists, forkVars, tVars, histVars, lastAct>>
LC(a) == now + bias[a] \* local clock of actor a
TypeOK ==
/\ now \in 0..MaxNow
/\ bias \in [Actors -> -E..E]
/\ vNames \subseteq Chunks
/\ sDeleted \in BOOLEAN
/\ delAt \in Int
/\ exists \in [Chunks -> BOOLEAN]
/\ fst \in FStates
/\ attempts \in 0..MaxAttempts
/\ readAt \in Int
/\ readSet \subseteq Chunks
/\ haveRead \in BOOLEAN
/\ checkAt \in Int
/\ tPub \in BOOLEAN
/\ tHead \subseteq Chunks
/\ nReads \in 0..MaxReads
/\ pubAfterDel \in BOOLEAN
/\ lateReadOK \in BOOLEAN
/\ deadlineLoss \in BOOLEAN
/\ retryNotFound \in BOOLEAN
/\ lastAct \in STRING
Init ==
/\ now = 0
/\ bias \in {b \in [Actors -> -E..E] : (\A x, y \in Actors : b[x] - b[y] <= E)}
/\ vNames = Chunks
/\ sDeleted = FALSE
/\ delAt = NoTime
/\ exists = [c \in Chunks |-> TRUE]
/\ fst = "idle"
/\ attempts = 0
/\ readAt = NoTime
/\ readSet = {}
/\ haveRead = FALSE
/\ checkAt = NoTime
/\ tPub = FALSE
/\ tHead = {}
/\ nReads = 0
/\ pubAfterDel = FALSE
/\ lateReadOK = FALSE
/\ deadlineLoss = FALSE
/\ retryNotFound = FALSE
/\ lastAct = "Init"
(* ============================ time ============================ *)
\* Real time advances. With a two-step publish, at most P ticks pass between check and publish.
Tick ==
/\ now < MaxNow
/\ (PublishAtomic \/ fst # "checked" \/ now < checkAt + P)
/\ now' = now + 1
/\ lastAct' = "Tick"
/\ UNCHANGED <<bias, vNames, sDeleted, delAt, exists, forkVars, tVars, histVars>>
(* ============================ fork ============================ *)
\* Start an attempt (first try, or retry after a clean failure or a crash).
ReadSnapshot ==
/\ fst \in {"idle", "failed", "crashed"}
/\ attempts < MaxAttempts
/\ attempts' = attempts + 1
/\ lastAct' = "ReadSnapshot"
/\ (IF ~RetryAfterDelete /\ haveRead
THEN \* mutant: reuse the chunk set of an earlier attempt, no re-read of S
/\ fst' = "read"
/\ readAt' = LC("F")
/\ UNCHANGED <<readSet, haveRead, retryNotFound>>
ELSE (IF sDeleted
THEN /\ fst' = "notfound" \* "snapshot not found": T never gets a HEAD
/\ retryNotFound' = (retryNotFound \/ attempts > 0)
/\ UNCHANGED <<readAt, readSet, haveRead>>
ELSE /\ fst' = "read"
/\ readAt' = LC("F")
/\ readSet' = SChunks
/\ haveRead' = TRUE
/\ UNCHANGED retryNotFound))
/\ UNCHANGED <<now, bias, vNames, sDeleted, delAt, exists, checkAt, tVars,
pubAfterDel, lateReadOK, deadlineLoss>>
\* Create T's record (no HEAD yet, no effect on roots).
CreateTarget ==
/\ fst = "read"
/\ fst' = "created"
/\ lastAct' = "CreateTarget"
/\ UNCHANGED <<now, bias, vNames, sDeleted, delAt, exists,
attempts, readAt, readSet, haveRead, checkAt, tVars, histVars>>
DeadlineOK == (~PublishChecksDeadline) \/ (LC("F") < readAt + D)
\* Publish T's HEAD = the chunk set held by the fork.
DoPublish ==
/\ fst' = "published"
/\ tPub' = TRUE
/\ tHead' = readSet
/\ pubAfterDel' = (pubAfterDel \/ sDeleted)
\* (F) atomic: deadline check and publish in one step.
PublishAtomicStep ==
/\ PublishAtomic
/\ fst = "created"
/\ (IF DeadlineOK
THEN /\ DoPublish
/\ lastAct' = "Publish"
/\ UNCHANGED deadlineLoss
ELSE /\ fst' = "failed"
/\ deadlineLoss' = TRUE
/\ lastAct' = "PublishDeadlineFail"
/\ UNCHANGED <<tPub, tHead, pubAfterDel>>)
/\ UNCHANGED <<now, bias, vNames, sDeleted, delAt, exists,
attempts, readAt, readSet, haveRead, checkAt, nReads,
lateReadOK, retryNotFound>>
\* (F) two-step, step 1: the deadline check.
CheckDeadline ==
/\ ~PublishAtomic
/\ fst = "created"
/\ (IF DeadlineOK
THEN /\ fst' = "checked"
/\ checkAt' = now
/\ lastAct' = "CheckDeadlineOK"
/\ UNCHANGED deadlineLoss
ELSE /\ fst' = "failed"
/\ deadlineLoss' = TRUE
/\ lastAct' = "CheckDeadlineFail"
/\ UNCHANGED checkAt)
/\ UNCHANGED <<now, bias, vNames, sDeleted, delAt, exists,
attempts, readAt, readSet, haveRead, tVars,
pubAfterDel, lateReadOK, retryNotFound>>
\* (F) two-step, step 2: the publish, no new check (Tick bounds it to <= P ticks after the check).
PublishAfterCheck ==
/\ fst = "checked"
/\ DoPublish
/\ lastAct' = "PublishAfterCheck"
/\ UNCHANGED <<now, bias, vNames, sDeleted, delAt, exists,
attempts, readAt, readSet, haveRead, checkAt, nReads,
lateReadOK, deadlineLoss, retryNotFound>>
\* The fork crashes in the middle of an attempt; it may later retry or never continue.
Crash ==
/\ fst \in {"read", "created", "checked"}
/\ fst' = "crashed"
/\ lastAct' = "Crash"
/\ UNCHANGED <<now, bias, vNames, sDeleted, delAt, exists,
attempts, readAt, readSet, haveRead, checkAt, tVars, histVars>>
(* ========================== catalog / V ========================== *)
\* (G) delete S at any time: stamped on the catalog clock; S stops being a live root.
DeleteS ==
/\ ~sDeleted
/\ sDeleted' = TRUE
/\ delAt' = LC("C")
/\ lastAct' = "DeleteS"
/\ UNCHANGED <<now, bias, vNames, exists, forkVars, tVars, histVars>>
\* V's HEAD stops naming chunk c (V overwrote it).
VOverwrite(c) ==
/\ VCanOverwrite
/\ c \in vNames
/\ vNames' = vNames \ {c}
/\ lastAct' = "VOverwrite"
/\ UNCHANGED <<now, bias, sDeleted, delAt, exists, forkVars, tVars, histVars>>
(* ============================== GC ============================== *)
Rooted(c) ==
\/ c \in vNames
\/ ~sDeleted
\/ (DeletedRecordRooted /\ LC("GC") < delAt + G)
\/ (tPub /\ c \in tHead)
\* One step: delete every stored chunk no root names.
GC ==
/\ (\E c \in Chunks : exists[c] /\ ~Rooted(c))
/\ exists' = [c \in Chunks |-> exists[c] /\ Rooted(c)]
/\ lastAct' = "GC"
/\ UNCHANGED <<now, bias, vNames, sDeleted, delAt, forkVars, tVars, histVars>>
(* ============================ readers of T ============================ *)
TRead ==
/\ tPub
/\ nReads < MaxReads
/\ nReads' = nReads + 1
/\ lateReadOK' = (lateReadOK \/
(/\ sDeleted
/\ vNames \cap tHead = {}
/\ LC("GC") >= delAt + G
/\ (\A c \in tHead : exists[c])))
/\ lastAct' = "TRead"
/\ UNCHANGED <<now, bias, vNames, sDeleted, delAt, exists, forkVars, tPub, tHead,
pubAfterDel, deadlineLoss, retryNotFound>>
Next ==
\/ Tick
\/ ReadSnapshot
\/ CreateTarget
\/ PublishAtomicStep
\/ CheckDeadline
\/ PublishAfterCheck
\/ Crash
\/ DeleteS
\/ (\E c \in Chunks : VOverwrite(c))
\/ GC
\/ TRead
Spec == Init /\ [][Next]_vars
(* ============================ properties ============================ *)
\* Whenever T's HEAD is published, every chunk it names exists (checked in every state).
NoGap == tPub => (\A c \in tHead : exists[c])
(* Witnesses: each is expected VIOLATED (= the behaviour is reachable). *)
\* Benefit: a fork that read S before the delete publishes after the delete and T reads fine
\* after the grace has passed (only T's HEAD roots the chunks then).
WitNoBenefit == ~(pubAfterDel /\ lateReadOK)
\* A fork loses cleanly because the deadline passed.
WitNoDeadlineLoss == ~deadlineLoss
\* A retry gets "snapshot not found".
WitNoRetryNotFound == ~retryNotFound
\* GC deletes some chunk at all (shows GC is not vacuous in a safe configuration).
WitNoGCDelete == \A c \in Chunks : exists[c]
=============================================================================
+2
View File
@@ -98,6 +98,7 @@ Two kinds of config are **expected to violate**:
| `ReplicationFailover.tla` | `cfg/S6_*` | design-level |
| `RetentionGCTiming.tla` | `cfg/S9_*` | |
| `RetentionGCMulti.tla` | `cfg/S9b_*` | |
| `ForkDelete.tla` | `cfg/ForkDelete_*` | snapshot delete in any order with forks |
| `RestoreIndependence.tla` | `cfg/RestoreIndependence_*` | independent restore |
Each `.cfg` names its spec on its first line.
@@ -118,6 +119,7 @@ length of TLC's shortest counterexample.
| S6 | `ReplicationFailover` | RF=2: P ships to R, R acks what is durable, the client is acked when both are durable; promotion of R at a new epoch with an evidence gate; R refuses old-epoch shipping; cuts and snapshots cover only the replicated-durable frontier; an in-flight snapshot create from the old primary may still land after the failover. Design-level. | `AckedSurvive`, `HeadOnLineage`, `SnapOnLineage`, `NoStaleAck` | `S6_design` pass (52,897), `S6_design_big` (598,353). **RED:** `S6_red_localCut` HeadOnLineage; `S6_red_noFence` AckedSurvive. `S6_red_noEvidence` passes: with synchronous RF=2 acks the gate is redundant (it matters for quorum or async shipping, not modelled). | `core/transport/replica.go:362` replica rejects a stale-lineage ship entry; `core/replication/volume.go:680` RebaseShipLSN; takeover CAS as in S2 |
| S9 | `RetentionGCTiming`, `RetentionGCMulti` | GC timing with an explicit clock: a copy operation with deadline D, marks of duration up to MD, deletion only after two marks at least Grace apart; then marks across two volumes with a fork and a snapshot delete. | `NoLiveDelete` | **Single op:** `S9_rule_G4` (G > D + MD) pass (10,798; `_big` 43,780); G = D passes (`S9_red_G2_noguard`, 11,953). **RED:** `S9_red_G1_noguard`, `S9_red_G1_D3` (G < D) NoLiveDelete violated. **Two volumes:** `S9b_G1_MD2`, `_G2_MD2`, `_G2_MD3`, `_G3_MD1` pass (5,743-9,079). | `core/frontend/chunkstore/gc.go:89` grace > operation deadline, `:280` mark-duration margin, `:306-318` two-mark rule, `:214-221` intent expiry; `catalog.go:896-905` intent deadline re-checked before publish; `gc_copy.go:143`, `:177` a deleting attempt stays a root until grace |
| S10 | `RestoreIndependence` | Independent restore: claim, two-step fork, hydrate, bounded batch cuts (own keys uploaded under an intent, one HEAD CAS per batch), the independence marker after the last foreign ref, claim drop; GC, source snapshot and volume delete, snapshot retention, and crashes with resume from remote facts at any point. `ClaimUntilHead` selects today's fork claim (dropped at the first HEAD); the strict variant keeps the claim until independent. | `NoGap` (the target's chunks are always rooted), `Independent`, `NoForeignList`, `ClaimUntilHead_Inv`, `LifecycleFree`, `StateRemote` | **Exhaustive (TLC breadth-first, complete state graph, no error)** at MaxCrash 2, MaxGc 3 (4 for `n4`): option 1 (claim dropped at the first HEAD, the code): `safe` (NIdx 3, Batch 1) 3,639 distinct states; `safe_b2` 4,492; `safe_n4` (NIdx 4, Batch 2) 25,240. Strict variant `strict_claim_until_independent` 1,599 (and 2,003 / 9,838 at the `b2` / `n4` sizes, not shipped as cfgs here). **RED** (each violated at its invariant): `red_drop_claim_at_fork` ClaimUntilHead_Inv; `red_cas_before_upload`, `red_no_intent` NoGap; `red_marker_early`, `red_marker_before_cas`, `red_snap_during_restore` Independent; `red_list_foreign` NoForeignList; `red_resume_local` StateRemote; `red_retention_ignores_marker` LifecycleFree. **Witnesses reached:** `wit_done`, `wit_crash_resume`. Limits: no guest writes to the target while it takes ownership, GC acts immediately (no grace), one restore per snapshot. | `core/frontend/chunkstore/catalog.go` `Restore`, `CreateSnapshot` (restore refusal); `restore.go` `MarkIndependent`, `foreignRefsOf`; `retention.go` `liveClaims`, `forkParentsNeeded`; `gc.go` `Collector.run` (qualified refs rooted by owner); `core/storage/chunk_hydrate_all.go` `HydrateAll`. Batch cuts and the restore driver are not merged yet. |
| S11 | `ForkDelete` | Fork or restore against snapshot delete with no claim: the fork reads the parent, may crash and retry (a retry re-reads it), and publishes only before its read time + D, as one atomic step or check-then-publish with up to P ticks between; delete stamps its time; GC (one atomic step) keeps a deleted attempt rooted while its clock is below delete time + G. Three clocks with pairwise skew up to E. | `NoGap` (a published fork HEAD names only existing chunks) | **Exhaustive (TLC breadth-first, complete state graph, no error)**: all 11 safe cfgs, from `safe_D2E0G2` (18,672 distinct states) to `safe_na_P2_D1E2G5` (15,730,209), including every boundary G = D + E + P (atomic and two-step, NC = 2). **RED**, each violating NoGap: the boundary minus one (`red_bnd_*`, `red_na_P*`), `red_noDeadlineCheck`, `red_deletedNotRooted`, `red_noRetryReread`. **Witnesses reached:** `wit_benefit`, `wit_benefit_na_P1`, `wit_deadlineLoss`, `wit_gcDeletes`, `wit_retryNotFound`. Safe iff G >= D + E + P. | `core/frontend/chunkstore/catalog.go` `Fork` (deadline start before `readForkParent`, publish before start + deadline); `retention.go` `markDeleting` (no claim); `gc.go` `NewCollector` (grace >= deadline + skew + CAS apply bound); `gc_copy.go` `snapshotAttemptHeads` (deleted attempt rooted for grace) |
## Limits
@@ -0,0 +1,19 @@
\* RED boundary (G = D+E-1). Expected: NoGap violated.
SPECIFICATION Spec
CONSTANTS
NC = 1
D = 1
G = 1
E = 1
P = 0
MaxNow = 8
MaxAttempts = 2
MaxReads = 1
VCanOverwrite = TRUE
PublishChecksDeadline = TRUE
DeletedRecordRooted = TRUE
PublishAtomic = TRUE
RetryAfterDelete = TRUE
INVARIANTS
TypeOK
NoGap
@@ -0,0 +1,19 @@
\* RED boundary (G = D+E-1, E=0). Expected: NoGap violated.
SPECIFICATION Spec
CONSTANTS
NC = 1
D = 2
G = 1
E = 0
P = 0
MaxNow = 7
MaxAttempts = 2
MaxReads = 1
VCanOverwrite = TRUE
PublishChecksDeadline = TRUE
DeletedRecordRooted = TRUE
PublishAtomic = TRUE
RetryAfterDelete = TRUE
INVARIANTS
TypeOK
NoGap
@@ -0,0 +1,19 @@
\* RED boundary (G = D+E-1). Expected: NoGap violated.
SPECIFICATION Spec
CONSTANTS
NC = 1
D = 2
G = 2
E = 1
P = 0
MaxNow = 10
MaxAttempts = 2
MaxReads = 1
VCanOverwrite = TRUE
PublishChecksDeadline = TRUE
DeletedRecordRooted = TRUE
PublishAtomic = TRUE
RetryAfterDelete = TRUE
INVARIANTS
TypeOK
NoGap
@@ -0,0 +1,19 @@
\* RED boundary (G = D+E-1). Expected: NoGap violated.
SPECIFICATION Spec
CONSTANTS
NC = 1
D = 3
G = 4
E = 2
P = 0
MaxNow = 15
MaxAttempts = 2
MaxReads = 1
VCanOverwrite = TRUE
PublishChecksDeadline = TRUE
DeletedRecordRooted = TRUE
PublishAtomic = TRUE
RetryAfterDelete = TRUE
INVARIANTS
TypeOK
NoGap
@@ -0,0 +1,19 @@
\* RED boundary with 2 chunks. Expected: NoGap violated.
SPECIFICATION Spec
CONSTANTS
NC = 2
D = 2
G = 2
E = 1
P = 0
MaxNow = 10
MaxAttempts = 3
MaxReads = 2
VCanOverwrite = TRUE
PublishChecksDeadline = TRUE
DeletedRecordRooted = TRUE
PublishAtomic = TRUE
RetryAfterDelete = TRUE
INVARIANTS
TypeOK
NoGap
@@ -0,0 +1,19 @@
\* RED: a deleted snapshot stops being a root at once. Expected: NoGap violated.
SPECIFICATION Spec
CONSTANTS
NC = 1
D = 2
G = 3
E = 1
P = 0
MaxNow = 11
MaxAttempts = 2
MaxReads = 1
VCanOverwrite = TRUE
PublishChecksDeadline = TRUE
DeletedRecordRooted = FALSE
PublishAtomic = TRUE
RetryAfterDelete = TRUE
INVARIANTS
TypeOK
NoGap
@@ -0,0 +1,19 @@
\* RED two-step, P=0 (G = D+E+P-1). Expected: NoGap violated.
SPECIFICATION Spec
CONSTANTS
NC = 1
D = 2
G = 2
E = 1
P = 0
MaxNow = 10
MaxAttempts = 2
MaxReads = 1
VCanOverwrite = TRUE
PublishChecksDeadline = TRUE
DeletedRecordRooted = TRUE
PublishAtomic = FALSE
RetryAfterDelete = TRUE
INVARIANTS
TypeOK
NoGap
@@ -0,0 +1,19 @@
\* RED two-step, P=1 at the atomic grace G = D+E. Expected: NoGap violated.
SPECIFICATION Spec
CONSTANTS
NC = 1
D = 2
G = 3
E = 1
P = 1
MaxNow = 12
MaxAttempts = 2
MaxReads = 1
VCanOverwrite = TRUE
PublishChecksDeadline = TRUE
DeletedRecordRooted = TRUE
PublishAtomic = FALSE
RetryAfterDelete = TRUE
INVARIANTS
TypeOK
NoGap
@@ -0,0 +1,19 @@
\* RED two-step, P=2, E=2 (G = D+E+P-1). Expected: NoGap violated.
SPECIFICATION Spec
CONSTANTS
NC = 1
D = 1
G = 4
E = 2
P = 2
MaxNow = 15
MaxAttempts = 2
MaxReads = 1
VCanOverwrite = TRUE
PublishChecksDeadline = TRUE
DeletedRecordRooted = TRUE
PublishAtomic = FALSE
RetryAfterDelete = TRUE
INVARIANTS
TypeOK
NoGap
@@ -0,0 +1,19 @@
\* RED two-step, P=2 (G = D+E+P-1). Expected: NoGap violated.
SPECIFICATION Spec
CONSTANTS
NC = 1
D = 2
G = 4
E = 1
P = 2
MaxNow = 14
MaxAttempts = 2
MaxReads = 1
VCanOverwrite = TRUE
PublishChecksDeadline = TRUE
DeletedRecordRooted = TRUE
PublishAtomic = FALSE
RetryAfterDelete = TRUE
INVARIANTS
TypeOK
NoGap
@@ -0,0 +1,19 @@
\* RED: publish without the deadline check. Expected: NoGap violated.
SPECIFICATION Spec
CONSTANTS
NC = 1
D = 2
G = 3
E = 1
P = 0
MaxNow = 11
MaxAttempts = 2
MaxReads = 1
VCanOverwrite = TRUE
PublishChecksDeadline = FALSE
DeletedRecordRooted = TRUE
PublishAtomic = TRUE
RetryAfterDelete = TRUE
INVARIANTS
TypeOK
NoGap
@@ -0,0 +1,19 @@
\* RED: a retry reuses the earlier chunk set without re-reading S. Expected: NoGap violated.
SPECIFICATION Spec
CONSTANTS
NC = 1
D = 2
G = 3
E = 1
P = 0
MaxNow = 11
MaxAttempts = 2
MaxReads = 1
VCanOverwrite = TRUE
PublishChecksDeadline = TRUE
DeletedRecordRooted = TRUE
PublishAtomic = TRUE
RetryAfterDelete = FALSE
INVARIANTS
TypeOK
NoGap
@@ -0,0 +1,19 @@
\* SAFE boundary (G = D+E). Expected: no violation.
SPECIFICATION Spec
CONSTANTS
NC = 1
D = 1
G = 2
E = 1
P = 0
MaxNow = 9
MaxAttempts = 2
MaxReads = 1
VCanOverwrite = TRUE
PublishChecksDeadline = TRUE
DeletedRecordRooted = TRUE
PublishAtomic = TRUE
RetryAfterDelete = TRUE
INVARIANTS
TypeOK
NoGap
@@ -0,0 +1,19 @@
\* SAFE boundary (G = D+E, E=0; the brief's 'G <= D' case). Expected: no violation.
SPECIFICATION Spec
CONSTANTS
NC = 1
D = 2
G = 2
E = 0
P = 0
MaxNow = 8
MaxAttempts = 2
MaxReads = 1
VCanOverwrite = TRUE
PublishChecksDeadline = TRUE
DeletedRecordRooted = TRUE
PublishAtomic = TRUE
RetryAfterDelete = TRUE
INVARIANTS
TypeOK
NoGap
@@ -0,0 +1,19 @@
\* SAFE boundary (G = D+E). Expected: no violation.
SPECIFICATION Spec
CONSTANTS
NC = 1
D = 2
G = 3
E = 1
P = 0
MaxNow = 11
MaxAttempts = 2
MaxReads = 1
VCanOverwrite = TRUE
PublishChecksDeadline = TRUE
DeletedRecordRooted = TRUE
PublishAtomic = TRUE
RetryAfterDelete = TRUE
INVARIANTS
TypeOK
NoGap
@@ -0,0 +1,19 @@
\* SAFE margin (G = D+E+1). Expected: no violation.
SPECIFICATION Spec
CONSTANTS
NC = 1
D = 2
G = 4
E = 1
P = 0
MaxNow = 12
MaxAttempts = 2
MaxReads = 1
VCanOverwrite = TRUE
PublishChecksDeadline = TRUE
DeletedRecordRooted = TRUE
PublishAtomic = TRUE
RetryAfterDelete = TRUE
INVARIANTS
TypeOK
NoGap
@@ -0,0 +1,19 @@
\* SAFE margin (G = D+2E). Expected: no violation.
SPECIFICATION Spec
CONSTANTS
NC = 1
D = 2
G = 6
E = 2
P = 0
MaxNow = 16
MaxAttempts = 2
MaxReads = 1
VCanOverwrite = TRUE
PublishChecksDeadline = TRUE
DeletedRecordRooted = TRUE
PublishAtomic = TRUE
RetryAfterDelete = TRUE
INVARIANTS
TypeOK
NoGap
@@ -0,0 +1,19 @@
\* SAFE boundary (G = D+E). Expected: no violation.
SPECIFICATION Spec
CONSTANTS
NC = 1
D = 3
G = 5
E = 2
P = 0
MaxNow = 16
MaxAttempts = 2
MaxReads = 1
VCanOverwrite = TRUE
PublishChecksDeadline = TRUE
DeletedRecordRooted = TRUE
PublishAtomic = TRUE
RetryAfterDelete = TRUE
INVARIANTS
TypeOK
NoGap
@@ -0,0 +1,19 @@
\* SAFE two-step, P=0 (G = D+E+P). Expected: no violation.
SPECIFICATION Spec
CONSTANTS
NC = 1
D = 2
G = 3
E = 1
P = 0
MaxNow = 11
MaxAttempts = 2
MaxReads = 1
VCanOverwrite = TRUE
PublishChecksDeadline = TRUE
DeletedRecordRooted = TRUE
PublishAtomic = FALSE
RetryAfterDelete = TRUE
INVARIANTS
TypeOK
NoGap
@@ -0,0 +1,19 @@
\* SAFE two-step, P=1 (G = D+E+P). Expected: no violation.
SPECIFICATION Spec
CONSTANTS
NC = 1
D = 2
G = 4
E = 1
P = 1
MaxNow = 13
MaxAttempts = 2
MaxReads = 1
VCanOverwrite = TRUE
PublishChecksDeadline = TRUE
DeletedRecordRooted = TRUE
PublishAtomic = FALSE
RetryAfterDelete = TRUE
INVARIANTS
TypeOK
NoGap
@@ -0,0 +1,19 @@
\* SAFE two-step, P=2, E=2 (G = D+E+P). Expected: no violation.
SPECIFICATION Spec
CONSTANTS
NC = 1
D = 1
G = 5
E = 2
P = 2
MaxNow = 16
MaxAttempts = 2
MaxReads = 1
VCanOverwrite = TRUE
PublishChecksDeadline = TRUE
DeletedRecordRooted = TRUE
PublishAtomic = FALSE
RetryAfterDelete = TRUE
INVARIANTS
TypeOK
NoGap
@@ -0,0 +1,19 @@
\* SAFE two-step, P=2 (G = D+E+P). Expected: no violation.
SPECIFICATION Spec
CONSTANTS
NC = 1
D = 2
G = 5
E = 1
P = 2
MaxNow = 15
MaxAttempts = 2
MaxReads = 1
VCanOverwrite = TRUE
PublishChecksDeadline = TRUE
DeletedRecordRooted = TRUE
PublishAtomic = FALSE
RetryAfterDelete = TRUE
INVARIANTS
TypeOK
NoGap
@@ -0,0 +1,19 @@
\* SAFE boundary with 2 chunks, 3 attempts, 2 reads. Expected: no violation.
SPECIFICATION Spec
CONSTANTS
NC = 2
D = 2
G = 3
E = 1
P = 0
MaxNow = 11
MaxAttempts = 3
MaxReads = 2
VCanOverwrite = TRUE
PublishChecksDeadline = TRUE
DeletedRecordRooted = TRUE
PublishAtomic = TRUE
RetryAfterDelete = TRUE
INVARIANTS
TypeOK
NoGap
@@ -0,0 +1,20 @@
\* WITNESS (expected VIOLATED = reachable): fork read before the delete, published after it, T reads fine after the grace.
SPECIFICATION Spec
CONSTANTS
NC = 1
D = 2
G = 3
E = 1
P = 0
MaxNow = 11
MaxAttempts = 2
MaxReads = 1
VCanOverwrite = TRUE
PublishChecksDeadline = TRUE
DeletedRecordRooted = TRUE
PublishAtomic = TRUE
RetryAfterDelete = TRUE
INVARIANTS
TypeOK
NoGap
WitNoBenefit
@@ -0,0 +1,20 @@
\* WITNESS two-step P=1 at its safe grace (expected VIOLATED = reachable): benefit still reachable.
SPECIFICATION Spec
CONSTANTS
NC = 1
D = 2
G = 4
E = 1
P = 1
MaxNow = 13
MaxAttempts = 2
MaxReads = 1
VCanOverwrite = TRUE
PublishChecksDeadline = TRUE
DeletedRecordRooted = TRUE
PublishAtomic = FALSE
RetryAfterDelete = TRUE
INVARIANTS
TypeOK
NoGap
WitNoBenefit
@@ -0,0 +1,20 @@
\* WITNESS (expected VIOLATED = reachable): a fork fails cleanly on the deadline.
SPECIFICATION Spec
CONSTANTS
NC = 1
D = 2
G = 3
E = 1
P = 0
MaxNow = 11
MaxAttempts = 2
MaxReads = 1
VCanOverwrite = TRUE
PublishChecksDeadline = TRUE
DeletedRecordRooted = TRUE
PublishAtomic = TRUE
RetryAfterDelete = TRUE
INVARIANTS
TypeOK
NoGap
WitNoDeadlineLoss
@@ -0,0 +1,20 @@
\* WITNESS (expected VIOLATED = reachable): GC deletes S's chunks in a safe configuration.
SPECIFICATION Spec
CONSTANTS
NC = 1
D = 2
G = 3
E = 1
P = 0
MaxNow = 11
MaxAttempts = 2
MaxReads = 1
VCanOverwrite = TRUE
PublishChecksDeadline = TRUE
DeletedRecordRooted = TRUE
PublishAtomic = TRUE
RetryAfterDelete = TRUE
INVARIANTS
TypeOK
NoGap
WitNoGCDelete
@@ -0,0 +1,20 @@
\* WITNESS (expected VIOLATED = reachable): a retry gets snapshot-not-found.
SPECIFICATION Spec
CONSTANTS
NC = 1
D = 2
G = 3
E = 1
P = 0
MaxNow = 11
MaxAttempts = 2
MaxReads = 1
VCanOverwrite = TRUE
PublishChecksDeadline = TRUE
DeletedRecordRooted = TRUE
PublishAtomic = TRUE
RetryAfterDelete = TRUE
INVARIANTS
TypeOK
NoGap
WitNoRetryNotFound