Skip to content

Committed storage discipline (#392) + cluster crash durability (#395) - #401

Merged
nockawa merged 1 commit into
mainfrom
feature/committed-storage-mode
Jun 26, 2026
Merged

nockawa merged 1 commit into
mainfrom
feature/committed-storage-mode

Conversation

@nockawa

@nockawa nockawa commented Jun 26, 2026 •

Copy link
Copy Markdown
Collaborator

Implements #392 (Committed durability discipline) and the two #395 cluster crash-durability fixes, plus a host-crash hardening found under load.

Design doc: claude/design/Ecs/committed-storage-mode.md (rev 3). Docs PR: nockawa/typhon-claude#52.

#392 — Committed durability discipline

Runtime DurabilityDiscipline { TickFence (default) | Commit } knob on the SingleVersion layout (not a new StorageMode). Commit-discipline writes are staged per-tx (Variant A — native arena), made atomic + zero-loss durable at Transaction.Commit via the unified SlotRecord, then published in place to the cluster/flat HEAD. Read-committed, O(1) rollback, no revision chain. Exact B+Tree index reconciled at commit (spatial stays fence-batched for all modes).

#395 — cluster crash durability

  • Face A (CK-10): every checkpoint persists the per-archetype segment SPIs it consolidates, so a consolidated cluster/EntityMap base is reachable on reopen after a hard crash (was orphaned → total archetype loss).
  • Face B (CM-06): a Commit-discipline spawn WAL-logs its SingleVersion component values per-commit, so a crash before the next checkpoint recovers the entity with its values (was alive-but-default). Cluster RecoveryApplier increment added.

Host-crash hardening (top-priority, found under load)

DagScheduler.ExecuteCallbacks runs the tick on the raw timer thread; an unhandled tick exception aborted the process. Added an outer safety net mirroring WorkerLoop (log + surface via UnhandledExceptionCallback, drop the tick). Root teardown race (view-dispose vs in-flight tick) documented as a separate follow-up; benign with this net in place.

Acceptance criteria

  • AC-1 shared layout / runtime discipline
  • AC-2 commit durability (crash/recovery)
  • AC-3 atomicity + rollback
  • AC-4 read path unchanged (per-tx-constant Discipline branch only)
  • [~] AC-5 write ~SV-class — write 23.25 ns (≤25 ✓), 22.6× faster than Versioned (≥8× ✓), TickFence unregressed (+7 ns, within noise). Publish 65 ns vs ≤60 ns target — ~9% over, but BDN flagged the measurement unreliable (57 µs iteration, ±19 ns). See the benchmark comment on Committed storage discipline — commit-durable single-version components (closes ~6× Versioned write gap) #392.
  • AC-6 no revision chain allocated (staging dict = 104 B/op, 3× under Versioned's 288 B)
  • AC-7 recovery reuse (LSN-ordered SlotRecord, no Committed-specific recovery code)
  • AC-8 scheduler rejects ReadsSnapshot on non-Versioned at Build() (CM-04)
  • AC-9 Versioned & TickFence untouched
  • AC-10 tests + TLA⁺ S3 green + MixedDiscipline crash sweep (benchmarks now recorded — see AC-5)
  • AC-11 exact index at commit (flat + cluster)

Tests

Full suite: 3940 passed, 18 failed, 34 skipped — zero new reds (all 18 failures proven pre-existing baseline: spatial BulkLoad timeouts, OlcBTree #133 backpressure, lock-timeout-leak, CollectibleAlc, and the stale RunCheckpointCycle_NoDirtyPages which fails identically on main). No host crash across two full runs. New tests: CommittedDisciplineTests (AC unit), CommittedDisciplineRecoveryTests (AC-2/7 + #395 capstone), ReadsSnapshot_OnSingleVersionComponent_ThrowsAtBuild (CM-04), TickThread_UnhandledOrchestrationException_SurfacedNotHostCrash (host-crash regression), MixedDiscipline crash-sweep cells.

🤖 Generated with Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant