mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-12-06 19:17:28 +01:00
test: model atomic pool initialization and interrupted publishers
This commit is contained in:
1 parent
22793c7dbb
commit
586be4a6b4
6 files changed
+44
-12
No files matched your search
@@ -459,6 +459,7 @@ Notes:
|
||||
| `PROGRESS-DESTRUCTIVE` | Supported guest zero-data writes use ordinary COW and do not abort every update. Unsupported DSM/discard/write-zeroes opcodes reach no storage mutation. Administrative Recover/reset/BASE still invalidate and drain; progress assumes these lifecycle transitions eventually stop. | M1 Write / M5 Save | `chunk_cut_cow.go` `beforeCOWMutation`; frontend dispatch | `TestCutCOWV3_ZeroWritesDoNotAbortUpdates` (`core/storage/chunk_cut_alignment_test.go`); `TestDispatch_UnsupportedOperations` (`core/frontend/ublk/dispatch_test.go`); `TestT2Batch11a_IdentifyController_ONCSAllZero` (`core/frontend/nvme/identify_test.go`) | Guest/lifecycle distinction not modelled; native controls | ACTIVE |
|
||||
| `INV-CUT-PAYLOAD-BOUNDED-001` | Upload workers, active savers and cached saves share a configurable per-volume payload byte bound independent of candidate count; an explicit budget below six chunks is refused. An optional Budget admits before staging/barrier and accounts each COW save without a window lock; revocation aborts only the cut and its ticket is released after worker joins. Host-wide policy is a separate limiter module. WAL batch validation uses block-sized scratch even when a record spans many chunks. Pre-copy streams one chunk per worker; native at-H reads protect unsent candidates with COW. Only guest overwrites consume side-file bytes. A full side-file cap aborts the update, retains its dirty set and allows guest writes to proceed. Uploads join before cleanup. | M5 Stage / Copy / Upload | `chunk_cut_payload.go`; `chunk_cut_cow.go`; `chunk_upload.go` | `TestCutBudgetRefusesBeforeBarrier`, `TestCutBudgetCOWRefusalAbortsOnlyCut`, `TestCutBudgetRevocationJoinsBeforeRelease` (`core/storage/chunk_cut_budget_test.go`); `TestV3ReadLargeBatchScratchIsBlockBounded`, `TestCutAbortReasonsAreCountedAndCopied`, `TestCutPayloadBudgetBoundsSlots`, `TestChunkLayerPayloadBudgetRejectsUndersized` (`core/storage/chunk_cut_payload_budget_test.go`); `TestWALStoreChunk_InitialWriteAnonymousMemory` (isolated Linux RSS arms, `core/frontend/durable/provider_initial_memory_linux_test.go`); `TestCutCOWV3_ChangedImageExceedsSpillCap`, `TestChunkStageV3_ChangedImageExceedsSpillCap`, `TestCutCOWV3_OverwriteStormAbortsAndRetries`, `TestCutCOWV3_RemoteUploadDoesNotParkCopiedChunk` (`core/storage/chunk_cut_cow_spillcap_test.go`); `TestChunkUploads_FailureJoinsBeforeIntentCleanup` (`core/storage/chunk_upload_parallel_test.go`) | `CutPipeline` `AbortPoint` covers refused-point stutter; byte counts and filesystem/transport resource costs are not modelled | ACTIVE |
|
||||
| `INV-HOST-CUT-BUDGET-001` | Cooperating cut processes hold an OS slot before staging/barrier; payload and side caps are reserved per slot, including urgent slots. Cancellation never frees a slot before actual worker settlement. Missing-pool fallback is explicitly degraded and cannot claim the shared bound. | M7 admission/drain/release | `core/hostlimit`; durable `ChunkBudget`; blockvolume host-limit flags | `TestSlotsUrgentAndJoinedRelease`, `TestCOWAbortHoldsSlotUntilWorkerSettlement`, `TestHoldExpiryAndCloseDoNotSteal`, `TestKilledProcessReleasesButLiveHolderDoesNot`, `TestHostCutLimitDoesNotGateGuestIO`, `TestHostCOWCapAbortsCutAndRetainsPermitUntilJoin`, `TestCutPolicy_StaggerPreservesExplicitTimerReset`, `TestKilledInitializerDoesNotPublishPartialConfiguration` | `HostBudget` HeldUntilJoined/PayloadBound/SpillBound (bounded OS-lock abstraction; fallback excluded) | ACTIVE |
|
||||
| `INV-HOST-POOL-CONFIG-001` | A pool configuration is invisible until its complete synced temporary file is atomically renamed under the OS configuration lock. A killed initializer cannot leave a partial visible configuration that strands successors. | M7 configuration preparation/publication | `core/hostlimit` `publishConfig` | `TestKilledInitializerDoesNotPublishPartialConfiguration` | `HostBudget` NoPartialConfig/ConfigBeforeAdmission (filesystem atomicity checked natively) | ACTIVE |
|
||||
| `INV-CUT-INTENT-FIRST-001` | Before the first upload of a cut or staging round, one intent names every preallocated candidate key (unused keys are harmless), independent of upload wave count. Known-aborted reusable roots are removed at clean Close; unresolved CAS roots remain protected. Intent removal follows a known CAS outcome. | M5 Intent → Upload → CAS | `core/storage/chunk_layer.go` `captureLocked`, `stage`; `core/frontend/chunkstore/manifest.go` `PrepareManifest` | `TestCutPayloadReadsOverlapEarlierUploadsWithinBudget`, `TestCutPayloadIntentCountIndependentOfCandidates`, `TestChunkCloseDropsReusableButKeepsUnknownCASRoots`, `TestChunkIntent_WrittenBeforeFirstUploadAndDeletedAfterCAS` (`core/storage/chunk_layer_intent_test.go`); `TestChunkPrecopy_StagedUploadsAreCoveredByIntents` (`core/storage/chunk_layer_precopy_test.go`) | `ChunkLifecycleFixed` `GCSafe`; `WorkspaceTakeover` `NoLiveIntentExpired` | ACTIVE |
|
||||
| `INV-CUT-SEGMENT-REUSE-001` | A cut rewrites only manifest segments whose chunk references changed, and an uploaded but unpublished segment leaves the published root unchanged. | M5 Manifest | `core/frontend/chunkstore/manifest.go` `PrepareManifest` | `TestManifest_ReusesUnchangedRangeAndCrashKeepsOldRoot` (`core/frontend/chunkstore/manifest_test.go`) | `CutPipeline` `SegConsistent` | ACTIVE |
|
||||
| `INV-CUT-HYDRATION-WAIT-001` | A read command shares its arrival deadline across chunks. A timed-out waiter returns typed pending without cancelling a shared fill. Per-layer worker and distinct-flight limits bound remote work; Close wakes waiters and joins issued fills before storage release. Physical/hash errors remain terminal. | M4 Holder (hydration wait) | `core/storage/chunk_hydration.go`; `core/storage/walstore.go` `ReadContext`; `core/frontend/durable/storage_adapter.go` `readStorageBlock`; `core/frontend/nvme/session.go` `handleRead` | `TestDurableHydration_MultipleChunksShareOneDeadline`, `TestDurableHydration_NVMePreservesPhysicalAndHashErrors`, `TestSessionReadBudgetIncludesQueueResidence`, `TestChunkHydration_QueueAndWorkerLimitsAreBounded`, `TestChunkHydration_CloseWakesCallerAndJoinsUninterruptibleGet`, `TestChunkHydration_ContextlessReadAllowsSlowFill`, `TestChunkHydration_NewGenerationDoesNotJoinStaleGet`, `TestChunkHydration_StaleCompletionKeepsReplacement`, `TestDurableHydration_RMWFenceWinsCallerExpiry` | — | ACTIVE |
|
||||
|
||||
@@ -1,43 +1,61 @@
|
||||
----------------------------- MODULE HostBudget -----------------------------
|
||||
EXTENDS Integers, FiniteSets, TLC
|
||||
CONSTANTS N, SlotCount, Payload, Spill, EarlyRelease
|
||||
CONSTANTS N, SlotCount, Payload, Spill, EarlyRelease, AtomicConfig
|
||||
Owners == 1..N
|
||||
Slots == 1..SlotCount
|
||||
VARIABLES phase, owner, slot, saved
|
||||
vars == <<phase, owner, slot, saved>>
|
||||
Init == /\ phase = [o \in Owners |-> "free"]
|
||||
VARIABLES phase, owner, slot, saved, cfg, initializer
|
||||
vars == <<phase, owner, slot, saved, cfg, initializer>>
|
||||
Init == /\ cfg = "absent"
|
||||
/\ initializer = 0
|
||||
/\ phase = [o \in Owners |-> "free"]
|
||||
/\ owner = [s \in Slots |-> 0]
|
||||
/\ slot = [o \in Owners |-> 0]
|
||||
/\ saved = [o \in Owners |-> 0]
|
||||
Admit(o,s) == /\ phase[o] = "free" /\ owner[s] = 0
|
||||
Admit(o,s) == /\ cfg = "ready"
|
||||
/\ phase[o] = "free" /\ owner[s] = 0
|
||||
/\ (o = N \/ s < SlotCount)
|
||||
/\ phase' = [phase EXCEPT ![o] = "active"]
|
||||
/\ owner' = [owner EXCEPT ![s] = o]
|
||||
/\ slot' = [slot EXCEPT ![o] = s]
|
||||
/\ UNCHANGED saved
|
||||
/\ UNCHANGED <<saved,cfg,initializer>>
|
||||
Save(o) == /\ phase[o] = "active" /\ saved[o] < Spill
|
||||
/\ saved' = [saved EXCEPT ![o] = @ + 1]
|
||||
/\ UNCHANGED <<phase,owner,slot>>
|
||||
/\ UNCHANGED <<phase,owner,slot,cfg,initializer>>
|
||||
Abort(o) == /\ phase[o] = "active"
|
||||
/\ phase' = [phase EXCEPT ![o] = "draining"]
|
||||
/\ owner' = IF EarlyRelease THEN [owner EXCEPT ![slot[o]] = 0] ELSE owner
|
||||
/\ UNCHANGED <<slot,saved>>
|
||||
/\ UNCHANGED <<slot,saved,cfg,initializer>>
|
||||
Join(o) == /\ phase[o] \in {"active","draining"}
|
||||
/\ phase' = [phase EXCEPT ![o] = "joined"]
|
||||
/\ UNCHANGED <<owner,slot,saved>>
|
||||
/\ UNCHANGED <<owner,slot,saved,cfg,initializer>>
|
||||
Release(o) == /\ phase[o] = "joined"
|
||||
/\ owner' = [owner EXCEPT ![slot[o]] = 0]
|
||||
/\ phase' = [phase EXCEPT ![o] = "free"]
|
||||
/\ slot' = [slot EXCEPT ![o] = 0]
|
||||
/\ saved' = [saved EXCEPT ![o] = 0]
|
||||
/\ UNCHANGED <<cfg,initializer>>
|
||||
Crash(o) == /\ phase[o] # "free"
|
||||
/\ owner' = [owner EXCEPT ![slot[o]] = 0]
|
||||
/\ phase' = [phase EXCEPT ![o] = "free"]
|
||||
/\ slot' = [slot EXCEPT ![o] = 0]
|
||||
/\ saved' = [saved EXCEPT ![o] = 0]
|
||||
Next == (\E o \in Owners,s \in Slots: Admit(o,s)) \/
|
||||
/\ UNCHANGED <<cfg,initializer>>
|
||||
BeginConfig(o) == /\ cfg = "absent"
|
||||
/\ cfg' = IF AtomicConfig THEN "writing" ELSE "partial"
|
||||
/\ initializer' = o
|
||||
/\ UNCHANGED <<phase,owner,slot,saved>>
|
||||
PublishConfig == /\ cfg \in {"writing","partial"}
|
||||
/\ cfg' = "ready" /\ initializer' = 0
|
||||
/\ UNCHANGED <<phase,owner,slot,saved>>
|
||||
CrashInitializer == /\ cfg \in {"writing","partial"}
|
||||
/\ cfg' = "absent" /\ initializer' = 0
|
||||
/\ UNCHANGED <<phase,owner,slot,saved>>
|
||||
Next == (\E o \in Owners: BeginConfig(o)) \/ PublishConfig \/ CrashInitializer \/
|
||||
(\E o \in Owners,s \in Slots: Admit(o,s)) \/
|
||||
(\E o \in Owners: Save(o) \/ Abort(o) \/ Join(o) \/ Release(o) \/ Crash(o))
|
||||
Spec == Init /\ [][Next]_vars
|
||||
NoPartialConfig == cfg # "partial"
|
||||
ConfigBeforeAdmission == (\E o \in Owners: phase[o] # "free") => cfg = "ready"
|
||||
HeldUntilJoined == \A o \in Owners: phase[o] # "free" => owner[slot[o]] = o
|
||||
RECURSIVE Total(_)
|
||||
Total(n) == IF n=0 THEN 0 ELSE saved[n]+Total(n-1)
|
||||
|
||||
@@ -315,3 +315,5 @@ end-to-end wall-clock latency guarantee. Keep long model runs off tp04.
|
||||
## HostBudget
|
||||
|
||||
`HostBudget.tla` abstracts cooperating process slots, COW reservation and joined release. Config `HostBudget.cfg` checks three owners/two slots; `HostBudget_early_release.cfg` must violate HeldUntilJoined. It excludes degraded static fallback and does not prove filesystem locks, rates or physical-I/O deadlines. Native subprocess tests cover lock lifetime.
|
||||
|
||||
HostBudget also models guarded configuration initialization: staged bytes are invisible until atomic publication; an initializer crash permits a successor. `HostBudget_partial_config.cfg` must violate NoPartialConfig. The syscall-level crash boundary is covered by TestKilledInitializerDoesNotPublishPartialConfiguration.
|
||||
@@ -4,5 +4,6 @@ SlotCount=2
|
||||
Payload=1
|
||||
Spill=2
|
||||
EarlyRelease=FALSE
|
||||
AtomicConfig=TRUE
|
||||
SPECIFICATION Spec
|
||||
INVARIANTS HeldUntilJoined PayloadBound SpillBound
|
||||
INVARIANTS NoPartialConfig ConfigBeforeAdmission HeldUntilJoined PayloadBound SpillBound
|
||||
@@ -4,5 +4,6 @@ SlotCount=2
|
||||
Payload=1
|
||||
Spill=2
|
||||
EarlyRelease=TRUE
|
||||
AtomicConfig=TRUE
|
||||
SPECIFICATION Spec
|
||||
INVARIANTS HeldUntilJoined PayloadBound SpillBound
|
||||
INVARIANTS NoPartialConfig ConfigBeforeAdmission HeldUntilJoined PayloadBound SpillBound
|
||||
@@ -0,0 +1,9 @@
|
||||
CONSTANTS
|
||||
N=3
|
||||
SlotCount=2
|
||||
Payload=1
|
||||
Spill=2
|
||||
EarlyRelease=FALSE
|
||||
AtomicConfig=FALSE
|
||||
SPECIFICATION Spec
|
||||
INVARIANTS NoPartialConfig ConfigBeforeAdmission HeldUntilJoined PayloadBound SpillBound
|
||||
Reference in new issue
Block a user