spec: RestoreIndependence no-claim variant (exhausted) replaces the claim-era model

The model this part rests on, as checked (no-claim variant; only comment lines
changed: seat and note names removed), with its 26 configurations: the
no-claim safe cfgs exhausted with no error (360 k to 2.75 M states), the
boundary G >= D on one clock (ForkDelete's G >= D + E + P with E = P = 0),
13 reds and 2 witnesses on their properties, and the claim-frame regression
cfgs. The claim-era configurations not re-run against this spec are removed.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
pingqiuandClaude Opus 5.5 committed 2026-11-21 01:23:17 -08:00
1 parent 5184b1c119
commit c041d9e28e
30 files changed
+574 -66

No files matched your search

+1 -1
View File
@@ -577,7 +577,7 @@ Notes:
| `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 |
| `INV-RESTORE-INDEPENDENT-001` | `RESTORE-INDEPENDENT` is written once, only for a restore volume with a live HEAD whose resolved image holds no ref owned by another volume; a restore without a live HEAD (absent or aborted) never attaches and is never marked. | M6 snapshot: restore → independent | `core/frontend/chunkstore/restore.go` `MarkIndependent`, `foreignRefsOf`; `core/frontend/chunkstore/catalog.go` `EnsureVolume` | `TestRestore_MarkIndependentOnlyWithoutQualifiedRefs`, `TestRestore_WithoutLiveHeadNeverAttaches`, `TestRestore_SourceGoneIsNormal` (`core/frontend/chunkstore/restore_test.go`) | `RestoreIndependence` `Independent`, `NoForeignList` | ACTIVE |
| `INV-RESTORE-SNAPSHOT-001` | A snapshot of a restore volume is refused until it is independent, and the snapshot image itself must hold no ref owned by another volume (a cut saved before the marker is refused after it); a refused request leaves no name or attempt. | M6 snapshot: restore (not independent) → name held (refused) | `core/frontend/chunkstore/catalog.go` `CreateSnapshot` | `TestRestore_SnapshotsRefusedUntilIndependent`, `TestRestore_SnapshotOfAStalePreIndependenceImageRefused` (`core/frontend/chunkstore/restore_test.go`) | `RestoreIndependence` `Independent` (`red_snap_during_restore`) | ACTIVE |
| `INV-RESTORE-SNAPSHOT-001` | A snapshot of a restore volume is refused until it is independent, and the snapshot image itself must hold no ref owned by another volume (a cut saved before the marker is refused after it); a refused request leaves no name or attempt. | M6 snapshot: restore (not independent) → name held (refused) | `core/frontend/chunkstore/catalog.go` `CreateSnapshot` | `TestRestore_SnapshotsRefusedUntilIndependent`, `TestRestore_SnapshotOfAStalePreIndependenceImageRefused` (`core/frontend/chunkstore/restore_test.go`) | `RestoreIndependence` `Independent` (`nc_red_SnapDuringRestore`) | ACTIVE |
| `INV-RESTORE-PARENT-HOLD-001` | A restore target with an aborted first HEAD no longer has a live fork claim (any HEAD ends the claim), but retention still keeps the parent snapshot as `fork_parent` (the fork-record scan treats an aborted HEAD as no HEAD) until the target volume is deleted. | M6 snapshot: published (parent of an aborted restore) | `core/frontend/chunkstore/retention.go` `liveClaims`, `forkParentsNeeded` | `TestRestore_AbortedFirstHeadKeepsTheParentUntilTheTargetIsDeleted` (`core/frontend/chunkstore/restore_test.go`) | — (Go only: the model's `ClaimUntilHead` does not cover retention of an aborted target) | ACTIVE |
| `INV-RESTORE-HYDRATE-001` | The background hydrate walker fills only through the shared fill flights (one fetch per chunk, never over a local write), yields while a guest waits, and holds one host fill permit (no cut payload, the caller's class) per flight until that flight's I/O is over, also when it returns early on cancel or revocation. | M4 Holder (background hydrate) | `core/storage/chunk_hydrate_all.go` `HydrateAll`, `HydrateAllAt`, `startWalkerFill`, `admitFill` | `TestHydrateAll_YieldsToGuestReadsAndNeverFetchesTwice`, `TestHydrateAll_NeverOverwritesALocalWrite`, `TestHydrateAll_RealBackgroundFillLimiterAdmitsEveryFill`, `TestHydrateAll_PermitIsHeldUntilTheOwnedFetchSettles`, `TestHydrateAll_RevocationStopsTheWalker`, `TestHydrateAll_CancelReturnsWhileTheFetchIsHeld`, `TestHydrateAll_PacedByByteRate` (`core/storage/chunk_hydrate_all_test.go`) | — | ACTIVE |
| `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` | ACTIVE |
+1 -1
View File
@@ -117,7 +117,7 @@ length of TLC's shortest counterexample.
| S5 | `ControlPlane` | Blockmaster authority store: one volume record `{epoch, holder, move journal}`, two retried move requests, durable Puts that succeed, fail, or land with the reply lost, and restarts. | `UniqueEpoch` (issued epochs strictly increase), `Idempotent` (one epoch per request id), `JournalComplete` | `S5_code` pass (298). **RED:** `S5_red_noUncertain` UniqueEpoch violated (5-step: a lost-reply Put, then a reservation from stale memory puts the old assignment back). `S5_red_noReserve` passes (the reservation step is not needed for these invariants). | `core/authority/authority.go:436` applyWithWorkspaceMove (uncertain refusal `:442-444`, Put `:564`, mark uncertain `:568`); `core/authority/workspace.go:309` prepareWorkspaceMoveLocked (expected line `:313`, resume a reserved entry `:324-333`, reserve max+1 `:344-355`), journal replay `:192-219`, persist and mark uncertain `:276-288` |
| 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. |
| S10 | `RestoreIndependence` | Independent restore: fork of a sealed snapshot, hydrate, bounded batch cuts (own fids uploaded under an intent, one HEAD CAS per batch), the independence marker after the last foreign ref; GC, source delete, snapshot retention, and crashes with resume from remote facts at any point. `NoClaim` (the code): no claim; the fork window is safe by two time rules on one clock, ForkEnd only while now < readAt + D and a deleted snapshot rooted while now < delAt + G. The older claim variants stay as regression configurations. | `NoGap`, `Independent`, `NoForeignList`, `LifecycleFree`, `StateRemote` | **Exhaustive (TLC breadth-first, complete state graph, no error)**, no-claim: `nc_safe` 405,198 distinct states; `nc_safe_b2` 504,097; `nc_safe_n4` 2,752,518; `nc_safe_G3D2` 379,500; boundary `nc_bnd_G1D1` 444,564 and `nc_bnd_G3D3` 360,615 safe, `nc_bnd_G0D1` and `nc_bnd_G2D3` violate NoGap: safe iff G >= D on one clock, which is `ForkDelete`'s G >= D + E + P with E = P = 0 (the production inequality is ForkDelete's). **RED** (each violated): `nc_red_CasBeforeUpload`, `nc_red_NoIntent`, `nc_red_GltD`, `nc_red_noDeadline`, `nc_red_notRooted`, `nc_red_resumeNoReread` NoGap; `nc_red_MarkerEarly`, `nc_red_MarkerBeforeCas`, `nc_red_SnapDuringRestore` Independent; `nc_red_ListForeign` NoForeignList; `nc_red_ResumeLocal` StateRemote. **Witnesses reached:** `nc_wit_DelInFork` (the source snapshot deleted inside the fork window and the restore completes), `nc_wit_FailNotFound`. Regression (claim frame): `safe` 1,599, `opt1_safe` 3,639, `oldframe` 1,599 safe; `oldframe_drop`, `red_DropClaimAtFork_gap` violate NoGap. Limits: no guest writes to the target while it takes ownership, GC acts immediately, one restore per snapshot. | `core/frontend/chunkstore/catalog.go` `Restore`, `CreateSnapshot` (restore refusal); `restore.go` `MarkIndependent`, `foreignRefsOf`; `gc.go` `Collector.run` (qualified refs rooted by owner); `core/storage/chunk_hydrate_all.go` `HydrateAllAt`; `core/storage/chunk_own.go` `OwnBatch`; `core/host/volume/chunk_restore.go` `runRestore` |
## Limits
+95 -12
View File
@@ -1,7 +1,6 @@
------------------------------ MODULE RestoreIndependence ------------------------------
(***************************************************************************)
(* Independent restore: restore a snapshot into a volume that ends up *)
(* owning all its chunks, with no lineage to the source. *)
(* Independent restore of a snapshot into a new volume. *)
(* Source volume V with HEAD and one sealed snapshot S; target T restored *)
(* from S. T's HEAD maps indexes to fids; a fid is owned by V (a "@V/" *)
(* ref) or by T. Steps: 0 claim S; 1 fork (T HEAD = S's fids, all V-owned) *)
@@ -12,8 +11,14 @@
(* no root reaches) may run at any point; V may be deleted at any point; *)
(* the restore process may crash and a new owner resumes from REMOTE facts *)
(* only (forced move). Mutants are constants (FALSE = the design). *)
(* Reuse: the fid/owner/root vocabulary of the chunk GC model; this *)
(* Reuse: the fid/owner/root vocabulary of the chunk GC model; this *)
(* spec models only what the restore adds, not the superseded list/grace. *)
(* NOCLAIM: with NoClaim = TRUE claims are removed; *)
(* a snapshot delete never looks at a fork. Safety of the ForkBegin.. *)
(* ForkEnd window comes from two time rules on one clock: (D) ForkEnd only *)
(* while now < readAt + D, else ForkFail; (G) a deleted S stays a GC root *)
(* while now < delAt + G. With NoClaim = FALSE nothing below changes the *)
(* old model (Tick, ForkFail, ForkNotFound disabled; new variables fixed). *)
(***************************************************************************)
EXTENDS Integers, FiniteSets, TLC
@@ -33,7 +38,15 @@ CONSTANTS
RetentionIgnoresMarker, \* after the marker, V's retention still treats T as holding S
\* ---- added in review (r0.1) ----
ClaimUntilHead, \* r0.2 OPTION 1: the claim is dropped when T's HEAD is published (today's fork semantics)
NoIntent \* uploaded batch fids are not rooted by an intent before the HEAD CAS
NoIntent, \* uploaded batch fids are not rooted by an intent before the HEAD CAS
\* ---- NOCLAIM variant; old cfgs: NoClaim = FALSE, D = G = MaxTick = 0, the three below TRUE ----
NoClaim, \* TRUE: no claim ever holds S; DeleteS needs only slive; time rules D and G apply
D, \* fork deadline: ForkEnd only while now < readAt + D (read only when NoClaim)
G, \* grace: a deleted S stays a root while now < delAt + G (read only when NoClaim)
MaxTick, \* bound of the clock (Tick is enabled only when NoClaim)
ForkChecksDeadline,\* design TRUE; mutant FALSE = ForkEnd at any time
DeletedRooted, \* design TRUE; mutant FALSE = a deleted S stops being a root at once
ResumeRereads \* design TRUE; mutant FALSE = a resume in the fork window reuses the old read (fresh deadline, S not re-read)
Idx == 1..NIdx
VF == [i \in Idx |-> <<"V", i>>] \* the source fid of index i
@@ -41,6 +54,7 @@ TF == [i \in Idx |-> <<"T", i>>] \* T's own fid for index i
Fids == {VF[i] : i \in Idx} \cup {TF[i] : i \in Idx}
\* r0.1: "no HEAD yet" is a function too (TLC cannot compare a function with a string)
NoHead == [i \in Idx |-> <<"N", i>>]
None == -1 \* nc: "no tick" encoding for readAt / delAt
VARIABLES
store, \* Fids -> "none" | "pres" | "del"
@@ -54,40 +68,70 @@ VARIABLES
tsnap, \* a snapshot of T (its fid set), {} if none
gclist, \* fids put on a GC list (rule 8 check)
localdone,\* local "restore done" flag of the current owner (ResumeLocal mutant)
crashes, gcs
crashes, gcs,
\* ---- nc (all fixed at their Init value when NoClaim = FALSE) ----
now, \* the one clock
readAt, \* tick at which the current fork attempt read S (None if no attempt in progress)
delAt, \* tick at which S was deleted (None while S lives)
sdelfk, \* history: S was deleted while step = "fk" (for the witness)
ffail \* history: a fork attempt failed on its deadline (for the witness)
vars == <<store, vlive, slive, claim, thead, step, up, marker, tsnap, gclist, localdone, crashes, gcs>>
tvars == <<now, readAt, delAt, sdelfk, ffail>>
vars == <<store, vlive, slive, claim, thead, step, up, marker, tsnap, gclist, localdone, crashes, gcs, now, readAt, delAt, sdelfk, ffail>>
THeadFids == IF thead = NoHead THEN {} ELSE {thead[i] : i \in Idx}
VRefs == {i \in Idx : thead # NoHead /\ thead[i][1] = "V"}
\* roots: V's HEAD (while V lives), S (while it lives), T's HEAD, T's snapshot,
\* uploaded-but-unpublished batch fids (intent roots them), S's fids while claimed
SFids == {VF[i] : i \in Idx}
\* nc rule G: a deleted S stays a root for G ticks (FALSE whenever NoClaim = FALSE)
SGrace == NoClaim /\ DeletedRooted /\ ~ slive /\ delAt # None /\ now < delAt + G
Roots == (IF vlive THEN SFids ELSE {})
\cup (IF slive THEN SFids ELSE {})
\cup (IF (slive \/ SGrace) THEN SFids ELSE {})
\cup THeadFids \cup tsnap \cup (IF NoIntent THEN {} ELSE up)
\* S may be deleted by retention when nothing holds it
SHeld == claim \/ (RetentionIgnoresMarker /\ thead # NoHead)
\* nc: with NoClaim the snapshot delete never looks at a fork
SDeletable == slive /\ (NoClaim \/ ~ SHeld)
\* nc rule D (TRUE whenever NoClaim = FALSE)
DeadlineOK == (~ NoClaim) \/ (~ ForkChecksDeadline) \/ (now < readAt + D)
Init ==
/\ store = [f \in Fids |-> IF f[1] = "V" THEN "pres" ELSE "none"]
/\ vlive = TRUE /\ slive = TRUE /\ claim = FALSE /\ thead = NoHead
/\ step = "start" /\ up = {} /\ marker = FALSE /\ tsnap = {} /\ gclist = {}
/\ localdone = FALSE /\ crashes = 0 /\ gcs = 0
/\ now = 0 /\ readAt = None /\ delAt = None /\ sdelfk = FALSE /\ ffail = FALSE
\* step 0: S is sealed (given) and claimed
Claim == step = "start" /\ slive /\ claim' = TRUE /\ step' = "c"
\* nc: the step is kept (S found, step counter) but takes no claim
Claim == step = "start" /\ slive /\ claim' = (~ NoClaim) /\ step' = "c"
/\ UNCHANGED <<store, vlive, slive, thead, up, marker, tsnap, gclist, localdone, crashes, gcs>>
/\ UNCHANGED tvars
\* step 1: fork (T HEAD names S's fids, all V-owned)
\* r0.1: two steps. Between them T exists without a HEAD, so only the claim keeps S (and
\* through S its fids) alive; that window is what the claim is for.
\* nc: ForkBegin reads S (requires S live) and records readAt; ForkEnd only within the deadline
ForkBegin == step = "c" /\ step' = "fk"
/\ (NoClaim => slive)
/\ claim' = (IF DropClaimAtFork THEN FALSE ELSE claim)
/\ readAt' = (IF NoClaim THEN now ELSE readAt)
/\ UNCHANGED <<store, vlive, slive, thead, up, marker, tsnap, gclist, localdone, crashes, gcs>>
ForkEnd == step = "fk" /\ thead' = VF /\ step' = "own"
/\ UNCHANGED <<now, delAt, sdelfk, ffail>>
ForkEnd == step = "fk" /\ DeadlineOK /\ thead' = VF /\ step' = "own"
/\ claim' = (IF ClaimUntilHead THEN FALSE ELSE claim)
/\ UNCHANGED <<store, vlive, slive, up, marker, tsnap, gclist, localdone, crashes, gcs>>
/\ UNCHANGED tvars
\* nc: past the deadline the fork fails cleanly: T stays without a HEAD, a retry is a new ForkBegin
ForkFail == NoClaim /\ step = "fk" /\ now >= readAt + D
/\ step' = "c" /\ readAt' = None /\ ffail' = TRUE
/\ UNCHANGED <<store, vlive, slive, claim, thead, up, marker, tsnap, gclist, localdone, crashes, gcs>>
/\ UNCHANGED <<now, delAt, sdelfk>>
\* nc: a (re)try that re-reads S and finds it gone ends with "not found" (terminal)
ForkNotFound == NoClaim /\ step = "c" /\ ~ slive /\ step' = "nf"
/\ UNCHANGED <<store, vlive, slive, claim, thead, up, marker, tsnap, gclist, localdone, crashes, gcs>>
/\ UNCHANGED tvars
\* step 3: one batch: upload own fids for up to Batch V-owned indexes (intent roots them)
BatchSet == {B \in SUBSET VRefs : B # {} /\ Cardinality(B) <= Batch}
@@ -96,6 +140,7 @@ Upload(B) == step = "own" /\ up = {} /\ ~ CasBeforeUpload
/\ store' = [f \in Fids |-> IF f \in {TF[j] : j \in B} THEN "pres" ELSE store[f]]
/\ up' = {TF[j] : j \in B}
/\ UNCHANGED <<vlive, slive, claim, thead, step, marker, tsnap, gclist, localdone, crashes, gcs>>
/\ UNCHANGED tvars
\* the batch HEAD CAS: swap exactly the uploaded indexes
Cas == step = "own" /\ up # {}
/\ thead' = [i \in Idx |-> IF TF[i] \in up THEN TF[i] ELSE thead[i]]
@@ -103,50 +148,75 @@ Cas == step = "own" /\ up # {}
/\ up' = {}
/\ localdone' = (localdone \/ \A i \in Idx : (thead[i][1] = "V") => (TF[i] \in up))
/\ UNCHANGED <<store, vlive, slive, claim, step, marker, tsnap, crashes, gcs>>
/\ UNCHANGED tvars
\* mutant: CAS a batch whose upload is not durable (the T fid is still "none")
CasEarly(B) == CasBeforeUpload /\ step = "own" /\ up = {}
/\ thead' = [i \in Idx |-> IF i \in B THEN TF[i] ELSE thead[i]]
/\ UNCHANGED <<store, vlive, slive, claim, step, up, marker, tsnap, gclist, localdone, crashes, gcs>>
/\ UNCHANGED tvars
UploadLate == CasBeforeUpload /\ step = "own"
/\ \E i \in Idx : thead[i] = TF[i] /\ store[TF[i]] = "none"
/\ store' = [store EXCEPT ![TF[i]] = "pres"]
/\ UNCHANGED <<vlive, slive, claim, thead, step, up, marker, tsnap, gclist, localdone, crashes, gcs>>
/\ UNCHANGED tvars
\* step 4: marker after the last V ref is gone (and the final CAS is done), then drop the claim
Marker == step = "own" /\ ~ marker /\ up = {}
/\ (VRefs = {} \/ MarkerEarly \/ (MarkerBeforeCas /\ Cardinality(VRefs) <= Batch))
/\ marker' = TRUE /\ step' = "done" /\ localdone' = TRUE
/\ UNCHANGED <<store, vlive, slive, claim, thead, up, tsnap, gclist, crashes, gcs>>
/\ UNCHANGED tvars
DropClaim == marker /\ claim /\ claim' = FALSE
/\ UNCHANGED <<store, vlive, slive, thead, step, up, marker, tsnap, gclist, localdone, crashes, gcs>>
/\ UNCHANGED tvars
\* a snapshot of T: refused before the marker (unless the mutant allows it)
SnapT == tsnap = {} /\ thead # NoHead /\ (marker \/ SnapDuringRestore)
/\ tsnap' = THeadFids
/\ UNCHANGED <<store, vlive, slive, claim, thead, step, up, marker, gclist, localdone, crashes, gcs>>
/\ UNCHANGED tvars
\* crash of the restore process; the new owner resumes from remote facts (thead, marker)
\* nc: a resume in the fork window (no HEAD) is a retry that re-reads S (back to "c", new
\* ForkBegin requires S live); mutant ~ResumeRereads: stays "fk" with a fresh deadline (readAt = now)
\* and the content read before the crash
Crash == crashes < MaxCrash /\ step \in {"fk", "own", "done"}
/\ up' = {} \* an unpublished batch is abandoned; its fids are collectable
/\ step' = (IF ResumeLocal /\ localdone THEN "done"
ELSE IF marker THEN "done" ELSE IF thead = NoHead THEN "fk" ELSE "own")
ELSE IF marker THEN "done"
ELSE IF thead = NoHead THEN (IF (NoClaim /\ ResumeRereads) THEN "c" ELSE "fk")
ELSE "own")
/\ readAt' = (IF (NoClaim /\ thead = NoHead) THEN (IF ResumeRereads THEN None ELSE now) ELSE readAt)
/\ crashes' = crashes + 1
/\ UNCHANGED <<store, vlive, slive, claim, thead, marker, tsnap, gclist, localdone, gcs>>
/\ UNCHANGED <<now, delAt, sdelfk, ffail>>
\* user deletes V; retention deletes S when nothing holds it
DeleteV == vlive /\ vlive' = FALSE
/\ UNCHANGED <<store, slive, claim, thead, step, up, marker, tsnap, gclist, localdone, crashes, gcs>>
DeleteS == slive /\ ~ SHeld /\ slive' = FALSE
/\ UNCHANGED tvars
\* nc: whenever S is live (SDeletable = slive); records delAt and whether a fork was in its window
DeleteS == SDeletable /\ slive' = FALSE
/\ delAt' = (IF NoClaim THEN now ELSE delAt)
/\ sdelfk' = (IF (NoClaim /\ step = "fk") THEN TRUE ELSE sdelfk)
/\ UNCHANGED <<store, vlive, claim, thead, step, up, marker, tsnap, gclist, localdone, crashes, gcs>>
/\ UNCHANGED <<now, readAt, ffail>>
\* GC (reduced machine E): deletes present fids no root reaches, and fids put on the list
Gc == gcs < MaxGc
/\ store' = [f \in Fids |-> IF store[f] = "pres" /\ (f \notin Roots \/ f \in gclist) THEN "del" ELSE store[f]]
/\ gcs' = gcs + 1
/\ UNCHANGED <<vlive, slive, claim, thead, step, up, marker, tsnap, gclist, localdone, crashes>>
/\ UNCHANGED tvars
\* nc: time advances by one tick (never when NoClaim = FALSE)
Tick == NoClaim /\ now < MaxTick /\ now' = now + 1
/\ UNCHANGED <<store, vlive, slive, claim, thead, step, up, marker, tsnap, gclist, localdone, crashes, gcs>>
/\ UNCHANGED <<readAt, delAt, sdelfk, ffail>>
Next == Claim \/ ForkBegin \/ ForkEnd \/ Cas \/ Marker \/ DropClaim \/ SnapT \/ Crash \/ DeleteV \/ DeleteS \/ Gc \/ UploadLate
\/ (\E B \in BatchSet : Upload(B) \/ CasEarly(B))
\/ ForkFail \/ ForkNotFound \/ Tick
Spec == Init /\ [][Next]_vars
@@ -163,11 +233,24 @@ ClaimUntilIndependent == (thead # NoHead /\ ~ marker) => claim
ClaimUntilHead_Inv == (step = "fk") => claim
\* lifecycle independence: after the marker and the claim drop, nothing of T holds S
LifecycleFree == (marker /\ ~ claim) => ~ SHeld
\* nc replacement of LifecycleFree: nothing ever holds S; S is deletable at every moment it lives
LifecycleFreeNC == NoClaim => (~ claim /\ (SDeletable = slive))
\* nc frame check for old cfgs: with NoClaim = FALSE the new variables never move
OldFrame == (~ NoClaim) => (now = 0 /\ readAt = None /\ delAt = None /\ ~ sdelfk /\ ~ ffail)
\* INV-RESTORE-STATE-REMOTE: "done" only when the remote marker exists
StateRemote == step = "done" => marker
TypeOK == /\ step \in {"start", "c", "fk", "own", "done"} /\ up \subseteq Fids /\ tsnap \subseteq Fids
TypeOK == /\ step \in {"start", "c", "fk", "own", "done", "nf"} /\ up \subseteq Fids /\ tsnap \subseteq Fids
/\ now \in 0..MaxTick /\ readAt \in {None} \cup (0..MaxTick) /\ delAt \in {None} \cup (0..MaxTick)
/\ sdelfk \in BOOLEAN /\ ffail \in BOOLEAN
\* witnesses (r0.1): each is an invariant expected to be VIOLATED, proving the state is reachable
W_Done == ~ (marker /\ ~ claim /\ ~ slive /\ ~ vlive /\ \A i \in Idx : store[VF[i]] = "del")
W_CrashResume == ~ (marker /\ crashes = MaxCrash)
\* nc witnesses: S deleted inside the fork window and the restore still completes, every block present,
\* every V fid physically gone
W_nc_DelInFork == ~ (sdelfk /\ marker /\ step = "done" /\ ~ vlive /\ ~ slive
/\ (\A i \in Idx : store[VF[i]] = "del")
/\ (\A i \in Idx : store[thead[i]] = "pres"))
\* nc witness: a fork failed on its deadline and a retry found S gone
W_nc_FailNotFound == ~ (ffail /\ step = "nf")
=============================================================================
@@ -14,12 +14,17 @@ CONSTANTS
RetentionIgnoresMarker = FALSE
ClaimUntilHead = FALSE
NoIntent = FALSE
NoClaim = TRUE
D = 1
G = 0
MaxTick = 6
ForkChecksDeadline = TRUE
DeletedRooted = TRUE
ResumeRereads = TRUE
INVARIANTS
TypeOK
NoGap
Independent
NoForeignList
ClaimUntilIndependent
LifecycleFree
LifecycleFreeNC
StateRemote
W_CrashResume
@@ -0,0 +1,30 @@
SPECIFICATION Spec
CONSTANTS
NIdx = 3
Batch = 1
MaxCrash = 2
MaxGc = 3
DropClaimAtFork = FALSE
CasBeforeUpload = FALSE
ListForeign = FALSE
MarkerEarly = FALSE
MarkerBeforeCas = FALSE
ResumeLocal = FALSE
SnapDuringRestore = FALSE
RetentionIgnoresMarker = FALSE
ClaimUntilHead = FALSE
NoIntent = FALSE
NoClaim = TRUE
D = 1
G = 1
MaxTick = 6
ForkChecksDeadline = TRUE
DeletedRooted = TRUE
ResumeRereads = TRUE
INVARIANTS
TypeOK
NoGap
Independent
NoForeignList
LifecycleFreeNC
StateRemote
@@ -0,0 +1,30 @@
SPECIFICATION Spec
CONSTANTS
NIdx = 3
Batch = 1
MaxCrash = 2
MaxGc = 3
DropClaimAtFork = FALSE
CasBeforeUpload = FALSE
ListForeign = FALSE
MarkerEarly = FALSE
MarkerBeforeCas = FALSE
ResumeLocal = FALSE
SnapDuringRestore = FALSE
RetentionIgnoresMarker = FALSE
ClaimUntilHead = FALSE
NoIntent = FALSE
NoClaim = TRUE
D = 3
G = 2
MaxTick = 6
ForkChecksDeadline = TRUE
DeletedRooted = TRUE
ResumeRereads = TRUE
INVARIANTS
TypeOK
NoGap
Independent
NoForeignList
LifecycleFreeNC
StateRemote
@@ -0,0 +1,30 @@
SPECIFICATION Spec
CONSTANTS
NIdx = 3
Batch = 1
MaxCrash = 2
MaxGc = 3
DropClaimAtFork = FALSE
CasBeforeUpload = FALSE
ListForeign = FALSE
MarkerEarly = FALSE
MarkerBeforeCas = FALSE
ResumeLocal = FALSE
SnapDuringRestore = FALSE
RetentionIgnoresMarker = FALSE
ClaimUntilHead = FALSE
NoIntent = FALSE
NoClaim = TRUE
D = 3
G = 3
MaxTick = 6
ForkChecksDeadline = TRUE
DeletedRooted = TRUE
ResumeRereads = TRUE
INVARIANTS
TypeOK
NoGap
Independent
NoForeignList
LifecycleFreeNC
StateRemote
@@ -14,11 +14,17 @@ CONSTANTS
RetentionIgnoresMarker = FALSE
ClaimUntilHead = FALSE
NoIntent = FALSE
NoClaim = TRUE
D = 2
G = 2
MaxTick = 6
ForkChecksDeadline = TRUE
DeletedRooted = TRUE
ResumeRereads = TRUE
INVARIANTS
TypeOK
NoGap
Independent
NoForeignList
ClaimUntilIndependent
LifecycleFree
LifecycleFreeNC
StateRemote
@@ -0,0 +1,30 @@
SPECIFICATION Spec
CONSTANTS
NIdx = 3
Batch = 1
MaxCrash = 2
MaxGc = 3
DropClaimAtFork = FALSE
CasBeforeUpload = FALSE
ListForeign = FALSE
MarkerEarly = FALSE
MarkerBeforeCas = FALSE
ResumeLocal = FALSE
SnapDuringRestore = FALSE
RetentionIgnoresMarker = FALSE
ClaimUntilHead = FALSE
NoIntent = FALSE
NoClaim = TRUE
D = 2
G = 1
MaxTick = 6
ForkChecksDeadline = TRUE
DeletedRooted = TRUE
ResumeRereads = TRUE
INVARIANTS
TypeOK
NoGap
Independent
NoForeignList
LifecycleFreeNC
StateRemote
@@ -14,11 +14,17 @@ CONSTANTS
RetentionIgnoresMarker = FALSE
ClaimUntilHead = FALSE
NoIntent = FALSE
NoClaim = TRUE
D = 2
G = 2
MaxTick = 6
ForkChecksDeadline = TRUE
DeletedRooted = TRUE
ResumeRereads = TRUE
INVARIANTS
TypeOK
NoGap
Independent
NoForeignList
ClaimUntilIndependent
LifecycleFree
LifecycleFreeNC
StateRemote
@@ -14,11 +14,17 @@ CONSTANTS
RetentionIgnoresMarker = FALSE
ClaimUntilHead = FALSE
NoIntent = FALSE
NoClaim = TRUE
D = 2
G = 2
MaxTick = 6
ForkChecksDeadline = TRUE
DeletedRooted = TRUE
ResumeRereads = TRUE
INVARIANTS
TypeOK
NoGap
Independent
NoForeignList
ClaimUntilIndependent
LifecycleFree
LifecycleFreeNC
StateRemote
@@ -14,11 +14,17 @@ CONSTANTS
RetentionIgnoresMarker = FALSE
ClaimUntilHead = FALSE
NoIntent = FALSE
NoClaim = TRUE
D = 2
G = 2
MaxTick = 6
ForkChecksDeadline = TRUE
DeletedRooted = TRUE
ResumeRereads = TRUE
INVARIANTS
TypeOK
NoGap
Independent
NoForeignList
ClaimUntilIndependent
LifecycleFree
LifecycleFreeNC
StateRemote
@@ -14,11 +14,17 @@ CONSTANTS
RetentionIgnoresMarker = FALSE
ClaimUntilHead = FALSE
NoIntent = TRUE
NoClaim = TRUE
D = 2
G = 2
MaxTick = 6
ForkChecksDeadline = TRUE
DeletedRooted = TRUE
ResumeRereads = TRUE
INVARIANTS
TypeOK
NoGap
Independent
NoForeignList
ClaimUntilIndependent
LifecycleFree
LifecycleFreeNC
StateRemote
@@ -14,11 +14,17 @@ CONSTANTS
RetentionIgnoresMarker = FALSE
ClaimUntilHead = FALSE
NoIntent = FALSE
NoClaim = TRUE
D = 2
G = 2
MaxTick = 6
ForkChecksDeadline = TRUE
DeletedRooted = TRUE
ResumeRereads = TRUE
INVARIANTS
TypeOK
NoGap
Independent
NoForeignList
ClaimUntilIndependent
LifecycleFree
LifecycleFreeNC
StateRemote
@@ -14,11 +14,17 @@ CONSTANTS
RetentionIgnoresMarker = FALSE
ClaimUntilHead = FALSE
NoIntent = FALSE
NoClaim = TRUE
D = 2
G = 2
MaxTick = 6
ForkChecksDeadline = TRUE
DeletedRooted = TRUE
ResumeRereads = TRUE
INVARIANTS
TypeOK
NoGap
Independent
NoForeignList
ClaimUntilIndependent
LifecycleFree
LifecycleFreeNC
StateRemote
@@ -0,0 +1,30 @@
SPECIFICATION Spec
CONSTANTS
NIdx = 3
Batch = 1
MaxCrash = 2
MaxGc = 3
DropClaimAtFork = FALSE
CasBeforeUpload = FALSE
ListForeign = FALSE
MarkerEarly = FALSE
MarkerBeforeCas = FALSE
ResumeLocal = FALSE
SnapDuringRestore = FALSE
RetentionIgnoresMarker = FALSE
ClaimUntilHead = FALSE
NoIntent = FALSE
NoClaim = TRUE
D = 2
G = 2
MaxTick = 6
ForkChecksDeadline = FALSE
DeletedRooted = TRUE
ResumeRereads = TRUE
INVARIANTS
TypeOK
NoGap
Independent
NoForeignList
LifecycleFreeNC
StateRemote
@@ -0,0 +1,30 @@
SPECIFICATION Spec
CONSTANTS
NIdx = 3
Batch = 1
MaxCrash = 2
MaxGc = 3
DropClaimAtFork = FALSE
CasBeforeUpload = FALSE
ListForeign = FALSE
MarkerEarly = FALSE
MarkerBeforeCas = FALSE
ResumeLocal = FALSE
SnapDuringRestore = FALSE
RetentionIgnoresMarker = FALSE
ClaimUntilHead = FALSE
NoIntent = FALSE
NoClaim = TRUE
D = 2
G = 2
MaxTick = 6
ForkChecksDeadline = TRUE
DeletedRooted = FALSE
ResumeRereads = TRUE
INVARIANTS
TypeOK
NoGap
Independent
NoForeignList
LifecycleFreeNC
StateRemote
@@ -0,0 +1,30 @@
SPECIFICATION Spec
CONSTANTS
NIdx = 3
Batch = 1
MaxCrash = 2
MaxGc = 3
DropClaimAtFork = FALSE
CasBeforeUpload = FALSE
ListForeign = FALSE
MarkerEarly = FALSE
MarkerBeforeCas = FALSE
ResumeLocal = FALSE
SnapDuringRestore = FALSE
RetentionIgnoresMarker = FALSE
ClaimUntilHead = FALSE
NoIntent = FALSE
NoClaim = TRUE
D = 2
G = 2
MaxTick = 6
ForkChecksDeadline = TRUE
DeletedRooted = TRUE
ResumeRereads = FALSE
INVARIANTS
TypeOK
NoGap
Independent
NoForeignList
LifecycleFreeNC
StateRemote
@@ -0,0 +1,30 @@
SPECIFICATION Spec
CONSTANTS
NIdx = 3
Batch = 1
MaxCrash = 2
MaxGc = 3
DropClaimAtFork = FALSE
CasBeforeUpload = FALSE
ListForeign = FALSE
MarkerEarly = FALSE
MarkerBeforeCas = FALSE
ResumeLocal = FALSE
SnapDuringRestore = FALSE
RetentionIgnoresMarker = FALSE
ClaimUntilHead = FALSE
NoIntent = FALSE
NoClaim = TRUE
D = 2
G = 2
MaxTick = 6
ForkChecksDeadline = TRUE
DeletedRooted = TRUE
ResumeRereads = TRUE
INVARIANTS
TypeOK
NoGap
Independent
NoForeignList
LifecycleFreeNC
StateRemote
@@ -0,0 +1,30 @@
SPECIFICATION Spec
CONSTANTS
NIdx = 3
Batch = 1
MaxCrash = 2
MaxGc = 3
DropClaimAtFork = FALSE
CasBeforeUpload = FALSE
ListForeign = FALSE
MarkerEarly = FALSE
MarkerBeforeCas = FALSE
ResumeLocal = FALSE
SnapDuringRestore = FALSE
RetentionIgnoresMarker = FALSE
ClaimUntilHead = FALSE
NoIntent = FALSE
NoClaim = TRUE
D = 2
G = 3
MaxTick = 6
ForkChecksDeadline = TRUE
DeletedRooted = TRUE
ResumeRereads = TRUE
INVARIANTS
TypeOK
NoGap
Independent
NoForeignList
LifecycleFreeNC
StateRemote
@@ -12,13 +12,19 @@ CONSTANTS
ResumeLocal = FALSE
SnapDuringRestore = FALSE
RetentionIgnoresMarker = FALSE
ClaimUntilHead = TRUE
ClaimUntilHead = FALSE
NoIntent = FALSE
NoClaim = TRUE
D = 2
G = 2
MaxTick = 6
ForkChecksDeadline = TRUE
DeletedRooted = TRUE
ResumeRereads = TRUE
INVARIANTS
TypeOK
NoGap
Independent
NoForeignList
ClaimUntilHead_Inv
LifecycleFree
LifecycleFreeNC
StateRemote
@@ -12,13 +12,19 @@ CONSTANTS
ResumeLocal = FALSE
SnapDuringRestore = FALSE
RetentionIgnoresMarker = FALSE
ClaimUntilHead = TRUE
ClaimUntilHead = FALSE
NoIntent = FALSE
NoClaim = TRUE
D = 2
G = 2
MaxTick = 6
ForkChecksDeadline = TRUE
DeletedRooted = TRUE
ResumeRereads = TRUE
INVARIANTS
TypeOK
NoGap
Independent
NoForeignList
ClaimUntilHead_Inv
LifecycleFree
LifecycleFreeNC
StateRemote
@@ -0,0 +1,31 @@
SPECIFICATION Spec
CONSTANTS
NIdx = 3
Batch = 1
MaxCrash = 2
MaxGc = 3
DropClaimAtFork = FALSE
CasBeforeUpload = FALSE
ListForeign = FALSE
MarkerEarly = FALSE
MarkerBeforeCas = FALSE
ResumeLocal = FALSE
SnapDuringRestore = FALSE
RetentionIgnoresMarker = FALSE
ClaimUntilHead = FALSE
NoIntent = FALSE
NoClaim = TRUE
D = 2
G = 2
MaxTick = 6
ForkChecksDeadline = TRUE
DeletedRooted = TRUE
ResumeRereads = TRUE
INVARIANTS
TypeOK
NoGap
Independent
NoForeignList
LifecycleFreeNC
StateRemote
W_nc_DelInFork
@@ -0,0 +1,31 @@
SPECIFICATION Spec
CONSTANTS
NIdx = 3
Batch = 1
MaxCrash = 2
MaxGc = 3
DropClaimAtFork = FALSE
CasBeforeUpload = FALSE
ListForeign = FALSE
MarkerEarly = FALSE
MarkerBeforeCas = FALSE
ResumeLocal = FALSE
SnapDuringRestore = FALSE
RetentionIgnoresMarker = FALSE
ClaimUntilHead = FALSE
NoIntent = FALSE
NoClaim = TRUE
D = 2
G = 2
MaxTick = 6
ForkChecksDeadline = TRUE
DeletedRooted = TRUE
ResumeRereads = TRUE
INVARIANTS
TypeOK
NoGap
Independent
NoForeignList
LifecycleFreeNC
StateRemote
W_nc_FailNotFound
@@ -14,6 +14,13 @@ CONSTANTS
RetentionIgnoresMarker = FALSE
ClaimUntilHead = FALSE
NoIntent = FALSE
NoClaim = FALSE
D = 0
G = 0
MaxTick = 0
ForkChecksDeadline = TRUE
DeletedRooted = TRUE
ResumeRereads = TRUE
INVARIANTS
TypeOK
NoGap
@@ -22,3 +29,4 @@ INVARIANTS
ClaimUntilIndependent
LifecycleFree
StateRemote
OldFrame
@@ -0,0 +1,31 @@
SPECIFICATION Spec
CONSTANTS
NIdx = 3
Batch = 1
MaxCrash = 2
MaxGc = 3
DropClaimAtFork = TRUE
CasBeforeUpload = FALSE
ListForeign = FALSE
MarkerEarly = FALSE
MarkerBeforeCas = FALSE
ResumeLocal = FALSE
SnapDuringRestore = FALSE
RetentionIgnoresMarker = FALSE
ClaimUntilHead = FALSE
NoIntent = FALSE
NoClaim = FALSE
D = 0
G = 0
MaxTick = 0
ForkChecksDeadline = TRUE
DeletedRooted = TRUE
ResumeRereads = TRUE
INVARIANTS
TypeOK
NoGap
Independent
NoForeignList
LifecycleFree
StateRemote
OldFrame
@@ -14,6 +14,13 @@ CONSTANTS
RetentionIgnoresMarker = FALSE
ClaimUntilHead = TRUE
NoIntent = FALSE
NoClaim = FALSE
D = 0
G = 0
MaxTick = 0
ForkChecksDeadline = TRUE
DeletedRooted = TRUE
ResumeRereads = TRUE
INVARIANTS
TypeOK
NoGap
@@ -22,4 +29,3 @@ INVARIANTS
ClaimUntilHead_Inv
LifecycleFree
StateRemote
W_Done
@@ -12,13 +12,19 @@ CONSTANTS
ResumeLocal = FALSE
SnapDuringRestore = FALSE
RetentionIgnoresMarker = FALSE
ClaimUntilHead = TRUE
ClaimUntilHead = FALSE
NoIntent = FALSE
NoClaim = FALSE
D = 0
G = 0
MaxTick = 0
ForkChecksDeadline = TRUE
DeletedRooted = TRUE
ResumeRereads = TRUE
INVARIANTS
TypeOK
NoGap
Independent
NoForeignList
ClaimUntilHead_Inv
LifecycleFree
StateRemote
@@ -1,24 +0,0 @@
SPECIFICATION Spec
CONSTANTS
NIdx = 3
Batch = 1
MaxCrash = 2
MaxGc = 3
DropClaimAtFork = FALSE
CasBeforeUpload = FALSE
ListForeign = FALSE
MarkerEarly = FALSE
MarkerBeforeCas = FALSE
ResumeLocal = FALSE
SnapDuringRestore = FALSE
RetentionIgnoresMarker = TRUE
ClaimUntilHead = FALSE
NoIntent = FALSE
INVARIANTS
TypeOK
NoGap
Independent
NoForeignList
ClaimUntilIndependent
LifecycleFree
StateRemote
@@ -12,13 +12,20 @@ CONSTANTS
ResumeLocal = FALSE
SnapDuringRestore = FALSE
RetentionIgnoresMarker = FALSE
ClaimUntilHead = TRUE
ClaimUntilHead = FALSE
NoIntent = FALSE
NoClaim = FALSE
D = 0
G = 0
MaxTick = 0
ForkChecksDeadline = TRUE
DeletedRooted = TRUE
ResumeRereads = TRUE
INVARIANTS
TypeOK
NoGap
Independent
NoForeignList
ClaimUntilHead_Inv
ClaimUntilIndependent
LifecycleFree
StateRemote