Repository navigation
Cluster migration optimization umbrella (#291) - #292
Merged
nockawa merged 2 commits intoApr 30, 2026
Merged
Conversation
The committed `schema/openapi.json` predated the v9 (`overloadLevel`, `tickMultiplier`, `metronomeWaitUs`, `metronomeIntentClass`) and v11 (`consecutiveOverrun`, `consecutiveUnderrun`) field additions to the C# `TickSummaryDto`. CI's TypeScript build failed with 11 errors because Orval generated `tickSummaryDto.ts` from the stale schema — the consumer code in `dtoConverters.ts` and `OverloadStrip.tsx` referenced fields that didn't exist on the generated DTO. Locally the regenerated TS types (gitignored) had the fields because someone had run `npm run generate-types` against a fresh schema at some point — but the source of truth was never committed. Refreshed `schema/openapi.json` from the live Kestrel `:5200/openapi.json` and adjusted four consumers for the freshly generated `number | string` field types (the standard .NET OpenAPI dual representation that all integer fields now use): * `dtoConverters.ts` — wrap the 6 new fields in `toInt(...)` for parity with `tickNumber`, `eventCount`, etc. * `tickOverview.ts` — `TickSummaryLike` widened to accept `number | string` for the 6 v9/v11 fields; `buildTickRows` coerces via `Number(...)` when assigning to the `TickRow` consumer shape. * `OverloadStrip.tsx` — wrap the 6 new field reads in `Number(...)`. * `useProfilerSessionStore.test.ts` — `tick()` factory provides the 6 now- required fields (default 0). `npx tsc --noEmit` clean; `npx vitest run` 246/246. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #291.
Summary
What started as a perf hunt on
DatabaseEngine.ExecuteMigrations(28 ms / tick on TickDriver during cluster cell-crossing storms) surfaced an architectural bug in tick-fence ChangeSet ownership, a profiler observability gap that hid it, and a missing DI registration in AntHill that silently downgraded it to WAL-less mode. All fixed; the migration loop also got a focused micro-optimization. AntHill storm tick: 28 ms → 2.96 ms (≈9.5×).See #291 for the full story (trigger, what was delivered, why this is umbrella-shaped, follow-ups out of scope).
What's in this PR
A. Tick-fence ChangeSet ownership architectural correction. Four tick-fence methods (
ExecuteMigrations,ProcessClusterShadowEntries,ProcessShadowEntries,ProcessSpatialEntries) plusUowRegistry.RecordCommitwere creating privateChangeSets and callingSaveChangesthemselves, bypassing the UoW lifecycle. Threaded_currentUow.ChangeSetfromTyphonRuntime.OnTickEndInternalthroughWriteTickFence→WriteClusterTickFence→ all four callees, and throughRecordCommit→WriteEntryFields(externalCs). Public API preserved via optional parameter (test/admin callers without a UoW get a one-shot local CS owned byWriteTickFence).B. Phases as real spans + click-to-detail. New typed kind
RuntimePhaseSpan = 243.InspectorPhaseopens a real span instead of emitting Start/End instants, so child spans (PageCacheFlush, ClusterMigration, …) attach viaparentSpanId. Phase span lands on both the tick-wide phase track AND the TickDriver swimlane. Phase-track marker glyphs forUoW Create/UoW Flush(palette green for both themes). NewProfilerSelectionvariants'phase'+'phase-marker'with dedicated DetailPane sections.C. Suppression deny-list re-tier. The
TyphonEventstatic-ctor deny-list was over-tiered — bundled diagnostic-grade kinds (PageCacheFlush, DiskRead/Write, FlushCompleted, UoWState, etc.) with the truly extreme-frequency ones (PageCacheFetch). Result: 12 kinds were unreachable from JSON config alone. After the re-tier the deny-list contains only kinds that fire ≥ 10⁵/sec on realistic workloads. Diagnostic-grade kinds are now gated solely by their JSON category like everything else.D. DetailPane UX. Relative timestamps (subtract
globalStartUsto match the ruler) via shareduseGlobalStartUs()hook.select-textopt-in for value cells (the body-leveluser-select: noneapp-feel default is preserved everywhere else). Kind-specific fields surfaced forPageCacheFlush(page count) and disk-IO spans (file page index, page count) — the page-count fingerprint was the smoking gun that proved the 1050-page flush was the migration's full dirty page set.E.1. AntHill WAL registration fix (the big one).
DatabaseEngine.InitializeWalManagerrequires bothWalWriterOptionsANDIWalFileIOregistered in DI. AntHill set the options but didn't registerIWalFileIO, so the manager silently stayednulland AntHill ran WAL-less Deferred — every UoW.Flush wrote 1050 dirty migration pages synchronously on TickDriver. Single line:.AddSingleton<IWalFileIO, WalFileIO>(). Migration storm: 28 ms → 3.18 ms.E.2. EntityMap
TryUpdateInPlaceprimitive. New public primitive onRawValuePagedHashMap:Single chain scan + single OLC write critical section instead of
TryGet + Upsert's two scans + two OLC ops + full-record memcpy. Migration step 9 uses a tinyClusterLocationUpdaterto write the 5 bytes that change. Storm: 3.18 → 2.96 ms. The primitive is generic and reusable.Net effect on AntHill storm tick
Test plan
dotnet test— Engine: 3638/3671 pass (one pre-existing flaky concurrent BTree test, unrelated)npx vitest run— Workbench: 246/246 pass;tsc --noEmitcleanCluster migration stormwarn-level log line confirming throughput🤖 Generated with Claude Code