Repository navigation
#296 Test suite cleanup: cut wall-time, fix variance, add per-fixture test-affected tooling - #301
Merged
Merged
Conversation
This was referenced May 27, 2026
nockawa
added a commit
that referenced
this pull request
May 27, 2026
- BulkLoad write path (P1-P5): opt-in throughput API skipping per-row WAL via BulkBegin/BulkEnd manifest pair; new BulkLoadSession + recovery. - Engine ALC lifecycle fix: ArchetypeRegistry refcounts per-engine, releases Type refs on dispose so collectible session ALCs can GC-unload. - Workbench Data Browser (read-only) + non-generic entity access surface on the engine. - File Map per-kind rendering: dbmap colour scheme, L0 ordering, hit-test, metrics, scale tests. - CP-04 / #301 hardening: ChunkBasedSegment AllocateChunk/FreeChunk use ChangeSet-tracked IncrementDirty + new CP-04-safe accessor overload. - ChunkBasedSegment.Grow capped-doubling at 1024 pages: avoids catastrophic single-allocation requests at scale. - BitmapL3.SetL1 CAS fix: replaced non-undoable Interlocked.Or with CompareExchange; eliminates orphan-bit leak on partial-collision. - LogicalSegment.Grow patches OLD tail's NextRawDataPBID: chain is now an actively-maintained invariant, not vestigial dead code. - EnsureDirtyAtLeast(2) on every CreateOrGrow write path: closes the lost-write window when callers pass null ChangeSet. - Chain<->Directory cross-check at LogicalSegment.Load: throws with precise diff on mismatch; loud detector for lost-writes. - CheckpointManager shutdown fixes: unconditional final cycle (no LSN gate) + removed _shutdown early-exit that skipped fsync. - DatabaseEngine.RunStorageIntegrityCheck + StorageIntegrityReport: audit API for popcount canary, chain/dir check, chunk-segment capacity invariant. - PagedMMF short-disk-read defensive Debug.Assert against stale bytes in cache slot from partial reads. - Workbench fixture: directory-per-database layout + Dev Fixture useBulkLoad toggle + stale dockview-API cleanup on session close. - Tests: BulkLoadReopenIntegration, UnknownPagesDiagnostic, BulkLoadRecovery, BulkLoadWrite, BulkManifest, BitmapL3FreeRange, ArchetypeRegistryLifecycle.
nockawa
added a commit
that referenced
this pull request
Oct 9, 2026
…otected nothing (PR #1249) ChangeSet.RegisterReDirty is gone. Its five call sites (ChunkAccessor.MarkSlotDirty, ChunkBasedSegment.AllocateChunk and TryReserveChunk, LogicalSegment.InitDataPages and the map-page path of CreateOrGrow) call only AddByMemPageIndex, and the per-page count map becomes a set. The extra mark served a checkpoint that decremented DirtyCounter. Since #824 the checkpoint never touches the counter, a set keeps its first mark on a page until ReleaseDirtyMarks clears it, and every reader tests only == 0 or > 0. A re-dirty's write obligation is the WritebackGen bump AddByMemPageIndex makes on a page it already tracks (CP-04). The removed bump was always the second of two adjacent ones, with no write between them. MarkSlotDirty no longer pays a dictionary update and two Interlocked operations per re-dirty. Thirteen source files described a DirtyCounter floor of 2, release capping at 1, or a checkpoint DecrementDirty; they now describe marks released in full and writeback debt. PS-05 and CP-04 drop RegisterReDirty, PS-01's eviction predicate includes writeback debt as TryAcquire does, and PS-05a and PS-08 name what the code uses. doc/in-depth-overview/02-storage.md follows. Five independent reviews found no regression: eviction sees DC == 0 at the same instants, the five sites are race-free on x64 and arm64, and #385, #301 and #824 cannot recur. A stress A/B against main was clean. Mutation testing found two Release-gate blind spots: an over-release on a co-owned page, and an allocation not followed by a write on its page (#301). ChangeSetCallSiteRecordingTests pins both and is named in CP-04 and PS-05. Gate-parity run: 7931 tests, 0 failures.
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 #296.
Summary
ExceptionPathLeakTests.GetRevisionElement_WhenLockTimeoutwas 78 ms ↔ 5 039 ms (1 of 3 runs spiked); now deterministic at ~80 msscripts/test-affected.pyresolves edited files → fixture set viacoverage/test-affected-map.json; focused edits run in ~1.7 s vs 30 s for the full suite (18× speedup on the typical iteration loop)What's in the diff
1. Phase 1 —
[Explicit]6Report_*benchmarks inRuntime/DagSchedulerCpuTests.csandRuntime/DagSchedulerLatencyTests.cs. They were CPU/latency measurements over multi-second windows, not regression assertions.2. Phase 2.1 — OlcBTree concurrency-test diagnostics. Replaced
int errors+Interlocked.Increment(ref errors)withConcurrentBag<Exception>+exceptions.Add(ex)in 5 OlcBTree concurrent tests; assertion message now dumps the first exception's full stack. Already paying off — surfaced a real OLC concurrency bug pattern (workers don't throw, but a key is missing on read-back) → filed as #297.3. Phase 2.2 —
[NonParallelizable]onExceptionPathLeakTestsandTransactionUnitOfWorkContextTests. Root cause:TimeoutOptions.Currentis a process-global static; every parallelDatabaseEnginector overwrites it, racing the test's own override. Filed proper architectural fix as #298.4. Phase H — Heavy-test optimization (36 tests, 14 files):
LockTest: 10 000 → 2 000 iterations (32 threads × 2 000 = 64 000 ops still ample for race detection)ReliabilityTest: 25 frames × 1 000 ops → 10 × 500TransactionChain.Stress_ConcurrentCreateDispose: 200 ms → 50 ms holdConcurrentBitmapL3 stress: 5 000 → 2 000 ops/threadWAL_ManyEntities_SurvivesReopen: 500 → 100 entitiesAccessControlSmallTests/ResourceAccessControlTests): 100 ms → 30 msHighResolutionSharedTimerServiceTests):Stopwatch.Frequency / 10(100 ms tick) →/100(10 ms) — these tests verify register/dispose semantics, not interval correctnessChunkBasedSegmentBitmapL3Tests.ClearL0_MultipleGroups_BitmapConsistency:List<int>.Contains→HashSet<int>.Contains(was O(n²) on hundreds of chunks)CreateAndLoadBigSegment(4500)(kept 5 000)5. Phase T — Test-selection tooling (
scripts/test-affected.py,scripts/build-test-affected-map.py,coverage/test-affected-map.json):PagedMMF,AccessControlSmall).--forcefor refactor-time full rebuild.Follow-ups (already filed)
TimeoutOptions.Currentfrom process-global static to per-DatabaseEngine #298 RefactorTimeoutOptions.Currentper-engine (P2, removes the[NonParallelizable]workaround)Test plan
scripts/test-affected.pyvalidated end-to-end on local-edit, cross-cutting, multi-file, and no-match fallback cases.Doc PR
Companion changes in the
claude/submodule on the same branch: research doc moved scratch → research, new design doc for the tooling. PR opened separately innockawa/typhon-claude.🤖 Generated with Claude Code