Repository navigation
[GC] GC25: Make N>1 sync writes visible only once durable, drop the failed-sync hiding machinery - #22
Closed
JustinGaoF wants to merge 1 commit into
Closed
JustinGaoF wants to merge 1 commit into
JustinGaoF wants to merge 1 commit into
Conversation
…ailed-sync hiding machinery
[GC] GC25
Reviewer question: Is a sync write now visible only once durable, with async writes behaving as at N=1, and is the failed-sync hiding machinery gone without losing D-1 handling?
Short answer. Yes. At N>1 a sync group's sync writers are inserted and published only after their records, and every lower record on every partition, are fsynced (RunSyncGate). Visibility stays the applied contiguous prefix. A failed fsync is handled as a failed append (D-1): the group's range is pinned under an open fence, the DB stops, every unreturned write above it fails with the background error, and Resume's flush plus the fence close keep it invisible, including after a reopen that follows Resume (Q1). In a sync-led group the async writers take the lower sequences and return as soon as those are visible, before the fsync. 2PC pre-release callbacks of sync writers run only after the fsync succeeds (Q2). The read mask, masked memtables, the masked flush drops, MemPurge mask inheritance, mask retirement, the exact (closed) failed-sync fence, the sync-group registration and the fence intent are removed; D-1's pinned ranges, open fences, recovery flush drop at UnreleasedWalGateFenceLow and the Resume fence close stay (Q3). Q4 updates the option doc, adds the release note and pins the reopen-without-Resume rule. Q5 gates an empty disableWAL commit that creates a snapshot. Q6 is measurement.
GC26 areas: ExplainBurnedWALIndices, CoverBurnedWALIndex, the recovery merge and the open path are not touched.
## Answers
### Q1. A sync write is visible only once durable
Property: at N>1 a sync write is visible (Get, MultiGet, plain iterators, new snapshots, LastSequence()) only after its record and every lower record on every partition are fsynced. Visibility stays a contiguous prefix. On fsync failure the write returns the error and is never visible: not before Resume, not after it, not after a reopen that follows Resume; every higher write that has not returned fails with the background error; the DB stops and Resume recovers as for an append failure; coalescing stays.
How:
- WriteImpl, when N>1 and the leader is sync (`sync_group`), allocates the group's sequences in two runs: the async writers first ([low, sync_first_sequence - 1]), then the sync writers ([sync_first_sequence, high]). AllocateSequenceAndWALIndex registers them as two applied ranges (new `leading_sequence_count`). MergeBatch merges in the same order, so the WAL record's sequence layout matches.
- The leader inserts only the async writers' batches in the group. The sync writers' range is left unapplied, so no publication can pass it.
- The completion gate of a sync group is RunSyncGate (db_impl_write.cc): the coalesced gate fsync (RunCoalescedGateSync over SyncWalsFromCompletionGate, unchanged), the second threshold (RunCompletionGate with `published=false`, which syncs again if the first fsync's safe point was below the group's target), then the sync writers' pre-release callbacks, their memtable insert (concurrent insert, leader's write options), and only then PublishLastSequence. It then waits until the range is published (WaitForWalDurability(target, wal_record, published)).
- A sync group is counted in unpublished_sync_groups_ from gate install until RunSyncGate publishes or fails its range. WaitForPendingWrites (every memtable switch, flush and recovery) and TEST_SwitchMemtable wait for the count to reach zero (WaitForUnpublishedSyncGroups), so the insert lands in the memtables current at allocation and AssertLastSequenceCoversAllocated holds. Deadlock argued: the wait is on bg_cv_ under mutex_; RunSyncGate needs mutex_ only transiently, plus WAL, sync-mark and sequence_wal_index mutexes; the appends below it never need the write thread or the switch gate.
- On failure (FailUnpublishedSyncRange): if the fsync failed, WALIOStatusCheck has already set the background error (N>1 requires paranoid_checks); the range is pushed to failed_wal_ranges_ and an open fence is installed at its low, exactly as WALIOStatusCheck does for a failed append. Every gate above it then returns the fence status (the background error). Resume's recovery flush drops every entry at or above the fence (UnreleasedWalGateFenceLow, unchanged), ClearWalDurabilityBGError closes the fence at the last allocated sequence and records the indeterminate range once (several failed syncs can share one fsync; their fences close at the same high, so the lowest low covers them), and releases the range.
- A failure with no background error set (the fsync succeeded but recording the synced WALs in the MANIFEST failed, or shutdown began) publishes the range as a hole, as at N=1 where such a write fails having inserted nothing and the DB goes on (keeps the M2 test FailedSyncTrackingReleasesItsRange passing). A failed pre-release callback sets the background error from its status, as before.
- Coalescing stays: RunCoalescedGateSync keeps its epochs, minus the waiter list that existed only for fencing.
- The removed GC18 clamp in PublishAppliedFrontierLocked is no longer needed: nothing publishes above an unfsynced sync range, because the range itself is unapplied until RunSyncGate.
Evidence:
- New SyncWriteVisibleOnlyOnceDurable (N in {2, 8}): S (sync) held in its fsync; Get, MultiGet, a plain and a tailing iterator, and GetLatestSequenceNumber do not see it, and a write C above it does not return. Released: S and C visible. Failing: S and C fail, S invisible before and after Resume and after a reopen in all 4 recovery modes.
- Rewritten to D-9: FailedGateSyncWriteStaysInvisible, FailedGateSyncStaysInvisibleAtNPartitions, FailedSyncRangeDeletionHiddenUntilResumeDropsIt, FailedGateSyncRangeDeletionStaysHidden, FailedGateSyncFailsWritesAbove (replaces FailedGateSyncKeepsAckedWritesAbove), GatePostWaitSyncFailureWakesParkedGate (W above a failed post-wait sync now fails at once instead of parking again), FailedGateSyncFencesCoalescedWaiterAtomically, FailedGateSyncFenceGoesInWithItsError, CoalescedFailedGateSyncFencedWithItsError (recovery now waits for the pending group: held until recovery reaches DBImpl::WaitForUnpublishedSyncGroups:Wait, then recovery_waited), GateSyncToleratesCoupledRotation (the rotation lands after the sync finishes).
Neuters (each applied to this commit, rebuilt, its tests run one by one, then the tree restored and checked identical to HEAD; every listed test fails):
- N1, insert and publish the sync range before its fsync (RunSyncGate's callbacks, insert and PublishLastSequence moved before RunCoalescedGateSync): SyncWriteVisibleOnlyOnceDurable (S reads back while held; abort), FailedGateSyncWriteStaysInvisible, FailedGateSyncStaysInvisibleAtNPartitions, FailedSyncRangeDeletionHiddenUntilResumeDropsIt ("zebra" no longer parks), FailedGateSyncRangeDeletionStaysHidden, FailedGateSyncAbsentUnderTransactionDB.
- N1b, publish the sync writers on group exit and not in RunSyncGate (PublishOnGroupExit ignoring sync_first_sequence): FailedGateSyncFailsWritesAbove.
- N9, no fence for a failed sync (FailUnpublishedSyncRange always publishing a hole): GatePostWaitSyncFailureWakesParkedGate, FailedGateSyncFailsWritesAbove.
- N10, no drop at the fence (UnreleasedWalGateFenceLow returning kMaxSequenceNumber): FailedSyncRangeDeletionHiddenUntilResumeDropsIt ("zebra", inserted before it failed, reads back after Resume), FailedGateSyncFailsWritesAbove. FailedGateSyncAbsentUnderTransactionDB passes under N10: the failed sync write is never inserted, so there is nothing of it to drop; its neuter is N1.
- N8, one indeterminate record per closed fence (before this commit's fix): FailedGateSyncWriteStaysInvisible (debug assertion in WalRecoverySequenceTracker::Record: two fences closed at the same high with different lows).
- N7, no hole release when no background error is set: FailedSyncTrackingReleasesItsRange (the later write fails with Corruption: Not active).
### Q2. Async writes as at N=1; 2PC callbacks after the fsync
Property: async members of a sync-led group take the lower sequences and return without waiting for the fsync. 2PC pre-release callbacks run only after the fsync succeeds. A failed commit is never visible and Rollback() then works. A failed sync Prepare leaves no prepared-heap entry. WriteCommitted and N=1 are unchanged.
How:
- WriteThread::WriteGroup gets `sync_first_sequence` and `async_writers_gate`. In ExitAsBatchGroupLeader (non-pipelined path), after the next leader is promoted and before the completion gate, the leader runs async_writers_gate: WaitForWalDurability(sync_first_sequence - 1, wal_record, published), then the async writers' post-memtable callbacks. CompleteAsyncWriters then completes the async writers (status, STATE_COMPLETED) and relinks the group to the leader and the sync writers only, so RunSyncGate and the exit see just those.
- Sequence assignment and pre-release callbacks run in two passes for a sync group: async writers first, callbacks inline only for them (count = async_pre_release_callback_cnt); the sync writers' callbacks run in RunSyncGate after the fsync, with their own count. A failed fsync therefore never reaches AddPrepared/AddCommitted for those writers: WritePrepared's prepared heap and commit cache hold nothing for them, and Rollback() of the failed commit finds its prepare still uncommitted.
- An async group above a pending sync group still waits for it: its gate waits for its range to be published, and the prefix cannot pass the unapplied sync range. This is the N=1 order (a write after a sync write is visible after it).
- WriteCommitted 2PC has no pre-release callbacks; its sync commit follows Q1 only. N=1 takes none of these paths (`sync_group` requires N>1): byte identity below.
Evidence:
- New SyncLedGroupAsyncWritersReturnBeforeFsync (N in {2, 8}): group [L sync, A1, A2] with L's fsync held; A1 and A2 return OK and read back, LastSequence() stops just below L's sequence, L has not returned. Released, L returns and reads back.
- New WritePreparedPartitionedWalTest.FailedSyncCommitAndPrepareNeverVisible (WRITE_PREPARED and WRITE_UNPREPARED, N in {2, 8}): a sync Commit whose gate fsync fails returns IOError and is absent before and after Resume and after a reopen; Rollback() then succeeds; a sync Prepare whose fsync fails leaves no prepared-heap entry (after Resume a new snapshot's min_uncommitted lies above it); GetTransactionByName finds nothing after reopen.
Neuters:
- N2, the async writers wait for an fsync before they complete (SyncWalsFromCompletionGate at the start of async_writers_gate): SyncLedGroupAsyncWritersReturnBeforeFsync (A1 and A2 do not return while L is held).
- N3, the sync writers' pre-release callbacks run in the group, before the gate (as at the base): FailedSyncCommitAndPrepareNeverVisible (the failed commit reads back after Resume(); then Rollback() hits AddCommitted's assertion `evicted.prep_seq != prepare_seq`).
### Q3. Removed machinery; D-1 handling kept
Removed:
- The read mask: db/db_impl/wal_gate_read_mask.h (WalGateReadMask, LiveWalGateReadMask), WalGateReadMaskRanges, NewTailingWalGateReadMask, RegisterTailingWalGateReadMaskCleanup, the mask in GetImpl, MultiGetCommon, MultiGetWithCallbackImpl, NewIterator(s) and NewIteratorImpl, TEST_WalGateReadMaskRanges, wal_gate_read_masks_, wal_gate_read_mask_version_, wal_gate_read_mask_mutex_.
- Masked memtables: MemTable/ReadOnlyMemTable SetMaskedSequenceRanges, GetMaskedSequenceRanges, HasMaskedSequenceRanges, DropMaskedSequenceRanges, masked_ranges_, has_masked_ranges_, the masked range-tombstone filter in NewRangeTombstoneIterator, MemTableListVersion::Remove's history exclusion, MemTableList's masked bookkeeping, wal_gate_masked_memtables_.
- The masked part of the flush drops: FlushJob's masked ranges (FailedGateSyncFlushDrops, SequenceFloorIterator's masked ranges and the masked range-deletion accounting); DropEntriesAtOrAbove takes the floor only.
- MemPurge mask inheritance (FlushJob::MemPurge keeps only the fence floor drop).
- Mask retirement: MaybeRetireWalGateReadMasks and both call sites (BackgroundCallFlush, InstallSuperVersionAndScheduleWork).
- The failed-sync fence: InstallFailedGateSyncFence, FenceFailedGateSync, WalGateFence::exact and the exact-fence matching in WalGateFenceStatusLocked, the `high` parameter of InstallWalGateFence, the closed_fence recompute in ClearWalDurabilityBGError, OpenWalGateFenceLowLocked (folded back into UnreleasedWalGateFenceLow).
- The fence intent and registration: GateSyncFenceIntent and its thread_local, the intent branch of WALIOStatusCheck, RegisterGateSyncGroup, EndGateSyncGroup, WalGateSyncWaiter and wal_gate_sync_waiters_.
- The GC18 frontier clamp in PublishAppliedFrontierLocked.
Kept (D-1): failed_wal_ranges_ pinned in WALIOStatusCheck under the same mutex_ hold as the error; open fences (InstallWalGateFence, released_by_recovery) and WalGateFenceStatusLocked; the flush drop at UnreleasedWalGateFenceLow, recovery's included; ClearWalDurabilityBGError's fence close, indeterminate record and range release at Resume; SignalWalDurabilityWaitersOnBGError.
Evidence:
- `git grep -nE '<removed symbols>'` at this commit: no match (exit 1); the same pattern has 195 matches at the base. Pattern: WalGateReadMask|LiveWalGateReadMask|wal_gate_read_mask|NewTailingWalGateReadMask|RegisterTailingWalGateReadMaskCleanup|SetMaskedSequenceRanges|GetMaskedSequenceRanges|HasMaskedSequenceRanges|DropMaskedSequenceRanges|MaskedSequenceRanges|has_masked_ranges_|masked_ranges_|wal_gate_masked_memtables_|wal_gate_read_masked_|MaybeRetireWalGateReadMasks|FailedGateSyncFlushDrops|InstallFailedGateSyncFence|FenceFailedGateSync|GateSyncFenceIntent|gate_sync_fence_intent|RegisterGateSyncGroup|EndGateSyncGroup|WalGateSyncWaiter|wal_gate_sync_waiters_|OpenWalGateFenceLowLocked|TEST_WalGateReadMaskRanges.
- D-1 tests unchanged and passing: the DBWalAppendFailureTest append-failure tests (EveryAppendFailureStopsTheDb, GateFailedWriteNeverSurvivesRecovery, FailedResumeKeepsFailingLaterWrites, FailedHoleExplanationFailsResume, RetryFlushResumeExplainsBurnedIndex and the rest) in the full db_write_test run.
Removed tests, with reasons:
- FailedGateSyncKeepsAckedWritesAbove: asserts D-7 (writes above a failed sync are acknowledged); D-9 fails them. Replaced by FailedGateSyncFailsWritesAbove.
- FailedGateSyncSparesZeroCountWriteAbove: asserts D-7 through the exact fence, which is gone; a zero-count write above a failed sync now fails like any other.
- LateSyncGroupFencedWithTheFailure: tests the registration; the scenario (a published group still in its gate when recovery flushes) cannot happen, since recovery waits for every unpublished sync group and a sync group publishes nothing before its fsync.
- FailedGateSyncRangeDeletionHiddenAfterMemPurge: a memtable switch can no longer seal a pending sync group's memtable before its insert, and inheritance is removed; the D-9 property (never visible) is covered by FailedSyncRangeDeletionHiddenUntilResumeDropsIt and FailedGateSyncRangeDeletionStaysHidden.
- AsyncWriteDoesNotWaitForOtherPartitionsSync and AsyncAboveSyncReturnsWhileSyncFsyncHeld: assert that a write above a pending sync returns before that sync; D-9 requires it to wait (visibility is a contiguous prefix, as at N=1).
Renamed and rewritten: FailedGateSyncMaskRetiresUnderTransactionDB -> FailedGateSyncAbsentUnderTransactionDB (no mask to retire; asserts absence through every read path and after reopen).
Other rewritten tests: FailedZeroCountSyncLeavesNoIndeterminateRecord and FailedZeroCountGateSyncRecordsNoIndeterminate (fences close empty, low > high), FailedSyncPrepareLeavesNoStaleFence (an open fence at L + 1 after the failure, empty after Resume), the mask lines of FailedGateSyncRangeDeletionStaysHidden dropped, comments of AsyncOnSyncingPartitionWaitsForItsFsync and SyncWriteAboveAsyncWriteSurvivesCrash.
Neuters (each applied to this commit, rebuilt, its tests run one by one, then the tree restored and checked identical to HEAD; every listed test fails):
- N4, no WaitForUnpublishedSyncGroups: FailedGateSyncFencesCoalescedWaiterAtomically, FailedGateSyncFenceGoesInWithItsError, CoalescedFailedGateSyncFencedWithItsError (recovery never waits), GateSyncToleratesCoupledRotation (aborts).
- N5, close the fence at max(low, last allocated) and record it, as before: FailedZeroCountGateSyncRecordsNoIndeterminate, FailedZeroCountSyncLeavesNoIndeterminateRecord, FailedSyncPrepareLeavesNoStaleFence.
### Q4. Docs and the reopen pin
- include/rocksdb/options.h, `wal_partitions`: only the sync/failed-sync paragraph is replaced (D-9 text: sequence-order visibility; a sync write visible once it and everything before it is synced; async writes do not wait for a sync they precede; a later write waits for a pending sync; a failed sync is never visible, later unreturned writes fail and writes stop until Resume; a reopen without Resume, or a backup or checkpoint taken before Resume, may recover a failed write whose record reached the WAL, as with one WAL).
- New unreleased_history/behavior_changes/partition_wal_sync_visibility.md.
- New FailedSyncReopenWithoutResumeMayRecoverIt (N in {2, 8}, all 4 recovery modes): a failed sync write whose record reached the WAL is invisible before Close; a reopen without Resume (error still set at Close) recovers it. It pins today's documented rule; there is no fix to neuter. Its discrimination is shown by its counterpart: SyncWriteVisibleOnlyOnceDurable reopens after Resume in the same 4 modes and finds the write absent.
### Q5. An empty disableWAL commit's snapshot is at or below the published frontier
Property: a snapshot created by an empty disableWAL commit (CommitAndTryCreateSnapshot) is at or below LastSequence() when created.
How: WriteImpl installs the disableWAL completion gate also for a group that consumes no sequence when it has a post-memtable callback (`seq_inc > 0 || has_post_memtable_callback`); the wrapper that runs post-memtable callbacks after the gate now requires a gate. The callback (snapshot creation) runs once every sequence at or below the group's is published.
Evidence: new TransactionPartitionedWalTest.EmptyDisableWalCommitSnapshotIsPublished: W (other partition) held after allocation, before insert; T's empty disableWAL commit parks (TEST_WalDurabilityWaiters() == 1); released, T's snapshot equals published_before + 1 and is at or below LastSequence(); reads through it repeat.
Neuter: N6, the old condition (seq_inc > 0 only): the test aborts on SnapshotCreationCallback's assertion `db_impl_->GetLastPublishedSequence() >= seq` (the snapshot lies above the published sequence).
### Q6. Measurement
Paired, interleaved runs (base = pwal/gc24 @ 121a5a0, commit = this commit; order base/commit, commit/base, base/commit), release static db_bench built in worktrees under the tmp dir, DBs under TEST_TMPDIR. Measured values only, three runs each, in run order. The host is shared: the load average (uptime) before each run was 15 to 26 for every cell except the trigger cell's first pair (about 42); per-run values in q6/results.jsonl.
GC16 trigger cell: fillrandom, N=8, partition_by_column_family, 64 CFs, 16 threads x 2000, value 1024, 1-in-20 sync, injected append and sync latency 1000 us (jitter 100):
| | ops/s | p99 us (Microseconds per write) |
| base | 3593, 3174, 3440 | 49293, 68429, 61664 |
| commit | 1270, 1190, 1289 | 47980, 49670, 48089 |
fillrandom, N=8, 64 CFs, 16 threads x 2000, value 100, no latency injection (real fsync):
| sync | base ops/s | commit ops/s | base p99 us | commit p99 us |
| 0% | 397111, 355943, 351953 | 398044, 390329, 391959 | 82, 106, 108 | 92, 89, 93 |
| 5% (1 in 20) | 12659, 12970, 9406 | 3123, 3302, 3222 | 22081, 20780, 20865 | 21359, 23751, 21636 |
| 50% (1 in 2) | 2368, 501, 564 | 1745, 301, 288 | 29066, 131753, 108260 | 25924, 149803, 156883 |
WritePrepared, mixed sync (wp_bench: 16 threads x 1000 transactions, each SetName, one Put, Prepare, Commit; 1 in 20 transactions sync=true; 16 CFs; latency per transaction):
| | txn/s | p50 us | p99 us | p99.9 us |
| N=8 base | 1585, 1828, 1231 | 36, 33, 34 | 199546, 148736, 236271 | 260420, 208453, 320997 |
| N=8 commit | 320, 292, 220 | 39915, 46439, 61643 | 174118, 236034, 351703 | 2390630, 1125430, 2044203 |
| N=1 base (reference) | 1892, 1708, 1857 | 8068, 7714, 5647 | 29450, 38614, 51742 | 179506, 249160, 441419 |
| N=1 commit (reference) | 1756, 1681, 1153 | 8269, 6593, 8039 | 60104, 67362, 129329 | 156925, 345776, 895572 |
Reads: one db_bench run per side does fillrandom, readrandom, then seekrandom with use_tailing_iterator=1 and seek_nexts=10 (8 threads, num 50000, reads 50000, 8 CFs, value 100); also compared with pwal/gc20-base (fbea767), interleaved three ways:
| | readrandom ops/s | readrandom p99 us | tailing seek ops/s | tailing seek p99 us |
| N=1 base | 3689049, 3715710, 3952295 | 4.50, 4.76, 4.19 | 684409, 751556, 804992 | 21.56, 20.21, 20.25 |
| N=1 commit | 3090497, 3471920, 3852414 | 5.08, 4.77, 3.99 | 753659, 969917, 730109 | 21.80, 19.33, 20.23 |
| N=1 gc20-base | 3774688, 3743740, 3538507 | 3.99, 4.22, 4.76 | 721474, 660189, 608579 | 20.51, 21.89, 23.50 |
| N=8 base | 3570950, 3659351, 3568019 | 4.68, 3.98, 4.81 | 717411, 667664, 565904 | 21.80, 20.70, 21.79 |
| N=8 commit | 3477172, 3550600, 3499409 | 4.73, 4.28, 4.20 | 708674, 647485, 611655 | 21.56, 21.45, 21.78 |
| N=8 gc20-base | 3915311, 3545564, 3832996 | 4.05, 4.80, 4.35 | 800160, 756279, 575762 | 21.62, 21.47, 21.61 |
Reading: with no sync, writes and reads are unchanged within run-to-run spread (no read mask is consulted any more). With mixed sync at N=8, throughput falls by about 3x and an async write's median latency rises from tens of microseconds to tens of milliseconds, because every write ordered after a pending sync now waits for that sync's fsync of every partition (D-9); GC24 published sync writes before their fsync. At N=1 the same workload's median already includes that wait. The spec sets no numeric perf target for this round, so none is listed as met or missed.
## Fold-back split
Blame at the base plus the Differential Revision line. GC commits carry no such line; per the doc, their lines go to the diff their round's split named: GC18 and GC20 gate-sync lines to D123551605; GC20, GC21 and GC24 fence, mask, retirement and flush-drop lines to D123701876.
- -> D123551605 (completion gating):
- db/write_thread.h WriteGroup::sync_first_sequence, async_writers_gate and CompleteAsyncWriters; db/write_thread.cc ExitAsBatchGroupLeader's async_writers_gate call and CompleteAsyncWriters: new code beside D123551605's completion_gate.
- db/db_impl/db_impl_write.cc WriteImpl: the sync_group counting loop (modifies upstream lines from D15741985), the two-pass sequence and pre-release callback loop (modifies upstream lines from D14221670, D14665210, D71939382, D29639917), the gate install (D123551605 lines, plus GC18 and GC24 registration lines), UnpublishedSyncGroup and the post-memtable wrapper condition, the sync-group branch of the leader's insert (next to D76641755's line).
- db_impl_write.cc WriteImplWALOnly: GC24 registration lines removed, the RunCompletionGate call.
- db_impl_write.cc MergeBatch two-pass merge: modifies upstream lines from D36917464, D6148023, D4838188, D6324312, D24006862, D5210732; it exists for the sync group's sequence order.
- db_impl_write.cc PublishAppliedFrontierLocked: GC18 clamp removed.
- db_impl_write.cc WaitForWalDurability `published` parameter: D123551605 and GC20 lines.
- db_impl_write.cc RunCompletionGate, RunCoalescedGateSync (waiter list and group parameter removed): D123551605 lines and GC18, GC20, GC21, GC24 gate-sync lines; RegisterGateSyncGroup and EndGateSyncGroup (GC24 lines) removed; new RunSyncGate and EndUnpublishedSyncGroup; SyncWalsFromCompletionGate comment (GC18 lines).
- db/db_impl/db_impl.h: WaitForPendingWrites' call and WaitForUnpublishedSyncGroups, unpublished_sync_groups_, RunSyncGate, EndUnpublishedSyncGroup, the RunCompletionGate/WaitForWalDurability declarations and comments (D123551605 and GC18/GC20/GC24 lines), the removed Register/End declarations and WalGateSyncWaiter.
- db/db_impl/db_impl_debug.cc TEST_SwitchMemtable's wait (next to D19771719's line).
- Tests: SyncWriteVisibleOnlyOnceDurable, SyncLedGroupAsyncWritersReturnBeforeFsync (new); GateSyncToleratesCoupledRotation, FailedGateSyncWriteStaysInvisible, AsyncOnSyncingPartitionWaitsForItsFsync and the removed AsyncAboveSyncReturnsWhileSyncFsyncHeld (GC18 lines); FailedGateSyncFencesCoalescedWaiterAtomically and the removed LateSyncGroupFencedWithTheFailure (GC24 lines, which GC24's split sent here); WritePreparedPartitionedWalTest.FailedSyncCommitAndPrepareNeverVisible (new, in D123079329's fixture, testing this diff's gate); TransactionPartitionedWalTest.EmptyDisableWalCommitSnapshotIsPublished (new, Q5; the disableWAL publication gate is D123551605's, M2 fold).
- Q5: WriteImpl's disableWAL gate condition (D123551605 line).
- -> D123476301 (trackers):
- db_impl_write.cc AllocateSequenceAndWALIndex `leading_sequence_count` and the two applied ranges (D123476301 lines); db_impl.h its overload and PublishOnGroupExit; the WriteImpl exit publication through PublishOnGroupExit and the release_unapplied_range path (D123476301 lines).
- -> D123701876 (fence, mask, release; M2.7):
- db_impl_write.cc: GateSyncFenceIntent and the WALIOStatusCheck intent branch (GC20, GC21, GC24 lines); ClearWalDurabilityBGError (D123701876 and GC18 lines); InstallWalGateFence, WalGateFenceStatusLocked, UnreleasedWalGateFenceLow (GC18, GC20, GC24 lines); FenceFailedGateSync, InstallFailedGateSyncFence, MaybeRetireWalGateReadMasks removed (GC18, GC20, GC21, GC24 lines); new FailUnpublishedSyncRange.
- db_impl.h: the wal_gate_read_mask.h include, mask members and functions, WalGateFence::exact, FailedGateSyncFlushDrops, OpenWalGateFenceLowLocked, InstallFailedGateSyncFence, FailUnpublishedSyncRange and InstallWalGateFence comments (GC20, GC21, GC24 lines, two D123701876 lines).
- db/db_impl/db_impl.cc and db/db_impl/db_impl_sync_and_async.h mask installation (GC20, GC21 lines); db/db_impl/db_impl_compaction_flush.cc drops and retirement calls (GC20, GC21, GC24 lines); db/flush_job.{h,cc} (GC20, GC21, GC24 lines); db/memtable.{h,cc}, db/memtable_list.{h,cc} (GC21, GC24 lines); db/db_impl/wal_gate_read_mask.h deleted (GC20, GC21 lines).
- Tests: FailedGateSyncFailsWritesAbove (replaces GC20's FailedGateSyncKeepsAckedWritesAbove), the removed FailedGateSyncSparesZeroCountWriteAbove, FailedGateSyncStaysInvisibleAtNPartitions, FailedGateSyncFenceGoesInWithItsError (GC20 lines); CoalescedFailedGateSyncFencedWithItsError, FailedGateSyncRangeDeletionStaysHidden (GC21 lines); FailedGateSyncAbsentUnderTransactionDB (was FailedGateSyncMaskRetiresUnderTransactionDB), the removed FailedGateSyncRangeDeletionHiddenAfterMemPurge, FailedSyncRangeDeletionHiddenUntilResumeDropsIt, FailedZeroCountSyncLeavesNoIndeterminateRecord, FailedZeroCountGateSyncRecordsNoIndeterminate (GC24 lines); GatePostWaitSyncFailureWakesParkedGate (GC20 lines in M2.7's test); FailedSyncReopenWithoutResumeMayRecoverIt (new, the fence and Resume rule); TransactionPartitionedWalTest.FailedSyncPrepareLeavesNoStaleFence (GC20 lines).
- -> D123928339 (recovery rotation and fixture): the removed AsyncWriteDoesNotWaitForOtherPartitionsSync and the SyncWriteAboveAsyncWriteSurvivesCrash comment (D123928339 lines).
- -> D117251769 (wal_partitions option): include/rocksdb/options.h, the sync paragraph of the wal_partitions doc (GC20 lines in this diff's doc); the new release note unreleased_history/behavior_changes/partition_wal_sync_visibility.md.
## Assumptions
- "On fsync failure" is read as a failure WALIOStatusCheck records (above one partition it sets the background error for every IO failure; paranoid_checks is required). A sync whose fsync succeeded but whose MANIFEST record of the synced WALs failed, or that saw shutdown begin, is handled as at N=1: it fails having inserted nothing, its range publishes as a hole and the DB goes on; a reopen may replay its durable record, as at N=1. This keeps the M2 test FailedSyncTrackingReleasesItsRange passing unchanged.
- Tailing iterators read the memtable at kMaxSequenceNumber, so at N>1 they already see inserted-but-unpublished writes. Sync writers are now inserted only after their fsync, so a pending or failed sync write never shows in a tailing iterator. An async write in its own group above a pending sync is inserted before it waits; if the sync fails, that write fails and a tailing iterator may show it until Resume's flush drops it, exactly as for a write above a failed append (D-1) at the base. FailedSyncRangeDeletionHiddenUntilResumeDropsIt allows "zebra" in the tailing view before Resume only; every other read path, and every path after Resume, is strict.
- "Async writes behaving as at N=1" is read as N=1's visibility order: a write ordered after a pending sync write becomes visible and returns only after it. Async members of a sync-led group return before the fsync, as Q2 requires (at N=1 they wait for the leader's fsync).
- The cost of that order is measured, not avoided (Q6): with mixed sync at N=8 every write queued behind a pending sync waits for its fsync of all partitions, where GC24 published sync writes before their fsync.
- GatePostWaitSyncFailureWakesParkedGate (M2.7 test, GC20 lines, not a repro test) expected W above a failed post-wait sync to park again (D-N71 (b), under D-7). Under D-9 W fails at once; rewritten, park count relaxed to at least one (W may also wake on A's publication first). Invariant 3 exception, argued.
- Other invariant 3 exceptions, all tests that asserted D-7/D-8 behaviour or the removed machinery: the removed and rewritten tests listed under Q3.
- No repro test was edited: the bodies of GateSyncKeepsOtherPartitionsErrorResumable, ResumedTwoPCHoleKeepsAckedWritesAfterCrash, SyncPrepareAfterSyncCommitSurvivesCrash and the FU14 tests hash identically at base and commit.
- db_bench cannot open WRITE_PREPARED above one partition (it sets write_policy only with unordered_write, which forces two_write_queues, rejected at N>1). Q6's WritePrepared numbers come from a 150-line standalone program (wp_bench.cc, kept in the tmp dir, not committed) linked against each side's release librocksdb.a.
- The suites ran sharded (78 processes); each shard's TEST_TMPDIR is its own subdirectory of ~/pwal-3p/gc-25-claude-tmp, so no two processes share a per-thread DB path.
- The Q4 pin test has no fix to neuter (it pins today's documented reopen rule); SyncWriteVisibleOnlyOnceDurable's reopen-after-Resume in the same 4 modes is its counterpart.
- Q5 gates only an empty disableWAL group that has a post-memtable callback (a snapshot to create); an empty disableWAL group without one still has nothing to wait for.
## Not done
- Nothing from Q1-Q6 is cut.
- Not attempted: shortening the window during which a sync stays pending (for example fsyncing only partitions that hold unsynced records below the group, or letting writes above a pending sync publish ahead of it), which drives the mixed-sync numbers in Q6. That would trade against D-9's contiguous prefix and needs its own requirement.
- The Q4 pin test has no neuter (argued under Assumptions).
- ASan/UBSan and db_stress: not run (not required).
## Test plan
1. Debug suites (DEBUG_LEVEL=1, make -j83 at most, run sharded with TEST_TMPDIR under ~/pwal-3p/gc-25-claude-tmp): db_write_test 390, db_wal_test 2081, db_basic_test 300, transaction_test 3436, write_prepared_transaction_test 930, write_unprepared_transaction_test 250, optimistic_transaction_test 107, db_wal_oracle_test 4, write_callback_test 129, flush_job_test 15, memtable_list_test 10, db_iterator_test 260, db_options_test 58 passed: 7970 passed, 1 failed (GatePostWaitSyncFailureWakesParkedGate, which asserted the pre-D-9 re-park; rewritten, see Assumptions, then 20/20 in debug). After the final code: db_write_test again in full, 391 passed, 0 failed. Load average during the runs 40 to 75.
2. TSan (clang, USE_CLANG=1 COMPILE_WITH_TSAN=1 AUTO_CLEAN=1, worktree under the tmp dir): every new or changed test (20 in db_write_test, EmptyDisableWalCommitSnapshotIsPublished, FailedSyncPrepareLeavesNoStaleFence, FailedSyncCommitAndPrepareNeverVisible), each --gtest_repeat=100 (all are SyncPoint or fault-injection tests): 3500 OK test-iterations (both parameter values where parameterized), 0 failures, 0 ThreadSanitizer reports.
3. 100x repeats of SyncPoint and fault-injection tests: as 2 (under TSan); plus GatePostWaitSyncFailureWakesParkedGate 20x in debug.
4. GC15 oracle (db_wal_oracle_test RecoveredStateIsPrefixOfHistory, debug): 12 seeds blocks x 100 cycles = 1200 cycles (N=2 in 611, N=8 in 589; sync 1 in 1..12 per cycle, so mixed), 0 violations; the same 1200 cycles again with ROCKSDB_WAL_ORACLE_CHECK_PUBLISHED=1: 0 violations, 0 published-but-lost.
5. N=1 byte identity: release db_bench fillseq --threads=1 --num=10000 --seed=20260928 --disable_auto_compactions=1, SHA-256 of *.log at base vs commit: --partition_wal_usage=none 6d1351117a289a2784449a68d5421b1aa385ab0b383273c2c5918befa9181b09 both; --partition_wal_usage=partition_by_column_family 9a69a3fc66777fadce05e8a999479a5f57364aca27cd6d22aa00e4631adfc796 both.
6. `FORMAT_UPSTREAM=121a5a07 make check-format`: "Nothing needs to be reformatted!" (clang-format 21.1.2; formatting applied to changed lines only, with clang-format-diff). `make check-sources`: pass.
7. Neuters: listed under Q1, Q2, Q3 and Q5; every listed test fails under its neuter, and the tree was restored and checked identical to HEAD after each.
8. `git grep` for the removed symbols: 0 matches (195 at the base).
9. Q6: above.
10. db_stress: not run (not required). ASan/UBSan: not run (not required).
JustinGaoF
force-pushed
the
pwal/gc25-claude
branch
from
October 30, 2026 16:17
28ba4a1 to
5c48af0
Compare
Owner
Author
JustinGaoF
added a commit
that referenced
this pull request
Nov 9, 2026
M1 standalone S-D (from GC16 Q1-Q3): reproducible WAL partition sweep
harness (`tools/partition_wal_sweep.py`) plus `db_bench --sync_write_one_in`
and `--wal_slow_partition`.
At-M1...
Summary:
**Measured before GC17.** Every number in this summary and its test plan was measured on the code before GC17 changed the N>1 sync path. Since GC17, a sync write fsyncs from its completion gate, and concurrent gate syncs coalesce; that change is folded into D123551605. The tables below describe the earlier code, not the current stack.
GC17's own paired, interleaved run (this harness; N=8, 1000 us injected append and sync latency, sync mix 1 in 20, 1 KB values; 3 rounds, base then GC17) measured these N=8 mixed-sync ranges:
| threads | ops/s, before GC17 | ops/s, after GC17 |
|---|---|---|
| 8 | 920–1004 | 2136–2198 |
| 16 | 970–1216 | 3054–3535 |
| 32 | 1458–1514 | 5454–5685 |
The same N=8 cell at 16 threads reads 1399 ops/s in the table below, from a different run. In GC17's run, async-only cells were unchanged within run-to-run noise.
Mixed-sync throughput at N>1 is still below N=1. This summary's N=1 kNone figure for the same profile is 5658 ops/s at 16 threads, against 3054–3535 for N=8 after GC17. The two come from different runs, so the size of the gap is not established. A same-run N=1 vs N>1 comparison under mixed sync is pending, on the final code.
Known harness bug: `compute_trigger` in `tools/partition_wal_sweep.py` takes a `threads` parameter, then rebinds `threads` while unpacking each cell key, so the verdict check compares against the thread count of the last cell iterated rather than the requested one. The trigger table has cells at 16 and 32 threads; on the default grid the last cell happens to use 16 threads, so the default run reports the intended verdict, but a narrowed grid can report the verdict of the 32-thread cell. The trigger verdicts quoted here and in later summaries will be re-checked once this is fixed.
M1 standalone S-D (from GC16 Q1-Q3): reproducible WAL partition sweep harness (`tools/partition_wal_sweep.py`) plus `db_bench --sync_write_one_in` and `--wal_slow_partition`. Carved from GC16 D126232422, which is abandoned at M1.
At-M1 corrections to the GC16 summary below (applied inline): (1) reproducibility: the second `--quick` run's medians moved up to -8.3% (write p99) and -21% (gate p99) from the first, not "~2% on every median"; (2) the N=1 to N=16 async gain at 50us for 1024B values is +92% (47075 to 90571 ops/s); +77% is the 100B row; (3) join p99 at N=16/mix reaches 350ms; the 192ms figure was N=8/5000us/mix/1024B.
[GC] GC16: the N sweep and the abandon trigger, measured reproducibly (G-53). Benchmark tooling only: a checked-in sweep script plus two new `db_bench` flags, with the Tasks:975 abandon trigger evaluated under D-G53 (A). Also closes the GC15 carry-over: G-50 evidence for the multi-partition `synced_size` advance (Q4), a regression test for GC03's claim-time `SyncWAL` horizon (Q5), proof that the oracle's crashes lose data (G-54, Q6), and the `CrashMidRotationUnderSkewRecoversPrefix` drop fix (N-7-4, Q7). Q4's test idea, Q5's test, Q6's drop check and the Q7 finding are ported from D126193958 (MuseCode) as the requirement allows; its oracle, hooks, `SyncWalImpl` advance, latency FileSystem, per-WAL flag and Q8 labelling are not.
Reviewer question: Can anyone rerun this sweep and get the same picture, and does the watermark wait trip the abandon trigger at N=8? Anyone can: one command reproduces the 435-run matrix below (plus `--quick` in ~100s), and a second `--quick` run matches the first within −8.3% write p99 / −21% gate p99 at worst (see header). The trigger does not fire: 0.0012 at the designated N=8 profile, 50x below the 0.10 threshold on every sync-containing cell.
Q1: `tools/partition_wal_sweep.py` takes a `db_bench` binary and an output directory and runs the Q2 matrix with 3 reps per cell, emitting `results.json` (one row per rep: config, rep index, seed, throughput, p50/p99/p99.9 write latency, every Q2 histogram, FS counters; plus median/min-max aggregates), `results.md` (human table), per-cell command lines and raw logs, and the environment (host, CPUs, storage, opt build mode, commit hash, FS wait mode and concurrency cap). Injected and uninjected cells render in separate tables and the trigger refuses uninjected input. Reproducibility: two `--quick` runs from this commit (18 runs each, tables below) agree within −8.3% write p99 / −21% gate p99 at worst; strict min-max containment fails narrowly on 7 of 18 checked medians (worst -2.2%) because 3-rep spreads are extremely tight, and with n=3 a fresh median lands outside the previous min-max half the time by chance alone, so the small relative deviation, not strict containment, is the reproducibility evidence.
First `--quick` table (medians; commit 9c7f9a9b5188, opt, 166x AMD EPYC-Genoa):
## Injected cells (median across reps)
N usage append_us sync size slow ops/s us/op wr_p50 wr_p99 wr_p99.9 gate_p50 gate_p99 join_p50 join_p99 fsync/wr cap_med fanout_med
1 knone 500 mix 100 -1 9213 1707 1660 4309 6014 0.000 0.000 1291 4254 0.024 0.000 0.000
1 knone 500 none 100 -1 13884 1118 1321 1895 2886 0.000 0.000 989.5 1874 0.000 0.000 0.000
1 idx 500 mix 100 -1 9126 1713 1644 4300 6172 0.000 0.000 1292 4250 0.024 0.000 0.000
1 idx 500 none 100 -1 13908 1114 1318 1890 3625 0.000 0.000 987.3 1869 0.000 0.000 0.000
8 idx 500 mix 100 -1 2024 7721 867.9 49064 74742 0.553 43.9 269.3 44354 0.267 0.000 8.00
8 idx 500 none 100 -1 18247 866.2 820.4 1415 2716 0.558 41.8 597.6 1271 0.000 0.000 0.000
Second --quick table (medians):
## Injected cells (median across reps)
N usage append_us sync size slow ops/s us/op wr_p50 wr_p99 wr_p99.9 gate_p50 gate_p99 join_p50 join_p99 fsync/wr cap_med fanout_med
1 knone 500 mix 100 -1 9013 1729 1670 4323 6485 0.000 0.000 1306 4270 0.025 0.000 0.000
1 knone 500 none 100 -1 13746 1118 1314 1890 2770 0.000 0.000 994.9 1868 0.000 0.000 0.000
1 idx 500 mix 100 -1 8815 1796 1675 4393 8014 0.000 0.000 1333 4335 0.025 0.000 0.000
1 idx 500 none 100 -1 13938 1120 1322 1891 2668 0.000 0.000 993.4 1871 0.000 0.000 0.000
8 idx 500 mix 100 -1 2013 7755 867.4 49739 77800 0.554 44.0 309.6 44902 0.265 0.000 8.00
8 idx 500 none 100 -1 17845 864.9 818.0 1298 1882 0.555 33.0 588.7 1267 0.000 0.000 0.000
Q2: matrix is N in {1 kNone, 1 indexed, 2, 4, 8, 16} x append latency {50, 200, 1000, 5000}us (sync = append, jitter = append/10, seeded per rep) x sync {none, mix 1-in-20 via `--sync_write_one_in`, all} x value sizes {100, 1024} x 3 reps, 32k writes per cell on 64 CFs fixed across N (per-WAL counters verify every partition is covered in every N>1 cell; 8 CFs covered only 6/8 partitions in a pilot, hence 64), plus the N=8 one-slow-partition cell (`--wal_slow_partition=7`, 10x, mirroring the trigger profile). Steady state is inherent (WAL append cost is constant; the benchmark loop excludes open/CF setup) and confirmed by tight 3-rep spreads (e.g., trigger cell ops/s 1385-1417). New code only: the two flags live next to GC15's latency flags; no D118371518 line is touched. Cells use default write buffers (single generation; the slow override's rotation re-apply is validated in a separate small-buffer pilot where a stability check keeps mid-rotation tails from being misread as generations). Readings, one per bullet: baseline: N=1 indexed is within ~5% of kNone on every cell (e.g., 1000/mix/1024: 5376 vs 5658 ops/s) and byte-identical per the check below, so the stack costs ~nothing at N=1 (pre-stack-base comparison at 217951834332: not run, needs a second opt build; covered by byte-identity plus indexed-vs-kNone instead). N/BDP sweep: partitioning helps async writes at every latency (none/1024B N=1 to N=16: +92% at 50us (1024B: 47075 to 90571 ops/s; +77% is the 100B row), +40% at 1000us, +34% at 5000us) and hurts sync-containing ones (mix/1024B at 1000us: 5658 to 905 ops/s, -84%; all: 2874 to 582, -80%), driven by sync fan-out, not the gate. Cap-hit rate at N=8: `cap_excluded` sum is 0 in every cell over 10k-20k groups each, so the group cap never binds at N>1 here (M0.4: no). Join-wait vs watermark-wait: join p99 exceeds gate p99 by 7x (none) to 650x (mix) at N=8 (mix/1000/1024: 61ms vs 0.09ms); queueing dwarfs the watermark wait in every cell. Sync barrier: fan-out median is exactly N; barrier p50/p99 at N=8/1000/1024 is 21/49ms (all) and 36/102ms (mix); fsyncs/write is 0.33 (all) and 0.27 (mix), rising to 0.48/0.44 at N=16. One slow partition: throughput -53% (1399 to 661 ops/s), write p99 +126% (74 to 167ms), gate p99 x108 (91us to 9868us); the straggler cost lands almost entirely in the gate wait. Contention at N=8: the single-partition WAL mutex is uncontended (p99 1us); the all-partition mutex is taken per sync write (21k takes at all, p99 4.3ms; 2.8k takes at mix, p99 21.6ms) while async barely takes it (9 takes), so cross-partition serialization is the sync path's lock cost. Highlight (1000us, mix, 1024B medians): N=1 kNone 5658 ops/s wr_p99 6497us; N=1 idx 5376/6570; N=2 3615/17241; N=4 2275/34590; N=8 1399/73761 gate_p99 90.9us; N=8 slow 661/166813 gate_p99 9868us; N=16 905/157617. Full 145-row table (medians; commit 9c7f9a9b5188, opt, 166x AMD EPYC-Genoa):
## Injected cells (median across reps)
N usage append_us sync size slow ops/s us/op wr_p50 wr_p99 wr_p99.9 gate_p50 gate_p99 join_p50 join_p99 fsync/wr cap_med fanout_med
1 knone 50 all 100 -1 6955 2144 1837 4392 9100 0.000 0.000 1768 4346 0.092 0.000 0.000
1 knone 50 all 1024 -1 6764 2246 1870 4384 8360 0.000 0.000 1803 4364 0.094 0.000 0.000
1 knone 50 mix 100 -1 19060 827.4 369.9 2867 4317 0.000 0.000 331.3 2710 0.025 0.000 0.000
1 knone 50 mix 1024 -1 18416 851.3 467.6 2749 4569 0.000 0.000 340.8 2623 0.025 0.000 0.000
1 knone 50 none 100 -1 52029 298.1 289.4 547.9 784.1 0.000 0.000 278.6 378.5 0.000 0.000 0.000
1 knone 50 none 1024 -1 47075 328.7 304.2 799.5 2900 0.000 0.000 276.9 532.3 0.000 0.000 0.000
1 knone 200 all 100 -1 5864 2555 2127 5104 11634 0.000 0.000 1842 4392 0.095 0.000 0.000
1 knone 200 all 1024 -1 5186 2936 2819 6054 11152 0.000 0.000 2396 5488 0.099 0.000 0.000
1 knone 200 mix 100 -1 13826 1133 783.6 2895 5909 0.000 0.000 751.0 2865 0.025 0.000 0.000
1 knone 200 mix 1024 -1 13194 1195 793.7 3448 7385 0.000 0.000 752.8 2879 0.025 0.000 0.000
1 knone 200 none 100 -1 26404 578.7 660.0 868.5 1621 0.000 0.000 638.1 865.8 0.000 0.000 0.000
1 knone 200 none 1024 -1 25858 598.2 655.7 970.0 1732 0.000 0.000 634.7 866.4 0.000 0.000 0.000
1 knone 1000 all 100 -1 2954 5049 4184 9834 12417 0.000 0.000 4060 9817 0.094 0.000 0.000
1 knone 1000 all 1024 -1 2874 5215 4239 9844 13632 0.000 0.000 4110 9831 0.095 0.000 0.000
1 knone 1000 mix 100 -1 5633 2723 2565 6513 9417 0.000 0.000 2453 6414 0.025 0.000 0.000
1 knone 1000 mix 1024 -1 5658 2760 2569 6497 9424 0.000 0.000 2459 6410 0.025 0.000 0.000
1 knone 1000 none 100 -1 7702 1997 2146 2887 3828 0.000 0.000 2079 2884 0.000 0.000 0.000
1 knone 1000 none 1024 -1 7588 2026 2139 2887 3511 0.000 0.000 2070 2883 0.000 0.000 0.000
1 knone 5000 all 100 -1 857 17711 13717 32780 45952 0.000 0.000 13352 32746 0.096 0.000 0.000
1 knone 5000 all 1024 -1 843 17630 13599 32787 44333 0.000 0.000 13243 32759 0.097 0.000 0.000
1 knone 5000 mix 100 -1 1441 10811 11403 27626 34000 0.000 0.000 11105 21824 0.026 0.000 0.000
1 knone 5000 mix 1024 -1 1393 11108 11556 28820 48827 0.000 0.000 11254 21991 0.027 0.000 0.000
1 knone 5000 none 100 -1 1636 9191 11013 13943 13996 0.000 0.000 10747 13166 0.000 0.000 0.000
1 knone 5000 none 1024 -1 1646 9117 10908 13941 13996 0.000 0.000 10626 12602 0.000 0.000 0.000
1 idx 50 all 100 -1 7064 2168 1846 4374 7920 0.000 0.000 1782 4350 0.092 0.000 0.000
1 idx 50 all 1024 -1 6825 2220 1869 4366 6578 0.000 0.000 1804 4344 0.094 0.000 0.000
1 idx 50 mix 100 -1 19277 816.4 373.6 2656 4279 0.000 0.000 336.5 2514 0.026 0.000 0.000
1 idx 50 mix 1024 -1 18639 843.4 484.9 2757 4203 0.000 0.000 344.4 2595 0.025 0.000 0.000
1 idx 50 none 100 -1 51514 301.2 291.4 566.0 937.9 0.000 0.000 277.6 379.2 0.000 0.000 0.000
1 idx 50 none 1024 -1 49359 316.1 301.8 574.3 1231 0.000 0.000 275.8 490.9 0.000 0.000 0.000
1 idx 200 all 100 -1 5825 2596 2343 4840 8014 0.000 0.000 1870 4387 0.095 0.000 0.000
1 idx 200 all 1024 -1 5410 2795 2747 6311 8910 0.000 0.000 2441 6185 0.097 0.000 0.000
1 idx 200 mix 100 -1 13807 1135 780.7 2881 4569 0.000 0.000 754.3 2862 0.025 0.000 0.000
1 idx 200 mix 1024 -1 13350 1182 784.4 3069 5700 0.000 0.000 755.6 2874 0.025 0.000 0.000
1 idx 200 none 100 -1 26815 582.8 659.9 968.4 2900 0.000 0.000 637.3 866.9 0.000 0.000 0.000
1 idx 200 none 1024 -1 24464 637.1 667.5 1686 3922 0.000 0.000 638.3 869.8 0.000 0.000 0.000
1 idx 1000 all 100 -1 2799 5308 4213 11187 20780 0.000 0.000 4079 10327 0.095 0.000 0.000
1 idx 1000 all 1024 -1 2767 5391 4326 9893 13819 0.000 0.000 4175 9867 0.097 0.000 0.000
1 idx 1000 mix 100 -1 5465 2811 2571 6542 9845 0.000 0.000 2439 6451 0.026 0.000 0.000
1 idx 1000 mix 1024 -1 5376 2804 2564 6570 11266 0.000 0.000 2430 6459 0.026 0.000 0.000
1 idx 1000 none 100 -1 7531 2009 2141 2890 4266 0.000 0.000 2070 2884 0.000 0.000 0.000
1 idx 1000 none 1024 -1 7275 2080 2175 3272 6355 0.000 0.000 2106 2889 0.000 0.000 0.000
1 idx 5000 all 100 -1 835 18449 22425 32826 45265 0.000 0.000 13761 32778 0.099 0.000 0.000
1 idx 5000 all 1024 -1 849 17924 13812 32804 42208 0.000 0.000 13421 32778 0.097 0.000 0.000
1 idx 5000 mix 100 -1 1474 10462 11192 25826 32667 0.000 0.000 10899 21554 0.025 0.000 0.000
1 idx 5000 mix 1024 -1 1470 10612 11227 26240 32679 0.000 0.000 10926 21628 0.026 0.000 0.000
1 idx 5000 none 100 -1 1713 8883 10730 13938 13996 0.000 0.000 10421 13000 0.000 0.000 0.000
1 idx 5000 none 1024 -1 1685 9065 10878 13943 13999 0.000 0.000 10594 13533 0.000 0.000 0.000
2 idx 50 all 100 -1 3173 5010 4817 10548 18717 0.500 0.990 4146 9837 0.157 0.000 2.00
2 idx 50 all 1024 -1 3253 4881 4584 9844 13883 0.500 0.991 3990 9737 0.157 0.000 2.00
2 idx 50 mix 100 -1 9613 1632 530.9 6555 9705 0.501 0.992 326.0 6348 0.072 0.000 2.00
2 idx 50 mix 1024 -1 7238 2182 535.5 10814 13913 0.501 0.993 332.4 9763 0.072 0.000 2.00
2 idx 50 none 100 -1 73703 212.3 196.4 378.1 1054 0.501 0.992 152.7 372.7 0.000 0.000 0.000
2 idx 50 none 1024 -1 58770 233.9 219.8 759.8 2900 0.505 0.999 160.3 455.9 0.000 0.000 0.000
2 idx 200 all 100 -1 3007 5295 5069 11021 15756 0.500 0.991 4350 9876 0.157 0.000 2.00
2 idx 200 all 1024 -1 3507 4537 4482 8705 13672 0.500 0.991 3980 7920 0.157 0.000 2.00
2 idx 200 mix 100 -1 5592 2831 856.8 13065 20918 0.501 0.993 708.3 11987 0.071 0.000 2.00
2 idx 200 mix 1024 -1 5360 2944 863.0 13563 28000 0.501 0.993 720.6 12924 0.071 0.000 2.00
2 idx 200 none 100 -1 36498 435.4 371.1 860.0 1660 0.501 0.991 335.0 842.5 0.000 0.000 0.000
2 idx 200 none 1024 -1 35377 448.3 385.8 859.5 1900 0.501 0.991 339.0 845.5 0.000 0.000 0.000
2 idx 1000 all 100 -1 1823 8740 9873 13967 21764 0.500 0.991 8830 13928 0.157 0.000 2.00
2 idx 1000 all 1024 -1 1749 9091 9913 13974 21810 0.500 0.991 8879 13929 0.157 0.000 2.00
2 idx 1000 mix 100 -1 3677 4298 2723 16638 21509 0.504 0.998 2381 13766 0.071 0.000 2.00
2 idx 1000 mix 1024 -1 3615 4350 2742 17241 21887 0.506 5.06 2389 13746 0.071 0.000 2.00
2 idx 1000 none 100 -1 10378 1528 1285 2862 3136 0.502 0.995 1169 2837 0.000 0.000 0.000
2 idx 1000 none 1024 -1 10328 1538 1281 2865 3542 0.502 0.994 1168 2843 0.000 0.000 0.000
2 idx 5000 all 100 -1 527 30190 33019 49746 68939 0.500 0.991 29637 49610 0.157 0.000 2.00
2 idx 5000 all 1024 -1 524 30321 32999 49710 69078 0.500 0.991 29615 49566 0.157 0.000 2.00
2 idx 5000 mix 100 -1 985 16047 12484 55452 73373 0.541 296.0 11359 48332 0.072 0.000 2.00
2 idx 5000 mix 1024 -1 977 16107 12512 53021 73347 0.538 262.4 11407 48122 0.072 0.000 2.00
2 idx 5000 none 100 -1 2271 6987 6264 13715 13983 0.508 46.0 5811 12824 0.000 0.000 0.000
2 idx 5000 none 1024 -1 2236 7095 6344 13721 13989 0.508 53.5 5852 13541 0.000 0.000 0.000
4 idx 50 all 100 -1 3132 5052 4757 9900 19523 0.501 0.991 3436 9757 0.220 0.000 4.00
4 idx 50 all 1024 -1 2981 5328 5059 12450 19304 0.500 0.990 3752 10256 0.220 0.000 4.00
4 idx 50 mix 100 -1 5206 2994 362.7 16734 21957 0.513 15.5 209.2 13481 0.146 0.000 4.00
4 idx 50 mix 1024 -1 5116 3089 417.6 17175 21767 0.519 93.9 225.1 13734 0.147 0.000 4.00
4 idx 50 none 100 -1 75704 206.7 197.1 375.7 531.4 0.503 0.995 145.0 363.1 0.000 0.000 0.000
4 idx 50 none 1024 -1 72385 214.7 205.4 376.7 1335 0.504 0.997 147.2 366.4 0.000 0.000 0.000
4 idx 200 all 100 -1 2557 6199 6379 13396 21463 0.500 0.991 4657 12400 0.219 0.000 4.00
4 idx 200 all 1024 -1 2469 6413 6528 13829 21784 0.500 0.990 4721 12782 0.220 0.000 4.00
4 idx 200 mix 100 -1 4487 3493 781.0 19880 26685 0.515 14.2 371.2 17212 0.145 0.000 4.00
4 idx 200 mix 1024 -1 4341 3612 827.3 19957 26529 0.517 22.2 389.9 17764 0.145 0.000 4.00
4 idx 200 none 100 -1 35151 449.1 416.6 864.5 1796 0.505 0.999 323.2 815.6 0.000 0.000 0.000
4 idx 200 none 1024 -1 34343 461.6 431.4 866.4 3650 0.504 0.999 326.9 840.0 0.000 0.000 0.000
4 idx 1000 all 100 -1 1297 12186 12349 25183 33000 0.500 0.991 10115 21877 0.219 0.000 4.00
4 idx 1000 all 1024 -1 1264 12488 13023 25700 41225 0.500 0.990 10220 21925 0.219 0.000 4.00
4 idx 1000 mix 100 -1 2255 6946 2644 34819 49792 0.540 65.4 1266 30316 0.149 0.000 4.00
4 idx 1000 mix 1024 -1 2275 6908 2613 34590 55952 0.538 67.8 1270 30184 0.147 0.000 4.00
4 idx 1000 none 100 -1 9766 1627 1516 2875 3800 0.522 35.1 1138 2839 0.000 0.000 0.000
4 idx 1000 none 1024 -1 9644 1648 1559 2885 5866 0.523 66.5 1145 2851 0.000 0.000 0.000
4 idx 5000 all 100 -1 378 41788 40944 75336 107477 0.500 0.991 33643 73855 0.218 0.000 4.00
4 idx 5000 all 1024 -1 375 42333 41105 78277 108731 0.500 0.991 33890 74077 0.218 0.000 4.00
4 idx 5000 mix 100 -1 631 24937 12239 136600 197826 0.590 373.8 6387 102624 0.151 0.000 4.00
4 idx 5000 mix 1024 -1 626 24990 12237 129052 187297 0.584 369.4 6385 101482 0.152 0.000 4.00
4 idx 5000 none 100 -1 2085 7609 6598 13854 13990 0.550 292.9 5628 12498 0.000 0.000 0.000
4 idx 5000 none 1024 -1 2071 7654 6698 13858 13991 0.550 306.8 5648 12430 0.000 0.000 0.000
8 idx 50 all 100 -1 2129 7442 7339 21040 41904 0.500 0.990 3655 18016 0.329 0.000 8.00
8 idx 50 all 1024 -1 1991 7965 7726 20817 31412 0.500 0.990 3943 18174 0.330 0.000 8.00
8 idx 50 mix 100 -1 3202 4871 225.7 31709 47000 0.531 21.8 69.8 29138 0.260 0.000 8.00
8 idx 50 mix 1024 -1 3108 5067 233.7 32225 47820 0.531 27.8 74.5 30062 0.256 0.000 8.00
8 idx 50 none 100 -1 82431 188.7 178.4 372.4 501.7 0.512 5.47 116.1 327.5 0.000 0.000 0.000
8 idx 50 none 1024 -1 80988 195.0 185.6 374.4 568.9 0.513 6.83 117.6 343.0 0.000 0.000 0.000
8 idx 200 all 100 -1 1729 9168 9338 21970 32715 0.500 0.991 5025 20367 0.330 0.000 8.00
8 idx 200 all 1024 -1 1652 9603 9627 25015 34888 0.500 0.991 5143 20962 0.331 0.000 8.00
8 idx 200 mix 100 -1 2694 5791 445.2 39174 53125 0.534 26.0 151.0 31635 0.259 0.000 8.00
8 idx 200 mix 1024 -1 2614 5992 471.6 40379 49928 0.536 51.4 177.5 32085 0.256 0.000 8.00
8 idx 200 none 100 -1 37460 422.0 379.5 851.2 1062 0.523 13.5 272.6 728.2 0.000 0.000 0.000
8 idx 200 none 1024 -1 36931 426.4 393.3 851.3 869.3 0.522 12.4 271.5 741.5 0.000 0.000 0.000
8 idx 1000 all 100 -1 857 18445 17511 47477 73571 0.500 0.990 10538 42973 0.330 0.000 8.00
8 idx 1000 all 1024 -1 845 18738 17946 47829 72670 0.500 0.991 10756 42949 0.329 0.000 8.00
8 idx 1000 mix 100 -1 1402 11165 1741 74393 108959 0.585 93.4 312.5 60059 0.276 0.000 8.00
8 idx 1000 mix 1024 -1 1399 11114 1802 73761 109023 0.578 90.9 880.4 60966 0.270 0.000 8.00
8 idx 1000 mix 1024 7 661 23760 11139 166812 244581 0.732 9867 870.7 108682 0.295 0.000 8.00
8 idx 1000 none 100 -1 9843 1609 1451 2875 3650 0.598 98.5 994.0 2806 0.000 0.000 0.000
8 idx 1000 none 1024 -1 9552 1655 1523 3025 5377 0.603 414.8 991.9 2828 0.000 0.000 0.000
8 idx 5000 all 100 -1 250 63159 58084 159190 222173 0.500 0.990 35234 140991 0.330 0.000 8.00
8 idx 5000 all 1024 -1 247 63715 58555 161949 232028 0.500 0.991 35455 144577 0.331 0.000 8.00
8 idx 5000 mix 100 -1 410 38438 6810 289671 378652 0.643 494.2 889.1 197712 0.283 0.000 8.00
8 idx 5000 mix 1024 -1 412 38123 7160 254511 372618 0.641 486.1 1900 191509 0.282 0.000 8.00
8 idx 5000 none 100 -1 2075 7651 6478 13876 13991 0.658 395.1 4996 13349 0.000 0.000 0.000
8 idx 5000 none 1024 -1 2074 7648 6445 13878 13991 0.658 408.6 5002 11790 0.000 0.000 0.000
16 idx 50 all 100 -1 1491 10629 10610 31645 49569 0.500 0.990 1960 24014 0.484 0.000 16.0
16 idx 50 all 1024 -1 1437 11010 10980 31891 48539 0.500 0.991 1993 25956 0.484 0.000 16.0
16 idx 50 mix 100 -1 2130 7392 162.9 62961 78181 0.541 27.9 0.782 48548 0.405 0.000 16.0
16 idx 50 mix 1024 -1 2007 7818 164.6 65696 98068 0.540 32.0 0.780 49673 0.404 0.000 16.0
16 idx 50 none 100 -1 92287 169.7 159.3 366.9 379.8 0.527 11.3 44.4 249.1 0.000 0.000 0.000
16 idx 50 none 1024 -1 90571 173.0 160.6 368.9 379.7 0.530 12.1 45.3 285.3 0.000 0.000 0.000
16 idx 200 all 100 -1 1181 13431 13356 38860 63571 0.500 0.990 2991 30479 0.484 0.000 16.0
16 idx 200 all 1024 -1 949 16720 15013 72363 118108 0.500 0.990 3108 48272 0.486 0.000 16.0
16 idx 200 mix 100 -1 1778 8789 355.4 71340 105314 0.546 44.1 0.782 61541 0.409 0.000 16.0
16 idx 200 mix 1024 -1 1727 9101 356.4 72268 104615 0.544 39.9 0.787 65150 0.407 0.000 16.0
16 idx 200 none 100 -1 40927 385.7 353.6 837.2 869.8 0.551 19.1 85.8 573.0 0.000 0.000 0.000
16 idx 200 none 1024 -1 40675 389.0 355.3 840.6 870.0 0.545 15.7 88.9 578.4 0.000 0.000 0.000
16 idx 1000 all 100 -1 589 26867 26163 74241 108472 0.500 0.991 6078 64161 0.483 0.000 16.0
16 idx 1000 all 1024 -1 582 27175 26211 74011 131818 0.500 0.991 6756 63614 0.481 0.000 16.0
16 idx 1000 mix 100 -1 954 16309 1212 149831 231600 0.604 84.9 0.773 104478 0.439 0.000 16.0
16 idx 1000 mix 1024 -1 905 17307 1216 157617 238930 0.603 90.3 0.776 108960 0.438 0.000 16.0
16 idx 1000 none 100 -1 10625 1490 1224 2868 2900 0.693 78.3 170.1 2725 0.000 0.000 0.000
16 idx 1000 none 1024 -1 10610 1491 1226 2866 2898 0.689 75.0 166.4 2724 0.000 0.000 0.000
16 idx 5000 all 100 -1 171 92232 88833 246299 368560 0.500 0.990 22354 210692 0.482 0.000 16.0
16 idx 5000 all 1024 -1 169 93424 89851 246061 368288 0.500 0.990 22052 212761 0.485 0.000 16.0
16 idx 5000 mix 100 -1 278 55903 6118 533996 815050 0.660 517.5 0.751 348988 0.471 0.000 16.0
16 idx 5000 mix 1024 -1 279 55956 6123 533486 817263 0.655 508.0 0.757 350460 0.468 0.000 16.0
16 idx 5000 none 100 -1 2223 7125 6114 13834 13986 0.752 487.9 787.9 11836 0.000 0.000 0.000
16 idx 5000 none 1024 -1 2205 7131 6109 13839 13986 0.754 485.5 743.3 11352 0.000 0.000 0.000
Q3: D-G53 = (A) share of the tail (Recommended; the choice cell is blank). Metric is p99(`rocksdb.wal.durability.wait.micros`) / p99(write) at N=8 per (latency, sync) cell; the designated profile is append=1000us, mix, 1024B (mid-range networked-WAL latency, realistic sync ratio, KB-scale values, per the doc's own example). Number: 0.0012. Verdict: DOES NOT FIRE. The verdict is robust: every sync-containing cell at N=8 is at most 0.0019 (5000us mix), 50x below threshold, and all-sync cells round to 0.0000 (writes serialize through the barrier, so the gate never waits). The highest ratio anywhere is 0.1371 at (1000us, none, 1024B), a no-sync extreme where the denominator has no barrier (write p99 3.0ms) while the gate tail reaches 415us consistently across reps (281/415/531us); the 100B sibling is 0.034. That cell is reported, not the verdict: the trigger refers to the realistic sync mix, but the none-mode tail's value-size sensitivity is flagged for GC17.
## Abandon trigger (D-G53 (A)) at N=8
append_us sync size gate_p99_us write_p99_us ratio
50 all 100 0.990 21040 0.0000
50 all 1024 0.990 20817 0.0000
50 mix 100 21.8 31709 0.0007
50 mix 1024 27.8 32225 0.0009
50 none 100 5.47 372.4 0.0147
50 none 1024 6.83 374.4 0.0183
200 all 100 0.991 21970 0.0000
200 all 1024 0.991 25015 0.0000
200 mix 100 26.0 39174 0.0007
200 mix 1024 51.4 40379 0.0013
200 none 100 13.5 851.2 0.0159
200 none 1024 12.4 851.3 0.0146
1000 all 100 0.990 47477 0.0000
1000 all 1024 0.991 47829 0.0000
1000 mix 100 93.4 74393 0.0013
1000 mix 1024 90.9 73761 0.0012
1000 none 100 98.5 2875 0.0343
1000 none 1024 414.8 3025 0.1371
5000 all 100 0.990 159190 0.0000
5000 all 1024 0.991 161949 0.0000
5000 mix 100 494.2 289671 0.0017
5000 mix 1024 486.1 254511 0.0019
5000 none 100 395.1 13876 0.0285
5000 none 1024 408.6 13878 0.0294
TRIGGER: ratio 0.0012 at N=8 append=1000us sync=mix size=1024B does not fire (threshold 0.10)
Q4: `SyncWalAdvancesOtherPartitionsSyncedSize` syncs both partitions, writes nothing more, then a sync write on partition 0 must record sum 0 on `WAL_SYNC_UNSYNCED_PARTITIONS`. Neuter (drop the `note_synced` in the `wal.number > up_to` branch; dropping the whole branch would still advance via the active-WAL path): fails with sum 1. Existing `NonLeadershipSyncsAdvanceSyncedSize` passes unmodified.
Q5: `SyncWalClaimTimeHorizonExcludesCoupledRotation` holds a manual `SyncWAL` in its fsync loop with 100ms slow syncs, lands a coupled rotation inside (counter-observed, order proven by `DBImpl::SyncWAL:Begin` < switch < `DBImpl::SyncWAL:BeforeMarkLogsSynced:1`), writes into the rotated-in WALs, and requires a later sync write to count all 4 partitions unsynced, with marks clear and deques consistent. Neuter (finish-time horizon): aborts on `assert(wal.IsSyncing())` on the unmarked rotated-in WAL.
Q6: the oracle records per power-loss cycle whether an acknowledged write is absent after recovery, prints the count in the summary line, and `RecoveredStateIsPrefixOfHistory` fails when power-loss cycles ran but none lost a write (runs with zero power-loss cycles, i.e. single-cycle reruns of process-crash seeds, are exempt: nothing to prove). 1000-cycle run from this commit: pass, 313 of 528 power-loss cycles lost a write. Neuter (crash keeps unsynced data): 40-cycle run fails with "power loss lost an acknowledged write in 0".
Q7: `CrashMidRotationUnderSkewRecoversPrefix` now sets `SetInjectUnsyncedDataLoss(true)` before the open (files capture the flag at creation) and requires `missing_seen` past the last sync. Neuter (flag off again): fails on "the crash dropped no acknowledged write". Listed under Invariant 4 as the one modified test.
GC17 pointers (numbers only, no decisions): D-G11: mean unsynced partitions under the mix is 1.3-2.3 of 8 (well below N) and the barrier dominates sync-write p99 (barrier p99 102ms over 1321 sync groups vs write p99 74ms over 32k mixed writes at N=8/1000/mix/1024; different populations, noted). G-19a: writers/group p50 is 1-2.4 while join p99 reaches 350ms at N=16/mix (191.5ms is N=8/5000us/mix/1024B); the index-allocation mutex has no dedicated histogram, so the harness bounds group-formation queueing but does not isolate the allocator. muse #22: per-partition mutex waits are ~0 at all N (p99 1us); no contention signature that padding would relieve in these workloads. N-2-6: 0.27-0.48 fsyncs/write sit on the write path at N=8-16 sync workloads; a background fsync's prize is bounded by the barrier numbers above minus the all-mutex claim, which stays.
Fold-back split: Q1-Q3 (script + `--sync_write_one_in` + `--wal_slow_partition` in `tools/db_bench_tool.cc`) stays a standalone diff (new code; no D118371518 line touched; no D-G53 (B) bypass). Q4 test folds with GC15's `NonLeadershipSyncsAdvanceSyncedSize` (D123971668, or D123551605). Q5 test to GC15's standalone diff (needs the latency FS). Q6 (oracle drop count + failure) to GC15's standalone diff. Q7 (test change) to D123928339. No hunk is unplaceable at its target.
Assumptions: D-G53 blank, so Recommended (A) per AB section 4 rule 2. Trigger profile (1000us append, mix 1-in-20, 1024B) chosen per rule 5 (mid-range networked-WAL latency, realistic sync ratio, KB-scale values; every cell tabulated so the choice is auditable). Sync latency = append latency and jitter = append/10 per rule 5 (one profile knob; seeded jitter keeps reps reproducible). 64 fixed CFs per rule 5 (isolates N; coverage verified from per-WAL counters). Cells use default write buffers (single generation; rotation re-apply validated in a separate small-buffer pilot) per rule 5 (cleanest numbers). Q4 neuter removes the `note_synced` call rather than the whole branch per rule 5 (the literal branch drop still advances via the active path and would not fail). Q6 exempts runs with zero power-loss cycles per rule 5 (single-cycle reruns must stay green). Cap-hit rate is reported as mean excluded/group plus P99 (ToString exposes no non-zero fraction) per rule 5.
Not done: (empty).
M2 fold (2026-10-22, `M2-FoldTasks.md` + `M2-Amendment.md`): Absorbs (M2) GC10 Q8/Q9: `SlowWalPartitionFileSystem`, sweep comparisons, steady state, `--compare_to`, trigger table; GC07 Q9: sweep dedup and N=1 baselines. This diff now edits S-C's db_bench lines: it moves S-C's latency-FS install block below its own slow-partition validation.
Test Plan:
- `buck2 test fbcode//internal_repo_rocksdb/repo:db_write_test fbcode//internal_repo_rocksdb/repo:latency_injection_fs_test`: 199 pass, 0 fail.
- `buck2 test fbcode//internal_repo_rocksdb/repo:db_wal_oracle_test` (40 cycles): 3 pass; drop count 13/17 power-loss cycles.
- 1000-cycle oracle run from this commit (`ROCKSDB_WAL_ORACLE_CYCLES=1000`): pass; 313 of 528 power-loss cycles lost a write; 2 known lower-bound holes (non-strict, expected). A pre-format run gave 310/528; the committed run above is the evidence.
- Q5+Q7 x100 repeats (`--gtest_repeat=100`): 100/100 iterations pass, 0 failures.
- Q5+Q7 under `@fbcode//mode/dev-tsan`: 4 pass, no TSan warnings.
- Q4 neuter (no `note_synced` past the horizon): `SyncWalAdvancesOtherPartitionsSyncedSize` fails with sum 1 (expected). Q5 neuter (finish-time horizon): aborts on `assert(wal.IsSyncing())` (expected). Q6 neuter (crash keeps unsynced data): 40-cycle run fails "no power-loss cycle lost an acknowledged write" with count 0 (expected). Q7 neuter (flag off): fails "the crash dropped no acknowledged write" (expected). All neuters reverted; `db_impl.cc` clean.
- Full matrix: 435/435 runs ok from this commit (opt `db_bench`); trigger verdict DOES NOT FIRE (0.0012 at N=8/1000us/mix/1024B; max 0.0019 on any sync-containing cell).
- Two `--quick` runs from this commit: 18/18 each; second run's medians within −8.3% write p99 / −21% gate p99 of the first at worst (7 of 18 narrowly outside the tight 3-rep min-max; worst -2.2%); tables in summary.
- N=1 byte-identity check (base vs this commit, `none` and `partition_by_column_family`): pass; hashes equal the documented values (`6d135111...` off, `9a69a3fc...` on).
- 180s `db_stress` blackbox crash test at N=1 with `partition_wal_usage` on: first run failed early (checkpoint "WAL index merge: WAL 3 unreadable" under injected read faults), retry passed ("Crash-recovery verification passed"). Engine code is untouched by this diff (benchmark tooling + tests only), so the intermittent failure is a pre-existing base finding, reported, not fixed.
- Pre-stack-base N=1 comparison at 217951834332: not run (needs a second opt build; covered by byte-identity plus N=1 indexed-vs-kNone instead).
- Repo-pinned clang-format clean on all touched C++ files; `arc lint -a` and the script's lint clean.
(M1 standalone carved from GC16 D126232422; that round diff is abandoned at M1.)
M1 re-verification (2026-10-20, after rebasing the stack onto master f0c3a35689fc and clang-formatting D117251769, D117251771, D123079329, D123551605):
- Per-diff gate, all 35 commits bottom-up: CI format check, `rocksdb_lib` build, every touched test target: all pass, 0 failures.
- Tip suites (23 targets): 8126 pass, 0 fail.
- N=1 byte identity at the tip: `6d135111...` (off) and `9a69a3fc...` (on), equal to T0.
- 180s blackbox crash test at N=1 with `partition_wal_usage=partition_by_column_family`: pass.
- Trigger rerun, opt `db_bench`, N=8/1000us/1024B, this harness: sync mix 0.0014 / 0.0013 / 0.0011 at 8 / 16 / 32 threads; all-async 0.026 / 0.025 / 0.018. Does not fire in either profile (the earlier 0.137 and dev-mode 0.108 readings do not reproduce in opt).
M2 fold: new or moved tests here: (none). B.1 at this diff (format check, `rocksdb_lib`, touched test targets): PASS; no test targets; `db_bench` and `db_stress` build; `partition_wal_sweep.py` compiles.
M3 B.1 at this diff (clang-format 21.1.2 on its changed lines, make check-sources, debug librocksdb build; no test file touched): PASS.
Note (2026-10-27): every number above predates GC17's sync-path change; see the first paragraph of the summary. The pre-stack-base comparison is still not run.
M5 fold: Absorbs 10 A.1 entries (GC28 5, GC27 1, GC29b 4): GC28 Q5 (b)/Q6: TRIGGER_THREAD_COUNTS, compute_trigger, --stats_level comments; GC27's zero guard; GC29b's docstrings and report heading. M5-F1 (A.8): F1.3: partition_wal_sweep.py's docstring placeholders.
M5 B.1: PASS (clang-format 21.1.2 on the changed lines, make check-sources, debug build of db_bench); no test binary touched.
M6 fold: Absorbs GC35 Q4: `tools/partition_wal_sweep.py` `--bandwidths-mbps` (cells, labels, parsing of `size_sleep_micros`, comparisons and trigger per bandwidth) and `db_bench` `--wal_slow_partition` taking a tenth of the WAL bandwidths.
M6 B.1: PASS (debug build of db_bench; no test binary touched).
Differential Revision: https://phabricator.intern.facebook.com/D126533195
JustinGaoF
added a commit
that referenced
this pull request
Nov 10, 2026
M1 standalone S-D (from GC16 Q1-Q3): reproducible WAL partition sweep
harness (`tools/partition_wal_sweep.py`) plus `db_bench --sync_write_one_in`
and `--wal_slow_partition`.
At-M1...
Summary:
**Measured before GC17.** Every number in this summary and its test plan was measured on the code before GC17 changed the N>1 sync path. Since GC17, a sync write fsyncs from its completion gate, and concurrent gate syncs coalesce; that change is folded into D123551605. The tables below describe the earlier code, not the current stack.
GC17's own paired, interleaved run (this harness; N=8, 1000 us injected append and sync latency, sync mix 1 in 20, 1 KB values; 3 rounds, base then GC17) measured these N=8 mixed-sync ranges:
| threads | ops/s, before GC17 | ops/s, after GC17 |
|---|---|---|
| 8 | 920–1004 | 2136–2198 |
| 16 | 970–1216 | 3054–3535 |
| 32 | 1458–1514 | 5454–5685 |
The same N=8 cell at 16 threads reads 1399 ops/s in the table below, from a different run. In GC17's run, async-only cells were unchanged within run-to-run noise.
Mixed-sync throughput at N>1 is still below N=1. This summary's N=1 kNone figure for the same profile is 5658 ops/s at 16 threads, against 3054–3535 for N=8 after GC17. The two come from different runs, so the size of the gap is not established. A same-run N=1 vs N>1 comparison under mixed sync is pending, on the final code.
Known harness bug: `compute_trigger` in `tools/partition_wal_sweep.py` takes a `threads` parameter, then rebinds `threads` while unpacking each cell key, so the verdict check compares against the thread count of the last cell iterated rather than the requested one. The trigger table has cells at 16 and 32 threads; on the default grid the last cell happens to use 16 threads, so the default run reports the intended verdict, but a narrowed grid can report the verdict of the 32-thread cell. The trigger verdicts quoted here and in later summaries will be re-checked once this is fixed.
M1 standalone S-D (from GC16 Q1-Q3): reproducible WAL partition sweep harness (`tools/partition_wal_sweep.py`) plus `db_bench --sync_write_one_in` and `--wal_slow_partition`. Carved from GC16 D126232422, which is abandoned at M1.
At-M1 corrections to the GC16 summary below (applied inline): (1) reproducibility: the second `--quick` run's medians moved up to -8.3% (write p99) and -21% (gate p99) from the first, not "~2% on every median"; (2) the N=1 to N=16 async gain at 50us for 1024B values is +92% (47075 to 90571 ops/s); +77% is the 100B row; (3) join p99 at N=16/mix reaches 350ms; the 192ms figure was N=8/5000us/mix/1024B.
[GC] GC16: the N sweep and the abandon trigger, measured reproducibly (G-53). Benchmark tooling only: a checked-in sweep script plus two new `db_bench` flags, with the Tasks:975 abandon trigger evaluated under D-G53 (A). Also closes the GC15 carry-over: G-50 evidence for the multi-partition `synced_size` advance (Q4), a regression test for GC03's claim-time `SyncWAL` horizon (Q5), proof that the oracle's crashes lose data (G-54, Q6), and the `CrashMidRotationUnderSkewRecoversPrefix` drop fix (N-7-4, Q7). Q4's test idea, Q5's test, Q6's drop check and the Q7 finding are ported from D126193958 (MuseCode) as the requirement allows; its oracle, hooks, `SyncWalImpl` advance, latency FileSystem, per-WAL flag and Q8 labelling are not.
Reviewer question: Can anyone rerun this sweep and get the same picture, and does the watermark wait trip the abandon trigger at N=8? Anyone can: one command reproduces the 435-run matrix below (plus `--quick` in ~100s), and a second `--quick` run matches the first within −8.3% write p99 / −21% gate p99 at worst (see header). The trigger does not fire: 0.0012 at the designated N=8 profile, 50x below the 0.10 threshold on every sync-containing cell.
Q1: `tools/partition_wal_sweep.py` takes a `db_bench` binary and an output directory and runs the Q2 matrix with 3 reps per cell, emitting `results.json` (one row per rep: config, rep index, seed, throughput, p50/p99/p99.9 write latency, every Q2 histogram, FS counters; plus median/min-max aggregates), `results.md` (human table), per-cell command lines and raw logs, and the environment (host, CPUs, storage, opt build mode, commit hash, FS wait mode and concurrency cap). Injected and uninjected cells render in separate tables and the trigger refuses uninjected input. Reproducibility: two `--quick` runs from this commit (18 runs each, tables below) agree within −8.3% write p99 / −21% gate p99 at worst; strict min-max containment fails narrowly on 7 of 18 checked medians (worst -2.2%) because 3-rep spreads are extremely tight, and with n=3 a fresh median lands outside the previous min-max half the time by chance alone, so the small relative deviation, not strict containment, is the reproducibility evidence.
First `--quick` table (medians; commit 9c7f9a9b5188, opt, 166x AMD EPYC-Genoa):
## Injected cells (median across reps)
N usage append_us sync size slow ops/s us/op wr_p50 wr_p99 wr_p99.9 gate_p50 gate_p99 join_p50 join_p99 fsync/wr cap_med fanout_med
1 knone 500 mix 100 -1 9213 1707 1660 4309 6014 0.000 0.000 1291 4254 0.024 0.000 0.000
1 knone 500 none 100 -1 13884 1118 1321 1895 2886 0.000 0.000 989.5 1874 0.000 0.000 0.000
1 idx 500 mix 100 -1 9126 1713 1644 4300 6172 0.000 0.000 1292 4250 0.024 0.000 0.000
1 idx 500 none 100 -1 13908 1114 1318 1890 3625 0.000 0.000 987.3 1869 0.000 0.000 0.000
8 idx 500 mix 100 -1 2024 7721 867.9 49064 74742 0.553 43.9 269.3 44354 0.267 0.000 8.00
8 idx 500 none 100 -1 18247 866.2 820.4 1415 2716 0.558 41.8 597.6 1271 0.000 0.000 0.000
Second --quick table (medians):
## Injected cells (median across reps)
N usage append_us sync size slow ops/s us/op wr_p50 wr_p99 wr_p99.9 gate_p50 gate_p99 join_p50 join_p99 fsync/wr cap_med fanout_med
1 knone 500 mix 100 -1 9013 1729 1670 4323 6485 0.000 0.000 1306 4270 0.025 0.000 0.000
1 knone 500 none 100 -1 13746 1118 1314 1890 2770 0.000 0.000 994.9 1868 0.000 0.000 0.000
1 idx 500 mix 100 -1 8815 1796 1675 4393 8014 0.000 0.000 1333 4335 0.025 0.000 0.000
1 idx 500 none 100 -1 13938 1120 1322 1891 2668 0.000 0.000 993.4 1871 0.000 0.000 0.000
8 idx 500 mix 100 -1 2013 7755 867.4 49739 77800 0.554 44.0 309.6 44902 0.265 0.000 8.00
8 idx 500 none 100 -1 17845 864.9 818.0 1298 1882 0.555 33.0 588.7 1267 0.000 0.000 0.000
Q2: matrix is N in {1 kNone, 1 indexed, 2, 4, 8, 16} x append latency {50, 200, 1000, 5000}us (sync = append, jitter = append/10, seeded per rep) x sync {none, mix 1-in-20 via `--sync_write_one_in`, all} x value sizes {100, 1024} x 3 reps, 32k writes per cell on 64 CFs fixed across N (per-WAL counters verify every partition is covered in every N>1 cell; 8 CFs covered only 6/8 partitions in a pilot, hence 64), plus the N=8 one-slow-partition cell (`--wal_slow_partition=7`, 10x, mirroring the trigger profile). Steady state is inherent (WAL append cost is constant; the benchmark loop excludes open/CF setup) and confirmed by tight 3-rep spreads (e.g., trigger cell ops/s 1385-1417). New code only: the two flags live next to GC15's latency flags; no D118371518 line is touched. Cells use default write buffers (single generation; the slow override's rotation re-apply is validated in a separate small-buffer pilot where a stability check keeps mid-rotation tails from being misread as generations). Readings, one per bullet: baseline: N=1 indexed is within ~5% of kNone on every cell (e.g., 1000/mix/1024: 5376 vs 5658 ops/s) and byte-identical per the check below, so the stack costs ~nothing at N=1 (pre-stack-base comparison at 217951834332: not run, needs a second opt build; covered by byte-identity plus indexed-vs-kNone instead). N/BDP sweep: partitioning helps async writes at every latency (none/1024B N=1 to N=16: +92% at 50us (1024B: 47075 to 90571 ops/s; +77% is the 100B row), +40% at 1000us, +34% at 5000us) and hurts sync-containing ones (mix/1024B at 1000us: 5658 to 905 ops/s, -84%; all: 2874 to 582, -80%), driven by sync fan-out, not the gate. Cap-hit rate at N=8: `cap_excluded` sum is 0 in every cell over 10k-20k groups each, so the group cap never binds at N>1 here (M0.4: no). Join-wait vs watermark-wait: join p99 exceeds gate p99 by 7x (none) to 650x (mix) at N=8 (mix/1000/1024: 61ms vs 0.09ms); queueing dwarfs the watermark wait in every cell. Sync barrier: fan-out median is exactly N; barrier p50/p99 at N=8/1000/1024 is 21/49ms (all) and 36/102ms (mix); fsyncs/write is 0.33 (all) and 0.27 (mix), rising to 0.48/0.44 at N=16. One slow partition: throughput -53% (1399 to 661 ops/s), write p99 +126% (74 to 167ms), gate p99 x108 (91us to 9868us); the straggler cost lands almost entirely in the gate wait. Contention at N=8: the single-partition WAL mutex is uncontended (p99 1us); the all-partition mutex is taken per sync write (21k takes at all, p99 4.3ms; 2.8k takes at mix, p99 21.6ms) while async barely takes it (9 takes), so cross-partition serialization is the sync path's lock cost. Highlight (1000us, mix, 1024B medians): N=1 kNone 5658 ops/s wr_p99 6497us; N=1 idx 5376/6570; N=2 3615/17241; N=4 2275/34590; N=8 1399/73761 gate_p99 90.9us; N=8 slow 661/166813 gate_p99 9868us; N=16 905/157617. Full 145-row table (medians; commit 9c7f9a9b5188, opt, 166x AMD EPYC-Genoa):
## Injected cells (median across reps)
N usage append_us sync size slow ops/s us/op wr_p50 wr_p99 wr_p99.9 gate_p50 gate_p99 join_p50 join_p99 fsync/wr cap_med fanout_med
1 knone 50 all 100 -1 6955 2144 1837 4392 9100 0.000 0.000 1768 4346 0.092 0.000 0.000
1 knone 50 all 1024 -1 6764 2246 1870 4384 8360 0.000 0.000 1803 4364 0.094 0.000 0.000
1 knone 50 mix 100 -1 19060 827.4 369.9 2867 4317 0.000 0.000 331.3 2710 0.025 0.000 0.000
1 knone 50 mix 1024 -1 18416 851.3 467.6 2749 4569 0.000 0.000 340.8 2623 0.025 0.000 0.000
1 knone 50 none 100 -1 52029 298.1 289.4 547.9 784.1 0.000 0.000 278.6 378.5 0.000 0.000 0.000
1 knone 50 none 1024 -1 47075 328.7 304.2 799.5 2900 0.000 0.000 276.9 532.3 0.000 0.000 0.000
1 knone 200 all 100 -1 5864 2555 2127 5104 11634 0.000 0.000 1842 4392 0.095 0.000 0.000
1 knone 200 all 1024 -1 5186 2936 2819 6054 11152 0.000 0.000 2396 5488 0.099 0.000 0.000
1 knone 200 mix 100 -1 13826 1133 783.6 2895 5909 0.000 0.000 751.0 2865 0.025 0.000 0.000
1 knone 200 mix 1024 -1 13194 1195 793.7 3448 7385 0.000 0.000 752.8 2879 0.025 0.000 0.000
1 knone 200 none 100 -1 26404 578.7 660.0 868.5 1621 0.000 0.000 638.1 865.8 0.000 0.000 0.000
1 knone 200 none 1024 -1 25858 598.2 655.7 970.0 1732 0.000 0.000 634.7 866.4 0.000 0.000 0.000
1 knone 1000 all 100 -1 2954 5049 4184 9834 12417 0.000 0.000 4060 9817 0.094 0.000 0.000
1 knone 1000 all 1024 -1 2874 5215 4239 9844 13632 0.000 0.000 4110 9831 0.095 0.000 0.000
1 knone 1000 mix 100 -1 5633 2723 2565 6513 9417 0.000 0.000 2453 6414 0.025 0.000 0.000
1 knone 1000 mix 1024 -1 5658 2760 2569 6497 9424 0.000 0.000 2459 6410 0.025 0.000 0.000
1 knone 1000 none 100 -1 7702 1997 2146 2887 3828 0.000 0.000 2079 2884 0.000 0.000 0.000
1 knone 1000 none 1024 -1 7588 2026 2139 2887 3511 0.000 0.000 2070 2883 0.000 0.000 0.000
1 knone 5000 all 100 -1 857 17711 13717 32780 45952 0.000 0.000 13352 32746 0.096 0.000 0.000
1 knone 5000 all 1024 -1 843 17630 13599 32787 44333 0.000 0.000 13243 32759 0.097 0.000 0.000
1 knone 5000 mix 100 -1 1441 10811 11403 27626 34000 0.000 0.000 11105 21824 0.026 0.000 0.000
1 knone 5000 mix 1024 -1 1393 11108 11556 28820 48827 0.000 0.000 11254 21991 0.027 0.000 0.000
1 knone 5000 none 100 -1 1636 9191 11013 13943 13996 0.000 0.000 10747 13166 0.000 0.000 0.000
1 knone 5000 none 1024 -1 1646 9117 10908 13941 13996 0.000 0.000 10626 12602 0.000 0.000 0.000
1 idx 50 all 100 -1 7064 2168 1846 4374 7920 0.000 0.000 1782 4350 0.092 0.000 0.000
1 idx 50 all 1024 -1 6825 2220 1869 4366 6578 0.000 0.000 1804 4344 0.094 0.000 0.000
1 idx 50 mix 100 -1 19277 816.4 373.6 2656 4279 0.000 0.000 336.5 2514 0.026 0.000 0.000
1 idx 50 mix 1024 -1 18639 843.4 484.9 2757 4203 0.000 0.000 344.4 2595 0.025 0.000 0.000
1 idx 50 none 100 -1 51514 301.2 291.4 566.0 937.9 0.000 0.000 277.6 379.2 0.000 0.000 0.000
1 idx 50 none 1024 -1 49359 316.1 301.8 574.3 1231 0.000 0.000 275.8 490.9 0.000 0.000 0.000
1 idx 200 all 100 -1 5825 2596 2343 4840 8014 0.000 0.000 1870 4387 0.095 0.000 0.000
1 idx 200 all 1024 -1 5410 2795 2747 6311 8910 0.000 0.000 2441 6185 0.097 0.000 0.000
1 idx 200 mix 100 -1 13807 1135 780.7 2881 4569 0.000 0.000 754.3 2862 0.025 0.000 0.000
1 idx 200 mix 1024 -1 13350 1182 784.4 3069 5700 0.000 0.000 755.6 2874 0.025 0.000 0.000
1 idx 200 none 100 -1 26815 582.8 659.9 968.4 2900 0.000 0.000 637.3 866.9 0.000 0.000 0.000
1 idx 200 none 1024 -1 24464 637.1 667.5 1686 3922 0.000 0.000 638.3 869.8 0.000 0.000 0.000
1 idx 1000 all 100 -1 2799 5308 4213 11187 20780 0.000 0.000 4079 10327 0.095 0.000 0.000
1 idx 1000 all 1024 -1 2767 5391 4326 9893 13819 0.000 0.000 4175 9867 0.097 0.000 0.000
1 idx 1000 mix 100 -1 5465 2811 2571 6542 9845 0.000 0.000 2439 6451 0.026 0.000 0.000
1 idx 1000 mix 1024 -1 5376 2804 2564 6570 11266 0.000 0.000 2430 6459 0.026 0.000 0.000
1 idx 1000 none 100 -1 7531 2009 2141 2890 4266 0.000 0.000 2070 2884 0.000 0.000 0.000
1 idx 1000 none 1024 -1 7275 2080 2175 3272 6355 0.000 0.000 2106 2889 0.000 0.000 0.000
1 idx 5000 all 100 -1 835 18449 22425 32826 45265 0.000 0.000 13761 32778 0.099 0.000 0.000
1 idx 5000 all 1024 -1 849 17924 13812 32804 42208 0.000 0.000 13421 32778 0.097 0.000 0.000
1 idx 5000 mix 100 -1 1474 10462 11192 25826 32667 0.000 0.000 10899 21554 0.025 0.000 0.000
1 idx 5000 mix 1024 -1 1470 10612 11227 26240 32679 0.000 0.000 10926 21628 0.026 0.000 0.000
1 idx 5000 none 100 -1 1713 8883 10730 13938 13996 0.000 0.000 10421 13000 0.000 0.000 0.000
1 idx 5000 none 1024 -1 1685 9065 10878 13943 13999 0.000 0.000 10594 13533 0.000 0.000 0.000
2 idx 50 all 100 -1 3173 5010 4817 10548 18717 0.500 0.990 4146 9837 0.157 0.000 2.00
2 idx 50 all 1024 -1 3253 4881 4584 9844 13883 0.500 0.991 3990 9737 0.157 0.000 2.00
2 idx 50 mix 100 -1 9613 1632 530.9 6555 9705 0.501 0.992 326.0 6348 0.072 0.000 2.00
2 idx 50 mix 1024 -1 7238 2182 535.5 10814 13913 0.501 0.993 332.4 9763 0.072 0.000 2.00
2 idx 50 none 100 -1 73703 212.3 196.4 378.1 1054 0.501 0.992 152.7 372.7 0.000 0.000 0.000
2 idx 50 none 1024 -1 58770 233.9 219.8 759.8 2900 0.505 0.999 160.3 455.9 0.000 0.000 0.000
2 idx 200 all 100 -1 3007 5295 5069 11021 15756 0.500 0.991 4350 9876 0.157 0.000 2.00
2 idx 200 all 1024 -1 3507 4537 4482 8705 13672 0.500 0.991 3980 7920 0.157 0.000 2.00
2 idx 200 mix 100 -1 5592 2831 856.8 13065 20918 0.501 0.993 708.3 11987 0.071 0.000 2.00
2 idx 200 mix 1024 -1 5360 2944 863.0 13563 28000 0.501 0.993 720.6 12924 0.071 0.000 2.00
2 idx 200 none 100 -1 36498 435.4 371.1 860.0 1660 0.501 0.991 335.0 842.5 0.000 0.000 0.000
2 idx 200 none 1024 -1 35377 448.3 385.8 859.5 1900 0.501 0.991 339.0 845.5 0.000 0.000 0.000
2 idx 1000 all 100 -1 1823 8740 9873 13967 21764 0.500 0.991 8830 13928 0.157 0.000 2.00
2 idx 1000 all 1024 -1 1749 9091 9913 13974 21810 0.500 0.991 8879 13929 0.157 0.000 2.00
2 idx 1000 mix 100 -1 3677 4298 2723 16638 21509 0.504 0.998 2381 13766 0.071 0.000 2.00
2 idx 1000 mix 1024 -1 3615 4350 2742 17241 21887 0.506 5.06 2389 13746 0.071 0.000 2.00
2 idx 1000 none 100 -1 10378 1528 1285 2862 3136 0.502 0.995 1169 2837 0.000 0.000 0.000
2 idx 1000 none 1024 -1 10328 1538 1281 2865 3542 0.502 0.994 1168 2843 0.000 0.000 0.000
2 idx 5000 all 100 -1 527 30190 33019 49746 68939 0.500 0.991 29637 49610 0.157 0.000 2.00
2 idx 5000 all 1024 -1 524 30321 32999 49710 69078 0.500 0.991 29615 49566 0.157 0.000 2.00
2 idx 5000 mix 100 -1 985 16047 12484 55452 73373 0.541 296.0 11359 48332 0.072 0.000 2.00
2 idx 5000 mix 1024 -1 977 16107 12512 53021 73347 0.538 262.4 11407 48122 0.072 0.000 2.00
2 idx 5000 none 100 -1 2271 6987 6264 13715 13983 0.508 46.0 5811 12824 0.000 0.000 0.000
2 idx 5000 none 1024 -1 2236 7095 6344 13721 13989 0.508 53.5 5852 13541 0.000 0.000 0.000
4 idx 50 all 100 -1 3132 5052 4757 9900 19523 0.501 0.991 3436 9757 0.220 0.000 4.00
4 idx 50 all 1024 -1 2981 5328 5059 12450 19304 0.500 0.990 3752 10256 0.220 0.000 4.00
4 idx 50 mix 100 -1 5206 2994 362.7 16734 21957 0.513 15.5 209.2 13481 0.146 0.000 4.00
4 idx 50 mix 1024 -1 5116 3089 417.6 17175 21767 0.519 93.9 225.1 13734 0.147 0.000 4.00
4 idx 50 none 100 -1 75704 206.7 197.1 375.7 531.4 0.503 0.995 145.0 363.1 0.000 0.000 0.000
4 idx 50 none 1024 -1 72385 214.7 205.4 376.7 1335 0.504 0.997 147.2 366.4 0.000 0.000 0.000
4 idx 200 all 100 -1 2557 6199 6379 13396 21463 0.500 0.991 4657 12400 0.219 0.000 4.00
4 idx 200 all 1024 -1 2469 6413 6528 13829 21784 0.500 0.990 4721 12782 0.220 0.000 4.00
4 idx 200 mix 100 -1 4487 3493 781.0 19880 26685 0.515 14.2 371.2 17212 0.145 0.000 4.00
4 idx 200 mix 1024 -1 4341 3612 827.3 19957 26529 0.517 22.2 389.9 17764 0.145 0.000 4.00
4 idx 200 none 100 -1 35151 449.1 416.6 864.5 1796 0.505 0.999 323.2 815.6 0.000 0.000 0.000
4 idx 200 none 1024 -1 34343 461.6 431.4 866.4 3650 0.504 0.999 326.9 840.0 0.000 0.000 0.000
4 idx 1000 all 100 -1 1297 12186 12349 25183 33000 0.500 0.991 10115 21877 0.219 0.000 4.00
4 idx 1000 all 1024 -1 1264 12488 13023 25700 41225 0.500 0.990 10220 21925 0.219 0.000 4.00
4 idx 1000 mix 100 -1 2255 6946 2644 34819 49792 0.540 65.4 1266 30316 0.149 0.000 4.00
4 idx 1000 mix 1024 -1 2275 6908 2613 34590 55952 0.538 67.8 1270 30184 0.147 0.000 4.00
4 idx 1000 none 100 -1 9766 1627 1516 2875 3800 0.522 35.1 1138 2839 0.000 0.000 0.000
4 idx 1000 none 1024 -1 9644 1648 1559 2885 5866 0.523 66.5 1145 2851 0.000 0.000 0.000
4 idx 5000 all 100 -1 378 41788 40944 75336 107477 0.500 0.991 33643 73855 0.218 0.000 4.00
4 idx 5000 all 1024 -1 375 42333 41105 78277 108731 0.500 0.991 33890 74077 0.218 0.000 4.00
4 idx 5000 mix 100 -1 631 24937 12239 136600 197826 0.590 373.8 6387 102624 0.151 0.000 4.00
4 idx 5000 mix 1024 -1 626 24990 12237 129052 187297 0.584 369.4 6385 101482 0.152 0.000 4.00
4 idx 5000 none 100 -1 2085 7609 6598 13854 13990 0.550 292.9 5628 12498 0.000 0.000 0.000
4 idx 5000 none 1024 -1 2071 7654 6698 13858 13991 0.550 306.8 5648 12430 0.000 0.000 0.000
8 idx 50 all 100 -1 2129 7442 7339 21040 41904 0.500 0.990 3655 18016 0.329 0.000 8.00
8 idx 50 all 1024 -1 1991 7965 7726 20817 31412 0.500 0.990 3943 18174 0.330 0.000 8.00
8 idx 50 mix 100 -1 3202 4871 225.7 31709 47000 0.531 21.8 69.8 29138 0.260 0.000 8.00
8 idx 50 mix 1024 -1 3108 5067 233.7 32225 47820 0.531 27.8 74.5 30062 0.256 0.000 8.00
8 idx 50 none 100 -1 82431 188.7 178.4 372.4 501.7 0.512 5.47 116.1 327.5 0.000 0.000 0.000
8 idx 50 none 1024 -1 80988 195.0 185.6 374.4 568.9 0.513 6.83 117.6 343.0 0.000 0.000 0.000
8 idx 200 all 100 -1 1729 9168 9338 21970 32715 0.500 0.991 5025 20367 0.330 0.000 8.00
8 idx 200 all 1024 -1 1652 9603 9627 25015 34888 0.500 0.991 5143 20962 0.331 0.000 8.00
8 idx 200 mix 100 -1 2694 5791 445.2 39174 53125 0.534 26.0 151.0 31635 0.259 0.000 8.00
8 idx 200 mix 1024 -1 2614 5992 471.6 40379 49928 0.536 51.4 177.5 32085 0.256 0.000 8.00
8 idx 200 none 100 -1 37460 422.0 379.5 851.2 1062 0.523 13.5 272.6 728.2 0.000 0.000 0.000
8 idx 200 none 1024 -1 36931 426.4 393.3 851.3 869.3 0.522 12.4 271.5 741.5 0.000 0.000 0.000
8 idx 1000 all 100 -1 857 18445 17511 47477 73571 0.500 0.990 10538 42973 0.330 0.000 8.00
8 idx 1000 all 1024 -1 845 18738 17946 47829 72670 0.500 0.991 10756 42949 0.329 0.000 8.00
8 idx 1000 mix 100 -1 1402 11165 1741 74393 108959 0.585 93.4 312.5 60059 0.276 0.000 8.00
8 idx 1000 mix 1024 -1 1399 11114 1802 73761 109023 0.578 90.9 880.4 60966 0.270 0.000 8.00
8 idx 1000 mix 1024 7 661 23760 11139 166812 244581 0.732 9867 870.7 108682 0.295 0.000 8.00
8 idx 1000 none 100 -1 9843 1609 1451 2875 3650 0.598 98.5 994.0 2806 0.000 0.000 0.000
8 idx 1000 none 1024 -1 9552 1655 1523 3025 5377 0.603 414.8 991.9 2828 0.000 0.000 0.000
8 idx 5000 all 100 -1 250 63159 58084 159190 222173 0.500 0.990 35234 140991 0.330 0.000 8.00
8 idx 5000 all 1024 -1 247 63715 58555 161949 232028 0.500 0.991 35455 144577 0.331 0.000 8.00
8 idx 5000 mix 100 -1 410 38438 6810 289671 378652 0.643 494.2 889.1 197712 0.283 0.000 8.00
8 idx 5000 mix 1024 -1 412 38123 7160 254511 372618 0.641 486.1 1900 191509 0.282 0.000 8.00
8 idx 5000 none 100 -1 2075 7651 6478 13876 13991 0.658 395.1 4996 13349 0.000 0.000 0.000
8 idx 5000 none 1024 -1 2074 7648 6445 13878 13991 0.658 408.6 5002 11790 0.000 0.000 0.000
16 idx 50 all 100 -1 1491 10629 10610 31645 49569 0.500 0.990 1960 24014 0.484 0.000 16.0
16 idx 50 all 1024 -1 1437 11010 10980 31891 48539 0.500 0.991 1993 25956 0.484 0.000 16.0
16 idx 50 mix 100 -1 2130 7392 162.9 62961 78181 0.541 27.9 0.782 48548 0.405 0.000 16.0
16 idx 50 mix 1024 -1 2007 7818 164.6 65696 98068 0.540 32.0 0.780 49673 0.404 0.000 16.0
16 idx 50 none 100 -1 92287 169.7 159.3 366.9 379.8 0.527 11.3 44.4 249.1 0.000 0.000 0.000
16 idx 50 none 1024 -1 90571 173.0 160.6 368.9 379.7 0.530 12.1 45.3 285.3 0.000 0.000 0.000
16 idx 200 all 100 -1 1181 13431 13356 38860 63571 0.500 0.990 2991 30479 0.484 0.000 16.0
16 idx 200 all 1024 -1 949 16720 15013 72363 118108 0.500 0.990 3108 48272 0.486 0.000 16.0
16 idx 200 mix 100 -1 1778 8789 355.4 71340 105314 0.546 44.1 0.782 61541 0.409 0.000 16.0
16 idx 200 mix 1024 -1 1727 9101 356.4 72268 104615 0.544 39.9 0.787 65150 0.407 0.000 16.0
16 idx 200 none 100 -1 40927 385.7 353.6 837.2 869.8 0.551 19.1 85.8 573.0 0.000 0.000 0.000
16 idx 200 none 1024 -1 40675 389.0 355.3 840.6 870.0 0.545 15.7 88.9 578.4 0.000 0.000 0.000
16 idx 1000 all 100 -1 589 26867 26163 74241 108472 0.500 0.991 6078 64161 0.483 0.000 16.0
16 idx 1000 all 1024 -1 582 27175 26211 74011 131818 0.500 0.991 6756 63614 0.481 0.000 16.0
16 idx 1000 mix 100 -1 954 16309 1212 149831 231600 0.604 84.9 0.773 104478 0.439 0.000 16.0
16 idx 1000 mix 1024 -1 905 17307 1216 157617 238930 0.603 90.3 0.776 108960 0.438 0.000 16.0
16 idx 1000 none 100 -1 10625 1490 1224 2868 2900 0.693 78.3 170.1 2725 0.000 0.000 0.000
16 idx 1000 none 1024 -1 10610 1491 1226 2866 2898 0.689 75.0 166.4 2724 0.000 0.000 0.000
16 idx 5000 all 100 -1 171 92232 88833 246299 368560 0.500 0.990 22354 210692 0.482 0.000 16.0
16 idx 5000 all 1024 -1 169 93424 89851 246061 368288 0.500 0.990 22052 212761 0.485 0.000 16.0
16 idx 5000 mix 100 -1 278 55903 6118 533996 815050 0.660 517.5 0.751 348988 0.471 0.000 16.0
16 idx 5000 mix 1024 -1 279 55956 6123 533486 817263 0.655 508.0 0.757 350460 0.468 0.000 16.0
16 idx 5000 none 100 -1 2223 7125 6114 13834 13986 0.752 487.9 787.9 11836 0.000 0.000 0.000
16 idx 5000 none 1024 -1 2205 7131 6109 13839 13986 0.754 485.5 743.3 11352 0.000 0.000 0.000
Q3: D-G53 = (A) share of the tail (Recommended; the choice cell is blank). Metric is p99(`rocksdb.wal.durability.wait.micros`) / p99(write) at N=8 per (latency, sync) cell; the designated profile is append=1000us, mix, 1024B (mid-range networked-WAL latency, realistic sync ratio, KB-scale values, per the doc's own example). Number: 0.0012. Verdict: DOES NOT FIRE. The verdict is robust: every sync-containing cell at N=8 is at most 0.0019 (5000us mix), 50x below threshold, and all-sync cells round to 0.0000 (writes serialize through the barrier, so the gate never waits). The highest ratio anywhere is 0.1371 at (1000us, none, 1024B), a no-sync extreme where the denominator has no barrier (write p99 3.0ms) while the gate tail reaches 415us consistently across reps (281/415/531us); the 100B sibling is 0.034. That cell is reported, not the verdict: the trigger refers to the realistic sync mix, but the none-mode tail's value-size sensitivity is flagged for GC17.
## Abandon trigger (D-G53 (A)) at N=8
append_us sync size gate_p99_us write_p99_us ratio
50 all 100 0.990 21040 0.0000
50 all 1024 0.990 20817 0.0000
50 mix 100 21.8 31709 0.0007
50 mix 1024 27.8 32225 0.0009
50 none 100 5.47 372.4 0.0147
50 none 1024 6.83 374.4 0.0183
200 all 100 0.991 21970 0.0000
200 all 1024 0.991 25015 0.0000
200 mix 100 26.0 39174 0.0007
200 mix 1024 51.4 40379 0.0013
200 none 100 13.5 851.2 0.0159
200 none 1024 12.4 851.3 0.0146
1000 all 100 0.990 47477 0.0000
1000 all 1024 0.991 47829 0.0000
1000 mix 100 93.4 74393 0.0013
1000 mix 1024 90.9 73761 0.0012
1000 none 100 98.5 2875 0.0343
1000 none 1024 414.8 3025 0.1371
5000 all 100 0.990 159190 0.0000
5000 all 1024 0.991 161949 0.0000
5000 mix 100 494.2 289671 0.0017
5000 mix 1024 486.1 254511 0.0019
5000 none 100 395.1 13876 0.0285
5000 none 1024 408.6 13878 0.0294
TRIGGER: ratio 0.0012 at N=8 append=1000us sync=mix size=1024B does not fire (threshold 0.10)
Q4: `SyncWalAdvancesOtherPartitionsSyncedSize` syncs both partitions, writes nothing more, then a sync write on partition 0 must record sum 0 on `WAL_SYNC_UNSYNCED_PARTITIONS`. Neuter (drop the `note_synced` in the `wal.number > up_to` branch; dropping the whole branch would still advance via the active-WAL path): fails with sum 1. Existing `NonLeadershipSyncsAdvanceSyncedSize` passes unmodified.
Q5: `SyncWalClaimTimeHorizonExcludesCoupledRotation` holds a manual `SyncWAL` in its fsync loop with 100ms slow syncs, lands a coupled rotation inside (counter-observed, order proven by `DBImpl::SyncWAL:Begin` < switch < `DBImpl::SyncWAL:BeforeMarkLogsSynced:1`), writes into the rotated-in WALs, and requires a later sync write to count all 4 partitions unsynced, with marks clear and deques consistent. Neuter (finish-time horizon): aborts on `assert(wal.IsSyncing())` on the unmarked rotated-in WAL.
Q6: the oracle records per power-loss cycle whether an acknowledged write is absent after recovery, prints the count in the summary line, and `RecoveredStateIsPrefixOfHistory` fails when power-loss cycles ran but none lost a write (runs with zero power-loss cycles, i.e. single-cycle reruns of process-crash seeds, are exempt: nothing to prove). 1000-cycle run from this commit: pass, 313 of 528 power-loss cycles lost a write. Neuter (crash keeps unsynced data): 40-cycle run fails with "power loss lost an acknowledged write in 0".
Q7: `CrashMidRotationUnderSkewRecoversPrefix` now sets `SetInjectUnsyncedDataLoss(true)` before the open (files capture the flag at creation) and requires `missing_seen` past the last sync. Neuter (flag off again): fails on "the crash dropped no acknowledged write". Listed under Invariant 4 as the one modified test.
GC17 pointers (numbers only, no decisions): D-G11: mean unsynced partitions under the mix is 1.3-2.3 of 8 (well below N) and the barrier dominates sync-write p99 (barrier p99 102ms over 1321 sync groups vs write p99 74ms over 32k mixed writes at N=8/1000/mix/1024; different populations, noted). G-19a: writers/group p50 is 1-2.4 while join p99 reaches 350ms at N=16/mix (191.5ms is N=8/5000us/mix/1024B); the index-allocation mutex has no dedicated histogram, so the harness bounds group-formation queueing but does not isolate the allocator. muse #22: per-partition mutex waits are ~0 at all N (p99 1us); no contention signature that padding would relieve in these workloads. N-2-6: 0.27-0.48 fsyncs/write sit on the write path at N=8-16 sync workloads; a background fsync's prize is bounded by the barrier numbers above minus the all-mutex claim, which stays.
Fold-back split: Q1-Q3 (script + `--sync_write_one_in` + `--wal_slow_partition` in `tools/db_bench_tool.cc`) stays a standalone diff (new code; no D118371518 line touched; no D-G53 (B) bypass). Q4 test folds with GC15's `NonLeadershipSyncsAdvanceSyncedSize` (D123971668, or D123551605). Q5 test to GC15's standalone diff (needs the latency FS). Q6 (oracle drop count + failure) to GC15's standalone diff. Q7 (test change) to D123928339. No hunk is unplaceable at its target.
Assumptions: D-G53 blank, so Recommended (A) per AB section 4 rule 2. Trigger profile (1000us append, mix 1-in-20, 1024B) chosen per rule 5 (mid-range networked-WAL latency, realistic sync ratio, KB-scale values; every cell tabulated so the choice is auditable). Sync latency = append latency and jitter = append/10 per rule 5 (one profile knob; seeded jitter keeps reps reproducible). 64 fixed CFs per rule 5 (isolates N; coverage verified from per-WAL counters). Cells use default write buffers (single generation; rotation re-apply validated in a separate small-buffer pilot) per rule 5 (cleanest numbers). Q4 neuter removes the `note_synced` call rather than the whole branch per rule 5 (the literal branch drop still advances via the active path and would not fail). Q6 exempts runs with zero power-loss cycles per rule 5 (single-cycle reruns must stay green). Cap-hit rate is reported as mean excluded/group plus P99 (ToString exposes no non-zero fraction) per rule 5.
Not done: (empty).
M2 fold (2026-10-22, `M2-FoldTasks.md` + `M2-Amendment.md`): Absorbs (M2) GC10 Q8/Q9: `SlowWalPartitionFileSystem`, sweep comparisons, steady state, `--compare_to`, trigger table; GC07 Q9: sweep dedup and N=1 baselines. This diff now edits S-C's db_bench lines: it moves S-C's latency-FS install block below its own slow-partition validation.
Test Plan:
- `buck2 test fbcode//internal_repo_rocksdb/repo:db_write_test fbcode//internal_repo_rocksdb/repo:latency_injection_fs_test`: 199 pass, 0 fail.
- `buck2 test fbcode//internal_repo_rocksdb/repo:db_wal_oracle_test` (40 cycles): 3 pass; drop count 13/17 power-loss cycles.
- 1000-cycle oracle run from this commit (`ROCKSDB_WAL_ORACLE_CYCLES=1000`): pass; 313 of 528 power-loss cycles lost a write; 2 known lower-bound holes (non-strict, expected). A pre-format run gave 310/528; the committed run above is the evidence.
- Q5+Q7 x100 repeats (`--gtest_repeat=100`): 100/100 iterations pass, 0 failures.
- Q5+Q7 under `@fbcode//mode/dev-tsan`: 4 pass, no TSan warnings.
- Q4 neuter (no `note_synced` past the horizon): `SyncWalAdvancesOtherPartitionsSyncedSize` fails with sum 1 (expected). Q5 neuter (finish-time horizon): aborts on `assert(wal.IsSyncing())` (expected). Q6 neuter (crash keeps unsynced data): 40-cycle run fails "no power-loss cycle lost an acknowledged write" with count 0 (expected). Q7 neuter (flag off): fails "the crash dropped no acknowledged write" (expected). All neuters reverted; `db_impl.cc` clean.
- Full matrix: 435/435 runs ok from this commit (opt `db_bench`); trigger verdict DOES NOT FIRE (0.0012 at N=8/1000us/mix/1024B; max 0.0019 on any sync-containing cell).
- Two `--quick` runs from this commit: 18/18 each; second run's medians within −8.3% write p99 / −21% gate p99 of the first at worst (7 of 18 narrowly outside the tight 3-rep min-max; worst -2.2%); tables in summary.
- N=1 byte-identity check (base vs this commit, `none` and `partition_by_column_family`): pass; hashes equal the documented values (`6d135111...` off, `9a69a3fc...` on).
- 180s `db_stress` blackbox crash test at N=1 with `partition_wal_usage` on: first run failed early (checkpoint "WAL index merge: WAL 3 unreadable" under injected read faults), retry passed ("Crash-recovery verification passed"). Engine code is untouched by this diff (benchmark tooling + tests only), so the intermittent failure is a pre-existing base finding, reported, not fixed.
- Pre-stack-base N=1 comparison at 217951834332: not run (needs a second opt build; covered by byte-identity plus N=1 indexed-vs-kNone instead).
- Repo-pinned clang-format clean on all touched C++ files; `arc lint -a` and the script's lint clean.
(M1 standalone carved from GC16 D126232422; that round diff is abandoned at M1.)
M1 re-verification (2026-10-20, after rebasing the stack onto master f0c3a35689fc and clang-formatting D117251769, D117251771, D123079329, D123551605):
- Per-diff gate, all 35 commits bottom-up: CI format check, `rocksdb_lib` build, every touched test target: all pass, 0 failures.
- Tip suites (23 targets): 8126 pass, 0 fail.
- N=1 byte identity at the tip: `6d135111...` (off) and `9a69a3fc...` (on), equal to T0.
- 180s blackbox crash test at N=1 with `partition_wal_usage=partition_by_column_family`: pass.
- Trigger rerun, opt `db_bench`, N=8/1000us/1024B, this harness: sync mix 0.0014 / 0.0013 / 0.0011 at 8 / 16 / 32 threads; all-async 0.026 / 0.025 / 0.018. Does not fire in either profile (the earlier 0.137 and dev-mode 0.108 readings do not reproduce in opt).
M2 fold: new or moved tests here: (none). B.1 at this diff (format check, `rocksdb_lib`, touched test targets): PASS; no test targets; `db_bench` and `db_stress` build; `partition_wal_sweep.py` compiles.
M3 B.1 at this diff (clang-format 21.1.2 on its changed lines, make check-sources, debug librocksdb build; no test file touched): PASS.
Note (2026-10-27): every number above predates GC17's sync-path change; see the first paragraph of the summary. The pre-stack-base comparison is still not run.
M5 fold: Absorbs 10 A.1 entries (GC28 5, GC27 1, GC29b 4): GC28 Q5 (b)/Q6: TRIGGER_THREAD_COUNTS, compute_trigger, --stats_level comments; GC27's zero guard; GC29b's docstrings and report heading. M5-F1 (A.8): F1.3: partition_wal_sweep.py's docstring placeholders.
M5 B.1: PASS (clang-format 21.1.2 on the changed lines, make check-sources, debug build of db_bench); no test binary touched.
M6 fold: Absorbs GC35 Q4: `tools/partition_wal_sweep.py` `--bandwidths-mbps` (cells, labels, parsing of `size_sleep_micros`, comparisons and trigger per bandwidth) and `db_bench` `--wal_slow_partition` taking a tenth of the WAL bandwidths.
M6 B.1: PASS (debug build of db_bench; no test binary touched).
Differential Revision: https://phabricator.intern.facebook.com/D126533195
JustinGaoF
added a commit
that referenced
this pull request
Nov 19, 2026
Summary:
**Measured before GC17.** Every number in this summary and its test plan was measured on the code before GC17 changed the N>1 sync path. Since GC17, a sync write fsyncs from its completion gate, and concurrent gate syncs coalesce; that change is folded into D123551605. The tables below describe the earlier code, not the current stack.
GC17's own paired, interleaved run (this harness; N=8, 1000 us injected append and sync latency, sync mix 1 in 20, 1 KB values; 3 rounds, base then GC17) measured these N=8 mixed-sync ranges:
| threads | ops/s, before GC17 | ops/s, after GC17 |
|---|---|---|
| 8 | 920–1004 | 2136–2198 |
| 16 | 970–1216 | 3054–3535 |
| 32 | 1458–1514 | 5454–5685 |
The same N=8 cell at 16 threads reads 1399 ops/s in the table below, from a different run. In GC17's run, async-only cells were unchanged within run-to-run noise.
Mixed-sync throughput at N>1 is still below N=1. This summary's N=1 kNone figure for the same profile is 5658 ops/s at 16 threads, against 3054–3535 for N=8 after GC17. The two come from different runs, so the size of the gap is not established. A same-run N=1 vs N>1 comparison under mixed sync is pending, on the final code.
`compute_trigger` in `tools/partition_wal_sweep.py` unpacks each cell's thread count into `cell_threads` and matches it against the requested `threads` (TRIGGER_THREAD_COUNTS is 8, 16, 32), so a narrowed grid reports the verdict of the requested thread count. Verdicts from runs before the M5 fold used the earlier version, which could compare against the last cell's thread count.
M1 standalone S-D (from GC16 Q1-Q3): reproducible WAL partition sweep harness (`tools/partition_wal_sweep.py`) plus `db_bench --sync_write_one_in` and `--wal_slow_partition`. Carved from GC16 D126232422, which is abandoned at M1.
At-M1 corrections to the GC16 summary below (applied inline): (1) reproducibility: the second `--quick` run's medians moved up to -8.3% (write p99) and -21% (gate p99) from the first, not "~2% on every median"; (2) the N=1 to N=16 async gain at 50us for 1024B values is +92% (47075 to 90571 ops/s); +77% is the 100B row; (3) join p99 at N=16/mix reaches 350ms; the 192ms figure was N=8/5000us/mix/1024B.
[GC] GC16: the N sweep and the abandon trigger, measured reproducibly (G-53). Benchmark tooling only: a checked-in sweep script plus two new `db_bench` flags, with the Tasks:975 abandon trigger evaluated under D-G53 (A). Also closes the GC15 carry-over: G-50 evidence for the multi-partition `synced_size` advance (Q4), a regression test for GC03's claim-time `SyncWAL` horizon (Q5), proof that the oracle's crashes lose data (G-54, Q6), and the `CrashMidRotationUnderSkewRecoversPrefix` drop fix (N-7-4, Q7). Q4's test idea, Q5's test, Q6's drop check and the Q7 finding are ported from D126193958 (MuseCode) as the requirement allows; its oracle, hooks, `SyncWalImpl` advance, latency FileSystem, per-WAL flag and Q8 labelling are not.
Reviewer question: Can anyone rerun this sweep and get the same picture, and does the watermark wait trip the abandon trigger at N=8? Anyone can: one command reproduces the 435-run matrix below (plus `--quick` in ~100s), and a second `--quick` run matches the first within −8.3% write p99 / −21% gate p99 at worst (see header). The trigger does not fire: 0.0012 at the designated N=8 profile, 50x below the 0.10 threshold on every sync-containing cell.
Q1: `tools/partition_wal_sweep.py` takes a `db_bench` binary and an output directory and runs the Q2 matrix with 3 reps per cell, emitting `results.json` (one row per rep: config, rep index, seed, throughput, p50/p99/p99.9 write latency, every Q2 histogram, FS counters; plus median/min-max aggregates), `results.md` (human table), per-cell command lines and raw logs, and the environment (host, CPUs, storage, opt build mode, commit hash, FS wait mode and concurrency cap). Injected and uninjected cells render in separate tables and the trigger refuses uninjected input. Reproducibility: two `--quick` runs from this commit (18 runs each, tables below) agree within −8.3% write p99 / −21% gate p99 at worst; strict min-max containment fails narrowly on 7 of 18 checked medians (worst -2.2%) because 3-rep spreads are extremely tight, and with n=3 a fresh median lands outside the previous min-max half the time by chance alone, so the small relative deviation, not strict containment, is the reproducibility evidence.
First `--quick` table (medians; commit 9c7f9a9b5188, opt, 166x AMD EPYC-Genoa):
## Injected cells (median across reps)
N usage append_us sync size slow ops/s us/op wr_p50 wr_p99 wr_p99.9 gate_p50 gate_p99 join_p50 join_p99 fsync/wr cap_med fanout_med
1 knone 500 mix 100 -1 9213 1707 1660 4309 6014 0.000 0.000 1291 4254 0.024 0.000 0.000
1 knone 500 none 100 -1 13884 1118 1321 1895 2886 0.000 0.000 989.5 1874 0.000 0.000 0.000
1 idx 500 mix 100 -1 9126 1713 1644 4300 6172 0.000 0.000 1292 4250 0.024 0.000 0.000
1 idx 500 none 100 -1 13908 1114 1318 1890 3625 0.000 0.000 987.3 1869 0.000 0.000 0.000
8 idx 500 mix 100 -1 2024 7721 867.9 49064 74742 0.553 43.9 269.3 44354 0.267 0.000 8.00
8 idx 500 none 100 -1 18247 866.2 820.4 1415 2716 0.558 41.8 597.6 1271 0.000 0.000 0.000
Second --quick table (medians):
## Injected cells (median across reps)
N usage append_us sync size slow ops/s us/op wr_p50 wr_p99 wr_p99.9 gate_p50 gate_p99 join_p50 join_p99 fsync/wr cap_med fanout_med
1 knone 500 mix 100 -1 9013 1729 1670 4323 6485 0.000 0.000 1306 4270 0.025 0.000 0.000
1 knone 500 none 100 -1 13746 1118 1314 1890 2770 0.000 0.000 994.9 1868 0.000 0.000 0.000
1 idx 500 mix 100 -1 8815 1796 1675 4393 8014 0.000 0.000 1333 4335 0.025 0.000 0.000
1 idx 500 none 100 -1 13938 1120 1322 1891 2668 0.000 0.000 993.4 1871 0.000 0.000 0.000
8 idx 500 mix 100 -1 2013 7755 867.4 49739 77800 0.554 44.0 309.6 44902 0.265 0.000 8.00
8 idx 500 none 100 -1 17845 864.9 818.0 1298 1882 0.555 33.0 588.7 1267 0.000 0.000 0.000
Q2: matrix is N in {1 kNone, 1 indexed, 2, 4, 8, 16} x append latency {50, 200, 1000, 5000}us (sync = append, jitter = append/10, seeded per rep) x sync {none, mix 1-in-20 via `--sync_write_one_in`, all} x value sizes {100, 1024} x 3 reps, 32k writes per cell on 64 CFs fixed across N (per-WAL counters verify every partition is covered in every N>1 cell; 8 CFs covered only 6/8 partitions in a pilot, hence 64), plus the N=8 one-slow-partition cell (`--wal_slow_partition=7`, 10x, mirroring the trigger profile). Steady state is inherent (WAL append cost is constant; the benchmark loop excludes open/CF setup) and confirmed by tight 3-rep spreads (e.g., trigger cell ops/s 1385-1417). New code only: the two flags live next to GC15's latency flags; no D118371518 line is touched. Cells use default write buffers (single generation; the slow override's rotation re-apply is validated in a separate small-buffer pilot where a stability check keeps mid-rotation tails from being misread as generations). Readings, one per bullet: baseline: N=1 indexed is within ~5% of kNone on every cell (e.g., 1000/mix/1024: 5376 vs 5658 ops/s) and byte-identical per the check below, so the stack costs ~nothing at N=1 (pre-stack-base comparison at 217951834332: not run, needs a second opt build; covered by byte-identity plus indexed-vs-kNone instead). N/BDP sweep: partitioning helps async writes at every latency (none/1024B N=1 to N=16: +92% at 50us (1024B: 47075 to 90571 ops/s; +77% is the 100B row), +40% at 1000us, +34% at 5000us) and hurts sync-containing ones (mix/1024B at 1000us: 5658 to 905 ops/s, -84%; all: 2874 to 582, -80%), driven by sync fan-out, not the gate. Cap-hit rate at N=8: `cap_excluded` sum is 0 in every cell over 10k-20k groups each, so the group cap never binds at N>1 here (M0.4: no). Join-wait vs watermark-wait: join p99 exceeds gate p99 by 7x (none) to 650x (mix) at N=8 (mix/1000/1024: 61ms vs 0.09ms); queueing dwarfs the watermark wait in every cell. Sync barrier: fan-out median is exactly N; barrier p50/p99 at N=8/1000/1024 is 21/49ms (all) and 36/102ms (mix); fsyncs/write is 0.33 (all) and 0.27 (mix), rising to 0.48/0.44 at N=16. One slow partition: throughput -53% (1399 to 661 ops/s), write p99 +126% (74 to 167ms), gate p99 x108 (91us to 9868us); the straggler cost lands almost entirely in the gate wait. Contention at N=8: the single-partition WAL mutex is uncontended (p99 1us); the all-partition mutex is taken per sync write (21k takes at all, p99 4.3ms; 2.8k takes at mix, p99 21.6ms) while async barely takes it (9 takes), so cross-partition serialization is the sync path's lock cost. Highlight (1000us, mix, 1024B medians): N=1 kNone 5658 ops/s wr_p99 6497us; N=1 idx 5376/6570; N=2 3615/17241; N=4 2275/34590; N=8 1399/73761 gate_p99 90.9us; N=8 slow 661/166813 gate_p99 9868us; N=16 905/157617. Full 145-row table (medians; commit 9c7f9a9b5188, opt, 166x AMD EPYC-Genoa):
## Injected cells (median across reps)
N usage append_us sync size slow ops/s us/op wr_p50 wr_p99 wr_p99.9 gate_p50 gate_p99 join_p50 join_p99 fsync/wr cap_med fanout_med
1 knone 50 all 100 -1 6955 2144 1837 4392 9100 0.000 0.000 1768 4346 0.092 0.000 0.000
1 knone 50 all 1024 -1 6764 2246 1870 4384 8360 0.000 0.000 1803 4364 0.094 0.000 0.000
1 knone 50 mix 100 -1 19060 827.4 369.9 2867 4317 0.000 0.000 331.3 2710 0.025 0.000 0.000
1 knone 50 mix 1024 -1 18416 851.3 467.6 2749 4569 0.000 0.000 340.8 2623 0.025 0.000 0.000
1 knone 50 none 100 -1 52029 298.1 289.4 547.9 784.1 0.000 0.000 278.6 378.5 0.000 0.000 0.000
1 knone 50 none 1024 -1 47075 328.7 304.2 799.5 2900 0.000 0.000 276.9 532.3 0.000 0.000 0.000
1 knone 200 all 100 -1 5864 2555 2127 5104 11634 0.000 0.000 1842 4392 0.095 0.000 0.000
1 knone 200 all 1024 -1 5186 2936 2819 6054 11152 0.000 0.000 2396 5488 0.099 0.000 0.000
1 knone 200 mix 100 -1 13826 1133 783.6 2895 5909 0.000 0.000 751.0 2865 0.025 0.000 0.000
1 knone 200 mix 1024 -1 13194 1195 793.7 3448 7385 0.000 0.000 752.8 2879 0.025 0.000 0.000
1 knone 200 none 100 -1 26404 578.7 660.0 868.5 1621 0.000 0.000 638.1 865.8 0.000 0.000 0.000
1 knone 200 none 1024 -1 25858 598.2 655.7 970.0 1732 0.000 0.000 634.7 866.4 0.000 0.000 0.000
1 knone 1000 all 100 -1 2954 5049 4184 9834 12417 0.000 0.000 4060 9817 0.094 0.000 0.000
1 knone 1000 all 1024 -1 2874 5215 4239 9844 13632 0.000 0.000 4110 9831 0.095 0.000 0.000
1 knone 1000 mix 100 -1 5633 2723 2565 6513 9417 0.000 0.000 2453 6414 0.025 0.000 0.000
1 knone 1000 mix 1024 -1 5658 2760 2569 6497 9424 0.000 0.000 2459 6410 0.025 0.000 0.000
1 knone 1000 none 100 -1 7702 1997 2146 2887 3828 0.000 0.000 2079 2884 0.000 0.000 0.000
1 knone 1000 none 1024 -1 7588 2026 2139 2887 3511 0.000 0.000 2070 2883 0.000 0.000 0.000
1 knone 5000 all 100 -1 857 17711 13717 32780 45952 0.000 0.000 13352 32746 0.096 0.000 0.000
1 knone 5000 all 1024 -1 843 17630 13599 32787 44333 0.000 0.000 13243 32759 0.097 0.000 0.000
1 knone 5000 mix 100 -1 1441 10811 11403 27626 34000 0.000 0.000 11105 21824 0.026 0.000 0.000
1 knone 5000 mix 1024 -1 1393 11108 11556 28820 48827 0.000 0.000 11254 21991 0.027 0.000 0.000
1 knone 5000 none 100 -1 1636 9191 11013 13943 13996 0.000 0.000 10747 13166 0.000 0.000 0.000
1 knone 5000 none 1024 -1 1646 9117 10908 13941 13996 0.000 0.000 10626 12602 0.000 0.000 0.000
1 idx 50 all 100 -1 7064 2168 1846 4374 7920 0.000 0.000 1782 4350 0.092 0.000 0.000
1 idx 50 all 1024 -1 6825 2220 1869 4366 6578 0.000 0.000 1804 4344 0.094 0.000 0.000
1 idx 50 mix 100 -1 19277 816.4 373.6 2656 4279 0.000 0.000 336.5 2514 0.026 0.000 0.000
1 idx 50 mix 1024 -1 18639 843.4 484.9 2757 4203 0.000 0.000 344.4 2595 0.025 0.000 0.000
1 idx 50 none 100 -1 51514 301.2 291.4 566.0 937.9 0.000 0.000 277.6 379.2 0.000 0.000 0.000
1 idx 50 none 1024 -1 49359 316.1 301.8 574.3 1231 0.000 0.000 275.8 490.9 0.000 0.000 0.000
1 idx 200 all 100 -1 5825 2596 2343 4840 8014 0.000 0.000 1870 4387 0.095 0.000 0.000
1 idx 200 all 1024 -1 5410 2795 2747 6311 8910 0.000 0.000 2441 6185 0.097 0.000 0.000
1 idx 200 mix 100 -1 13807 1135 780.7 2881 4569 0.000 0.000 754.3 2862 0.025 0.000 0.000
1 idx 200 mix 1024 -1 13350 1182 784.4 3069 5700 0.000 0.000 755.6 2874 0.025 0.000 0.000
1 idx 200 none 100 -1 26815 582.8 659.9 968.4 2900 0.000 0.000 637.3 866.9 0.000 0.000 0.000
1 idx 200 none 1024 -1 24464 637.1 667.5 1686 3922 0.000 0.000 638.3 869.8 0.000 0.000 0.000
1 idx 1000 all 100 -1 2799 5308 4213 11187 20780 0.000 0.000 4079 10327 0.095 0.000 0.000
1 idx 1000 all 1024 -1 2767 5391 4326 9893 13819 0.000 0.000 4175 9867 0.097 0.000 0.000
1 idx 1000 mix 100 -1 5465 2811 2571 6542 9845 0.000 0.000 2439 6451 0.026 0.000 0.000
1 idx 1000 mix 1024 -1 5376 2804 2564 6570 11266 0.000 0.000 2430 6459 0.026 0.000 0.000
1 idx 1000 none 100 -1 7531 2009 2141 2890 4266 0.000 0.000 2070 2884 0.000 0.000 0.000
1 idx 1000 none 1024 -1 7275 2080 2175 3272 6355 0.000 0.000 2106 2889 0.000 0.000 0.000
1 idx 5000 all 100 -1 835 18449 22425 32826 45265 0.000 0.000 13761 32778 0.099 0.000 0.000
1 idx 5000 all 1024 -1 849 17924 13812 32804 42208 0.000 0.000 13421 32778 0.097 0.000 0.000
1 idx 5000 mix 100 -1 1474 10462 11192 25826 32667 0.000 0.000 10899 21554 0.025 0.000 0.000
1 idx 5000 mix 1024 -1 1470 10612 11227 26240 32679 0.000 0.000 10926 21628 0.026 0.000 0.000
1 idx 5000 none 100 -1 1713 8883 10730 13938 13996 0.000 0.000 10421 13000 0.000 0.000 0.000
1 idx 5000 none 1024 -1 1685 9065 10878 13943 13999 0.000 0.000 10594 13533 0.000 0.000 0.000
2 idx 50 all 100 -1 3173 5010 4817 10548 18717 0.500 0.990 4146 9837 0.157 0.000 2.00
2 idx 50 all 1024 -1 3253 4881 4584 9844 13883 0.500 0.991 3990 9737 0.157 0.000 2.00
2 idx 50 mix 100 -1 9613 1632 530.9 6555 9705 0.501 0.992 326.0 6348 0.072 0.000 2.00
2 idx 50 mix 1024 -1 7238 2182 535.5 10814 13913 0.501 0.993 332.4 9763 0.072 0.000 2.00
2 idx 50 none 100 -1 73703 212.3 196.4 378.1 1054 0.501 0.992 152.7 372.7 0.000 0.000 0.000
2 idx 50 none 1024 -1 58770 233.9 219.8 759.8 2900 0.505 0.999 160.3 455.9 0.000 0.000 0.000
2 idx 200 all 100 -1 3007 5295 5069 11021 15756 0.500 0.991 4350 9876 0.157 0.000 2.00
2 idx 200 all 1024 -1 3507 4537 4482 8705 13672 0.500 0.991 3980 7920 0.157 0.000 2.00
2 idx 200 mix 100 -1 5592 2831 856.8 13065 20918 0.501 0.993 708.3 11987 0.071 0.000 2.00
2 idx 200 mix 1024 -1 5360 2944 863.0 13563 28000 0.501 0.993 720.6 12924 0.071 0.000 2.00
2 idx 200 none 100 -1 36498 435.4 371.1 860.0 1660 0.501 0.991 335.0 842.5 0.000 0.000 0.000
2 idx 200 none 1024 -1 35377 448.3 385.8 859.5 1900 0.501 0.991 339.0 845.5 0.000 0.000 0.000
2 idx 1000 all 100 -1 1823 8740 9873 13967 21764 0.500 0.991 8830 13928 0.157 0.000 2.00
2 idx 1000 all 1024 -1 1749 9091 9913 13974 21810 0.500 0.991 8879 13929 0.157 0.000 2.00
2 idx 1000 mix 100 -1 3677 4298 2723 16638 21509 0.504 0.998 2381 13766 0.071 0.000 2.00
2 idx 1000 mix 1024 -1 3615 4350 2742 17241 21887 0.506 5.06 2389 13746 0.071 0.000 2.00
2 idx 1000 none 100 -1 10378 1528 1285 2862 3136 0.502 0.995 1169 2837 0.000 0.000 0.000
2 idx 1000 none 1024 -1 10328 1538 1281 2865 3542 0.502 0.994 1168 2843 0.000 0.000 0.000
2 idx 5000 all 100 -1 527 30190 33019 49746 68939 0.500 0.991 29637 49610 0.157 0.000 2.00
2 idx 5000 all 1024 -1 524 30321 32999 49710 69078 0.500 0.991 29615 49566 0.157 0.000 2.00
2 idx 5000 mix 100 -1 985 16047 12484 55452 73373 0.541 296.0 11359 48332 0.072 0.000 2.00
2 idx 5000 mix 1024 -1 977 16107 12512 53021 73347 0.538 262.4 11407 48122 0.072 0.000 2.00
2 idx 5000 none 100 -1 2271 6987 6264 13715 13983 0.508 46.0 5811 12824 0.000 0.000 0.000
2 idx 5000 none 1024 -1 2236 7095 6344 13721 13989 0.508 53.5 5852 13541 0.000 0.000 0.000
4 idx 50 all 100 -1 3132 5052 4757 9900 19523 0.501 0.991 3436 9757 0.220 0.000 4.00
4 idx 50 all 1024 -1 2981 5328 5059 12450 19304 0.500 0.990 3752 10256 0.220 0.000 4.00
4 idx 50 mix 100 -1 5206 2994 362.7 16734 21957 0.513 15.5 209.2 13481 0.146 0.000 4.00
4 idx 50 mix 1024 -1 5116 3089 417.6 17175 21767 0.519 93.9 225.1 13734 0.147 0.000 4.00
4 idx 50 none 100 -1 75704 206.7 197.1 375.7 531.4 0.503 0.995 145.0 363.1 0.000 0.000 0.000
4 idx 50 none 1024 -1 72385 214.7 205.4 376.7 1335 0.504 0.997 147.2 366.4 0.000 0.000 0.000
4 idx 200 all 100 -1 2557 6199 6379 13396 21463 0.500 0.991 4657 12400 0.219 0.000 4.00
4 idx 200 all 1024 -1 2469 6413 6528 13829 21784 0.500 0.990 4721 12782 0.220 0.000 4.00
4 idx 200 mix 100 -1 4487 3493 781.0 19880 26685 0.515 14.2 371.2 17212 0.145 0.000 4.00
4 idx 200 mix 1024 -1 4341 3612 827.3 19957 26529 0.517 22.2 389.9 17764 0.145 0.000 4.00
4 idx 200 none 100 -1 35151 449.1 416.6 864.5 1796 0.505 0.999 323.2 815.6 0.000 0.000 0.000
4 idx 200 none 1024 -1 34343 461.6 431.4 866.4 3650 0.504 0.999 326.9 840.0 0.000 0.000 0.000
4 idx 1000 all 100 -1 1297 12186 12349 25183 33000 0.500 0.991 10115 21877 0.219 0.000 4.00
4 idx 1000 all 1024 -1 1264 12488 13023 25700 41225 0.500 0.990 10220 21925 0.219 0.000 4.00
4 idx 1000 mix 100 -1 2255 6946 2644 34819 49792 0.540 65.4 1266 30316 0.149 0.000 4.00
4 idx 1000 mix 1024 -1 2275 6908 2613 34590 55952 0.538 67.8 1270 30184 0.147 0.000 4.00
4 idx 1000 none 100 -1 9766 1627 1516 2875 3800 0.522 35.1 1138 2839 0.000 0.000 0.000
4 idx 1000 none 1024 -1 9644 1648 1559 2885 5866 0.523 66.5 1145 2851 0.000 0.000 0.000
4 idx 5000 all 100 -1 378 41788 40944 75336 107477 0.500 0.991 33643 73855 0.218 0.000 4.00
4 idx 5000 all 1024 -1 375 42333 41105 78277 108731 0.500 0.991 33890 74077 0.218 0.000 4.00
4 idx 5000 mix 100 -1 631 24937 12239 136600 197826 0.590 373.8 6387 102624 0.151 0.000 4.00
4 idx 5000 mix 1024 -1 626 24990 12237 129052 187297 0.584 369.4 6385 101482 0.152 0.000 4.00
4 idx 5000 none 100 -1 2085 7609 6598 13854 13990 0.550 292.9 5628 12498 0.000 0.000 0.000
4 idx 5000 none 1024 -1 2071 7654 6698 13858 13991 0.550 306.8 5648 12430 0.000 0.000 0.000
8 idx 50 all 100 -1 2129 7442 7339 21040 41904 0.500 0.990 3655 18016 0.329 0.000 8.00
8 idx 50 all 1024 -1 1991 7965 7726 20817 31412 0.500 0.990 3943 18174 0.330 0.000 8.00
8 idx 50 mix 100 -1 3202 4871 225.7 31709 47000 0.531 21.8 69.8 29138 0.260 0.000 8.00
8 idx 50 mix 1024 -1 3108 5067 233.7 32225 47820 0.531 27.8 74.5 30062 0.256 0.000 8.00
8 idx 50 none 100 -1 82431 188.7 178.4 372.4 501.7 0.512 5.47 116.1 327.5 0.000 0.000 0.000
8 idx 50 none 1024 -1 80988 195.0 185.6 374.4 568.9 0.513 6.83 117.6 343.0 0.000 0.000 0.000
8 idx 200 all 100 -1 1729 9168 9338 21970 32715 0.500 0.991 5025 20367 0.330 0.000 8.00
8 idx 200 all 1024 -1 1652 9603 9627 25015 34888 0.500 0.991 5143 20962 0.331 0.000 8.00
8 idx 200 mix 100 -1 2694 5791 445.2 39174 53125 0.534 26.0 151.0 31635 0.259 0.000 8.00
8 idx 200 mix 1024 -1 2614 5992 471.6 40379 49928 0.536 51.4 177.5 32085 0.256 0.000 8.00
8 idx 200 none 100 -1 37460 422.0 379.5 851.2 1062 0.523 13.5 272.6 728.2 0.000 0.000 0.000
8 idx 200 none 1024 -1 36931 426.4 393.3 851.3 869.3 0.522 12.4 271.5 741.5 0.000 0.000 0.000
8 idx 1000 all 100 -1 857 18445 17511 47477 73571 0.500 0.990 10538 42973 0.330 0.000 8.00
8 idx 1000 all 1024 -1 845 18738 17946 47829 72670 0.500 0.991 10756 42949 0.329 0.000 8.00
8 idx 1000 mix 100 -1 1402 11165 1741 74393 108959 0.585 93.4 312.5 60059 0.276 0.000 8.00
8 idx 1000 mix 1024 -1 1399 11114 1802 73761 109023 0.578 90.9 880.4 60966 0.270 0.000 8.00
8 idx 1000 mix 1024 7 661 23760 11139 166812 244581 0.732 9867 870.7 108682 0.295 0.000 8.00
8 idx 1000 none 100 -1 9843 1609 1451 2875 3650 0.598 98.5 994.0 2806 0.000 0.000 0.000
8 idx 1000 none 1024 -1 9552 1655 1523 3025 5377 0.603 414.8 991.9 2828 0.000 0.000 0.000
8 idx 5000 all 100 -1 250 63159 58084 159190 222173 0.500 0.990 35234 140991 0.330 0.000 8.00
8 idx 5000 all 1024 -1 247 63715 58555 161949 232028 0.500 0.991 35455 144577 0.331 0.000 8.00
8 idx 5000 mix 100 -1 410 38438 6810 289671 378652 0.643 494.2 889.1 197712 0.283 0.000 8.00
8 idx 5000 mix 1024 -1 412 38123 7160 254511 372618 0.641 486.1 1900 191509 0.282 0.000 8.00
8 idx 5000 none 100 -1 2075 7651 6478 13876 13991 0.658 395.1 4996 13349 0.000 0.000 0.000
8 idx 5000 none 1024 -1 2074 7648 6445 13878 13991 0.658 408.6 5002 11790 0.000 0.000 0.000
16 idx 50 all 100 -1 1491 10629 10610 31645 49569 0.500 0.990 1960 24014 0.484 0.000 16.0
16 idx 50 all 1024 -1 1437 11010 10980 31891 48539 0.500 0.991 1993 25956 0.484 0.000 16.0
16 idx 50 mix 100 -1 2130 7392 162.9 62961 78181 0.541 27.9 0.782 48548 0.405 0.000 16.0
16 idx 50 mix 1024 -1 2007 7818 164.6 65696 98068 0.540 32.0 0.780 49673 0.404 0.000 16.0
16 idx 50 none 100 -1 92287 169.7 159.3 366.9 379.8 0.527 11.3 44.4 249.1 0.000 0.000 0.000
16 idx 50 none 1024 -1 90571 173.0 160.6 368.9 379.7 0.530 12.1 45.3 285.3 0.000 0.000 0.000
16 idx 200 all 100 -1 1181 13431 13356 38860 63571 0.500 0.990 2991 30479 0.484 0.000 16.0
16 idx 200 all 1024 -1 949 16720 15013 72363 118108 0.500 0.990 3108 48272 0.486 0.000 16.0
16 idx 200 mix 100 -1 1778 8789 355.4 71340 105314 0.546 44.1 0.782 61541 0.409 0.000 16.0
16 idx 200 mix 1024 -1 1727 9101 356.4 72268 104615 0.544 39.9 0.787 65150 0.407 0.000 16.0
16 idx 200 none 100 -1 40927 385.7 353.6 837.2 869.8 0.551 19.1 85.8 573.0 0.000 0.000 0.000
16 idx 200 none 1024 -1 40675 389.0 355.3 840.6 870.0 0.545 15.7 88.9 578.4 0.000 0.000 0.000
16 idx 1000 all 100 -1 589 26867 26163 74241 108472 0.500 0.991 6078 64161 0.483 0.000 16.0
16 idx 1000 all 1024 -1 582 27175 26211 74011 131818 0.500 0.991 6756 63614 0.481 0.000 16.0
16 idx 1000 mix 100 -1 954 16309 1212 149831 231600 0.604 84.9 0.773 104478 0.439 0.000 16.0
16 idx 1000 mix 1024 -1 905 17307 1216 157617 238930 0.603 90.3 0.776 108960 0.438 0.000 16.0
16 idx 1000 none 100 -1 10625 1490 1224 2868 2900 0.693 78.3 170.1 2725 0.000 0.000 0.000
16 idx 1000 none 1024 -1 10610 1491 1226 2866 2898 0.689 75.0 166.4 2724 0.000 0.000 0.000
16 idx 5000 all 100 -1 171 92232 88833 246299 368560 0.500 0.990 22354 210692 0.482 0.000 16.0
16 idx 5000 all 1024 -1 169 93424 89851 246061 368288 0.500 0.990 22052 212761 0.485 0.000 16.0
16 idx 5000 mix 100 -1 278 55903 6118 533996 815050 0.660 517.5 0.751 348988 0.471 0.000 16.0
16 idx 5000 mix 1024 -1 279 55956 6123 533486 817263 0.655 508.0 0.757 350460 0.468 0.000 16.0
16 idx 5000 none 100 -1 2223 7125 6114 13834 13986 0.752 487.9 787.9 11836 0.000 0.000 0.000
16 idx 5000 none 1024 -1 2205 7131 6109 13839 13986 0.754 485.5 743.3 11352 0.000 0.000 0.000
Q3: D-G53 = (A) share of the tail (Recommended; the choice cell is blank). Metric is p99(`rocksdb.wal.durability.wait.micros`) / p99(write) at N=8 per (latency, sync) cell; the designated profile is append=1000us, mix, 1024B (mid-range networked-WAL latency, realistic sync ratio, KB-scale values, per the doc's own example). Number: 0.0012. Verdict: DOES NOT FIRE. The verdict is robust: every sync-containing cell at N=8 is at most 0.0019 (5000us mix), 50x below threshold, and all-sync cells round to 0.0000 (writes serialize through the barrier, so the gate never waits). The highest ratio anywhere is 0.1371 at (1000us, none, 1024B), a no-sync extreme where the denominator has no barrier (write p99 3.0ms) while the gate tail reaches 415us consistently across reps (281/415/531us); the 100B sibling is 0.034. That cell is reported, not the verdict: the trigger refers to the realistic sync mix, but the none-mode tail's value-size sensitivity is flagged for GC17.
## Abandon trigger (D-G53 (A)) at N=8
append_us sync size gate_p99_us write_p99_us ratio
50 all 100 0.990 21040 0.0000
50 all 1024 0.990 20817 0.0000
50 mix 100 21.8 31709 0.0007
50 mix 1024 27.8 32225 0.0009
50 none 100 5.47 372.4 0.0147
50 none 1024 6.83 374.4 0.0183
200 all 100 0.991 21970 0.0000
200 all 1024 0.991 25015 0.0000
200 mix 100 26.0 39174 0.0007
200 mix 1024 51.4 40379 0.0013
200 none 100 13.5 851.2 0.0159
200 none 1024 12.4 851.3 0.0146
1000 all 100 0.990 47477 0.0000
1000 all 1024 0.991 47829 0.0000
1000 mix 100 93.4 74393 0.0013
1000 mix 1024 90.9 73761 0.0012
1000 none 100 98.5 2875 0.0343
1000 none 1024 414.8 3025 0.1371
5000 all 100 0.990 159190 0.0000
5000 all 1024 0.991 161949 0.0000
5000 mix 100 494.2 289671 0.0017
5000 mix 1024 486.1 254511 0.0019
5000 none 100 395.1 13876 0.0285
5000 none 1024 408.6 13878 0.0294
TRIGGER: ratio 0.0012 at N=8 append=1000us sync=mix size=1024B does not fire (threshold 0.10)
Q4: `SyncWalAdvancesOtherPartitionsSyncedSize` syncs both partitions, writes nothing more, then a sync write on partition 0 must record sum 0 on `WAL_SYNC_UNSYNCED_PARTITIONS`. Neuter (drop the `note_synced` in the `wal.number > up_to` branch; dropping the whole branch would still advance via the active-WAL path): fails with sum 1. Existing `NonLeadershipSyncsAdvanceSyncedSize` passes unmodified.
Q5: `SyncWalClaimTimeHorizonExcludesCoupledRotation` holds a manual `SyncWAL` in its fsync loop with 100ms slow syncs, lands a coupled rotation inside (counter-observed, order proven by `DBImpl::SyncWAL:Begin` < switch < `DBImpl::SyncWAL:BeforeMarkLogsSynced:1`), writes into the rotated-in WALs, and requires a later sync write to count all 4 partitions unsynced, with marks clear and deques consistent. Neuter (finish-time horizon): aborts on `assert(wal.IsSyncing())` on the unmarked rotated-in WAL.
Q6: the oracle records per power-loss cycle whether an acknowledged write is absent after recovery, prints the count in the summary line, and `RecoveredStateIsPrefixOfHistory` fails when power-loss cycles ran but none lost a write (runs with zero power-loss cycles, i.e. single-cycle reruns of process-crash seeds, are exempt: nothing to prove). 1000-cycle run from this commit: pass, 313 of 528 power-loss cycles lost a write. Neuter (crash keeps unsynced data): 40-cycle run fails with "power loss lost an acknowledged write in 0".
Q7: `CrashMidRotationUnderSkewRecoversPrefix` now sets `SetInjectUnsyncedDataLoss(true)` before the open (files capture the flag at creation) and requires `missing_seen` past the last sync. Neuter (flag off again): fails on "the crash dropped no acknowledged write". Listed under Invariant 4 as the one modified test.
GC17 pointers (numbers only, no decisions): D-G11: mean unsynced partitions under the mix is 1.3-2.3 of 8 (well below N) and the barrier dominates sync-write p99 (barrier p99 102ms over 1321 sync groups vs write p99 74ms over 32k mixed writes at N=8/1000/mix/1024; different populations, noted). G-19a: writers/group p50 is 1-2.4 while join p99 reaches 350ms at N=16/mix (191.5ms is N=8/5000us/mix/1024B); the index-allocation mutex has no dedicated histogram, so the harness bounds group-formation queueing but does not isolate the allocator. muse #22: per-partition mutex waits are ~0 at all N (p99 1us); no contention signature that padding would relieve in these workloads. N-2-6: 0.27-0.48 fsyncs/write sit on the write path at N=8-16 sync workloads; a background fsync's prize is bounded by the barrier numbers above minus the all-mutex claim, which stays.
Fold-back split: Q1-Q3 (script + `--sync_write_one_in` + `--wal_slow_partition` in `tools/db_bench_tool.cc`) stays a standalone diff (new code; no D118371518 line touched; no D-G53 (B) bypass). Q4 test folds with GC15's `NonLeadershipSyncsAdvanceSyncedSize` (D123971668, or D123551605). Q5 test to GC15's standalone diff (needs the latency FS). Q6 (oracle drop count + failure) to GC15's standalone diff. Q7 (test change) to D123928339. No hunk is unplaceable at its target.
Assumptions: D-G53 blank, so Recommended (A) per AB section 4 rule 2. Trigger profile (1000us append, mix 1-in-20, 1024B) chosen per rule 5 (mid-range networked-WAL latency, realistic sync ratio, KB-scale values; every cell tabulated so the choice is auditable). Sync latency = append latency and jitter = append/10 per rule 5 (one profile knob; seeded jitter keeps reps reproducible). 64 fixed CFs per rule 5 (isolates N; coverage verified from per-WAL counters). Cells use default write buffers (single generation; rotation re-apply validated in a separate small-buffer pilot) per rule 5 (cleanest numbers). Q4 neuter removes the `note_synced` call rather than the whole branch per rule 5 (the literal branch drop still advances via the active path and would not fail). Q6 exempts runs with zero power-loss cycles per rule 5 (single-cycle reruns must stay green). Cap-hit rate is reported as mean excluded/group plus P99 (ToString exposes no non-zero fraction) per rule 5.
Not done: (empty).
M2 fold (2026-10-22, `M2-FoldTasks.md` + `M2-Amendment.md`): Absorbs (M2) GC10 Q8/Q9: `SlowWalPartitionFileSystem`, sweep comparisons, steady state, `--compare_to`, trigger table; GC07 Q9: sweep dedup and N=1 baselines. This diff now edits S-C's db_bench lines: it moves S-C's latency-FS install block below its own slow-partition validation.
Changes visible to existing users:
- db_bench gains --sync_write_one_in (default 0) and --wal_slow_partition (default -1).
- db_bench now exits with an error when --wal_append_bandwidth_mbps or --wal_sync_bandwidth_mbps is set without --inject_wal_latency or outside [0, 1e12].
- db_bench fill/write benchmarks copy WriteOptions once per batch.
- New script tools/partition_wal_sweep.py.
Test Plan:
- `buck2 test fbcode//internal_repo_rocksdb/repo:db_write_test fbcode//internal_repo_rocksdb/repo:latency_injection_fs_test`: 199 pass, 0 fail.
- `buck2 test fbcode//internal_repo_rocksdb/repo:db_wal_oracle_test` (40 cycles): 3 pass; drop count 13/17 power-loss cycles.
- 1000-cycle oracle run from this commit (`ROCKSDB_WAL_ORACLE_CYCLES=1000`): pass; 313 of 528 power-loss cycles lost a write; 2 known lower-bound holes (non-strict, expected). A pre-format run gave 310/528; the committed run above is the evidence.
- Q5+Q7 x100 repeats (`--gtest_repeat=100`): 100/100 iterations pass, 0 failures.
- Q5+Q7 under `@fbcode//mode/dev-tsan`: 4 pass, no TSan warnings.
- Q4 neuter (no `note_synced` past the horizon): `SyncWalAdvancesOtherPartitionsSyncedSize` fails with sum 1 (expected). Q5 neuter (finish-time horizon): aborts on `assert(wal.IsSyncing())` (expected). Q6 neuter (crash keeps unsynced data): 40-cycle run fails "no power-loss cycle lost an acknowledged write" with count 0 (expected). Q7 neuter (flag off): fails "the crash dropped no acknowledged write" (expected). All neuters reverted; `db_impl.cc` clean.
- Full matrix: 435/435 runs ok from this commit (opt `db_bench`); trigger verdict DOES NOT FIRE (0.0012 at N=8/1000us/mix/1024B; max 0.0019 on any sync-containing cell).
- Two `--quick` runs from this commit: 18/18 each; second run's medians within −8.3% write p99 / −21% gate p99 of the first at worst (7 of 18 narrowly outside the tight 3-rep min-max; worst -2.2%); tables in summary.
- N=1 byte-identity check (base vs this commit, `none` and `partition_by_column_family`): pass; hashes equal the documented values (`6d135111...` off, `9a69a3fc...` on).
- 180s `db_stress` blackbox crash test at N=1 with `partition_wal_usage` on: first run failed early (checkpoint "WAL index merge: WAL 3 unreadable" under injected read faults), retry passed ("Crash-recovery verification passed"). Engine code is untouched by this diff (benchmark tooling + tests only), so the intermittent failure is a pre-existing base finding, reported, not fixed.
- Pre-stack-base N=1 comparison at 217951834332: not run (needs a second opt build; covered by byte-identity plus N=1 indexed-vs-kNone instead).
- Repo-pinned clang-format clean on all touched C++ files; `arc lint -a` and the script's lint clean.
(M1 standalone carved from GC16 D126232422; that round diff is abandoned at M1.)
M1 re-verification (2026-10-20, after rebasing the stack onto master f0c3a35689fc and clang-formatting D117251769, D117251771, D123079329, D123551605):
- Per-diff gate, all 35 commits bottom-up: CI format check, `rocksdb_lib` build, every touched test target: all pass, 0 failures.
- Tip suites (23 targets): 8126 pass, 0 fail.
- N=1 byte identity at the tip: `6d135111...` (off) and `9a69a3fc...` (on), equal to T0.
- 180s blackbox crash test at N=1 with `partition_wal_usage=partition_by_column_family`: pass.
- Trigger rerun, opt `db_bench`, N=8/1000us/1024B, this harness: sync mix 0.0014 / 0.0013 / 0.0011 at 8 / 16 / 32 threads; all-async 0.026 / 0.025 / 0.018. Does not fire in either profile (the earlier 0.137 and dev-mode 0.108 readings do not reproduce in opt).
M2 fold: new or moved tests here: (none). B.1 at this diff (format check, `rocksdb_lib`, touched test targets): PASS; no test targets; `db_bench` and `db_stress` build; `partition_wal_sweep.py` compiles.
M3 B.1 at this diff (clang-format 21.1.2 on its changed lines, make check-sources, debug librocksdb build; no test file touched): PASS.
Note (2026-10-27): every number above predates GC17's sync-path change; see the first paragraph of the summary. The pre-stack-base comparison is still not run.
M5 fold: Absorbs 10 A.1 entries (GC28 5, GC27 1, GC29b 4): GC28 Q5 (b)/Q6: TRIGGER_THREAD_COUNTS, compute_trigger, --stats_level comments; GC27's zero guard; GC29b's docstrings and report heading. M5-F1 (A.8): F1.3: partition_wal_sweep.py's docstring placeholders.
M5 B.1: PASS (clang-format 21.1.2 on the changed lines, make check-sources, debug build of db_bench); no test binary touched.
M6 fold: Absorbs GC35 Q4: `tools/partition_wal_sweep.py` `--bandwidths-mbps` (cells, labels, parsing of `size_sleep_micros`, comparisons and trigger per bandwidth) and `db_bench` `--wal_slow_partition` taking a tenth of the WAL bandwidths.
M6 B.1: PASS (debug build of db_bench; no test binary touched).
Differential Revision: https://phabricator.intern.facebook.com/D126533195
JustinGaoF
added a commit
that referenced
this pull request
Nov 19, 2026
Summary:
**Measured before GC17.** Every number in this summary and its test plan was measured on the code before GC17 changed the N>1 sync path. Since GC17, a sync write fsyncs from its completion gate, and concurrent gate syncs coalesce; that change is folded into D123551605. The tables below describe the earlier code, not the current stack.
GC17's own paired, interleaved run (this harness; N=8, 1000 us injected append and sync latency, sync mix 1 in 20, 1 KB values; 3 rounds, base then GC17) measured these N=8 mixed-sync ranges:
| threads | ops/s, before GC17 | ops/s, after GC17 |
|---|---|---|
| 8 | 920–1004 | 2136–2198 |
| 16 | 970–1216 | 3054–3535 |
| 32 | 1458–1514 | 5454–5685 |
The same N=8 cell at 16 threads reads 1399 ops/s in the table below, from a different run. In GC17's run, async-only cells were unchanged within run-to-run noise.
Mixed-sync throughput at N>1 is still below N=1. This summary's N=1 kNone figure for the same profile is 5658 ops/s at 16 threads, against 3054–3535 for N=8 after GC17. The two come from different runs, so the size of the gap is not established. A same-run N=1 vs N>1 comparison under mixed sync is pending, on the final code.
`compute_trigger` in `tools/partition_wal_sweep.py` unpacks each cell's thread count into `cell_threads` and matches it against the requested `threads` (TRIGGER_THREAD_COUNTS is 8, 16, 32), so a narrowed grid reports the verdict of the requested thread count. Verdicts from runs before the M5 fold used the earlier version, which could compare against the last cell's thread count.
M1 standalone S-D (from GC16 Q1-Q3): reproducible WAL partition sweep harness (`tools/partition_wal_sweep.py`) plus `db_bench --sync_write_one_in` and `--wal_slow_partition`. Carved from GC16 D126232422, which is abandoned at M1.
At-M1 corrections to the GC16 summary below (applied inline): (1) reproducibility: the second `--quick` run's medians moved up to -8.3% (write p99) and -21% (gate p99) from the first, not "~2% on every median"; (2) the N=1 to N=16 async gain at 50us for 1024B values is +92% (47075 to 90571 ops/s); +77% is the 100B row; (3) join p99 at N=16/mix reaches 350ms; the 192ms figure was N=8/5000us/mix/1024B.
[GC] GC16: the N sweep and the abandon trigger, measured reproducibly (G-53). Benchmark tooling only: a checked-in sweep script plus two new `db_bench` flags, with the Tasks:975 abandon trigger evaluated under D-G53 (A). Also closes the GC15 carry-over: G-50 evidence for the multi-partition `synced_size` advance (Q4), a regression test for GC03's claim-time `SyncWAL` horizon (Q5), proof that the oracle's crashes lose data (G-54, Q6), and the `CrashMidRotationUnderSkewRecoversPrefix` drop fix (N-7-4, Q7). Q4's test idea, Q5's test, Q6's drop check and the Q7 finding are ported from D126193958 (MuseCode) as the requirement allows; its oracle, hooks, `SyncWalImpl` advance, latency FileSystem, per-WAL flag and Q8 labelling are not.
Reviewer question: Can anyone rerun this sweep and get the same picture, and does the watermark wait trip the abandon trigger at N=8? Anyone can: one command reproduces the 435-run matrix below (plus `--quick` in ~100s), and a second `--quick` run matches the first within −8.3% write p99 / −21% gate p99 at worst (see header). The trigger does not fire: 0.0012 at the designated N=8 profile, 50x below the 0.10 threshold on every sync-containing cell.
Q1: `tools/partition_wal_sweep.py` takes a `db_bench` binary and an output directory and runs the Q2 matrix with 3 reps per cell, emitting `results.json` (one row per rep: config, rep index, seed, throughput, p50/p99/p99.9 write latency, every Q2 histogram, FS counters; plus median/min-max aggregates), `results.md` (human table), per-cell command lines and raw logs, and the environment (host, CPUs, storage, opt build mode, commit hash, FS wait mode and concurrency cap). Injected and uninjected cells render in separate tables and the trigger refuses uninjected input. Reproducibility: two `--quick` runs from this commit (18 runs each, tables below) agree within −8.3% write p99 / −21% gate p99 at worst; strict min-max containment fails narrowly on 7 of 18 checked medians (worst -2.2%) because 3-rep spreads are extremely tight, and with n=3 a fresh median lands outside the previous min-max half the time by chance alone, so the small relative deviation, not strict containment, is the reproducibility evidence.
First `--quick` table (medians; commit 9c7f9a9b5188, opt, 166x AMD EPYC-Genoa):
## Injected cells (median across reps)
N usage append_us sync size slow ops/s us/op wr_p50 wr_p99 wr_p99.9 gate_p50 gate_p99 join_p50 join_p99 fsync/wr cap_med fanout_med
1 knone 500 mix 100 -1 9213 1707 1660 4309 6014 0.000 0.000 1291 4254 0.024 0.000 0.000
1 knone 500 none 100 -1 13884 1118 1321 1895 2886 0.000 0.000 989.5 1874 0.000 0.000 0.000
1 idx 500 mix 100 -1 9126 1713 1644 4300 6172 0.000 0.000 1292 4250 0.024 0.000 0.000
1 idx 500 none 100 -1 13908 1114 1318 1890 3625 0.000 0.000 987.3 1869 0.000 0.000 0.000
8 idx 500 mix 100 -1 2024 7721 867.9 49064 74742 0.553 43.9 269.3 44354 0.267 0.000 8.00
8 idx 500 none 100 -1 18247 866.2 820.4 1415 2716 0.558 41.8 597.6 1271 0.000 0.000 0.000
Second --quick table (medians):
## Injected cells (median across reps)
N usage append_us sync size slow ops/s us/op wr_p50 wr_p99 wr_p99.9 gate_p50 gate_p99 join_p50 join_p99 fsync/wr cap_med fanout_med
1 knone 500 mix 100 -1 9013 1729 1670 4323 6485 0.000 0.000 1306 4270 0.025 0.000 0.000
1 knone 500 none 100 -1 13746 1118 1314 1890 2770 0.000 0.000 994.9 1868 0.000 0.000 0.000
1 idx 500 mix 100 -1 8815 1796 1675 4393 8014 0.000 0.000 1333 4335 0.025 0.000 0.000
1 idx 500 none 100 -1 13938 1120 1322 1891 2668 0.000 0.000 993.4 1871 0.000 0.000 0.000
8 idx 500 mix 100 -1 2013 7755 867.4 49739 77800 0.554 44.0 309.6 44902 0.265 0.000 8.00
8 idx 500 none 100 -1 17845 864.9 818.0 1298 1882 0.555 33.0 588.7 1267 0.000 0.000 0.000
Q2: matrix is N in {1 kNone, 1 indexed, 2, 4, 8, 16} x append latency {50, 200, 1000, 5000}us (sync = append, jitter = append/10, seeded per rep) x sync {none, mix 1-in-20 via `--sync_write_one_in`, all} x value sizes {100, 1024} x 3 reps, 32k writes per cell on 64 CFs fixed across N (per-WAL counters verify every partition is covered in every N>1 cell; 8 CFs covered only 6/8 partitions in a pilot, hence 64), plus the N=8 one-slow-partition cell (`--wal_slow_partition=7`, 10x, mirroring the trigger profile). Steady state is inherent (WAL append cost is constant; the benchmark loop excludes open/CF setup) and confirmed by tight 3-rep spreads (e.g., trigger cell ops/s 1385-1417). New code only: the two flags live next to GC15's latency flags; no D118371518 line is touched. Cells use default write buffers (single generation; the slow override's rotation re-apply is validated in a separate small-buffer pilot where a stability check keeps mid-rotation tails from being misread as generations). Readings, one per bullet: baseline: N=1 indexed is within ~5% of kNone on every cell (e.g., 1000/mix/1024: 5376 vs 5658 ops/s) and byte-identical per the check below, so the stack costs ~nothing at N=1 (pre-stack-base comparison at 217951834332: not run, needs a second opt build; covered by byte-identity plus indexed-vs-kNone instead). N/BDP sweep: partitioning helps async writes at every latency (none/1024B N=1 to N=16: +92% at 50us (1024B: 47075 to 90571 ops/s; +77% is the 100B row), +40% at 1000us, +34% at 5000us) and hurts sync-containing ones (mix/1024B at 1000us: 5658 to 905 ops/s, -84%; all: 2874 to 582, -80%), driven by sync fan-out, not the gate. Cap-hit rate at N=8: `cap_excluded` sum is 0 in every cell over 10k-20k groups each, so the group cap never binds at N>1 here (M0.4: no). Join-wait vs watermark-wait: join p99 exceeds gate p99 by 7x (none) to 650x (mix) at N=8 (mix/1000/1024: 61ms vs 0.09ms); queueing dwarfs the watermark wait in every cell. Sync barrier: fan-out median is exactly N; barrier p50/p99 at N=8/1000/1024 is 21/49ms (all) and 36/102ms (mix); fsyncs/write is 0.33 (all) and 0.27 (mix), rising to 0.48/0.44 at N=16. One slow partition: throughput -53% (1399 to 661 ops/s), write p99 +126% (74 to 167ms), gate p99 x108 (91us to 9868us); the straggler cost lands almost entirely in the gate wait. Contention at N=8: the single-partition WAL mutex is uncontended (p99 1us); the all-partition mutex is taken per sync write (21k takes at all, p99 4.3ms; 2.8k takes at mix, p99 21.6ms) while async barely takes it (9 takes), so cross-partition serialization is the sync path's lock cost. Highlight (1000us, mix, 1024B medians): N=1 kNone 5658 ops/s wr_p99 6497us; N=1 idx 5376/6570; N=2 3615/17241; N=4 2275/34590; N=8 1399/73761 gate_p99 90.9us; N=8 slow 661/166813 gate_p99 9868us; N=16 905/157617. Full 145-row table (medians; commit 9c7f9a9b5188, opt, 166x AMD EPYC-Genoa):
## Injected cells (median across reps)
N usage append_us sync size slow ops/s us/op wr_p50 wr_p99 wr_p99.9 gate_p50 gate_p99 join_p50 join_p99 fsync/wr cap_med fanout_med
1 knone 50 all 100 -1 6955 2144 1837 4392 9100 0.000 0.000 1768 4346 0.092 0.000 0.000
1 knone 50 all 1024 -1 6764 2246 1870 4384 8360 0.000 0.000 1803 4364 0.094 0.000 0.000
1 knone 50 mix 100 -1 19060 827.4 369.9 2867 4317 0.000 0.000 331.3 2710 0.025 0.000 0.000
1 knone 50 mix 1024 -1 18416 851.3 467.6 2749 4569 0.000 0.000 340.8 2623 0.025 0.000 0.000
1 knone 50 none 100 -1 52029 298.1 289.4 547.9 784.1 0.000 0.000 278.6 378.5 0.000 0.000 0.000
1 knone 50 none 1024 -1 47075 328.7 304.2 799.5 2900 0.000 0.000 276.9 532.3 0.000 0.000 0.000
1 knone 200 all 100 -1 5864 2555 2127 5104 11634 0.000 0.000 1842 4392 0.095 0.000 0.000
1 knone 200 all 1024 -1 5186 2936 2819 6054 11152 0.000 0.000 2396 5488 0.099 0.000 0.000
1 knone 200 mix 100 -1 13826 1133 783.6 2895 5909 0.000 0.000 751.0 2865 0.025 0.000 0.000
1 knone 200 mix 1024 -1 13194 1195 793.7 3448 7385 0.000 0.000 752.8 2879 0.025 0.000 0.000
1 knone 200 none 100 -1 26404 578.7 660.0 868.5 1621 0.000 0.000 638.1 865.8 0.000 0.000 0.000
1 knone 200 none 1024 -1 25858 598.2 655.7 970.0 1732 0.000 0.000 634.7 866.4 0.000 0.000 0.000
1 knone 1000 all 100 -1 2954 5049 4184 9834 12417 0.000 0.000 4060 9817 0.094 0.000 0.000
1 knone 1000 all 1024 -1 2874 5215 4239 9844 13632 0.000 0.000 4110 9831 0.095 0.000 0.000
1 knone 1000 mix 100 -1 5633 2723 2565 6513 9417 0.000 0.000 2453 6414 0.025 0.000 0.000
1 knone 1000 mix 1024 -1 5658 2760 2569 6497 9424 0.000 0.000 2459 6410 0.025 0.000 0.000
1 knone 1000 none 100 -1 7702 1997 2146 2887 3828 0.000 0.000 2079 2884 0.000 0.000 0.000
1 knone 1000 none 1024 -1 7588 2026 2139 2887 3511 0.000 0.000 2070 2883 0.000 0.000 0.000
1 knone 5000 all 100 -1 857 17711 13717 32780 45952 0.000 0.000 13352 32746 0.096 0.000 0.000
1 knone 5000 all 1024 -1 843 17630 13599 32787 44333 0.000 0.000 13243 32759 0.097 0.000 0.000
1 knone 5000 mix 100 -1 1441 10811 11403 27626 34000 0.000 0.000 11105 21824 0.026 0.000 0.000
1 knone 5000 mix 1024 -1 1393 11108 11556 28820 48827 0.000 0.000 11254 21991 0.027 0.000 0.000
1 knone 5000 none 100 -1 1636 9191 11013 13943 13996 0.000 0.000 10747 13166 0.000 0.000 0.000
1 knone 5000 none 1024 -1 1646 9117 10908 13941 13996 0.000 0.000 10626 12602 0.000 0.000 0.000
1 idx 50 all 100 -1 7064 2168 1846 4374 7920 0.000 0.000 1782 4350 0.092 0.000 0.000
1 idx 50 all 1024 -1 6825 2220 1869 4366 6578 0.000 0.000 1804 4344 0.094 0.000 0.000
1 idx 50 mix 100 -1 19277 816.4 373.6 2656 4279 0.000 0.000 336.5 2514 0.026 0.000 0.000
1 idx 50 mix 1024 -1 18639 843.4 484.9 2757 4203 0.000 0.000 344.4 2595 0.025 0.000 0.000
1 idx 50 none 100 -1 51514 301.2 291.4 566.0 937.9 0.000 0.000 277.6 379.2 0.000 0.000 0.000
1 idx 50 none 1024 -1 49359 316.1 301.8 574.3 1231 0.000 0.000 275.8 490.9 0.000 0.000 0.000
1 idx 200 all 100 -1 5825 2596 2343 4840 8014 0.000 0.000 1870 4387 0.095 0.000 0.000
1 idx 200 all 1024 -1 5410 2795 2747 6311 8910 0.000 0.000 2441 6185 0.097 0.000 0.000
1 idx 200 mix 100 -1 13807 1135 780.7 2881 4569 0.000 0.000 754.3 2862 0.025 0.000 0.000
1 idx 200 mix 1024 -1 13350 1182 784.4 3069 5700 0.000 0.000 755.6 2874 0.025 0.000 0.000
1 idx 200 none 100 -1 26815 582.8 659.9 968.4 2900 0.000 0.000 637.3 866.9 0.000 0.000 0.000
1 idx 200 none 1024 -1 24464 637.1 667.5 1686 3922 0.000 0.000 638.3 869.8 0.000 0.000 0.000
1 idx 1000 all 100 -1 2799 5308 4213 11187 20780 0.000 0.000 4079 10327 0.095 0.000 0.000
1 idx 1000 all 1024 -1 2767 5391 4326 9893 13819 0.000 0.000 4175 9867 0.097 0.000 0.000
1 idx 1000 mix 100 -1 5465 2811 2571 6542 9845 0.000 0.000 2439 6451 0.026 0.000 0.000
1 idx 1000 mix 1024 -1 5376 2804 2564 6570 11266 0.000 0.000 2430 6459 0.026 0.000 0.000
1 idx 1000 none 100 -1 7531 2009 2141 2890 4266 0.000 0.000 2070 2884 0.000 0.000 0.000
1 idx 1000 none 1024 -1 7275 2080 2175 3272 6355 0.000 0.000 2106 2889 0.000 0.000 0.000
1 idx 5000 all 100 -1 835 18449 22425 32826 45265 0.000 0.000 13761 32778 0.099 0.000 0.000
1 idx 5000 all 1024 -1 849 17924 13812 32804 42208 0.000 0.000 13421 32778 0.097 0.000 0.000
1 idx 5000 mix 100 -1 1474 10462 11192 25826 32667 0.000 0.000 10899 21554 0.025 0.000 0.000
1 idx 5000 mix 1024 -1 1470 10612 11227 26240 32679 0.000 0.000 10926 21628 0.026 0.000 0.000
1 idx 5000 none 100 -1 1713 8883 10730 13938 13996 0.000 0.000 10421 13000 0.000 0.000 0.000
1 idx 5000 none 1024 -1 1685 9065 10878 13943 13999 0.000 0.000 10594 13533 0.000 0.000 0.000
2 idx 50 all 100 -1 3173 5010 4817 10548 18717 0.500 0.990 4146 9837 0.157 0.000 2.00
2 idx 50 all 1024 -1 3253 4881 4584 9844 13883 0.500 0.991 3990 9737 0.157 0.000 2.00
2 idx 50 mix 100 -1 9613 1632 530.9 6555 9705 0.501 0.992 326.0 6348 0.072 0.000 2.00
2 idx 50 mix 1024 -1 7238 2182 535.5 10814 13913 0.501 0.993 332.4 9763 0.072 0.000 2.00
2 idx 50 none 100 -1 73703 212.3 196.4 378.1 1054 0.501 0.992 152.7 372.7 0.000 0.000 0.000
2 idx 50 none 1024 -1 58770 233.9 219.8 759.8 2900 0.505 0.999 160.3 455.9 0.000 0.000 0.000
2 idx 200 all 100 -1 3007 5295 5069 11021 15756 0.500 0.991 4350 9876 0.157 0.000 2.00
2 idx 200 all 1024 -1 3507 4537 4482 8705 13672 0.500 0.991 3980 7920 0.157 0.000 2.00
2 idx 200 mix 100 -1 5592 2831 856.8 13065 20918 0.501 0.993 708.3 11987 0.071 0.000 2.00
2 idx 200 mix 1024 -1 5360 2944 863.0 13563 28000 0.501 0.993 720.6 12924 0.071 0.000 2.00
2 idx 200 none 100 -1 36498 435.4 371.1 860.0 1660 0.501 0.991 335.0 842.5 0.000 0.000 0.000
2 idx 200 none 1024 -1 35377 448.3 385.8 859.5 1900 0.501 0.991 339.0 845.5 0.000 0.000 0.000
2 idx 1000 all 100 -1 1823 8740 9873 13967 21764 0.500 0.991 8830 13928 0.157 0.000 2.00
2 idx 1000 all 1024 -1 1749 9091 9913 13974 21810 0.500 0.991 8879 13929 0.157 0.000 2.00
2 idx 1000 mix 100 -1 3677 4298 2723 16638 21509 0.504 0.998 2381 13766 0.071 0.000 2.00
2 idx 1000 mix 1024 -1 3615 4350 2742 17241 21887 0.506 5.06 2389 13746 0.071 0.000 2.00
2 idx 1000 none 100 -1 10378 1528 1285 2862 3136 0.502 0.995 1169 2837 0.000 0.000 0.000
2 idx 1000 none 1024 -1 10328 1538 1281 2865 3542 0.502 0.994 1168 2843 0.000 0.000 0.000
2 idx 5000 all 100 -1 527 30190 33019 49746 68939 0.500 0.991 29637 49610 0.157 0.000 2.00
2 idx 5000 all 1024 -1 524 30321 32999 49710 69078 0.500 0.991 29615 49566 0.157 0.000 2.00
2 idx 5000 mix 100 -1 985 16047 12484 55452 73373 0.541 296.0 11359 48332 0.072 0.000 2.00
2 idx 5000 mix 1024 -1 977 16107 12512 53021 73347 0.538 262.4 11407 48122 0.072 0.000 2.00
2 idx 5000 none 100 -1 2271 6987 6264 13715 13983 0.508 46.0 5811 12824 0.000 0.000 0.000
2 idx 5000 none 1024 -1 2236 7095 6344 13721 13989 0.508 53.5 5852 13541 0.000 0.000 0.000
4 idx 50 all 100 -1 3132 5052 4757 9900 19523 0.501 0.991 3436 9757 0.220 0.000 4.00
4 idx 50 all 1024 -1 2981 5328 5059 12450 19304 0.500 0.990 3752 10256 0.220 0.000 4.00
4 idx 50 mix 100 -1 5206 2994 362.7 16734 21957 0.513 15.5 209.2 13481 0.146 0.000 4.00
4 idx 50 mix 1024 -1 5116 3089 417.6 17175 21767 0.519 93.9 225.1 13734 0.147 0.000 4.00
4 idx 50 none 100 -1 75704 206.7 197.1 375.7 531.4 0.503 0.995 145.0 363.1 0.000 0.000 0.000
4 idx 50 none 1024 -1 72385 214.7 205.4 376.7 1335 0.504 0.997 147.2 366.4 0.000 0.000 0.000
4 idx 200 all 100 -1 2557 6199 6379 13396 21463 0.500 0.991 4657 12400 0.219 0.000 4.00
4 idx 200 all 1024 -1 2469 6413 6528 13829 21784 0.500 0.990 4721 12782 0.220 0.000 4.00
4 idx 200 mix 100 -1 4487 3493 781.0 19880 26685 0.515 14.2 371.2 17212 0.145 0.000 4.00
4 idx 200 mix 1024 -1 4341 3612 827.3 19957 26529 0.517 22.2 389.9 17764 0.145 0.000 4.00
4 idx 200 none 100 -1 35151 449.1 416.6 864.5 1796 0.505 0.999 323.2 815.6 0.000 0.000 0.000
4 idx 200 none 1024 -1 34343 461.6 431.4 866.4 3650 0.504 0.999 326.9 840.0 0.000 0.000 0.000
4 idx 1000 all 100 -1 1297 12186 12349 25183 33000 0.500 0.991 10115 21877 0.219 0.000 4.00
4 idx 1000 all 1024 -1 1264 12488 13023 25700 41225 0.500 0.990 10220 21925 0.219 0.000 4.00
4 idx 1000 mix 100 -1 2255 6946 2644 34819 49792 0.540 65.4 1266 30316 0.149 0.000 4.00
4 idx 1000 mix 1024 -1 2275 6908 2613 34590 55952 0.538 67.8 1270 30184 0.147 0.000 4.00
4 idx 1000 none 100 -1 9766 1627 1516 2875 3800 0.522 35.1 1138 2839 0.000 0.000 0.000
4 idx 1000 none 1024 -1 9644 1648 1559 2885 5866 0.523 66.5 1145 2851 0.000 0.000 0.000
4 idx 5000 all 100 -1 378 41788 40944 75336 107477 0.500 0.991 33643 73855 0.218 0.000 4.00
4 idx 5000 all 1024 -1 375 42333 41105 78277 108731 0.500 0.991 33890 74077 0.218 0.000 4.00
4 idx 5000 mix 100 -1 631 24937 12239 136600 197826 0.590 373.8 6387 102624 0.151 0.000 4.00
4 idx 5000 mix 1024 -1 626 24990 12237 129052 187297 0.584 369.4 6385 101482 0.152 0.000 4.00
4 idx 5000 none 100 -1 2085 7609 6598 13854 13990 0.550 292.9 5628 12498 0.000 0.000 0.000
4 idx 5000 none 1024 -1 2071 7654 6698 13858 13991 0.550 306.8 5648 12430 0.000 0.000 0.000
8 idx 50 all 100 -1 2129 7442 7339 21040 41904 0.500 0.990 3655 18016 0.329 0.000 8.00
8 idx 50 all 1024 -1 1991 7965 7726 20817 31412 0.500 0.990 3943 18174 0.330 0.000 8.00
8 idx 50 mix 100 -1 3202 4871 225.7 31709 47000 0.531 21.8 69.8 29138 0.260 0.000 8.00
8 idx 50 mix 1024 -1 3108 5067 233.7 32225 47820 0.531 27.8 74.5 30062 0.256 0.000 8.00
8 idx 50 none 100 -1 82431 188.7 178.4 372.4 501.7 0.512 5.47 116.1 327.5 0.000 0.000 0.000
8 idx 50 none 1024 -1 80988 195.0 185.6 374.4 568.9 0.513 6.83 117.6 343.0 0.000 0.000 0.000
8 idx 200 all 100 -1 1729 9168 9338 21970 32715 0.500 0.991 5025 20367 0.330 0.000 8.00
8 idx 200 all 1024 -1 1652 9603 9627 25015 34888 0.500 0.991 5143 20962 0.331 0.000 8.00
8 idx 200 mix 100 -1 2694 5791 445.2 39174 53125 0.534 26.0 151.0 31635 0.259 0.000 8.00
8 idx 200 mix 1024 -1 2614 5992 471.6 40379 49928 0.536 51.4 177.5 32085 0.256 0.000 8.00
8 idx 200 none 100 -1 37460 422.0 379.5 851.2 1062 0.523 13.5 272.6 728.2 0.000 0.000 0.000
8 idx 200 none 1024 -1 36931 426.4 393.3 851.3 869.3 0.522 12.4 271.5 741.5 0.000 0.000 0.000
8 idx 1000 all 100 -1 857 18445 17511 47477 73571 0.500 0.990 10538 42973 0.330 0.000 8.00
8 idx 1000 all 1024 -1 845 18738 17946 47829 72670 0.500 0.991 10756 42949 0.329 0.000 8.00
8 idx 1000 mix 100 -1 1402 11165 1741 74393 108959 0.585 93.4 312.5 60059 0.276 0.000 8.00
8 idx 1000 mix 1024 -1 1399 11114 1802 73761 109023 0.578 90.9 880.4 60966 0.270 0.000 8.00
8 idx 1000 mix 1024 7 661 23760 11139 166812 244581 0.732 9867 870.7 108682 0.295 0.000 8.00
8 idx 1000 none 100 -1 9843 1609 1451 2875 3650 0.598 98.5 994.0 2806 0.000 0.000 0.000
8 idx 1000 none 1024 -1 9552 1655 1523 3025 5377 0.603 414.8 991.9 2828 0.000 0.000 0.000
8 idx 5000 all 100 -1 250 63159 58084 159190 222173 0.500 0.990 35234 140991 0.330 0.000 8.00
8 idx 5000 all 1024 -1 247 63715 58555 161949 232028 0.500 0.991 35455 144577 0.331 0.000 8.00
8 idx 5000 mix 100 -1 410 38438 6810 289671 378652 0.643 494.2 889.1 197712 0.283 0.000 8.00
8 idx 5000 mix 1024 -1 412 38123 7160 254511 372618 0.641 486.1 1900 191509 0.282 0.000 8.00
8 idx 5000 none 100 -1 2075 7651 6478 13876 13991 0.658 395.1 4996 13349 0.000 0.000 0.000
8 idx 5000 none 1024 -1 2074 7648 6445 13878 13991 0.658 408.6 5002 11790 0.000 0.000 0.000
16 idx 50 all 100 -1 1491 10629 10610 31645 49569 0.500 0.990 1960 24014 0.484 0.000 16.0
16 idx 50 all 1024 -1 1437 11010 10980 31891 48539 0.500 0.991 1993 25956 0.484 0.000 16.0
16 idx 50 mix 100 -1 2130 7392 162.9 62961 78181 0.541 27.9 0.782 48548 0.405 0.000 16.0
16 idx 50 mix 1024 -1 2007 7818 164.6 65696 98068 0.540 32.0 0.780 49673 0.404 0.000 16.0
16 idx 50 none 100 -1 92287 169.7 159.3 366.9 379.8 0.527 11.3 44.4 249.1 0.000 0.000 0.000
16 idx 50 none 1024 -1 90571 173.0 160.6 368.9 379.7 0.530 12.1 45.3 285.3 0.000 0.000 0.000
16 idx 200 all 100 -1 1181 13431 13356 38860 63571 0.500 0.990 2991 30479 0.484 0.000 16.0
16 idx 200 all 1024 -1 949 16720 15013 72363 118108 0.500 0.990 3108 48272 0.486 0.000 16.0
16 idx 200 mix 100 -1 1778 8789 355.4 71340 105314 0.546 44.1 0.782 61541 0.409 0.000 16.0
16 idx 200 mix 1024 -1 1727 9101 356.4 72268 104615 0.544 39.9 0.787 65150 0.407 0.000 16.0
16 idx 200 none 100 -1 40927 385.7 353.6 837.2 869.8 0.551 19.1 85.8 573.0 0.000 0.000 0.000
16 idx 200 none 1024 -1 40675 389.0 355.3 840.6 870.0 0.545 15.7 88.9 578.4 0.000 0.000 0.000
16 idx 1000 all 100 -1 589 26867 26163 74241 108472 0.500 0.991 6078 64161 0.483 0.000 16.0
16 idx 1000 all 1024 -1 582 27175 26211 74011 131818 0.500 0.991 6756 63614 0.481 0.000 16.0
16 idx 1000 mix 100 -1 954 16309 1212 149831 231600 0.604 84.9 0.773 104478 0.439 0.000 16.0
16 idx 1000 mix 1024 -1 905 17307 1216 157617 238930 0.603 90.3 0.776 108960 0.438 0.000 16.0
16 idx 1000 none 100 -1 10625 1490 1224 2868 2900 0.693 78.3 170.1 2725 0.000 0.000 0.000
16 idx 1000 none 1024 -1 10610 1491 1226 2866 2898 0.689 75.0 166.4 2724 0.000 0.000 0.000
16 idx 5000 all 100 -1 171 92232 88833 246299 368560 0.500 0.990 22354 210692 0.482 0.000 16.0
16 idx 5000 all 1024 -1 169 93424 89851 246061 368288 0.500 0.990 22052 212761 0.485 0.000 16.0
16 idx 5000 mix 100 -1 278 55903 6118 533996 815050 0.660 517.5 0.751 348988 0.471 0.000 16.0
16 idx 5000 mix 1024 -1 279 55956 6123 533486 817263 0.655 508.0 0.757 350460 0.468 0.000 16.0
16 idx 5000 none 100 -1 2223 7125 6114 13834 13986 0.752 487.9 787.9 11836 0.000 0.000 0.000
16 idx 5000 none 1024 -1 2205 7131 6109 13839 13986 0.754 485.5 743.3 11352 0.000 0.000 0.000
Q3: D-G53 = (A) share of the tail (Recommended; the choice cell is blank). Metric is p99(`rocksdb.wal.durability.wait.micros`) / p99(write) at N=8 per (latency, sync) cell; the designated profile is append=1000us, mix, 1024B (mid-range networked-WAL latency, realistic sync ratio, KB-scale values, per the doc's own example). Number: 0.0012. Verdict: DOES NOT FIRE. The verdict is robust: every sync-containing cell at N=8 is at most 0.0019 (5000us mix), 50x below threshold, and all-sync cells round to 0.0000 (writes serialize through the barrier, so the gate never waits). The highest ratio anywhere is 0.1371 at (1000us, none, 1024B), a no-sync extreme where the denominator has no barrier (write p99 3.0ms) while the gate tail reaches 415us consistently across reps (281/415/531us); the 100B sibling is 0.034. That cell is reported, not the verdict: the trigger refers to the realistic sync mix, but the none-mode tail's value-size sensitivity is flagged for GC17.
## Abandon trigger (D-G53 (A)) at N=8
append_us sync size gate_p99_us write_p99_us ratio
50 all 100 0.990 21040 0.0000
50 all 1024 0.990 20817 0.0000
50 mix 100 21.8 31709 0.0007
50 mix 1024 27.8 32225 0.0009
50 none 100 5.47 372.4 0.0147
50 none 1024 6.83 374.4 0.0183
200 all 100 0.991 21970 0.0000
200 all 1024 0.991 25015 0.0000
200 mix 100 26.0 39174 0.0007
200 mix 1024 51.4 40379 0.0013
200 none 100 13.5 851.2 0.0159
200 none 1024 12.4 851.3 0.0146
1000 all 100 0.990 47477 0.0000
1000 all 1024 0.991 47829 0.0000
1000 mix 100 93.4 74393 0.0013
1000 mix 1024 90.9 73761 0.0012
1000 none 100 98.5 2875 0.0343
1000 none 1024 414.8 3025 0.1371
5000 all 100 0.990 159190 0.0000
5000 all 1024 0.991 161949 0.0000
5000 mix 100 494.2 289671 0.0017
5000 mix 1024 486.1 254511 0.0019
5000 none 100 395.1 13876 0.0285
5000 none 1024 408.6 13878 0.0294
TRIGGER: ratio 0.0012 at N=8 append=1000us sync=mix size=1024B does not fire (threshold 0.10)
Q4: `SyncWalAdvancesOtherPartitionsSyncedSize` syncs both partitions, writes nothing more, then a sync write on partition 0 must record sum 0 on `WAL_SYNC_UNSYNCED_PARTITIONS`. Neuter (drop the `note_synced` in the `wal.number > up_to` branch; dropping the whole branch would still advance via the active-WAL path): fails with sum 1. Existing `NonLeadershipSyncsAdvanceSyncedSize` passes unmodified.
Q5: `SyncWalClaimTimeHorizonExcludesCoupledRotation` holds a manual `SyncWAL` in its fsync loop with 100ms slow syncs, lands a coupled rotation inside (counter-observed, order proven by `DBImpl::SyncWAL:Begin` < switch < `DBImpl::SyncWAL:BeforeMarkLogsSynced:1`), writes into the rotated-in WALs, and requires a later sync write to count all 4 partitions unsynced, with marks clear and deques consistent. Neuter (finish-time horizon): aborts on `assert(wal.IsSyncing())` on the unmarked rotated-in WAL.
Q6: the oracle records per power-loss cycle whether an acknowledged write is absent after recovery, prints the count in the summary line, and `RecoveredStateIsPrefixOfHistory` fails when power-loss cycles ran but none lost a write (runs with zero power-loss cycles, i.e. single-cycle reruns of process-crash seeds, are exempt: nothing to prove). 1000-cycle run from this commit: pass, 313 of 528 power-loss cycles lost a write. Neuter (crash keeps unsynced data): 40-cycle run fails with "power loss lost an acknowledged write in 0".
Q7: `CrashMidRotationUnderSkewRecoversPrefix` now sets `SetInjectUnsyncedDataLoss(true)` before the open (files capture the flag at creation) and requires `missing_seen` past the last sync. Neuter (flag off again): fails on "the crash dropped no acknowledged write". Listed under Invariant 4 as the one modified test.
GC17 pointers (numbers only, no decisions): D-G11: mean unsynced partitions under the mix is 1.3-2.3 of 8 (well below N) and the barrier dominates sync-write p99 (barrier p99 102ms over 1321 sync groups vs write p99 74ms over 32k mixed writes at N=8/1000/mix/1024; different populations, noted). G-19a: writers/group p50 is 1-2.4 while join p99 reaches 350ms at N=16/mix (191.5ms is N=8/5000us/mix/1024B); the index-allocation mutex has no dedicated histogram, so the harness bounds group-formation queueing but does not isolate the allocator. muse #22: per-partition mutex waits are ~0 at all N (p99 1us); no contention signature that padding would relieve in these workloads. N-2-6: 0.27-0.48 fsyncs/write sit on the write path at N=8-16 sync workloads; a background fsync's prize is bounded by the barrier numbers above minus the all-mutex claim, which stays.
Fold-back split: Q1-Q3 (script + `--sync_write_one_in` + `--wal_slow_partition` in `tools/db_bench_tool.cc`) stays a standalone diff (new code; no D118371518 line touched; no D-G53 (B) bypass). Q4 test folds with GC15's `NonLeadershipSyncsAdvanceSyncedSize` (D123971668, or D123551605). Q5 test to GC15's standalone diff (needs the latency FS). Q6 (oracle drop count + failure) to GC15's standalone diff. Q7 (test change) to D123928339. No hunk is unplaceable at its target.
Assumptions: D-G53 blank, so Recommended (A) per AB section 4 rule 2. Trigger profile (1000us append, mix 1-in-20, 1024B) chosen per rule 5 (mid-range networked-WAL latency, realistic sync ratio, KB-scale values; every cell tabulated so the choice is auditable). Sync latency = append latency and jitter = append/10 per rule 5 (one profile knob; seeded jitter keeps reps reproducible). 64 fixed CFs per rule 5 (isolates N; coverage verified from per-WAL counters). Cells use default write buffers (single generation; rotation re-apply validated in a separate small-buffer pilot) per rule 5 (cleanest numbers). Q4 neuter removes the `note_synced` call rather than the whole branch per rule 5 (the literal branch drop still advances via the active path and would not fail). Q6 exempts runs with zero power-loss cycles per rule 5 (single-cycle reruns must stay green). Cap-hit rate is reported as mean excluded/group plus P99 (ToString exposes no non-zero fraction) per rule 5.
Not done: (empty).
M2 fold (2026-10-22, `M2-FoldTasks.md` + `M2-Amendment.md`): Absorbs (M2) GC10 Q8/Q9: `SlowWalPartitionFileSystem`, sweep comparisons, steady state, `--compare_to`, trigger table; GC07 Q9: sweep dedup and N=1 baselines. This diff now edits S-C's db_bench lines: it moves S-C's latency-FS install block below its own slow-partition validation.
Changes visible to existing users:
- db_bench gains --sync_write_one_in (default 0) and --wal_slow_partition (default -1).
- db_bench now exits with an error when --wal_append_bandwidth_mbps or --wal_sync_bandwidth_mbps is set without --inject_wal_latency or outside [0, 1e12].
- db_bench fill/write benchmarks copy WriteOptions once per batch.
- New script tools/partition_wal_sweep.py.
Test Plan:
- `buck2 test fbcode//internal_repo_rocksdb/repo:db_write_test fbcode//internal_repo_rocksdb/repo:latency_injection_fs_test`: 199 pass, 0 fail.
- `buck2 test fbcode//internal_repo_rocksdb/repo:db_wal_oracle_test` (40 cycles): 3 pass; drop count 13/17 power-loss cycles.
- 1000-cycle oracle run from this commit (`ROCKSDB_WAL_ORACLE_CYCLES=1000`): pass; 313 of 528 power-loss cycles lost a write; 2 known lower-bound holes (non-strict, expected). A pre-format run gave 310/528; the committed run above is the evidence.
- Q5+Q7 x100 repeats (`--gtest_repeat=100`): 100/100 iterations pass, 0 failures.
- Q5+Q7 under `@fbcode//mode/dev-tsan`: 4 pass, no TSan warnings.
- Q4 neuter (no `note_synced` past the horizon): `SyncWalAdvancesOtherPartitionsSyncedSize` fails with sum 1 (expected). Q5 neuter (finish-time horizon): aborts on `assert(wal.IsSyncing())` (expected). Q6 neuter (crash keeps unsynced data): 40-cycle run fails "no power-loss cycle lost an acknowledged write" with count 0 (expected). Q7 neuter (flag off): fails "the crash dropped no acknowledged write" (expected). All neuters reverted; `db_impl.cc` clean.
- Full matrix: 435/435 runs ok from this commit (opt `db_bench`); trigger verdict DOES NOT FIRE (0.0012 at N=8/1000us/mix/1024B; max 0.0019 on any sync-containing cell).
- Two `--quick` runs from this commit: 18/18 each; second run's medians within −8.3% write p99 / −21% gate p99 of the first at worst (7 of 18 narrowly outside the tight 3-rep min-max; worst -2.2%); tables in summary.
- N=1 byte-identity check (base vs this commit, `none` and `partition_by_column_family`): pass; hashes equal the documented values (`6d135111...` off, `9a69a3fc...` on).
- 180s `db_stress` blackbox crash test at N=1 with `partition_wal_usage` on: first run failed early (checkpoint "WAL index merge: WAL 3 unreadable" under injected read faults), retry passed ("Crash-recovery verification passed"). Engine code is untouched by this diff (benchmark tooling + tests only), so the intermittent failure is a pre-existing base finding, reported, not fixed.
- Pre-stack-base N=1 comparison at 217951834332: not run (needs a second opt build; covered by byte-identity plus N=1 indexed-vs-kNone instead).
- Repo-pinned clang-format clean on all touched C++ files; `arc lint -a` and the script's lint clean.
(M1 standalone carved from GC16 D126232422; that round diff is abandoned at M1.)
M1 re-verification (2026-10-20, after rebasing the stack onto master f0c3a35689fc and clang-formatting D117251769, D117251771, D123079329, D123551605):
- Per-diff gate, all 35 commits bottom-up: CI format check, `rocksdb_lib` build, every touched test target: all pass, 0 failures.
- Tip suites (23 targets): 8126 pass, 0 fail.
- N=1 byte identity at the tip: `6d135111...` (off) and `9a69a3fc...` (on), equal to T0.
- 180s blackbox crash test at N=1 with `partition_wal_usage=partition_by_column_family`: pass.
- Trigger rerun, opt `db_bench`, N=8/1000us/1024B, this harness: sync mix 0.0014 / 0.0013 / 0.0011 at 8 / 16 / 32 threads; all-async 0.026 / 0.025 / 0.018. Does not fire in either profile (the earlier 0.137 and dev-mode 0.108 readings do not reproduce in opt).
M2 fold: new or moved tests here: (none). B.1 at this diff (format check, `rocksdb_lib`, touched test targets): PASS; no test targets; `db_bench` and `db_stress` build; `partition_wal_sweep.py` compiles.
M3 B.1 at this diff (clang-format 21.1.2 on its changed lines, make check-sources, debug librocksdb build; no test file touched): PASS.
Note (2026-10-27): every number above predates GC17's sync-path change; see the first paragraph of the summary. The pre-stack-base comparison is still not run.
M5 fold: Absorbs 10 A.1 entries (GC28 5, GC27 1, GC29b 4): GC28 Q5 (b)/Q6: TRIGGER_THREAD_COUNTS, compute_trigger, --stats_level comments; GC27's zero guard; GC29b's docstrings and report heading. M5-F1 (A.8): F1.3: partition_wal_sweep.py's docstring placeholders.
M5 B.1: PASS (clang-format 21.1.2 on the changed lines, make check-sources, debug build of db_bench); no test binary touched.
M6 fold: Absorbs GC35 Q4: `tools/partition_wal_sweep.py` `--bandwidths-mbps` (cells, labels, parsing of `size_sleep_micros`, comparisons and trigger per bandwidth) and `db_bench` `--wal_slow_partition` taking a tenth of the WAL bandwidths.
M6 B.1: PASS (debug build of db_bench; no test binary touched).
Differential Revision: https://phabricator.intern.facebook.com/D126533195
JustinGaoF
added a commit
that referenced
this pull request
Nov 19, 2026
Summary:
**Measured before GC17.** Every number in this summary and its test plan was measured on the code before GC17 changed the N>1 sync path. Since GC17, a sync write fsyncs from its completion gate, and concurrent gate syncs coalesce; that change is folded into D123551605. The tables below describe the earlier code, not the current stack.
GC17's own paired, interleaved run (this harness; N=8, 1000 us injected append and sync latency, sync mix 1 in 20, 1 KB values; 3 rounds, base then GC17) measured these N=8 mixed-sync ranges:
| threads | ops/s, before GC17 | ops/s, after GC17 |
|---|---|---|
| 8 | 920–1004 | 2136–2198 |
| 16 | 970–1216 | 3054–3535 |
| 32 | 1458–1514 | 5454–5685 |
The same N=8 cell at 16 threads reads 1399 ops/s in the table below, from a different run. In GC17's run, async-only cells were unchanged within run-to-run noise.
Mixed-sync throughput at N>1 is still below N=1. This summary's N=1 kNone figure for the same profile is 5658 ops/s at 16 threads, against 3054–3535 for N=8 after GC17. The two come from different runs, so the size of the gap is not established. A same-run N=1 vs N>1 comparison under mixed sync is pending, on the final code.
`compute_trigger` in `tools/partition_wal_sweep.py` unpacks each cell's thread count into `cell_threads` and matches it against the requested `threads` (TRIGGER_THREAD_COUNTS is 8, 16, 32), so a narrowed grid reports the verdict of the requested thread count. Verdicts from runs before the M5 fold used the earlier version, which could compare against the last cell's thread count.
M1 standalone S-D (from GC16 Q1-Q3): reproducible WAL partition sweep harness (`tools/partition_wal_sweep.py`) plus `db_bench --sync_write_one_in` and `--wal_slow_partition`. Carved from GC16 D126232422, which is abandoned at M1.
At-M1 corrections to the GC16 summary below (applied inline): (1) reproducibility: the second `--quick` run's medians moved up to -8.3% (write p99) and -21% (gate p99) from the first, not "~2% on every median"; (2) the N=1 to N=16 async gain at 50us for 1024B values is +92% (47075 to 90571 ops/s); +77% is the 100B row; (3) join p99 at N=16/mix reaches 350ms; the 192ms figure was N=8/5000us/mix/1024B.
[GC] GC16: the N sweep and the abandon trigger, measured reproducibly (G-53). Benchmark tooling only: a checked-in sweep script plus two new `db_bench` flags, with the Tasks:975 abandon trigger evaluated under D-G53 (A). Also closes the GC15 carry-over: G-50 evidence for the multi-partition `synced_size` advance (Q4), a regression test for GC03's claim-time `SyncWAL` horizon (Q5), proof that the oracle's crashes lose data (G-54, Q6), and the `CrashMidRotationUnderSkewRecoversPrefix` drop fix (N-7-4, Q7). Q4's test idea, Q5's test, Q6's drop check and the Q7 finding are ported from D126193958 (MuseCode) as the requirement allows; its oracle, hooks, `SyncWalImpl` advance, latency FileSystem, per-WAL flag and Q8 labelling are not.
Reviewer question: Can anyone rerun this sweep and get the same picture, and does the watermark wait trip the abandon trigger at N=8? Anyone can: one command reproduces the 435-run matrix below (plus `--quick` in ~100s), and a second `--quick` run matches the first within −8.3% write p99 / −21% gate p99 at worst (see header). The trigger does not fire: 0.0012 at the designated N=8 profile, 50x below the 0.10 threshold on every sync-containing cell.
Q1: `tools/partition_wal_sweep.py` takes a `db_bench` binary and an output directory and runs the Q2 matrix with 3 reps per cell, emitting `results.json` (one row per rep: config, rep index, seed, throughput, p50/p99/p99.9 write latency, every Q2 histogram, FS counters; plus median/min-max aggregates), `results.md` (human table), per-cell command lines and raw logs, and the environment (host, CPUs, storage, opt build mode, commit hash, FS wait mode and concurrency cap). Injected and uninjected cells render in separate tables and the trigger refuses uninjected input. Reproducibility: two `--quick` runs from this commit (18 runs each, tables below) agree within −8.3% write p99 / −21% gate p99 at worst; strict min-max containment fails narrowly on 7 of 18 checked medians (worst -2.2%) because 3-rep spreads are extremely tight, and with n=3 a fresh median lands outside the previous min-max half the time by chance alone, so the small relative deviation, not strict containment, is the reproducibility evidence.
First `--quick` table (medians; commit 9c7f9a9b5188, opt, 166x AMD EPYC-Genoa):
## Injected cells (median across reps)
N usage append_us sync size slow ops/s us/op wr_p50 wr_p99 wr_p99.9 gate_p50 gate_p99 join_p50 join_p99 fsync/wr cap_med fanout_med
1 knone 500 mix 100 -1 9213 1707 1660 4309 6014 0.000 0.000 1291 4254 0.024 0.000 0.000
1 knone 500 none 100 -1 13884 1118 1321 1895 2886 0.000 0.000 989.5 1874 0.000 0.000 0.000
1 idx 500 mix 100 -1 9126 1713 1644 4300 6172 0.000 0.000 1292 4250 0.024 0.000 0.000
1 idx 500 none 100 -1 13908 1114 1318 1890 3625 0.000 0.000 987.3 1869 0.000 0.000 0.000
8 idx 500 mix 100 -1 2024 7721 867.9 49064 74742 0.553 43.9 269.3 44354 0.267 0.000 8.00
8 idx 500 none 100 -1 18247 866.2 820.4 1415 2716 0.558 41.8 597.6 1271 0.000 0.000 0.000
Second --quick table (medians):
## Injected cells (median across reps)
N usage append_us sync size slow ops/s us/op wr_p50 wr_p99 wr_p99.9 gate_p50 gate_p99 join_p50 join_p99 fsync/wr cap_med fanout_med
1 knone 500 mix 100 -1 9013 1729 1670 4323 6485 0.000 0.000 1306 4270 0.025 0.000 0.000
1 knone 500 none 100 -1 13746 1118 1314 1890 2770 0.000 0.000 994.9 1868 0.000 0.000 0.000
1 idx 500 mix 100 -1 8815 1796 1675 4393 8014 0.000 0.000 1333 4335 0.025 0.000 0.000
1 idx 500 none 100 -1 13938 1120 1322 1891 2668 0.000 0.000 993.4 1871 0.000 0.000 0.000
8 idx 500 mix 100 -1 2013 7755 867.4 49739 77800 0.554 44.0 309.6 44902 0.265 0.000 8.00
8 idx 500 none 100 -1 17845 864.9 818.0 1298 1882 0.555 33.0 588.7 1267 0.000 0.000 0.000
Q2: matrix is N in {1 kNone, 1 indexed, 2, 4, 8, 16} x append latency {50, 200, 1000, 5000}us (sync = append, jitter = append/10, seeded per rep) x sync {none, mix 1-in-20 via `--sync_write_one_in`, all} x value sizes {100, 1024} x 3 reps, 32k writes per cell on 64 CFs fixed across N (per-WAL counters verify every partition is covered in every N>1 cell; 8 CFs covered only 6/8 partitions in a pilot, hence 64), plus the N=8 one-slow-partition cell (`--wal_slow_partition=7`, 10x, mirroring the trigger profile). Steady state is inherent (WAL append cost is constant; the benchmark loop excludes open/CF setup) and confirmed by tight 3-rep spreads (e.g., trigger cell ops/s 1385-1417). New code only: the two flags live next to GC15's latency flags; no D118371518 line is touched. Cells use default write buffers (single generation; the slow override's rotation re-apply is validated in a separate small-buffer pilot where a stability check keeps mid-rotation tails from being misread as generations). Readings, one per bullet: baseline: N=1 indexed is within ~5% of kNone on every cell (e.g., 1000/mix/1024: 5376 vs 5658 ops/s) and byte-identical per the check below, so the stack costs ~nothing at N=1 (pre-stack-base comparison at 217951834332: not run, needs a second opt build; covered by byte-identity plus indexed-vs-kNone instead). N/BDP sweep: partitioning helps async writes at every latency (none/1024B N=1 to N=16: +92% at 50us (1024B: 47075 to 90571 ops/s; +77% is the 100B row), +40% at 1000us, +34% at 5000us) and hurts sync-containing ones (mix/1024B at 1000us: 5658 to 905 ops/s, -84%; all: 2874 to 582, -80%), driven by sync fan-out, not the gate. Cap-hit rate at N=8: `cap_excluded` sum is 0 in every cell over 10k-20k groups each, so the group cap never binds at N>1 here (M0.4: no). Join-wait vs watermark-wait: join p99 exceeds gate p99 by 7x (none) to 650x (mix) at N=8 (mix/1000/1024: 61ms vs 0.09ms); queueing dwarfs the watermark wait in every cell. Sync barrier: fan-out median is exactly N; barrier p50/p99 at N=8/1000/1024 is 21/49ms (all) and 36/102ms (mix); fsyncs/write is 0.33 (all) and 0.27 (mix), rising to 0.48/0.44 at N=16. One slow partition: throughput -53% (1399 to 661 ops/s), write p99 +126% (74 to 167ms), gate p99 x108 (91us to 9868us); the straggler cost lands almost entirely in the gate wait. Contention at N=8: the single-partition WAL mutex is uncontended (p99 1us); the all-partition mutex is taken per sync write (21k takes at all, p99 4.3ms; 2.8k takes at mix, p99 21.6ms) while async barely takes it (9 takes), so cross-partition serialization is the sync path's lock cost. Highlight (1000us, mix, 1024B medians): N=1 kNone 5658 ops/s wr_p99 6497us; N=1 idx 5376/6570; N=2 3615/17241; N=4 2275/34590; N=8 1399/73761 gate_p99 90.9us; N=8 slow 661/166813 gate_p99 9868us; N=16 905/157617. Full 145-row table (medians; commit 9c7f9a9b5188, opt, 166x AMD EPYC-Genoa):
## Injected cells (median across reps)
N usage append_us sync size slow ops/s us/op wr_p50 wr_p99 wr_p99.9 gate_p50 gate_p99 join_p50 join_p99 fsync/wr cap_med fanout_med
1 knone 50 all 100 -1 6955 2144 1837 4392 9100 0.000 0.000 1768 4346 0.092 0.000 0.000
1 knone 50 all 1024 -1 6764 2246 1870 4384 8360 0.000 0.000 1803 4364 0.094 0.000 0.000
1 knone 50 mix 100 -1 19060 827.4 369.9 2867 4317 0.000 0.000 331.3 2710 0.025 0.000 0.000
1 knone 50 mix 1024 -1 18416 851.3 467.6 2749 4569 0.000 0.000 340.8 2623 0.025 0.000 0.000
1 knone 50 none 100 -1 52029 298.1 289.4 547.9 784.1 0.000 0.000 278.6 378.5 0.000 0.000 0.000
1 knone 50 none 1024 -1 47075 328.7 304.2 799.5 2900 0.000 0.000 276.9 532.3 0.000 0.000 0.000
1 knone 200 all 100 -1 5864 2555 2127 5104 11634 0.000 0.000 1842 4392 0.095 0.000 0.000
1 knone 200 all 1024 -1 5186 2936 2819 6054 11152 0.000 0.000 2396 5488 0.099 0.000 0.000
1 knone 200 mix 100 -1 13826 1133 783.6 2895 5909 0.000 0.000 751.0 2865 0.025 0.000 0.000
1 knone 200 mix 1024 -1 13194 1195 793.7 3448 7385 0.000 0.000 752.8 2879 0.025 0.000 0.000
1 knone 200 none 100 -1 26404 578.7 660.0 868.5 1621 0.000 0.000 638.1 865.8 0.000 0.000 0.000
1 knone 200 none 1024 -1 25858 598.2 655.7 970.0 1732 0.000 0.000 634.7 866.4 0.000 0.000 0.000
1 knone 1000 all 100 -1 2954 5049 4184 9834 12417 0.000 0.000 4060 9817 0.094 0.000 0.000
1 knone 1000 all 1024 -1 2874 5215 4239 9844 13632 0.000 0.000 4110 9831 0.095 0.000 0.000
1 knone 1000 mix 100 -1 5633 2723 2565 6513 9417 0.000 0.000 2453 6414 0.025 0.000 0.000
1 knone 1000 mix 1024 -1 5658 2760 2569 6497 9424 0.000 0.000 2459 6410 0.025 0.000 0.000
1 knone 1000 none 100 -1 7702 1997 2146 2887 3828 0.000 0.000 2079 2884 0.000 0.000 0.000
1 knone 1000 none 1024 -1 7588 2026 2139 2887 3511 0.000 0.000 2070 2883 0.000 0.000 0.000
1 knone 5000 all 100 -1 857 17711 13717 32780 45952 0.000 0.000 13352 32746 0.096 0.000 0.000
1 knone 5000 all 1024 -1 843 17630 13599 32787 44333 0.000 0.000 13243 32759 0.097 0.000 0.000
1 knone 5000 mix 100 -1 1441 10811 11403 27626 34000 0.000 0.000 11105 21824 0.026 0.000 0.000
1 knone 5000 mix 1024 -1 1393 11108 11556 28820 48827 0.000 0.000 11254 21991 0.027 0.000 0.000
1 knone 5000 none 100 -1 1636 9191 11013 13943 13996 0.000 0.000 10747 13166 0.000 0.000 0.000
1 knone 5000 none 1024 -1 1646 9117 10908 13941 13996 0.000 0.000 10626 12602 0.000 0.000 0.000
1 idx 50 all 100 -1 7064 2168 1846 4374 7920 0.000 0.000 1782 4350 0.092 0.000 0.000
1 idx 50 all 1024 -1 6825 2220 1869 4366 6578 0.000 0.000 1804 4344 0.094 0.000 0.000
1 idx 50 mix 100 -1 19277 816.4 373.6 2656 4279 0.000 0.000 336.5 2514 0.026 0.000 0.000
1 idx 50 mix 1024 -1 18639 843.4 484.9 2757 4203 0.000 0.000 344.4 2595 0.025 0.000 0.000
1 idx 50 none 100 -1 51514 301.2 291.4 566.0 937.9 0.000 0.000 277.6 379.2 0.000 0.000 0.000
1 idx 50 none 1024 -1 49359 316.1 301.8 574.3 1231 0.000 0.000 275.8 490.9 0.000 0.000 0.000
1 idx 200 all 100 -1 5825 2596 2343 4840 8014 0.000 0.000 1870 4387 0.095 0.000 0.000
1 idx 200 all 1024 -1 5410 2795 2747 6311 8910 0.000 0.000 2441 6185 0.097 0.000 0.000
1 idx 200 mix 100 -1 13807 1135 780.7 2881 4569 0.000 0.000 754.3 2862 0.025 0.000 0.000
1 idx 200 mix 1024 -1 13350 1182 784.4 3069 5700 0.000 0.000 755.6 2874 0.025 0.000 0.000
1 idx 200 none 100 -1 26815 582.8 659.9 968.4 2900 0.000 0.000 637.3 866.9 0.000 0.000 0.000
1 idx 200 none 1024 -1 24464 637.1 667.5 1686 3922 0.000 0.000 638.3 869.8 0.000 0.000 0.000
1 idx 1000 all 100 -1 2799 5308 4213 11187 20780 0.000 0.000 4079 10327 0.095 0.000 0.000
1 idx 1000 all 1024 -1 2767 5391 4326 9893 13819 0.000 0.000 4175 9867 0.097 0.000 0.000
1 idx 1000 mix 100 -1 5465 2811 2571 6542 9845 0.000 0.000 2439 6451 0.026 0.000 0.000
1 idx 1000 mix 1024 -1 5376 2804 2564 6570 11266 0.000 0.000 2430 6459 0.026 0.000 0.000
1 idx 1000 none 100 -1 7531 2009 2141 2890 4266 0.000 0.000 2070 2884 0.000 0.000 0.000
1 idx 1000 none 1024 -1 7275 2080 2175 3272 6355 0.000 0.000 2106 2889 0.000 0.000 0.000
1 idx 5000 all 100 -1 835 18449 22425 32826 45265 0.000 0.000 13761 32778 0.099 0.000 0.000
1 idx 5000 all 1024 -1 849 17924 13812 32804 42208 0.000 0.000 13421 32778 0.097 0.000 0.000
1 idx 5000 mix 100 -1 1474 10462 11192 25826 32667 0.000 0.000 10899 21554 0.025 0.000 0.000
1 idx 5000 mix 1024 -1 1470 10612 11227 26240 32679 0.000 0.000 10926 21628 0.026 0.000 0.000
1 idx 5000 none 100 -1 1713 8883 10730 13938 13996 0.000 0.000 10421 13000 0.000 0.000 0.000
1 idx 5000 none 1024 -1 1685 9065 10878 13943 13999 0.000 0.000 10594 13533 0.000 0.000 0.000
2 idx 50 all 100 -1 3173 5010 4817 10548 18717 0.500 0.990 4146 9837 0.157 0.000 2.00
2 idx 50 all 1024 -1 3253 4881 4584 9844 13883 0.500 0.991 3990 9737 0.157 0.000 2.00
2 idx 50 mix 100 -1 9613 1632 530.9 6555 9705 0.501 0.992 326.0 6348 0.072 0.000 2.00
2 idx 50 mix 1024 -1 7238 2182 535.5 10814 13913 0.501 0.993 332.4 9763 0.072 0.000 2.00
2 idx 50 none 100 -1 73703 212.3 196.4 378.1 1054 0.501 0.992 152.7 372.7 0.000 0.000 0.000
2 idx 50 none 1024 -1 58770 233.9 219.8 759.8 2900 0.505 0.999 160.3 455.9 0.000 0.000 0.000
2 idx 200 all 100 -1 3007 5295 5069 11021 15756 0.500 0.991 4350 9876 0.157 0.000 2.00
2 idx 200 all 1024 -1 3507 4537 4482 8705 13672 0.500 0.991 3980 7920 0.157 0.000 2.00
2 idx 200 mix 100 -1 5592 2831 856.8 13065 20918 0.501 0.993 708.3 11987 0.071 0.000 2.00
2 idx 200 mix 1024 -1 5360 2944 863.0 13563 28000 0.501 0.993 720.6 12924 0.071 0.000 2.00
2 idx 200 none 100 -1 36498 435.4 371.1 860.0 1660 0.501 0.991 335.0 842.5 0.000 0.000 0.000
2 idx 200 none 1024 -1 35377 448.3 385.8 859.5 1900 0.501 0.991 339.0 845.5 0.000 0.000 0.000
2 idx 1000 all 100 -1 1823 8740 9873 13967 21764 0.500 0.991 8830 13928 0.157 0.000 2.00
2 idx 1000 all 1024 -1 1749 9091 9913 13974 21810 0.500 0.991 8879 13929 0.157 0.000 2.00
2 idx 1000 mix 100 -1 3677 4298 2723 16638 21509 0.504 0.998 2381 13766 0.071 0.000 2.00
2 idx 1000 mix 1024 -1 3615 4350 2742 17241 21887 0.506 5.06 2389 13746 0.071 0.000 2.00
2 idx 1000 none 100 -1 10378 1528 1285 2862 3136 0.502 0.995 1169 2837 0.000 0.000 0.000
2 idx 1000 none 1024 -1 10328 1538 1281 2865 3542 0.502 0.994 1168 2843 0.000 0.000 0.000
2 idx 5000 all 100 -1 527 30190 33019 49746 68939 0.500 0.991 29637 49610 0.157 0.000 2.00
2 idx 5000 all 1024 -1 524 30321 32999 49710 69078 0.500 0.991 29615 49566 0.157 0.000 2.00
2 idx 5000 mix 100 -1 985 16047 12484 55452 73373 0.541 296.0 11359 48332 0.072 0.000 2.00
2 idx 5000 mix 1024 -1 977 16107 12512 53021 73347 0.538 262.4 11407 48122 0.072 0.000 2.00
2 idx 5000 none 100 -1 2271 6987 6264 13715 13983 0.508 46.0 5811 12824 0.000 0.000 0.000
2 idx 5000 none 1024 -1 2236 7095 6344 13721 13989 0.508 53.5 5852 13541 0.000 0.000 0.000
4 idx 50 all 100 -1 3132 5052 4757 9900 19523 0.501 0.991 3436 9757 0.220 0.000 4.00
4 idx 50 all 1024 -1 2981 5328 5059 12450 19304 0.500 0.990 3752 10256 0.220 0.000 4.00
4 idx 50 mix 100 -1 5206 2994 362.7 16734 21957 0.513 15.5 209.2 13481 0.146 0.000 4.00
4 idx 50 mix 1024 -1 5116 3089 417.6 17175 21767 0.519 93.9 225.1 13734 0.147 0.000 4.00
4 idx 50 none 100 -1 75704 206.7 197.1 375.7 531.4 0.503 0.995 145.0 363.1 0.000 0.000 0.000
4 idx 50 none 1024 -1 72385 214.7 205.4 376.7 1335 0.504 0.997 147.2 366.4 0.000 0.000 0.000
4 idx 200 all 100 -1 2557 6199 6379 13396 21463 0.500 0.991 4657 12400 0.219 0.000 4.00
4 idx 200 all 1024 -1 2469 6413 6528 13829 21784 0.500 0.990 4721 12782 0.220 0.000 4.00
4 idx 200 mix 100 -1 4487 3493 781.0 19880 26685 0.515 14.2 371.2 17212 0.145 0.000 4.00
4 idx 200 mix 1024 -1 4341 3612 827.3 19957 26529 0.517 22.2 389.9 17764 0.145 0.000 4.00
4 idx 200 none 100 -1 35151 449.1 416.6 864.5 1796 0.505 0.999 323.2 815.6 0.000 0.000 0.000
4 idx 200 none 1024 -1 34343 461.6 431.4 866.4 3650 0.504 0.999 326.9 840.0 0.000 0.000 0.000
4 idx 1000 all 100 -1 1297 12186 12349 25183 33000 0.500 0.991 10115 21877 0.219 0.000 4.00
4 idx 1000 all 1024 -1 1264 12488 13023 25700 41225 0.500 0.990 10220 21925 0.219 0.000 4.00
4 idx 1000 mix 100 -1 2255 6946 2644 34819 49792 0.540 65.4 1266 30316 0.149 0.000 4.00
4 idx 1000 mix 1024 -1 2275 6908 2613 34590 55952 0.538 67.8 1270 30184 0.147 0.000 4.00
4 idx 1000 none 100 -1 9766 1627 1516 2875 3800 0.522 35.1 1138 2839 0.000 0.000 0.000
4 idx 1000 none 1024 -1 9644 1648 1559 2885 5866 0.523 66.5 1145 2851 0.000 0.000 0.000
4 idx 5000 all 100 -1 378 41788 40944 75336 107477 0.500 0.991 33643 73855 0.218 0.000 4.00
4 idx 5000 all 1024 -1 375 42333 41105 78277 108731 0.500 0.991 33890 74077 0.218 0.000 4.00
4 idx 5000 mix 100 -1 631 24937 12239 136600 197826 0.590 373.8 6387 102624 0.151 0.000 4.00
4 idx 5000 mix 1024 -1 626 24990 12237 129052 187297 0.584 369.4 6385 101482 0.152 0.000 4.00
4 idx 5000 none 100 -1 2085 7609 6598 13854 13990 0.550 292.9 5628 12498 0.000 0.000 0.000
4 idx 5000 none 1024 -1 2071 7654 6698 13858 13991 0.550 306.8 5648 12430 0.000 0.000 0.000
8 idx 50 all 100 -1 2129 7442 7339 21040 41904 0.500 0.990 3655 18016 0.329 0.000 8.00
8 idx 50 all 1024 -1 1991 7965 7726 20817 31412 0.500 0.990 3943 18174 0.330 0.000 8.00
8 idx 50 mix 100 -1 3202 4871 225.7 31709 47000 0.531 21.8 69.8 29138 0.260 0.000 8.00
8 idx 50 mix 1024 -1 3108 5067 233.7 32225 47820 0.531 27.8 74.5 30062 0.256 0.000 8.00
8 idx 50 none 100 -1 82431 188.7 178.4 372.4 501.7 0.512 5.47 116.1 327.5 0.000 0.000 0.000
8 idx 50 none 1024 -1 80988 195.0 185.6 374.4 568.9 0.513 6.83 117.6 343.0 0.000 0.000 0.000
8 idx 200 all 100 -1 1729 9168 9338 21970 32715 0.500 0.991 5025 20367 0.330 0.000 8.00
8 idx 200 all 1024 -1 1652 9603 9627 25015 34888 0.500 0.991 5143 20962 0.331 0.000 8.00
8 idx 200 mix 100 -1 2694 5791 445.2 39174 53125 0.534 26.0 151.0 31635 0.259 0.000 8.00
8 idx 200 mix 1024 -1 2614 5992 471.6 40379 49928 0.536 51.4 177.5 32085 0.256 0.000 8.00
8 idx 200 none 100 -1 37460 422.0 379.5 851.2 1062 0.523 13.5 272.6 728.2 0.000 0.000 0.000
8 idx 200 none 1024 -1 36931 426.4 393.3 851.3 869.3 0.522 12.4 271.5 741.5 0.000 0.000 0.000
8 idx 1000 all 100 -1 857 18445 17511 47477 73571 0.500 0.990 10538 42973 0.330 0.000 8.00
8 idx 1000 all 1024 -1 845 18738 17946 47829 72670 0.500 0.991 10756 42949 0.329 0.000 8.00
8 idx 1000 mix 100 -1 1402 11165 1741 74393 108959 0.585 93.4 312.5 60059 0.276 0.000 8.00
8 idx 1000 mix 1024 -1 1399 11114 1802 73761 109023 0.578 90.9 880.4 60966 0.270 0.000 8.00
8 idx 1000 mix 1024 7 661 23760 11139 166812 244581 0.732 9867 870.7 108682 0.295 0.000 8.00
8 idx 1000 none 100 -1 9843 1609 1451 2875 3650 0.598 98.5 994.0 2806 0.000 0.000 0.000
8 idx 1000 none 1024 -1 9552 1655 1523 3025 5377 0.603 414.8 991.9 2828 0.000 0.000 0.000
8 idx 5000 all 100 -1 250 63159 58084 159190 222173 0.500 0.990 35234 140991 0.330 0.000 8.00
8 idx 5000 all 1024 -1 247 63715 58555 161949 232028 0.500 0.991 35455 144577 0.331 0.000 8.00
8 idx 5000 mix 100 -1 410 38438 6810 289671 378652 0.643 494.2 889.1 197712 0.283 0.000 8.00
8 idx 5000 mix 1024 -1 412 38123 7160 254511 372618 0.641 486.1 1900 191509 0.282 0.000 8.00
8 idx 5000 none 100 -1 2075 7651 6478 13876 13991 0.658 395.1 4996 13349 0.000 0.000 0.000
8 idx 5000 none 1024 -1 2074 7648 6445 13878 13991 0.658 408.6 5002 11790 0.000 0.000 0.000
16 idx 50 all 100 -1 1491 10629 10610 31645 49569 0.500 0.990 1960 24014 0.484 0.000 16.0
16 idx 50 all 1024 -1 1437 11010 10980 31891 48539 0.500 0.991 1993 25956 0.484 0.000 16.0
16 idx 50 mix 100 -1 2130 7392 162.9 62961 78181 0.541 27.9 0.782 48548 0.405 0.000 16.0
16 idx 50 mix 1024 -1 2007 7818 164.6 65696 98068 0.540 32.0 0.780 49673 0.404 0.000 16.0
16 idx 50 none 100 -1 92287 169.7 159.3 366.9 379.8 0.527 11.3 44.4 249.1 0.000 0.000 0.000
16 idx 50 none 1024 -1 90571 173.0 160.6 368.9 379.7 0.530 12.1 45.3 285.3 0.000 0.000 0.000
16 idx 200 all 100 -1 1181 13431 13356 38860 63571 0.500 0.990 2991 30479 0.484 0.000 16.0
16 idx 200 all 1024 -1 949 16720 15013 72363 118108 0.500 0.990 3108 48272 0.486 0.000 16.0
16 idx 200 mix 100 -1 1778 8789 355.4 71340 105314 0.546 44.1 0.782 61541 0.409 0.000 16.0
16 idx 200 mix 1024 -1 1727 9101 356.4 72268 104615 0.544 39.9 0.787 65150 0.407 0.000 16.0
16 idx 200 none 100 -1 40927 385.7 353.6 837.2 869.8 0.551 19.1 85.8 573.0 0.000 0.000 0.000
16 idx 200 none 1024 -1 40675 389.0 355.3 840.6 870.0 0.545 15.7 88.9 578.4 0.000 0.000 0.000
16 idx 1000 all 100 -1 589 26867 26163 74241 108472 0.500 0.991 6078 64161 0.483 0.000 16.0
16 idx 1000 all 1024 -1 582 27175 26211 74011 131818 0.500 0.991 6756 63614 0.481 0.000 16.0
16 idx 1000 mix 100 -1 954 16309 1212 149831 231600 0.604 84.9 0.773 104478 0.439 0.000 16.0
16 idx 1000 mix 1024 -1 905 17307 1216 157617 238930 0.603 90.3 0.776 108960 0.438 0.000 16.0
16 idx 1000 none 100 -1 10625 1490 1224 2868 2900 0.693 78.3 170.1 2725 0.000 0.000 0.000
16 idx 1000 none 1024 -1 10610 1491 1226 2866 2898 0.689 75.0 166.4 2724 0.000 0.000 0.000
16 idx 5000 all 100 -1 171 92232 88833 246299 368560 0.500 0.990 22354 210692 0.482 0.000 16.0
16 idx 5000 all 1024 -1 169 93424 89851 246061 368288 0.500 0.990 22052 212761 0.485 0.000 16.0
16 idx 5000 mix 100 -1 278 55903 6118 533996 815050 0.660 517.5 0.751 348988 0.471 0.000 16.0
16 idx 5000 mix 1024 -1 279 55956 6123 533486 817263 0.655 508.0 0.757 350460 0.468 0.000 16.0
16 idx 5000 none 100 -1 2223 7125 6114 13834 13986 0.752 487.9 787.9 11836 0.000 0.000 0.000
16 idx 5000 none 1024 -1 2205 7131 6109 13839 13986 0.754 485.5 743.3 11352 0.000 0.000 0.000
Q3: D-G53 = (A) share of the tail (Recommended; the choice cell is blank). Metric is p99(`rocksdb.wal.durability.wait.micros`) / p99(write) at N=8 per (latency, sync) cell; the designated profile is append=1000us, mix, 1024B (mid-range networked-WAL latency, realistic sync ratio, KB-scale values, per the doc's own example). Number: 0.0012. Verdict: DOES NOT FIRE. The verdict is robust: every sync-containing cell at N=8 is at most 0.0019 (5000us mix), 50x below threshold, and all-sync cells round to 0.0000 (writes serialize through the barrier, so the gate never waits). The highest ratio anywhere is 0.1371 at (1000us, none, 1024B), a no-sync extreme where the denominator has no barrier (write p99 3.0ms) while the gate tail reaches 415us consistently across reps (281/415/531us); the 100B sibling is 0.034. That cell is reported, not the verdict: the trigger refers to the realistic sync mix, but the none-mode tail's value-size sensitivity is flagged for GC17.
## Abandon trigger (D-G53 (A)) at N=8
append_us sync size gate_p99_us write_p99_us ratio
50 all 100 0.990 21040 0.0000
50 all 1024 0.990 20817 0.0000
50 mix 100 21.8 31709 0.0007
50 mix 1024 27.8 32225 0.0009
50 none 100 5.47 372.4 0.0147
50 none 1024 6.83 374.4 0.0183
200 all 100 0.991 21970 0.0000
200 all 1024 0.991 25015 0.0000
200 mix 100 26.0 39174 0.0007
200 mix 1024 51.4 40379 0.0013
200 none 100 13.5 851.2 0.0159
200 none 1024 12.4 851.3 0.0146
1000 all 100 0.990 47477 0.0000
1000 all 1024 0.991 47829 0.0000
1000 mix 100 93.4 74393 0.0013
1000 mix 1024 90.9 73761 0.0012
1000 none 100 98.5 2875 0.0343
1000 none 1024 414.8 3025 0.1371
5000 all 100 0.990 159190 0.0000
5000 all 1024 0.991 161949 0.0000
5000 mix 100 494.2 289671 0.0017
5000 mix 1024 486.1 254511 0.0019
5000 none 100 395.1 13876 0.0285
5000 none 1024 408.6 13878 0.0294
TRIGGER: ratio 0.0012 at N=8 append=1000us sync=mix size=1024B does not fire (threshold 0.10)
Q4: `SyncWalAdvancesOtherPartitionsSyncedSize` syncs both partitions, writes nothing more, then a sync write on partition 0 must record sum 0 on `WAL_SYNC_UNSYNCED_PARTITIONS`. Neuter (drop the `note_synced` in the `wal.number > up_to` branch; dropping the whole branch would still advance via the active-WAL path): fails with sum 1. Existing `NonLeadershipSyncsAdvanceSyncedSize` passes unmodified.
Q5: `SyncWalClaimTimeHorizonExcludesCoupledRotation` holds a manual `SyncWAL` in its fsync loop with 100ms slow syncs, lands a coupled rotation inside (counter-observed, order proven by `DBImpl::SyncWAL:Begin` < switch < `DBImpl::SyncWAL:BeforeMarkLogsSynced:1`), writes into the rotated-in WALs, and requires a later sync write to count all 4 partitions unsynced, with marks clear and deques consistent. Neuter (finish-time horizon): aborts on `assert(wal.IsSyncing())` on the unmarked rotated-in WAL.
Q6: the oracle records per power-loss cycle whether an acknowledged write is absent after recovery, prints the count in the summary line, and `RecoveredStateIsPrefixOfHistory` fails when power-loss cycles ran but none lost a write (runs with zero power-loss cycles, i.e. single-cycle reruns of process-crash seeds, are exempt: nothing to prove). 1000-cycle run from this commit: pass, 313 of 528 power-loss cycles lost a write. Neuter (crash keeps unsynced data): 40-cycle run fails with "power loss lost an acknowledged write in 0".
Q7: `CrashMidRotationUnderSkewRecoversPrefix` now sets `SetInjectUnsyncedDataLoss(true)` before the open (files capture the flag at creation) and requires `missing_seen` past the last sync. Neuter (flag off again): fails on "the crash dropped no acknowledged write". Listed under Invariant 4 as the one modified test.
GC17 pointers (numbers only, no decisions): D-G11: mean unsynced partitions under the mix is 1.3-2.3 of 8 (well below N) and the barrier dominates sync-write p99 (barrier p99 102ms over 1321 sync groups vs write p99 74ms over 32k mixed writes at N=8/1000/mix/1024; different populations, noted). G-19a: writers/group p50 is 1-2.4 while join p99 reaches 350ms at N=16/mix (191.5ms is N=8/5000us/mix/1024B); the index-allocation mutex has no dedicated histogram, so the harness bounds group-formation queueing but does not isolate the allocator. muse #22: per-partition mutex waits are ~0 at all N (p99 1us); no contention signature that padding would relieve in these workloads. N-2-6: 0.27-0.48 fsyncs/write sit on the write path at N=8-16 sync workloads; a background fsync's prize is bounded by the barrier numbers above minus the all-mutex claim, which stays.
Fold-back split: Q1-Q3 (script + `--sync_write_one_in` + `--wal_slow_partition` in `tools/db_bench_tool.cc`) stays a standalone diff (new code; no D118371518 line touched; no D-G53 (B) bypass). Q4 test folds with GC15's `NonLeadershipSyncsAdvanceSyncedSize` (D123971668, or D123551605). Q5 test to GC15's standalone diff (needs the latency FS). Q6 (oracle drop count + failure) to GC15's standalone diff. Q7 (test change) to D123928339. No hunk is unplaceable at its target.
Assumptions: D-G53 blank, so Recommended (A) per AB section 4 rule 2. Trigger profile (1000us append, mix 1-in-20, 1024B) chosen per rule 5 (mid-range networked-WAL latency, realistic sync ratio, KB-scale values; every cell tabulated so the choice is auditable). Sync latency = append latency and jitter = append/10 per rule 5 (one profile knob; seeded jitter keeps reps reproducible). 64 fixed CFs per rule 5 (isolates N; coverage verified from per-WAL counters). Cells use default write buffers (single generation; rotation re-apply validated in a separate small-buffer pilot) per rule 5 (cleanest numbers). Q4 neuter removes the `note_synced` call rather than the whole branch per rule 5 (the literal branch drop still advances via the active path and would not fail). Q6 exempts runs with zero power-loss cycles per rule 5 (single-cycle reruns must stay green). Cap-hit rate is reported as mean excluded/group plus P99 (ToString exposes no non-zero fraction) per rule 5.
Not done: (empty).
M2 fold (2026-10-22, `M2-FoldTasks.md` + `M2-Amendment.md`): Absorbs (M2) GC10 Q8/Q9: `SlowWalPartitionFileSystem`, sweep comparisons, steady state, `--compare_to`, trigger table; GC07 Q9: sweep dedup and N=1 baselines. This diff now edits S-C's db_bench lines: it moves S-C's latency-FS install block below its own slow-partition validation.
Changes visible to existing users:
- db_bench gains --sync_write_one_in (default 0) and --wal_slow_partition (default -1).
- db_bench now exits with an error when --wal_append_bandwidth_mbps or --wal_sync_bandwidth_mbps is set without --inject_wal_latency or outside [0, 1e12].
- db_bench fill/write benchmarks copy WriteOptions once per batch.
- New script tools/partition_wal_sweep.py.
Test Plan:
- `buck2 test fbcode//internal_repo_rocksdb/repo:db_write_test fbcode//internal_repo_rocksdb/repo:latency_injection_fs_test`: 199 pass, 0 fail.
- `buck2 test fbcode//internal_repo_rocksdb/repo:db_wal_oracle_test` (40 cycles): 3 pass; drop count 13/17 power-loss cycles.
- 1000-cycle oracle run from this commit (`ROCKSDB_WAL_ORACLE_CYCLES=1000`): pass; 313 of 528 power-loss cycles lost a write; 2 known lower-bound holes (non-strict, expected). A pre-format run gave 310/528; the committed run above is the evidence.
- Q5+Q7 x100 repeats (`--gtest_repeat=100`): 100/100 iterations pass, 0 failures.
- Q5+Q7 under `@fbcode//mode/dev-tsan`: 4 pass, no TSan warnings.
- Q4 neuter (no `note_synced` past the horizon): `SyncWalAdvancesOtherPartitionsSyncedSize` fails with sum 1 (expected). Q5 neuter (finish-time horizon): aborts on `assert(wal.IsSyncing())` (expected). Q6 neuter (crash keeps unsynced data): 40-cycle run fails "no power-loss cycle lost an acknowledged write" with count 0 (expected). Q7 neuter (flag off): fails "the crash dropped no acknowledged write" (expected). All neuters reverted; `db_impl.cc` clean.
- Full matrix: 435/435 runs ok from this commit (opt `db_bench`); trigger verdict DOES NOT FIRE (0.0012 at N=8/1000us/mix/1024B; max 0.0019 on any sync-containing cell).
- Two `--quick` runs from this commit: 18/18 each; second run's medians within −8.3% write p99 / −21% gate p99 of the first at worst (7 of 18 narrowly outside the tight 3-rep min-max; worst -2.2%); tables in summary.
- N=1 byte-identity check (base vs this commit, `none` and `partition_by_column_family`): pass; hashes equal the documented values (`6d135111...` off, `9a69a3fc...` on).
- 180s `db_stress` blackbox crash test at N=1 with `partition_wal_usage` on: first run failed early (checkpoint "WAL index merge: WAL 3 unreadable" under injected read faults), retry passed ("Crash-recovery verification passed"). Engine code is untouched by this diff (benchmark tooling + tests only), so the intermittent failure is a pre-existing base finding, reported, not fixed.
- Pre-stack-base N=1 comparison at 217951834332: not run (needs a second opt build; covered by byte-identity plus N=1 indexed-vs-kNone instead).
- Repo-pinned clang-format clean on all touched C++ files; `arc lint -a` and the script's lint clean.
(M1 standalone carved from GC16 D126232422; that round diff is abandoned at M1.)
M1 re-verification (2026-10-20, after rebasing the stack onto master f0c3a35689fc and clang-formatting D117251769, D117251771, D123079329, D123551605):
- Per-diff gate, all 35 commits bottom-up: CI format check, `rocksdb_lib` build, every touched test target: all pass, 0 failures.
- Tip suites (23 targets): 8126 pass, 0 fail.
- N=1 byte identity at the tip: `6d135111...` (off) and `9a69a3fc...` (on), equal to T0.
- 180s blackbox crash test at N=1 with `partition_wal_usage=partition_by_column_family`: pass.
- Trigger rerun, opt `db_bench`, N=8/1000us/1024B, this harness: sync mix 0.0014 / 0.0013 / 0.0011 at 8 / 16 / 32 threads; all-async 0.026 / 0.025 / 0.018. Does not fire in either profile (the earlier 0.137 and dev-mode 0.108 readings do not reproduce in opt).
M2 fold: new or moved tests here: (none). B.1 at this diff (format check, `rocksdb_lib`, touched test targets): PASS; no test targets; `db_bench` and `db_stress` build; `partition_wal_sweep.py` compiles.
M3 B.1 at this diff (clang-format 21.1.2 on its changed lines, make check-sources, debug librocksdb build; no test file touched): PASS.
Note (2026-10-27): every number above predates GC17's sync-path change; see the first paragraph of the summary. The pre-stack-base comparison is still not run.
M5 fold: Absorbs 10 A.1 entries (GC28 5, GC27 1, GC29b 4): GC28 Q5 (b)/Q6: TRIGGER_THREAD_COUNTS, compute_trigger, --stats_level comments; GC27's zero guard; GC29b's docstrings and report heading. M5-F1 (A.8): F1.3: partition_wal_sweep.py's docstring placeholders.
M5 B.1: PASS (clang-format 21.1.2 on the changed lines, make check-sources, debug build of db_bench); no test binary touched.
M6 fold: Absorbs GC35 Q4: `tools/partition_wal_sweep.py` `--bandwidths-mbps` (cells, labels, parsing of `size_sleep_micros`, comparisons and trigger per bandwidth) and `db_bench` `--wal_slow_partition` taking a tenth of the WAL bandwidths.
M6 B.1: PASS (debug build of db_bench; no test binary touched).
Differential Revision: https://phabricator.intern.facebook.com/D126533195
JustinGaoF
added a commit
that referenced
this pull request
Nov 19, 2026
Summary:
**Measured before GC17.** Every number in this summary and its test plan was measured on the code before GC17 changed the N>1 sync path. Since GC17, a sync write fsyncs from its completion gate, and concurrent gate syncs coalesce; that change is folded into D123551605. The tables below describe the earlier code, not the current stack.
GC17's own paired, interleaved run (this harness; N=8, 1000 us injected append and sync latency, sync mix 1 in 20, 1 KB values; 3 rounds, base then GC17) measured these N=8 mixed-sync ranges:
| threads | ops/s, before GC17 | ops/s, after GC17 |
|---|---|---|
| 8 | 920–1004 | 2136–2198 |
| 16 | 970–1216 | 3054–3535 |
| 32 | 1458–1514 | 5454–5685 |
The same N=8 cell at 16 threads reads 1399 ops/s in the table below, from a different run. In GC17's run, async-only cells were unchanged within run-to-run noise.
Mixed-sync throughput at N>1 is still below N=1. This summary's N=1 kNone figure for the same profile is 5658 ops/s at 16 threads, against 3054–3535 for N=8 after GC17. The two come from different runs, so the size of the gap is not established. A same-run N=1 vs N>1 comparison under mixed sync is pending, on the final code.
`compute_trigger` in `tools/partition_wal_sweep.py` unpacks each cell's thread count into `cell_threads` and matches it against the requested `threads` (TRIGGER_THREAD_COUNTS is 8, 16, 32), so a narrowed grid reports the verdict of the requested thread count. Verdicts from runs before the M5 fold used the earlier version, which could compare against the last cell's thread count.
M1 standalone S-D (from GC16 Q1-Q3): reproducible WAL partition sweep harness (`tools/partition_wal_sweep.py`) plus `db_bench --sync_write_one_in` and `--wal_slow_partition`. Carved from GC16 D126232422, which is abandoned at M1.
At-M1 corrections to the GC16 summary below (applied inline): (1) reproducibility: the second `--quick` run's medians moved up to -8.3% (write p99) and -21% (gate p99) from the first, not "~2% on every median"; (2) the N=1 to N=16 async gain at 50us for 1024B values is +92% (47075 to 90571 ops/s); +77% is the 100B row; (3) join p99 at N=16/mix reaches 350ms; the 192ms figure was N=8/5000us/mix/1024B.
[GC] GC16: the N sweep and the abandon trigger, measured reproducibly (G-53). Benchmark tooling only: a checked-in sweep script plus two new `db_bench` flags, with the Tasks:975 abandon trigger evaluated under D-G53 (A). Also closes the GC15 carry-over: G-50 evidence for the multi-partition `synced_size` advance (Q4), a regression test for GC03's claim-time `SyncWAL` horizon (Q5), proof that the oracle's crashes lose data (G-54, Q6), and the `CrashMidRotationUnderSkewRecoversPrefix` drop fix (N-7-4, Q7). Q4's test idea, Q5's test, Q6's drop check and the Q7 finding are ported from D126193958 (MuseCode) as the requirement allows; its oracle, hooks, `SyncWalImpl` advance, latency FileSystem, per-WAL flag and Q8 labelling are not.
Reviewer question: Can anyone rerun this sweep and get the same picture, and does the watermark wait trip the abandon trigger at N=8? Anyone can: one command reproduces the 435-run matrix below (plus `--quick` in ~100s), and a second `--quick` run matches the first within −8.3% write p99 / −21% gate p99 at worst (see header). The trigger does not fire: 0.0012 at the designated N=8 profile, 50x below the 0.10 threshold on every sync-containing cell.
Q1: `tools/partition_wal_sweep.py` takes a `db_bench` binary and an output directory and runs the Q2 matrix with 3 reps per cell, emitting `results.json` (one row per rep: config, rep index, seed, throughput, p50/p99/p99.9 write latency, every Q2 histogram, FS counters; plus median/min-max aggregates), `results.md` (human table), per-cell command lines and raw logs, and the environment (host, CPUs, storage, opt build mode, commit hash, FS wait mode and concurrency cap). Injected and uninjected cells render in separate tables and the trigger refuses uninjected input. Reproducibility: two `--quick` runs from this commit (18 runs each, tables below) agree within −8.3% write p99 / −21% gate p99 at worst; strict min-max containment fails narrowly on 7 of 18 checked medians (worst -2.2%) because 3-rep spreads are extremely tight, and with n=3 a fresh median lands outside the previous min-max half the time by chance alone, so the small relative deviation, not strict containment, is the reproducibility evidence.
First `--quick` table (medians; commit 9c7f9a9b5188, opt, 166x AMD EPYC-Genoa):
## Injected cells (median across reps)
N usage append_us sync size slow ops/s us/op wr_p50 wr_p99 wr_p99.9 gate_p50 gate_p99 join_p50 join_p99 fsync/wr cap_med fanout_med
1 knone 500 mix 100 -1 9213 1707 1660 4309 6014 0.000 0.000 1291 4254 0.024 0.000 0.000
1 knone 500 none 100 -1 13884 1118 1321 1895 2886 0.000 0.000 989.5 1874 0.000 0.000 0.000
1 idx 500 mix 100 -1 9126 1713 1644 4300 6172 0.000 0.000 1292 4250 0.024 0.000 0.000
1 idx 500 none 100 -1 13908 1114 1318 1890 3625 0.000 0.000 987.3 1869 0.000 0.000 0.000
8 idx 500 mix 100 -1 2024 7721 867.9 49064 74742 0.553 43.9 269.3 44354 0.267 0.000 8.00
8 idx 500 none 100 -1 18247 866.2 820.4 1415 2716 0.558 41.8 597.6 1271 0.000 0.000 0.000
Second --quick table (medians):
## Injected cells (median across reps)
N usage append_us sync size slow ops/s us/op wr_p50 wr_p99 wr_p99.9 gate_p50 gate_p99 join_p50 join_p99 fsync/wr cap_med fanout_med
1 knone 500 mix 100 -1 9013 1729 1670 4323 6485 0.000 0.000 1306 4270 0.025 0.000 0.000
1 knone 500 none 100 -1 13746 1118 1314 1890 2770 0.000 0.000 994.9 1868 0.000 0.000 0.000
1 idx 500 mix 100 -1 8815 1796 1675 4393 8014 0.000 0.000 1333 4335 0.025 0.000 0.000
1 idx 500 none 100 -1 13938 1120 1322 1891 2668 0.000 0.000 993.4 1871 0.000 0.000 0.000
8 idx 500 mix 100 -1 2013 7755 867.4 49739 77800 0.554 44.0 309.6 44902 0.265 0.000 8.00
8 idx 500 none 100 -1 17845 864.9 818.0 1298 1882 0.555 33.0 588.7 1267 0.000 0.000 0.000
Q2: matrix is N in {1 kNone, 1 indexed, 2, 4, 8, 16} x append latency {50, 200, 1000, 5000}us (sync = append, jitter = append/10, seeded per rep) x sync {none, mix 1-in-20 via `--sync_write_one_in`, all} x value sizes {100, 1024} x 3 reps, 32k writes per cell on 64 CFs fixed across N (per-WAL counters verify every partition is covered in every N>1 cell; 8 CFs covered only 6/8 partitions in a pilot, hence 64), plus the N=8 one-slow-partition cell (`--wal_slow_partition=7`, 10x, mirroring the trigger profile). Steady state is inherent (WAL append cost is constant; the benchmark loop excludes open/CF setup) and confirmed by tight 3-rep spreads (e.g., trigger cell ops/s 1385-1417). New code only: the two flags live next to GC15's latency flags; no D118371518 line is touched. Cells use default write buffers (single generation; the slow override's rotation re-apply is validated in a separate small-buffer pilot where a stability check keeps mid-rotation tails from being misread as generations). Readings, one per bullet: baseline: N=1 indexed is within ~5% of kNone on every cell (e.g., 1000/mix/1024: 5376 vs 5658 ops/s) and byte-identical per the check below, so the stack costs ~nothing at N=1 (pre-stack-base comparison at 217951834332: not run, needs a second opt build; covered by byte-identity plus indexed-vs-kNone instead). N/BDP sweep: partitioning helps async writes at every latency (none/1024B N=1 to N=16: +92% at 50us (1024B: 47075 to 90571 ops/s; +77% is the 100B row), +40% at 1000us, +34% at 5000us) and hurts sync-containing ones (mix/1024B at 1000us: 5658 to 905 ops/s, -84%; all: 2874 to 582, -80%), driven by sync fan-out, not the gate. Cap-hit rate at N=8: `cap_excluded` sum is 0 in every cell over 10k-20k groups each, so the group cap never binds at N>1 here (M0.4: no). Join-wait vs watermark-wait: join p99 exceeds gate p99 by 7x (none) to 650x (mix) at N=8 (mix/1000/1024: 61ms vs 0.09ms); queueing dwarfs the watermark wait in every cell. Sync barrier: fan-out median is exactly N; barrier p50/p99 at N=8/1000/1024 is 21/49ms (all) and 36/102ms (mix); fsyncs/write is 0.33 (all) and 0.27 (mix), rising to 0.48/0.44 at N=16. One slow partition: throughput -53% (1399 to 661 ops/s), write p99 +126% (74 to 167ms), gate p99 x108 (91us to 9868us); the straggler cost lands almost entirely in the gate wait. Contention at N=8: the single-partition WAL mutex is uncontended (p99 1us); the all-partition mutex is taken per sync write (21k takes at all, p99 4.3ms; 2.8k takes at mix, p99 21.6ms) while async barely takes it (9 takes), so cross-partition serialization is the sync path's lock cost. Highlight (1000us, mix, 1024B medians): N=1 kNone 5658 ops/s wr_p99 6497us; N=1 idx 5376/6570; N=2 3615/17241; N=4 2275/34590; N=8 1399/73761 gate_p99 90.9us; N=8 slow 661/166813 gate_p99 9868us; N=16 905/157617. Full 145-row table (medians; commit 9c7f9a9b5188, opt, 166x AMD EPYC-Genoa):
## Injected cells (median across reps)
N usage append_us sync size slow ops/s us/op wr_p50 wr_p99 wr_p99.9 gate_p50 gate_p99 join_p50 join_p99 fsync/wr cap_med fanout_med
1 knone 50 all 100 -1 6955 2144 1837 4392 9100 0.000 0.000 1768 4346 0.092 0.000 0.000
1 knone 50 all 1024 -1 6764 2246 1870 4384 8360 0.000 0.000 1803 4364 0.094 0.000 0.000
1 knone 50 mix 100 -1 19060 827.4 369.9 2867 4317 0.000 0.000 331.3 2710 0.025 0.000 0.000
1 knone 50 mix 1024 -1 18416 851.3 467.6 2749 4569 0.000 0.000 340.8 2623 0.025 0.000 0.000
1 knone 50 none 100 -1 52029 298.1 289.4 547.9 784.1 0.000 0.000 278.6 378.5 0.000 0.000 0.000
1 knone 50 none 1024 -1 47075 328.7 304.2 799.5 2900 0.000 0.000 276.9 532.3 0.000 0.000 0.000
1 knone 200 all 100 -1 5864 2555 2127 5104 11634 0.000 0.000 1842 4392 0.095 0.000 0.000
1 knone 200 all 1024 -1 5186 2936 2819 6054 11152 0.000 0.000 2396 5488 0.099 0.000 0.000
1 knone 200 mix 100 -1 13826 1133 783.6 2895 5909 0.000 0.000 751.0 2865 0.025 0.000 0.000
1 knone 200 mix 1024 -1 13194 1195 793.7 3448 7385 0.000 0.000 752.8 2879 0.025 0.000 0.000
1 knone 200 none 100 -1 26404 578.7 660.0 868.5 1621 0.000 0.000 638.1 865.8 0.000 0.000 0.000
1 knone 200 none 1024 -1 25858 598.2 655.7 970.0 1732 0.000 0.000 634.7 866.4 0.000 0.000 0.000
1 knone 1000 all 100 -1 2954 5049 4184 9834 12417 0.000 0.000 4060 9817 0.094 0.000 0.000
1 knone 1000 all 1024 -1 2874 5215 4239 9844 13632 0.000 0.000 4110 9831 0.095 0.000 0.000
1 knone 1000 mix 100 -1 5633 2723 2565 6513 9417 0.000 0.000 2453 6414 0.025 0.000 0.000
1 knone 1000 mix 1024 -1 5658 2760 2569 6497 9424 0.000 0.000 2459 6410 0.025 0.000 0.000
1 knone 1000 none 100 -1 7702 1997 2146 2887 3828 0.000 0.000 2079 2884 0.000 0.000 0.000
1 knone 1000 none 1024 -1 7588 2026 2139 2887 3511 0.000 0.000 2070 2883 0.000 0.000 0.000
1 knone 5000 all 100 -1 857 17711 13717 32780 45952 0.000 0.000 13352 32746 0.096 0.000 0.000
1 knone 5000 all 1024 -1 843 17630 13599 32787 44333 0.000 0.000 13243 32759 0.097 0.000 0.000
1 knone 5000 mix 100 -1 1441 10811 11403 27626 34000 0.000 0.000 11105 21824 0.026 0.000 0.000
1 knone 5000 mix 1024 -1 1393 11108 11556 28820 48827 0.000 0.000 11254 21991 0.027 0.000 0.000
1 knone 5000 none 100 -1 1636 9191 11013 13943 13996 0.000 0.000 10747 13166 0.000 0.000 0.000
1 knone 5000 none 1024 -1 1646 9117 10908 13941 13996 0.000 0.000 10626 12602 0.000 0.000 0.000
1 idx 50 all 100 -1 7064 2168 1846 4374 7920 0.000 0.000 1782 4350 0.092 0.000 0.000
1 idx 50 all 1024 -1 6825 2220 1869 4366 6578 0.000 0.000 1804 4344 0.094 0.000 0.000
1 idx 50 mix 100 -1 19277 816.4 373.6 2656 4279 0.000 0.000 336.5 2514 0.026 0.000 0.000
1 idx 50 mix 1024 -1 18639 843.4 484.9 2757 4203 0.000 0.000 344.4 2595 0.025 0.000 0.000
1 idx 50 none 100 -1 51514 301.2 291.4 566.0 937.9 0.000 0.000 277.6 379.2 0.000 0.000 0.000
1 idx 50 none 1024 -1 49359 316.1 301.8 574.3 1231 0.000 0.000 275.8 490.9 0.000 0.000 0.000
1 idx 200 all 100 -1 5825 2596 2343 4840 8014 0.000 0.000 1870 4387 0.095 0.000 0.000
1 idx 200 all 1024 -1 5410 2795 2747 6311 8910 0.000 0.000 2441 6185 0.097 0.000 0.000
1 idx 200 mix 100 -1 13807 1135 780.7 2881 4569 0.000 0.000 754.3 2862 0.025 0.000 0.000
1 idx 200 mix 1024 -1 13350 1182 784.4 3069 5700 0.000 0.000 755.6 2874 0.025 0.000 0.000
1 idx 200 none 100 -1 26815 582.8 659.9 968.4 2900 0.000 0.000 637.3 866.9 0.000 0.000 0.000
1 idx 200 none 1024 -1 24464 637.1 667.5 1686 3922 0.000 0.000 638.3 869.8 0.000 0.000 0.000
1 idx 1000 all 100 -1 2799 5308 4213 11187 20780 0.000 0.000 4079 10327 0.095 0.000 0.000
1 idx 1000 all 1024 -1 2767 5391 4326 9893 13819 0.000 0.000 4175 9867 0.097 0.000 0.000
1 idx 1000 mix 100 -1 5465 2811 2571 6542 9845 0.000 0.000 2439 6451 0.026 0.000 0.000
1 idx 1000 mix 1024 -1 5376 2804 2564 6570 11266 0.000 0.000 2430 6459 0.026 0.000 0.000
1 idx 1000 none 100 -1 7531 2009 2141 2890 4266 0.000 0.000 2070 2884 0.000 0.000 0.000
1 idx 1000 none 1024 -1 7275 2080 2175 3272 6355 0.000 0.000 2106 2889 0.000 0.000 0.000
1 idx 5000 all 100 -1 835 18449 22425 32826 45265 0.000 0.000 13761 32778 0.099 0.000 0.000
1 idx 5000 all 1024 -1 849 17924 13812 32804 42208 0.000 0.000 13421 32778 0.097 0.000 0.000
1 idx 5000 mix 100 -1 1474 10462 11192 25826 32667 0.000 0.000 10899 21554 0.025 0.000 0.000
1 idx 5000 mix 1024 -1 1470 10612 11227 26240 32679 0.000 0.000 10926 21628 0.026 0.000 0.000
1 idx 5000 none 100 -1 1713 8883 10730 13938 13996 0.000 0.000 10421 13000 0.000 0.000 0.000
1 idx 5000 none 1024 -1 1685 9065 10878 13943 13999 0.000 0.000 10594 13533 0.000 0.000 0.000
2 idx 50 all 100 -1 3173 5010 4817 10548 18717 0.500 0.990 4146 9837 0.157 0.000 2.00
2 idx 50 all 1024 -1 3253 4881 4584 9844 13883 0.500 0.991 3990 9737 0.157 0.000 2.00
2 idx 50 mix 100 -1 9613 1632 530.9 6555 9705 0.501 0.992 326.0 6348 0.072 0.000 2.00
2 idx 50 mix 1024 -1 7238 2182 535.5 10814 13913 0.501 0.993 332.4 9763 0.072 0.000 2.00
2 idx 50 none 100 -1 73703 212.3 196.4 378.1 1054 0.501 0.992 152.7 372.7 0.000 0.000 0.000
2 idx 50 none 1024 -1 58770 233.9 219.8 759.8 2900 0.505 0.999 160.3 455.9 0.000 0.000 0.000
2 idx 200 all 100 -1 3007 5295 5069 11021 15756 0.500 0.991 4350 9876 0.157 0.000 2.00
2 idx 200 all 1024 -1 3507 4537 4482 8705 13672 0.500 0.991 3980 7920 0.157 0.000 2.00
2 idx 200 mix 100 -1 5592 2831 856.8 13065 20918 0.501 0.993 708.3 11987 0.071 0.000 2.00
2 idx 200 mix 1024 -1 5360 2944 863.0 13563 28000 0.501 0.993 720.6 12924 0.071 0.000 2.00
2 idx 200 none 100 -1 36498 435.4 371.1 860.0 1660 0.501 0.991 335.0 842.5 0.000 0.000 0.000
2 idx 200 none 1024 -1 35377 448.3 385.8 859.5 1900 0.501 0.991 339.0 845.5 0.000 0.000 0.000
2 idx 1000 all 100 -1 1823 8740 9873 13967 21764 0.500 0.991 8830 13928 0.157 0.000 2.00
2 idx 1000 all 1024 -1 1749 9091 9913 13974 21810 0.500 0.991 8879 13929 0.157 0.000 2.00
2 idx 1000 mix 100 -1 3677 4298 2723 16638 21509 0.504 0.998 2381 13766 0.071 0.000 2.00
2 idx 1000 mix 1024 -1 3615 4350 2742 17241 21887 0.506 5.06 2389 13746 0.071 0.000 2.00
2 idx 1000 none 100 -1 10378 1528 1285 2862 3136 0.502 0.995 1169 2837 0.000 0.000 0.000
2 idx 1000 none 1024 -1 10328 1538 1281 2865 3542 0.502 0.994 1168 2843 0.000 0.000 0.000
2 idx 5000 all 100 -1 527 30190 33019 49746 68939 0.500 0.991 29637 49610 0.157 0.000 2.00
2 idx 5000 all 1024 -1 524 30321 32999 49710 69078 0.500 0.991 29615 49566 0.157 0.000 2.00
2 idx 5000 mix 100 -1 985 16047 12484 55452 73373 0.541 296.0 11359 48332 0.072 0.000 2.00
2 idx 5000 mix 1024 -1 977 16107 12512 53021 73347 0.538 262.4 11407 48122 0.072 0.000 2.00
2 idx 5000 none 100 -1 2271 6987 6264 13715 13983 0.508 46.0 5811 12824 0.000 0.000 0.000
2 idx 5000 none 1024 -1 2236 7095 6344 13721 13989 0.508 53.5 5852 13541 0.000 0.000 0.000
4 idx 50 all 100 -1 3132 5052 4757 9900 19523 0.501 0.991 3436 9757 0.220 0.000 4.00
4 idx 50 all 1024 -1 2981 5328 5059 12450 19304 0.500 0.990 3752 10256 0.220 0.000 4.00
4 idx 50 mix 100 -1 5206 2994 362.7 16734 21957 0.513 15.5 209.2 13481 0.146 0.000 4.00
4 idx 50 mix 1024 -1 5116 3089 417.6 17175 21767 0.519 93.9 225.1 13734 0.147 0.000 4.00
4 idx 50 none 100 -1 75704 206.7 197.1 375.7 531.4 0.503 0.995 145.0 363.1 0.000 0.000 0.000
4 idx 50 none 1024 -1 72385 214.7 205.4 376.7 1335 0.504 0.997 147.2 366.4 0.000 0.000 0.000
4 idx 200 all 100 -1 2557 6199 6379 13396 21463 0.500 0.991 4657 12400 0.219 0.000 4.00
4 idx 200 all 1024 -1 2469 6413 6528 13829 21784 0.500 0.990 4721 12782 0.220 0.000 4.00
4 idx 200 mix 100 -1 4487 3493 781.0 19880 26685 0.515 14.2 371.2 17212 0.145 0.000 4.00
4 idx 200 mix 1024 -1 4341 3612 827.3 19957 26529 0.517 22.2 389.9 17764 0.145 0.000 4.00
4 idx 200 none 100 -1 35151 449.1 416.6 864.5 1796 0.505 0.999 323.2 815.6 0.000 0.000 0.000
4 idx 200 none 1024 -1 34343 461.6 431.4 866.4 3650 0.504 0.999 326.9 840.0 0.000 0.000 0.000
4 idx 1000 all 100 -1 1297 12186 12349 25183 33000 0.500 0.991 10115 21877 0.219 0.000 4.00
4 idx 1000 all 1024 -1 1264 12488 13023 25700 41225 0.500 0.990 10220 21925 0.219 0.000 4.00
4 idx 1000 mix 100 -1 2255 6946 2644 34819 49792 0.540 65.4 1266 30316 0.149 0.000 4.00
4 idx 1000 mix 1024 -1 2275 6908 2613 34590 55952 0.538 67.8 1270 30184 0.147 0.000 4.00
4 idx 1000 none 100 -1 9766 1627 1516 2875 3800 0.522 35.1 1138 2839 0.000 0.000 0.000
4 idx 1000 none 1024 -1 9644 1648 1559 2885 5866 0.523 66.5 1145 2851 0.000 0.000 0.000
4 idx 5000 all 100 -1 378 41788 40944 75336 107477 0.500 0.991 33643 73855 0.218 0.000 4.00
4 idx 5000 all 1024 -1 375 42333 41105 78277 108731 0.500 0.991 33890 74077 0.218 0.000 4.00
4 idx 5000 mix 100 -1 631 24937 12239 136600 197826 0.590 373.8 6387 102624 0.151 0.000 4.00
4 idx 5000 mix 1024 -1 626 24990 12237 129052 187297 0.584 369.4 6385 101482 0.152 0.000 4.00
4 idx 5000 none 100 -1 2085 7609 6598 13854 13990 0.550 292.9 5628 12498 0.000 0.000 0.000
4 idx 5000 none 1024 -1 2071 7654 6698 13858 13991 0.550 306.8 5648 12430 0.000 0.000 0.000
8 idx 50 all 100 -1 2129 7442 7339 21040 41904 0.500 0.990 3655 18016 0.329 0.000 8.00
8 idx 50 all 1024 -1 1991 7965 7726 20817 31412 0.500 0.990 3943 18174 0.330 0.000 8.00
8 idx 50 mix 100 -1 3202 4871 225.7 31709 47000 0.531 21.8 69.8 29138 0.260 0.000 8.00
8 idx 50 mix 1024 -1 3108 5067 233.7 32225 47820 0.531 27.8 74.5 30062 0.256 0.000 8.00
8 idx 50 none 100 -1 82431 188.7 178.4 372.4 501.7 0.512 5.47 116.1 327.5 0.000 0.000 0.000
8 idx 50 none 1024 -1 80988 195.0 185.6 374.4 568.9 0.513 6.83 117.6 343.0 0.000 0.000 0.000
8 idx 200 all 100 -1 1729 9168 9338 21970 32715 0.500 0.991 5025 20367 0.330 0.000 8.00
8 idx 200 all 1024 -1 1652 9603 9627 25015 34888 0.500 0.991 5143 20962 0.331 0.000 8.00
8 idx 200 mix 100 -1 2694 5791 445.2 39174 53125 0.534 26.0 151.0 31635 0.259 0.000 8.00
8 idx 200 mix 1024 -1 2614 5992 471.6 40379 49928 0.536 51.4 177.5 32085 0.256 0.000 8.00
8 idx 200 none 100 -1 37460 422.0 379.5 851.2 1062 0.523 13.5 272.6 728.2 0.000 0.000 0.000
8 idx 200 none 1024 -1 36931 426.4 393.3 851.3 869.3 0.522 12.4 271.5 741.5 0.000 0.000 0.000
8 idx 1000 all 100 -1 857 18445 17511 47477 73571 0.500 0.990 10538 42973 0.330 0.000 8.00
8 idx 1000 all 1024 -1 845 18738 17946 47829 72670 0.500 0.991 10756 42949 0.329 0.000 8.00
8 idx 1000 mix 100 -1 1402 11165 1741 74393 108959 0.585 93.4 312.5 60059 0.276 0.000 8.00
8 idx 1000 mix 1024 -1 1399 11114 1802 73761 109023 0.578 90.9 880.4 60966 0.270 0.000 8.00
8 idx 1000 mix 1024 7 661 23760 11139 166812 244581 0.732 9867 870.7 108682 0.295 0.000 8.00
8 idx 1000 none 100 -1 9843 1609 1451 2875 3650 0.598 98.5 994.0 2806 0.000 0.000 0.000
8 idx 1000 none 1024 -1 9552 1655 1523 3025 5377 0.603 414.8 991.9 2828 0.000 0.000 0.000
8 idx 5000 all 100 -1 250 63159 58084 159190 222173 0.500 0.990 35234 140991 0.330 0.000 8.00
8 idx 5000 all 1024 -1 247 63715 58555 161949 232028 0.500 0.991 35455 144577 0.331 0.000 8.00
8 idx 5000 mix 100 -1 410 38438 6810 289671 378652 0.643 494.2 889.1 197712 0.283 0.000 8.00
8 idx 5000 mix 1024 -1 412 38123 7160 254511 372618 0.641 486.1 1900 191509 0.282 0.000 8.00
8 idx 5000 none 100 -1 2075 7651 6478 13876 13991 0.658 395.1 4996 13349 0.000 0.000 0.000
8 idx 5000 none 1024 -1 2074 7648 6445 13878 13991 0.658 408.6 5002 11790 0.000 0.000 0.000
16 idx 50 all 100 -1 1491 10629 10610 31645 49569 0.500 0.990 1960 24014 0.484 0.000 16.0
16 idx 50 all 1024 -1 1437 11010 10980 31891 48539 0.500 0.991 1993 25956 0.484 0.000 16.0
16 idx 50 mix 100 -1 2130 7392 162.9 62961 78181 0.541 27.9 0.782 48548 0.405 0.000 16.0
16 idx 50 mix 1024 -1 2007 7818 164.6 65696 98068 0.540 32.0 0.780 49673 0.404 0.000 16.0
16 idx 50 none 100 -1 92287 169.7 159.3 366.9 379.8 0.527 11.3 44.4 249.1 0.000 0.000 0.000
16 idx 50 none 1024 -1 90571 173.0 160.6 368.9 379.7 0.530 12.1 45.3 285.3 0.000 0.000 0.000
16 idx 200 all 100 -1 1181 13431 13356 38860 63571 0.500 0.990 2991 30479 0.484 0.000 16.0
16 idx 200 all 1024 -1 949 16720 15013 72363 118108 0.500 0.990 3108 48272 0.486 0.000 16.0
16 idx 200 mix 100 -1 1778 8789 355.4 71340 105314 0.546 44.1 0.782 61541 0.409 0.000 16.0
16 idx 200 mix 1024 -1 1727 9101 356.4 72268 104615 0.544 39.9 0.787 65150 0.407 0.000 16.0
16 idx 200 none 100 -1 40927 385.7 353.6 837.2 869.8 0.551 19.1 85.8 573.0 0.000 0.000 0.000
16 idx 200 none 1024 -1 40675 389.0 355.3 840.6 870.0 0.545 15.7 88.9 578.4 0.000 0.000 0.000
16 idx 1000 all 100 -1 589 26867 26163 74241 108472 0.500 0.991 6078 64161 0.483 0.000 16.0
16 idx 1000 all 1024 -1 582 27175 26211 74011 131818 0.500 0.991 6756 63614 0.481 0.000 16.0
16 idx 1000 mix 100 -1 954 16309 1212 149831 231600 0.604 84.9 0.773 104478 0.439 0.000 16.0
16 idx 1000 mix 1024 -1 905 17307 1216 157617 238930 0.603 90.3 0.776 108960 0.438 0.000 16.0
16 idx 1000 none 100 -1 10625 1490 1224 2868 2900 0.693 78.3 170.1 2725 0.000 0.000 0.000
16 idx 1000 none 1024 -1 10610 1491 1226 2866 2898 0.689 75.0 166.4 2724 0.000 0.000 0.000
16 idx 5000 all 100 -1 171 92232 88833 246299 368560 0.500 0.990 22354 210692 0.482 0.000 16.0
16 idx 5000 all 1024 -1 169 93424 89851 246061 368288 0.500 0.990 22052 212761 0.485 0.000 16.0
16 idx 5000 mix 100 -1 278 55903 6118 533996 815050 0.660 517.5 0.751 348988 0.471 0.000 16.0
16 idx 5000 mix 1024 -1 279 55956 6123 533486 817263 0.655 508.0 0.757 350460 0.468 0.000 16.0
16 idx 5000 none 100 -1 2223 7125 6114 13834 13986 0.752 487.9 787.9 11836 0.000 0.000 0.000
16 idx 5000 none 1024 -1 2205 7131 6109 13839 13986 0.754 485.5 743.3 11352 0.000 0.000 0.000
Q3: D-G53 = (A) share of the tail (Recommended; the choice cell is blank). Metric is p99(`rocksdb.wal.durability.wait.micros`) / p99(write) at N=8 per (latency, sync) cell; the designated profile is append=1000us, mix, 1024B (mid-range networked-WAL latency, realistic sync ratio, KB-scale values, per the doc's own example). Number: 0.0012. Verdict: DOES NOT FIRE. The verdict is robust: every sync-containing cell at N=8 is at most 0.0019 (5000us mix), 50x below threshold, and all-sync cells round to 0.0000 (writes serialize through the barrier, so the gate never waits). The highest ratio anywhere is 0.1371 at (1000us, none, 1024B), a no-sync extreme where the denominator has no barrier (write p99 3.0ms) while the gate tail reaches 415us consistently across reps (281/415/531us); the 100B sibling is 0.034. That cell is reported, not the verdict: the trigger refers to the realistic sync mix, but the none-mode tail's value-size sensitivity is flagged for GC17.
## Abandon trigger (D-G53 (A)) at N=8
append_us sync size gate_p99_us write_p99_us ratio
50 all 100 0.990 21040 0.0000
50 all 1024 0.990 20817 0.0000
50 mix 100 21.8 31709 0.0007
50 mix 1024 27.8 32225 0.0009
50 none 100 5.47 372.4 0.0147
50 none 1024 6.83 374.4 0.0183
200 all 100 0.991 21970 0.0000
200 all 1024 0.991 25015 0.0000
200 mix 100 26.0 39174 0.0007
200 mix 1024 51.4 40379 0.0013
200 none 100 13.5 851.2 0.0159
200 none 1024 12.4 851.3 0.0146
1000 all 100 0.990 47477 0.0000
1000 all 1024 0.991 47829 0.0000
1000 mix 100 93.4 74393 0.0013
1000 mix 1024 90.9 73761 0.0012
1000 none 100 98.5 2875 0.0343
1000 none 1024 414.8 3025 0.1371
5000 all 100 0.990 159190 0.0000
5000 all 1024 0.991 161949 0.0000
5000 mix 100 494.2 289671 0.0017
5000 mix 1024 486.1 254511 0.0019
5000 none 100 395.1 13876 0.0285
5000 none 1024 408.6 13878 0.0294
TRIGGER: ratio 0.0012 at N=8 append=1000us sync=mix size=1024B does not fire (threshold 0.10)
Q4: `SyncWalAdvancesOtherPartitionsSyncedSize` syncs both partitions, writes nothing more, then a sync write on partition 0 must record sum 0 on `WAL_SYNC_UNSYNCED_PARTITIONS`. Neuter (drop the `note_synced` in the `wal.number > up_to` branch; dropping the whole branch would still advance via the active-WAL path): fails with sum 1. Existing `NonLeadershipSyncsAdvanceSyncedSize` passes unmodified.
Q5: `SyncWalClaimTimeHorizonExcludesCoupledRotation` holds a manual `SyncWAL` in its fsync loop with 100ms slow syncs, lands a coupled rotation inside (counter-observed, order proven by `DBImpl::SyncWAL:Begin` < switch < `DBImpl::SyncWAL:BeforeMarkLogsSynced:1`), writes into the rotated-in WALs, and requires a later sync write to count all 4 partitions unsynced, with marks clear and deques consistent. Neuter (finish-time horizon): aborts on `assert(wal.IsSyncing())` on the unmarked rotated-in WAL.
Q6: the oracle records per power-loss cycle whether an acknowledged write is absent after recovery, prints the count in the summary line, and `RecoveredStateIsPrefixOfHistory` fails when power-loss cycles ran but none lost a write (runs with zero power-loss cycles, i.e. single-cycle reruns of process-crash seeds, are exempt: nothing to prove). 1000-cycle run from this commit: pass, 313 of 528 power-loss cycles lost a write. Neuter (crash keeps unsynced data): 40-cycle run fails with "power loss lost an acknowledged write in 0".
Q7: `CrashMidRotationUnderSkewRecoversPrefix` now sets `SetInjectUnsyncedDataLoss(true)` before the open (files capture the flag at creation) and requires `missing_seen` past the last sync. Neuter (flag off again): fails on "the crash dropped no acknowledged write". Listed under Invariant 4 as the one modified test.
GC17 pointers (numbers only, no decisions): D-G11: mean unsynced partitions under the mix is 1.3-2.3 of 8 (well below N) and the barrier dominates sync-write p99 (barrier p99 102ms over 1321 sync groups vs write p99 74ms over 32k mixed writes at N=8/1000/mix/1024; different populations, noted). G-19a: writers/group p50 is 1-2.4 while join p99 reaches 350ms at N=16/mix (191.5ms is N=8/5000us/mix/1024B); the index-allocation mutex has no dedicated histogram, so the harness bounds group-formation queueing but does not isolate the allocator. muse #22: per-partition mutex waits are ~0 at all N (p99 1us); no contention signature that padding would relieve in these workloads. N-2-6: 0.27-0.48 fsyncs/write sit on the write path at N=8-16 sync workloads; a background fsync's prize is bounded by the barrier numbers above minus the all-mutex claim, which stays.
Fold-back split: Q1-Q3 (script + `--sync_write_one_in` + `--wal_slow_partition` in `tools/db_bench_tool.cc`) stays a standalone diff (new code; no D118371518 line touched; no D-G53 (B) bypass). Q4 test folds with GC15's `NonLeadershipSyncsAdvanceSyncedSize` (D123971668, or D123551605). Q5 test to GC15's standalone diff (needs the latency FS). Q6 (oracle drop count + failure) to GC15's standalone diff. Q7 (test change) to D123928339. No hunk is unplaceable at its target.
Assumptions: D-G53 blank, so Recommended (A) per AB section 4 rule 2. Trigger profile (1000us append, mix 1-in-20, 1024B) chosen per rule 5 (mid-range networked-WAL latency, realistic sync ratio, KB-scale values; every cell tabulated so the choice is auditable). Sync latency = append latency and jitter = append/10 per rule 5 (one profile knob; seeded jitter keeps reps reproducible). 64 fixed CFs per rule 5 (isolates N; coverage verified from per-WAL counters). Cells use default write buffers (single generation; rotation re-apply validated in a separate small-buffer pilot) per rule 5 (cleanest numbers). Q4 neuter removes the `note_synced` call rather than the whole branch per rule 5 (the literal branch drop still advances via the active path and would not fail). Q6 exempts runs with zero power-loss cycles per rule 5 (single-cycle reruns must stay green). Cap-hit rate is reported as mean excluded/group plus P99 (ToString exposes no non-zero fraction) per rule 5.
Not done: (empty).
M2 fold (2026-10-22, `M2-FoldTasks.md` + `M2-Amendment.md`): Absorbs (M2) GC10 Q8/Q9: `SlowWalPartitionFileSystem`, sweep comparisons, steady state, `--compare_to`, trigger table; GC07 Q9: sweep dedup and N=1 baselines. This diff now edits S-C's db_bench lines: it moves S-C's latency-FS install block below its own slow-partition validation.
Changes visible to existing users:
- db_bench gains --sync_write_one_in (default 0) and --wal_slow_partition (default -1).
- db_bench now exits with an error when --wal_append_bandwidth_mbps or --wal_sync_bandwidth_mbps is set without --inject_wal_latency or outside [0, 1e12].
- db_bench fill/write benchmarks copy WriteOptions once per batch.
- New script tools/partition_wal_sweep.py.
Test Plan:
- `buck2 test fbcode//internal_repo_rocksdb/repo:db_write_test fbcode//internal_repo_rocksdb/repo:latency_injection_fs_test`: 199 pass, 0 fail.
- `buck2 test fbcode//internal_repo_rocksdb/repo:db_wal_oracle_test` (40 cycles): 3 pass; drop count 13/17 power-loss cycles.
- 1000-cycle oracle run from this commit (`ROCKSDB_WAL_ORACLE_CYCLES=1000`): pass; 313 of 528 power-loss cycles lost a write; 2 known lower-bound holes (non-strict, expected). A pre-format run gave 310/528; the committed run above is the evidence.
- Q5+Q7 x100 repeats (`--gtest_repeat=100`): 100/100 iterations pass, 0 failures.
- Q5+Q7 under `@fbcode//mode/dev-tsan`: 4 pass, no TSan warnings.
- Q4 neuter (no `note_synced` past the horizon): `SyncWalAdvancesOtherPartitionsSyncedSize` fails with sum 1 (expected). Q5 neuter (finish-time horizon): aborts on `assert(wal.IsSyncing())` (expected). Q6 neuter (crash keeps unsynced data): 40-cycle run fails "no power-loss cycle lost an acknowledged write" with count 0 (expected). Q7 neuter (flag off): fails "the crash dropped no acknowledged write" (expected). All neuters reverted; `db_impl.cc` clean.
- Full matrix: 435/435 runs ok from this commit (opt `db_bench`); trigger verdict DOES NOT FIRE (0.0012 at N=8/1000us/mix/1024B; max 0.0019 on any sync-containing cell).
- Two `--quick` runs from this commit: 18/18 each; second run's medians within −8.3% write p99 / −21% gate p99 of the first at worst (7 of 18 narrowly outside the tight 3-rep min-max; worst -2.2%); tables in summary.
- N=1 byte-identity check (base vs this commit, `none` and `partition_by_column_family`): pass; hashes equal the documented values (`6d135111...` off, `9a69a3fc...` on).
- 180s `db_stress` blackbox crash test at N=1 with `partition_wal_usage` on: first run failed early (checkpoint "WAL index merge: WAL 3 unreadable" under injected read faults), retry passed ("Crash-recovery verification passed"). Engine code is untouched by this diff (benchmark tooling + tests only), so the intermittent failure is a pre-existing base finding, reported, not fixed.
- Pre-stack-base N=1 comparison at 217951834332: not run (needs a second opt build; covered by byte-identity plus N=1 indexed-vs-kNone instead).
- Repo-pinned clang-format clean on all touched C++ files; `arc lint -a` and the script's lint clean.
(M1 standalone carved from GC16 D126232422; that round diff is abandoned at M1.)
M1 re-verification (2026-10-20, after rebasing the stack onto master f0c3a35689fc and clang-formatting D117251769, D117251771, D123079329, D123551605):
- Per-diff gate, all 35 commits bottom-up: CI format check, `rocksdb_lib` build, every touched test target: all pass, 0 failures.
- Tip suites (23 targets): 8126 pass, 0 fail.
- N=1 byte identity at the tip: `6d135111...` (off) and `9a69a3fc...` (on), equal to T0.
- 180s blackbox crash test at N=1 with `partition_wal_usage=partition_by_column_family`: pass.
- Trigger rerun, opt `db_bench`, N=8/1000us/1024B, this harness: sync mix 0.0014 / 0.0013 / 0.0011 at 8 / 16 / 32 threads; all-async 0.026 / 0.025 / 0.018. Does not fire in either profile (the earlier 0.137 and dev-mode 0.108 readings do not reproduce in opt).
M2 fold: new or moved tests here: (none). B.1 at this diff (format check, `rocksdb_lib`, touched test targets): PASS; no test targets; `db_bench` and `db_stress` build; `partition_wal_sweep.py` compiles.
M3 B.1 at this diff (clang-format 21.1.2 on its changed lines, make check-sources, debug librocksdb build; no test file touched): PASS.
Note (2026-10-27): every number above predates GC17's sync-path change; see the first paragraph of the summary. The pre-stack-base comparison is still not run.
M5 fold: Absorbs 10 A.1 entries (GC28 5, GC27 1, GC29b 4): GC28 Q5 (b)/Q6: TRIGGER_THREAD_COUNTS, compute_trigger, --stats_level comments; GC27's zero guard; GC29b's docstrings and report heading. M5-F1 (A.8): F1.3: partition_wal_sweep.py's docstring placeholders.
M5 B.1: PASS (clang-format 21.1.2 on the changed lines, make check-sources, debug build of db_bench); no test binary touched.
M6 fold: Absorbs GC35 Q4: `tools/partition_wal_sweep.py` `--bandwidths-mbps` (cells, labels, parsing of `size_sleep_micros`, comparisons and trigger per bandwidth) and `db_bench` `--wal_slow_partition` taking a tenth of the WAL bandwidths.
M6 B.1: PASS (debug build of db_bench; no test binary touched).
Differential Revision: https://phabricator.intern.facebook.com/D126533195
JustinGaoF
added a commit
that referenced
this pull request
Nov 19, 2026
Summary:
**Measured before GC17.** Every number in this summary and its test plan was measured on the code before GC17 changed the N>1 sync path. Since GC17, a sync write fsyncs from its completion gate, and concurrent gate syncs coalesce; that change is folded into D123551605. The tables below describe the earlier code, not the current stack.
GC17's own paired, interleaved run (this harness; N=8, 1000 us injected append and sync latency, sync mix 1 in 20, 1 KB values; 3 rounds, base then GC17) measured these N=8 mixed-sync ranges:
| threads | ops/s, before GC17 | ops/s, after GC17 |
|---|---|---|
| 8 | 920–1004 | 2136–2198 |
| 16 | 970–1216 | 3054–3535 |
| 32 | 1458–1514 | 5454–5685 |
The same N=8 cell at 16 threads reads 1399 ops/s in the table below, from a different run. In GC17's run, async-only cells were unchanged within run-to-run noise.
Mixed-sync throughput at N>1 is still below N=1. This summary's N=1 kNone figure for the same profile is 5658 ops/s at 16 threads, against 3054–3535 for N=8 after GC17. The two come from different runs, so the size of the gap is not established. A same-run N=1 vs N>1 comparison under mixed sync is pending, on the final code.
`compute_trigger` in `tools/partition_wal_sweep.py` unpacks each cell's thread count into `cell_threads` and matches it against the requested `threads` (TRIGGER_THREAD_COUNTS is 8, 16, 32), so a narrowed grid reports the verdict of the requested thread count. Verdicts from runs before the M5 fold used the earlier version, which could compare against the last cell's thread count.
M1 standalone S-D (from GC16 Q1-Q3): reproducible WAL partition sweep harness (`tools/partition_wal_sweep.py`) plus `db_bench --sync_write_one_in` and `--wal_slow_partition`. Carved from GC16 D126232422, which is abandoned at M1.
At-M1 corrections to the GC16 summary below (applied inline): (1) reproducibility: the second `--quick` run's medians moved up to -8.3% (write p99) and -21% (gate p99) from the first, not "~2% on every median"; (2) the N=1 to N=16 async gain at 50us for 1024B values is +92% (47075 to 90571 ops/s); +77% is the 100B row; (3) join p99 at N=16/mix reaches 350ms; the 192ms figure was N=8/5000us/mix/1024B.
[GC] GC16: the N sweep and the abandon trigger, measured reproducibly (G-53). Benchmark tooling only: a checked-in sweep script plus two new `db_bench` flags, with the Tasks:975 abandon trigger evaluated under D-G53 (A). Also closes the GC15 carry-over: G-50 evidence for the multi-partition `synced_size` advance (Q4), a regression test for GC03's claim-time `SyncWAL` horizon (Q5), proof that the oracle's crashes lose data (G-54, Q6), and the `CrashMidRotationUnderSkewRecoversPrefix` drop fix (N-7-4, Q7). Q4's test idea, Q5's test, Q6's drop check and the Q7 finding are ported from D126193958 (MuseCode) as the requirement allows; its oracle, hooks, `SyncWalImpl` advance, latency FileSystem, per-WAL flag and Q8 labelling are not.
Reviewer question: Can anyone rerun this sweep and get the same picture, and does the watermark wait trip the abandon trigger at N=8? Anyone can: one command reproduces the 435-run matrix below (plus `--quick` in ~100s), and a second `--quick` run matches the first within −8.3% write p99 / −21% gate p99 at worst (see header). The trigger does not fire: 0.0012 at the designated N=8 profile, 50x below the 0.10 threshold on every sync-containing cell.
Q1: `tools/partition_wal_sweep.py` takes a `db_bench` binary and an output directory and runs the Q2 matrix with 3 reps per cell, emitting `results.json` (one row per rep: config, rep index, seed, throughput, p50/p99/p99.9 write latency, every Q2 histogram, FS counters; plus median/min-max aggregates), `results.md` (human table), per-cell command lines and raw logs, and the environment (host, CPUs, storage, opt build mode, commit hash, FS wait mode and concurrency cap). Injected and uninjected cells render in separate tables and the trigger refuses uninjected input. Reproducibility: two `--quick` runs from this commit (18 runs each, tables below) agree within −8.3% write p99 / −21% gate p99 at worst; strict min-max containment fails narrowly on 7 of 18 checked medians (worst -2.2%) because 3-rep spreads are extremely tight, and with n=3 a fresh median lands outside the previous min-max half the time by chance alone, so the small relative deviation, not strict containment, is the reproducibility evidence.
First `--quick` table (medians; commit 9c7f9a9b5188, opt, 166x AMD EPYC-Genoa):
## Injected cells (median across reps)
N usage append_us sync size slow ops/s us/op wr_p50 wr_p99 wr_p99.9 gate_p50 gate_p99 join_p50 join_p99 fsync/wr cap_med fanout_med
1 knone 500 mix 100 -1 9213 1707 1660 4309 6014 0.000 0.000 1291 4254 0.024 0.000 0.000
1 knone 500 none 100 -1 13884 1118 1321 1895 2886 0.000 0.000 989.5 1874 0.000 0.000 0.000
1 idx 500 mix 100 -1 9126 1713 1644 4300 6172 0.000 0.000 1292 4250 0.024 0.000 0.000
1 idx 500 none 100 -1 13908 1114 1318 1890 3625 0.000 0.000 987.3 1869 0.000 0.000 0.000
8 idx 500 mix 100 -1 2024 7721 867.9 49064 74742 0.553 43.9 269.3 44354 0.267 0.000 8.00
8 idx 500 none 100 -1 18247 866.2 820.4 1415 2716 0.558 41.8 597.6 1271 0.000 0.000 0.000
Second --quick table (medians):
## Injected cells (median across reps)
N usage append_us sync size slow ops/s us/op wr_p50 wr_p99 wr_p99.9 gate_p50 gate_p99 join_p50 join_p99 fsync/wr cap_med fanout_med
1 knone 500 mix 100 -1 9013 1729 1670 4323 6485 0.000 0.000 1306 4270 0.025 0.000 0.000
1 knone 500 none 100 -1 13746 1118 1314 1890 2770 0.000 0.000 994.9 1868 0.000 0.000 0.000
1 idx 500 mix 100 -1 8815 1796 1675 4393 8014 0.000 0.000 1333 4335 0.025 0.000 0.000
1 idx 500 none 100 -1 13938 1120 1322 1891 2668 0.000 0.000 993.4 1871 0.000 0.000 0.000
8 idx 500 mix 100 -1 2013 7755 867.4 49739 77800 0.554 44.0 309.6 44902 0.265 0.000 8.00
8 idx 500 none 100 -1 17845 864.9 818.0 1298 1882 0.555 33.0 588.7 1267 0.000 0.000 0.000
Q2: matrix is N in {1 kNone, 1 indexed, 2, 4, 8, 16} x append latency {50, 200, 1000, 5000}us (sync = append, jitter = append/10, seeded per rep) x sync {none, mix 1-in-20 via `--sync_write_one_in`, all} x value sizes {100, 1024} x 3 reps, 32k writes per cell on 64 CFs fixed across N (per-WAL counters verify every partition is covered in every N>1 cell; 8 CFs covered only 6/8 partitions in a pilot, hence 64), plus the N=8 one-slow-partition cell (`--wal_slow_partition=7`, 10x, mirroring the trigger profile). Steady state is inherent (WAL append cost is constant; the benchmark loop excludes open/CF setup) and confirmed by tight 3-rep spreads (e.g., trigger cell ops/s 1385-1417). New code only: the two flags live next to GC15's latency flags; no D118371518 line is touched. Cells use default write buffers (single generation; the slow override's rotation re-apply is validated in a separate small-buffer pilot where a stability check keeps mid-rotation tails from being misread as generations). Readings, one per bullet: baseline: N=1 indexed is within ~5% of kNone on every cell (e.g., 1000/mix/1024: 5376 vs 5658 ops/s) and byte-identical per the check below, so the stack costs ~nothing at N=1 (pre-stack-base comparison at 217951834332: not run, needs a second opt build; covered by byte-identity plus indexed-vs-kNone instead). N/BDP sweep: partitioning helps async writes at every latency (none/1024B N=1 to N=16: +92% at 50us (1024B: 47075 to 90571 ops/s; +77% is the 100B row), +40% at 1000us, +34% at 5000us) and hurts sync-containing ones (mix/1024B at 1000us: 5658 to 905 ops/s, -84%; all: 2874 to 582, -80%), driven by sync fan-out, not the gate. Cap-hit rate at N=8: `cap_excluded` sum is 0 in every cell over 10k-20k groups each, so the group cap never binds at N>1 here (M0.4: no). Join-wait vs watermark-wait: join p99 exceeds gate p99 by 7x (none) to 650x (mix) at N=8 (mix/1000/1024: 61ms vs 0.09ms); queueing dwarfs the watermark wait in every cell. Sync barrier: fan-out median is exactly N; barrier p50/p99 at N=8/1000/1024 is 21/49ms (all) and 36/102ms (mix); fsyncs/write is 0.33 (all) and 0.27 (mix), rising to 0.48/0.44 at N=16. One slow partition: throughput -53% (1399 to 661 ops/s), write p99 +126% (74 to 167ms), gate p99 x108 (91us to 9868us); the straggler cost lands almost entirely in the gate wait. Contention at N=8: the single-partition WAL mutex is uncontended (p99 1us); the all-partition mutex is taken per sync write (21k takes at all, p99 4.3ms; 2.8k takes at mix, p99 21.6ms) while async barely takes it (9 takes), so cross-partition serialization is the sync path's lock cost. Highlight (1000us, mix, 1024B medians): N=1 kNone 5658 ops/s wr_p99 6497us; N=1 idx 5376/6570; N=2 3615/17241; N=4 2275/34590; N=8 1399/73761 gate_p99 90.9us; N=8 slow 661/166813 gate_p99 9868us; N=16 905/157617. Full 145-row table (medians; commit 9c7f9a9b5188, opt, 166x AMD EPYC-Genoa):
## Injected cells (median across reps)
N usage append_us sync size slow ops/s us/op wr_p50 wr_p99 wr_p99.9 gate_p50 gate_p99 join_p50 join_p99 fsync/wr cap_med fanout_med
1 knone 50 all 100 -1 6955 2144 1837 4392 9100 0.000 0.000 1768 4346 0.092 0.000 0.000
1 knone 50 all 1024 -1 6764 2246 1870 4384 8360 0.000 0.000 1803 4364 0.094 0.000 0.000
1 knone 50 mix 100 -1 19060 827.4 369.9 2867 4317 0.000 0.000 331.3 2710 0.025 0.000 0.000
1 knone 50 mix 1024 -1 18416 851.3 467.6 2749 4569 0.000 0.000 340.8 2623 0.025 0.000 0.000
1 knone 50 none 100 -1 52029 298.1 289.4 547.9 784.1 0.000 0.000 278.6 378.5 0.000 0.000 0.000
1 knone 50 none 1024 -1 47075 328.7 304.2 799.5 2900 0.000 0.000 276.9 532.3 0.000 0.000 0.000
1 knone 200 all 100 -1 5864 2555 2127 5104 11634 0.000 0.000 1842 4392 0.095 0.000 0.000
1 knone 200 all 1024 -1 5186 2936 2819 6054 11152 0.000 0.000 2396 5488 0.099 0.000 0.000
1 knone 200 mix 100 -1 13826 1133 783.6 2895 5909 0.000 0.000 751.0 2865 0.025 0.000 0.000
1 knone 200 mix 1024 -1 13194 1195 793.7 3448 7385 0.000 0.000 752.8 2879 0.025 0.000 0.000
1 knone 200 none 100 -1 26404 578.7 660.0 868.5 1621 0.000 0.000 638.1 865.8 0.000 0.000 0.000
1 knone 200 none 1024 -1 25858 598.2 655.7 970.0 1732 0.000 0.000 634.7 866.4 0.000 0.000 0.000
1 knone 1000 all 100 -1 2954 5049 4184 9834 12417 0.000 0.000 4060 9817 0.094 0.000 0.000
1 knone 1000 all 1024 -1 2874 5215 4239 9844 13632 0.000 0.000 4110 9831 0.095 0.000 0.000
1 knone 1000 mix 100 -1 5633 2723 2565 6513 9417 0.000 0.000 2453 6414 0.025 0.000 0.000
1 knone 1000 mix 1024 -1 5658 2760 2569 6497 9424 0.000 0.000 2459 6410 0.025 0.000 0.000
1 knone 1000 none 100 -1 7702 1997 2146 2887 3828 0.000 0.000 2079 2884 0.000 0.000 0.000
1 knone 1000 none 1024 -1 7588 2026 2139 2887 3511 0.000 0.000 2070 2883 0.000 0.000 0.000
1 knone 5000 all 100 -1 857 17711 13717 32780 45952 0.000 0.000 13352 32746 0.096 0.000 0.000
1 knone 5000 all 1024 -1 843 17630 13599 32787 44333 0.000 0.000 13243 32759 0.097 0.000 0.000
1 knone 5000 mix 100 -1 1441 10811 11403 27626 34000 0.000 0.000 11105 21824 0.026 0.000 0.000
1 knone 5000 mix 1024 -1 1393 11108 11556 28820 48827 0.000 0.000 11254 21991 0.027 0.000 0.000
1 knone 5000 none 100 -1 1636 9191 11013 13943 13996 0.000 0.000 10747 13166 0.000 0.000 0.000
1 knone 5000 none 1024 -1 1646 9117 10908 13941 13996 0.000 0.000 10626 12602 0.000 0.000 0.000
1 idx 50 all 100 -1 7064 2168 1846 4374 7920 0.000 0.000 1782 4350 0.092 0.000 0.000
1 idx 50 all 1024 -1 6825 2220 1869 4366 6578 0.000 0.000 1804 4344 0.094 0.000 0.000
1 idx 50 mix 100 -1 19277 816.4 373.6 2656 4279 0.000 0.000 336.5 2514 0.026 0.000 0.000
1 idx 50 mix 1024 -1 18639 843.4 484.9 2757 4203 0.000 0.000 344.4 2595 0.025 0.000 0.000
1 idx 50 none 100 -1 51514 301.2 291.4 566.0 937.9 0.000 0.000 277.6 379.2 0.000 0.000 0.000
1 idx 50 none 1024 -1 49359 316.1 301.8 574.3 1231 0.000 0.000 275.8 490.9 0.000 0.000 0.000
1 idx 200 all 100 -1 5825 2596 2343 4840 8014 0.000 0.000 1870 4387 0.095 0.000 0.000
1 idx 200 all 1024 -1 5410 2795 2747 6311 8910 0.000 0.000 2441 6185 0.097 0.000 0.000
1 idx 200 mix 100 -1 13807 1135 780.7 2881 4569 0.000 0.000 754.3 2862 0.025 0.000 0.000
1 idx 200 mix 1024 -1 13350 1182 784.4 3069 5700 0.000 0.000 755.6 2874 0.025 0.000 0.000
1 idx 200 none 100 -1 26815 582.8 659.9 968.4 2900 0.000 0.000 637.3 866.9 0.000 0.000 0.000
1 idx 200 none 1024 -1 24464 637.1 667.5 1686 3922 0.000 0.000 638.3 869.8 0.000 0.000 0.000
1 idx 1000 all 100 -1 2799 5308 4213 11187 20780 0.000 0.000 4079 10327 0.095 0.000 0.000
1 idx 1000 all 1024 -1 2767 5391 4326 9893 13819 0.000 0.000 4175 9867 0.097 0.000 0.000
1 idx 1000 mix 100 -1 5465 2811 2571 6542 9845 0.000 0.000 2439 6451 0.026 0.000 0.000
1 idx 1000 mix 1024 -1 5376 2804 2564 6570 11266 0.000 0.000 2430 6459 0.026 0.000 0.000
1 idx 1000 none 100 -1 7531 2009 2141 2890 4266 0.000 0.000 2070 2884 0.000 0.000 0.000
1 idx 1000 none 1024 -1 7275 2080 2175 3272 6355 0.000 0.000 2106 2889 0.000 0.000 0.000
1 idx 5000 all 100 -1 835 18449 22425 32826 45265 0.000 0.000 13761 32778 0.099 0.000 0.000
1 idx 5000 all 1024 -1 849 17924 13812 32804 42208 0.000 0.000 13421 32778 0.097 0.000 0.000
1 idx 5000 mix 100 -1 1474 10462 11192 25826 32667 0.000 0.000 10899 21554 0.025 0.000 0.000
1 idx 5000 mix 1024 -1 1470 10612 11227 26240 32679 0.000 0.000 10926 21628 0.026 0.000 0.000
1 idx 5000 none 100 -1 1713 8883 10730 13938 13996 0.000 0.000 10421 13000 0.000 0.000 0.000
1 idx 5000 none 1024 -1 1685 9065 10878 13943 13999 0.000 0.000 10594 13533 0.000 0.000 0.000
2 idx 50 all 100 -1 3173 5010 4817 10548 18717 0.500 0.990 4146 9837 0.157 0.000 2.00
2 idx 50 all 1024 -1 3253 4881 4584 9844 13883 0.500 0.991 3990 9737 0.157 0.000 2.00
2 idx 50 mix 100 -1 9613 1632 530.9 6555 9705 0.501 0.992 326.0 6348 0.072 0.000 2.00
2 idx 50 mix 1024 -1 7238 2182 535.5 10814 13913 0.501 0.993 332.4 9763 0.072 0.000 2.00
2 idx 50 none 100 -1 73703 212.3 196.4 378.1 1054 0.501 0.992 152.7 372.7 0.000 0.000 0.000
2 idx 50 none 1024 -1 58770 233.9 219.8 759.8 2900 0.505 0.999 160.3 455.9 0.000 0.000 0.000
2 idx 200 all 100 -1 3007 5295 5069 11021 15756 0.500 0.991 4350 9876 0.157 0.000 2.00
2 idx 200 all 1024 -1 3507 4537 4482 8705 13672 0.500 0.991 3980 7920 0.157 0.000 2.00
2 idx 200 mix 100 -1 5592 2831 856.8 13065 20918 0.501 0.993 708.3 11987 0.071 0.000 2.00
2 idx 200 mix 1024 -1 5360 2944 863.0 13563 28000 0.501 0.993 720.6 12924 0.071 0.000 2.00
2 idx 200 none 100 -1 36498 435.4 371.1 860.0 1660 0.501 0.991 335.0 842.5 0.000 0.000 0.000
2 idx 200 none 1024 -1 35377 448.3 385.8 859.5 1900 0.501 0.991 339.0 845.5 0.000 0.000 0.000
2 idx 1000 all 100 -1 1823 8740 9873 13967 21764 0.500 0.991 8830 13928 0.157 0.000 2.00
2 idx 1000 all 1024 -1 1749 9091 9913 13974 21810 0.500 0.991 8879 13929 0.157 0.000 2.00
2 idx 1000 mix 100 -1 3677 4298 2723 16638 21509 0.504 0.998 2381 13766 0.071 0.000 2.00
2 idx 1000 mix 1024 -1 3615 4350 2742 17241 21887 0.506 5.06 2389 13746 0.071 0.000 2.00
2 idx 1000 none 100 -1 10378 1528 1285 2862 3136 0.502 0.995 1169 2837 0.000 0.000 0.000
2 idx 1000 none 1024 -1 10328 1538 1281 2865 3542 0.502 0.994 1168 2843 0.000 0.000 0.000
2 idx 5000 all 100 -1 527 30190 33019 49746 68939 0.500 0.991 29637 49610 0.157 0.000 2.00
2 idx 5000 all 1024 -1 524 30321 32999 49710 69078 0.500 0.991 29615 49566 0.157 0.000 2.00
2 idx 5000 mix 100 -1 985 16047 12484 55452 73373 0.541 296.0 11359 48332 0.072 0.000 2.00
2 idx 5000 mix 1024 -1 977 16107 12512 53021 73347 0.538 262.4 11407 48122 0.072 0.000 2.00
2 idx 5000 none 100 -1 2271 6987 6264 13715 13983 0.508 46.0 5811 12824 0.000 0.000 0.000
2 idx 5000 none 1024 -1 2236 7095 6344 13721 13989 0.508 53.5 5852 13541 0.000 0.000 0.000
4 idx 50 all 100 -1 3132 5052 4757 9900 19523 0.501 0.991 3436 9757 0.220 0.000 4.00
4 idx 50 all 1024 -1 2981 5328 5059 12450 19304 0.500 0.990 3752 10256 0.220 0.000 4.00
4 idx 50 mix 100 -1 5206 2994 362.7 16734 21957 0.513 15.5 209.2 13481 0.146 0.000 4.00
4 idx 50 mix 1024 -1 5116 3089 417.6 17175 21767 0.519 93.9 225.1 13734 0.147 0.000 4.00
4 idx 50 none 100 -1 75704 206.7 197.1 375.7 531.4 0.503 0.995 145.0 363.1 0.000 0.000 0.000
4 idx 50 none 1024 -1 72385 214.7 205.4 376.7 1335 0.504 0.997 147.2 366.4 0.000 0.000 0.000
4 idx 200 all 100 -1 2557 6199 6379 13396 21463 0.500 0.991 4657 12400 0.219 0.000 4.00
4 idx 200 all 1024 -1 2469 6413 6528 13829 21784 0.500 0.990 4721 12782 0.220 0.000 4.00
4 idx 200 mix 100 -1 4487 3493 781.0 19880 26685 0.515 14.2 371.2 17212 0.145 0.000 4.00
4 idx 200 mix 1024 -1 4341 3612 827.3 19957 26529 0.517 22.2 389.9 17764 0.145 0.000 4.00
4 idx 200 none 100 -1 35151 449.1 416.6 864.5 1796 0.505 0.999 323.2 815.6 0.000 0.000 0.000
4 idx 200 none 1024 -1 34343 461.6 431.4 866.4 3650 0.504 0.999 326.9 840.0 0.000 0.000 0.000
4 idx 1000 all 100 -1 1297 12186 12349 25183 33000 0.500 0.991 10115 21877 0.219 0.000 4.00
4 idx 1000 all 1024 -1 1264 12488 13023 25700 41225 0.500 0.990 10220 21925 0.219 0.000 4.00
4 idx 1000 mix 100 -1 2255 6946 2644 34819 49792 0.540 65.4 1266 30316 0.149 0.000 4.00
4 idx 1000 mix 1024 -1 2275 6908 2613 34590 55952 0.538 67.8 1270 30184 0.147 0.000 4.00
4 idx 1000 none 100 -1 9766 1627 1516 2875 3800 0.522 35.1 1138 2839 0.000 0.000 0.000
4 idx 1000 none 1024 -1 9644 1648 1559 2885 5866 0.523 66.5 1145 2851 0.000 0.000 0.000
4 idx 5000 all 100 -1 378 41788 40944 75336 107477 0.500 0.991 33643 73855 0.218 0.000 4.00
4 idx 5000 all 1024 -1 375 42333 41105 78277 108731 0.500 0.991 33890 74077 0.218 0.000 4.00
4 idx 5000 mix 100 -1 631 24937 12239 136600 197826 0.590 373.8 6387 102624 0.151 0.000 4.00
4 idx 5000 mix 1024 -1 626 24990 12237 129052 187297 0.584 369.4 6385 101482 0.152 0.000 4.00
4 idx 5000 none 100 -1 2085 7609 6598 13854 13990 0.550 292.9 5628 12498 0.000 0.000 0.000
4 idx 5000 none 1024 -1 2071 7654 6698 13858 13991 0.550 306.8 5648 12430 0.000 0.000 0.000
8 idx 50 all 100 -1 2129 7442 7339 21040 41904 0.500 0.990 3655 18016 0.329 0.000 8.00
8 idx 50 all 1024 -1 1991 7965 7726 20817 31412 0.500 0.990 3943 18174 0.330 0.000 8.00
8 idx 50 mix 100 -1 3202 4871 225.7 31709 47000 0.531 21.8 69.8 29138 0.260 0.000 8.00
8 idx 50 mix 1024 -1 3108 5067 233.7 32225 47820 0.531 27.8 74.5 30062 0.256 0.000 8.00
8 idx 50 none 100 -1 82431 188.7 178.4 372.4 501.7 0.512 5.47 116.1 327.5 0.000 0.000 0.000
8 idx 50 none 1024 -1 80988 195.0 185.6 374.4 568.9 0.513 6.83 117.6 343.0 0.000 0.000 0.000
8 idx 200 all 100 -1 1729 9168 9338 21970 32715 0.500 0.991 5025 20367 0.330 0.000 8.00
8 idx 200 all 1024 -1 1652 9603 9627 25015 34888 0.500 0.991 5143 20962 0.331 0.000 8.00
8 idx 200 mix 100 -1 2694 5791 445.2 39174 53125 0.534 26.0 151.0 31635 0.259 0.000 8.00
8 idx 200 mix 1024 -1 2614 5992 471.6 40379 49928 0.536 51.4 177.5 32085 0.256 0.000 8.00
8 idx 200 none 100 -1 37460 422.0 379.5 851.2 1062 0.523 13.5 272.6 728.2 0.000 0.000 0.000
8 idx 200 none 1024 -1 36931 426.4 393.3 851.3 869.3 0.522 12.4 271.5 741.5 0.000 0.000 0.000
8 idx 1000 all 100 -1 857 18445 17511 47477 73571 0.500 0.990 10538 42973 0.330 0.000 8.00
8 idx 1000 all 1024 -1 845 18738 17946 47829 72670 0.500 0.991 10756 42949 0.329 0.000 8.00
8 idx 1000 mix 100 -1 1402 11165 1741 74393 108959 0.585 93.4 312.5 60059 0.276 0.000 8.00
8 idx 1000 mix 1024 -1 1399 11114 1802 73761 109023 0.578 90.9 880.4 60966 0.270 0.000 8.00
8 idx 1000 mix 1024 7 661 23760 11139 166812 244581 0.732 9867 870.7 108682 0.295 0.000 8.00
8 idx 1000 none 100 -1 9843 1609 1451 2875 3650 0.598 98.5 994.0 2806 0.000 0.000 0.000
8 idx 1000 none 1024 -1 9552 1655 1523 3025 5377 0.603 414.8 991.9 2828 0.000 0.000 0.000
8 idx 5000 all 100 -1 250 63159 58084 159190 222173 0.500 0.990 35234 140991 0.330 0.000 8.00
8 idx 5000 all 1024 -1 247 63715 58555 161949 232028 0.500 0.991 35455 144577 0.331 0.000 8.00
8 idx 5000 mix 100 -1 410 38438 6810 289671 378652 0.643 494.2 889.1 197712 0.283 0.000 8.00
8 idx 5000 mix 1024 -1 412 38123 7160 254511 372618 0.641 486.1 1900 191509 0.282 0.000 8.00
8 idx 5000 none 100 -1 2075 7651 6478 13876 13991 0.658 395.1 4996 13349 0.000 0.000 0.000
8 idx 5000 none 1024 -1 2074 7648 6445 13878 13991 0.658 408.6 5002 11790 0.000 0.000 0.000
16 idx 50 all 100 -1 1491 10629 10610 31645 49569 0.500 0.990 1960 24014 0.484 0.000 16.0
16 idx 50 all 1024 -1 1437 11010 10980 31891 48539 0.500 0.991 1993 25956 0.484 0.000 16.0
16 idx 50 mix 100 -1 2130 7392 162.9 62961 78181 0.541 27.9 0.782 48548 0.405 0.000 16.0
16 idx 50 mix 1024 -1 2007 7818 164.6 65696 98068 0.540 32.0 0.780 49673 0.404 0.000 16.0
16 idx 50 none 100 -1 92287 169.7 159.3 366.9 379.8 0.527 11.3 44.4 249.1 0.000 0.000 0.000
16 idx 50 none 1024 -1 90571 173.0 160.6 368.9 379.7 0.530 12.1 45.3 285.3 0.000 0.000 0.000
16 idx 200 all 100 -1 1181 13431 13356 38860 63571 0.500 0.990 2991 30479 0.484 0.000 16.0
16 idx 200 all 1024 -1 949 16720 15013 72363 118108 0.500 0.990 3108 48272 0.486 0.000 16.0
16 idx 200 mix 100 -1 1778 8789 355.4 71340 105314 0.546 44.1 0.782 61541 0.409 0.000 16.0
16 idx 200 mix 1024 -1 1727 9101 356.4 72268 104615 0.544 39.9 0.787 65150 0.407 0.000 16.0
16 idx 200 none 100 -1 40927 385.7 353.6 837.2 869.8 0.551 19.1 85.8 573.0 0.000 0.000 0.000
16 idx 200 none 1024 -1 40675 389.0 355.3 840.6 870.0 0.545 15.7 88.9 578.4 0.000 0.000 0.000
16 idx 1000 all 100 -1 589 26867 26163 74241 108472 0.500 0.991 6078 64161 0.483 0.000 16.0
16 idx 1000 all 1024 -1 582 27175 26211 74011 131818 0.500 0.991 6756 63614 0.481 0.000 16.0
16 idx 1000 mix 100 -1 954 16309 1212 149831 231600 0.604 84.9 0.773 104478 0.439 0.000 16.0
16 idx 1000 mix 1024 -1 905 17307 1216 157617 238930 0.603 90.3 0.776 108960 0.438 0.000 16.0
16 idx 1000 none 100 -1 10625 1490 1224 2868 2900 0.693 78.3 170.1 2725 0.000 0.000 0.000
16 idx 1000 none 1024 -1 10610 1491 1226 2866 2898 0.689 75.0 166.4 2724 0.000 0.000 0.000
16 idx 5000 all 100 -1 171 92232 88833 246299 368560 0.500 0.990 22354 210692 0.482 0.000 16.0
16 idx 5000 all 1024 -1 169 93424 89851 246061 368288 0.500 0.990 22052 212761 0.485 0.000 16.0
16 idx 5000 mix 100 -1 278 55903 6118 533996 815050 0.660 517.5 0.751 348988 0.471 0.000 16.0
16 idx 5000 mix 1024 -1 279 55956 6123 533486 817263 0.655 508.0 0.757 350460 0.468 0.000 16.0
16 idx 5000 none 100 -1 2223 7125 6114 13834 13986 0.752 487.9 787.9 11836 0.000 0.000 0.000
16 idx 5000 none 1024 -1 2205 7131 6109 13839 13986 0.754 485.5 743.3 11352 0.000 0.000 0.000
Q3: D-G53 = (A) share of the tail (Recommended; the choice cell is blank). Metric is p99(`rocksdb.wal.durability.wait.micros`) / p99(write) at N=8 per (latency, sync) cell; the designated profile is append=1000us, mix, 1024B (mid-range networked-WAL latency, realistic sync ratio, KB-scale values, per the doc's own example). Number: 0.0012. Verdict: DOES NOT FIRE. The verdict is robust: every sync-containing cell at N=8 is at most 0.0019 (5000us mix), 50x below threshold, and all-sync cells round to 0.0000 (writes serialize through the barrier, so the gate never waits). The highest ratio anywhere is 0.1371 at (1000us, none, 1024B), a no-sync extreme where the denominator has no barrier (write p99 3.0ms) while the gate tail reaches 415us consistently across reps (281/415/531us); the 100B sibling is 0.034. That cell is reported, not the verdict: the trigger refers to the realistic sync mix, but the none-mode tail's value-size sensitivity is flagged for GC17.
## Abandon trigger (D-G53 (A)) at N=8
append_us sync size gate_p99_us write_p99_us ratio
50 all 100 0.990 21040 0.0000
50 all 1024 0.990 20817 0.0000
50 mix 100 21.8 31709 0.0007
50 mix 1024 27.8 32225 0.0009
50 none 100 5.47 372.4 0.0147
50 none 1024 6.83 374.4 0.0183
200 all 100 0.991 21970 0.0000
200 all 1024 0.991 25015 0.0000
200 mix 100 26.0 39174 0.0007
200 mix 1024 51.4 40379 0.0013
200 none 100 13.5 851.2 0.0159
200 none 1024 12.4 851.3 0.0146
1000 all 100 0.990 47477 0.0000
1000 all 1024 0.991 47829 0.0000
1000 mix 100 93.4 74393 0.0013
1000 mix 1024 90.9 73761 0.0012
1000 none 100 98.5 2875 0.0343
1000 none 1024 414.8 3025 0.1371
5000 all 100 0.990 159190 0.0000
5000 all 1024 0.991 161949 0.0000
5000 mix 100 494.2 289671 0.0017
5000 mix 1024 486.1 254511 0.0019
5000 none 100 395.1 13876 0.0285
5000 none 1024 408.6 13878 0.0294
TRIGGER: ratio 0.0012 at N=8 append=1000us sync=mix size=1024B does not fire (threshold 0.10)
Q4: `SyncWalAdvancesOtherPartitionsSyncedSize` syncs both partitions, writes nothing more, then a sync write on partition 0 must record sum 0 on `WAL_SYNC_UNSYNCED_PARTITIONS`. Neuter (drop the `note_synced` in the `wal.number > up_to` branch; dropping the whole branch would still advance via the active-WAL path): fails with sum 1. Existing `NonLeadershipSyncsAdvanceSyncedSize` passes unmodified.
Q5: `SyncWalClaimTimeHorizonExcludesCoupledRotation` holds a manual `SyncWAL` in its fsync loop with 100ms slow syncs, lands a coupled rotation inside (counter-observed, order proven by `DBImpl::SyncWAL:Begin` < switch < `DBImpl::SyncWAL:BeforeMarkLogsSynced:1`), writes into the rotated-in WALs, and requires a later sync write to count all 4 partitions unsynced, with marks clear and deques consistent. Neuter (finish-time horizon): aborts on `assert(wal.IsSyncing())` on the unmarked rotated-in WAL.
Q6: the oracle records per power-loss cycle whether an acknowledged write is absent after recovery, prints the count in the summary line, and `RecoveredStateIsPrefixOfHistory` fails when power-loss cycles ran but none lost a write (runs with zero power-loss cycles, i.e. single-cycle reruns of process-crash seeds, are exempt: nothing to prove). 1000-cycle run from this commit: pass, 313 of 528 power-loss cycles lost a write. Neuter (crash keeps unsynced data): 40-cycle run fails with "power loss lost an acknowledged write in 0".
Q7: `CrashMidRotationUnderSkewRecoversPrefix` now sets `SetInjectUnsyncedDataLoss(true)` before the open (files capture the flag at creation) and requires `missing_seen` past the last sync. Neuter (flag off again): fails on "the crash dropped no acknowledged write". Listed under Invariant 4 as the one modified test.
GC17 pointers (numbers only, no decisions): D-G11: mean unsynced partitions under the mix is 1.3-2.3 of 8 (well below N) and the barrier dominates sync-write p99 (barrier p99 102ms over 1321 sync groups vs write p99 74ms over 32k mixed writes at N=8/1000/mix/1024; different populations, noted). G-19a: writers/group p50 is 1-2.4 while join p99 reaches 350ms at N=16/mix (191.5ms is N=8/5000us/mix/1024B); the index-allocation mutex has no dedicated histogram, so the harness bounds group-formation queueing but does not isolate the allocator. muse #22: per-partition mutex waits are ~0 at all N (p99 1us); no contention signature that padding would relieve in these workloads. N-2-6: 0.27-0.48 fsyncs/write sit on the write path at N=8-16 sync workloads; a background fsync's prize is bounded by the barrier numbers above minus the all-mutex claim, which stays.
Fold-back split: Q1-Q3 (script + `--sync_write_one_in` + `--wal_slow_partition` in `tools/db_bench_tool.cc`) stays a standalone diff (new code; no D118371518 line touched; no D-G53 (B) bypass). Q4 test folds with GC15's `NonLeadershipSyncsAdvanceSyncedSize` (D123971668, or D123551605). Q5 test to GC15's standalone diff (needs the latency FS). Q6 (oracle drop count + failure) to GC15's standalone diff. Q7 (test change) to D123928339. No hunk is unplaceable at its target.
Assumptions: D-G53 blank, so Recommended (A) per AB section 4 rule 2. Trigger profile (1000us append, mix 1-in-20, 1024B) chosen per rule 5 (mid-range networked-WAL latency, realistic sync ratio, KB-scale values; every cell tabulated so the choice is auditable). Sync latency = append latency and jitter = append/10 per rule 5 (one profile knob; seeded jitter keeps reps reproducible). 64 fixed CFs per rule 5 (isolates N; coverage verified from per-WAL counters). Cells use default write buffers (single generation; rotation re-apply validated in a separate small-buffer pilot) per rule 5 (cleanest numbers). Q4 neuter removes the `note_synced` call rather than the whole branch per rule 5 (the literal branch drop still advances via the active path and would not fail). Q6 exempts runs with zero power-loss cycles per rule 5 (single-cycle reruns must stay green). Cap-hit rate is reported as mean excluded/group plus P99 (ToString exposes no non-zero fraction) per rule 5.
Not done: (empty).
M2 fold (2026-10-22, `M2-FoldTasks.md` + `M2-Amendment.md`): Absorbs (M2) GC10 Q8/Q9: `SlowWalPartitionFileSystem`, sweep comparisons, steady state, `--compare_to`, trigger table; GC07 Q9: sweep dedup and N=1 baselines. This diff now edits S-C's db_bench lines: it moves S-C's latency-FS install block below its own slow-partition validation.
Changes visible to existing users:
- db_bench gains --sync_write_one_in (default 0) and --wal_slow_partition (default -1).
- db_bench now exits with an error when --wal_append_bandwidth_mbps or --wal_sync_bandwidth_mbps is set without --inject_wal_latency or outside [0, 1e12].
- db_bench fill/write benchmarks copy WriteOptions once per batch.
- New script tools/partition_wal_sweep.py.
Test Plan:
- `buck2 test fbcode//internal_repo_rocksdb/repo:db_write_test fbcode//internal_repo_rocksdb/repo:latency_injection_fs_test`: 199 pass, 0 fail.
- `buck2 test fbcode//internal_repo_rocksdb/repo:db_wal_oracle_test` (40 cycles): 3 pass; drop count 13/17 power-loss cycles.
- 1000-cycle oracle run from this commit (`ROCKSDB_WAL_ORACLE_CYCLES=1000`): pass; 313 of 528 power-loss cycles lost a write; 2 known lower-bound holes (non-strict, expected). A pre-format run gave 310/528; the committed run above is the evidence.
- Q5+Q7 x100 repeats (`--gtest_repeat=100`): 100/100 iterations pass, 0 failures.
- Q5+Q7 under `@fbcode//mode/dev-tsan`: 4 pass, no TSan warnings.
- Q4 neuter (no `note_synced` past the horizon): `SyncWalAdvancesOtherPartitionsSyncedSize` fails with sum 1 (expected). Q5 neuter (finish-time horizon): aborts on `assert(wal.IsSyncing())` (expected). Q6 neuter (crash keeps unsynced data): 40-cycle run fails "no power-loss cycle lost an acknowledged write" with count 0 (expected). Q7 neuter (flag off): fails "the crash dropped no acknowledged write" (expected). All neuters reverted; `db_impl.cc` clean.
- Full matrix: 435/435 runs ok from this commit (opt `db_bench`); trigger verdict DOES NOT FIRE (0.0012 at N=8/1000us/mix/1024B; max 0.0019 on any sync-containing cell).
- Two `--quick` runs from this commit: 18/18 each; second run's medians within −8.3% write p99 / −21% gate p99 of the first at worst (7 of 18 narrowly outside the tight 3-rep min-max; worst -2.2%); tables in summary.
- N=1 byte-identity check (base vs this commit, `none` and `partition_by_column_family`): pass; hashes equal the documented values (`6d135111...` off, `9a69a3fc...` on).
- 180s `db_stress` blackbox crash test at N=1 with `partition_wal_usage` on: first run failed early (checkpoint "WAL index merge: WAL 3 unreadable" under injected read faults), retry passed ("Crash-recovery verification passed"). Engine code is untouched by this diff (benchmark tooling + tests only), so the intermittent failure is a pre-existing base finding, reported, not fixed.
- Pre-stack-base N=1 comparison at 217951834332: not run (needs a second opt build; covered by byte-identity plus N=1 indexed-vs-kNone instead).
- Repo-pinned clang-format clean on all touched C++ files; `arc lint -a` and the script's lint clean.
(M1 standalone carved from GC16 D126232422; that round diff is abandoned at M1.)
M1 re-verification (2026-10-20, after rebasing the stack onto master f0c3a35689fc and clang-formatting D117251769, D117251771, D123079329, D123551605):
- Per-diff gate, all 35 commits bottom-up: CI format check, `rocksdb_lib` build, every touched test target: all pass, 0 failures.
- Tip suites (23 targets): 8126 pass, 0 fail.
- N=1 byte identity at the tip: `6d135111...` (off) and `9a69a3fc...` (on), equal to T0.
- 180s blackbox crash test at N=1 with `partition_wal_usage=partition_by_column_family`: pass.
- Trigger rerun, opt `db_bench`, N=8/1000us/1024B, this harness: sync mix 0.0014 / 0.0013 / 0.0011 at 8 / 16 / 32 threads; all-async 0.026 / 0.025 / 0.018. Does not fire in either profile (the earlier 0.137 and dev-mode 0.108 readings do not reproduce in opt).
M2 fold: new or moved tests here: (none). B.1 at this diff (format check, `rocksdb_lib`, touched test targets): PASS; no test targets; `db_bench` and `db_stress` build; `partition_wal_sweep.py` compiles.
M3 B.1 at this diff (clang-format 21.1.2 on its changed lines, make check-sources, debug librocksdb build; no test file touched): PASS.
Note (2026-10-27): every number above predates GC17's sync-path change; see the first paragraph of the summary. The pre-stack-base comparison is still not run.
M5 fold: Absorbs 10 A.1 entries (GC28 5, GC27 1, GC29b 4): GC28 Q5 (b)/Q6: TRIGGER_THREAD_COUNTS, compute_trigger, --stats_level comments; GC27's zero guard; GC29b's docstrings and report heading. M5-F1 (A.8): F1.3: partition_wal_sweep.py's docstring placeholders.
M5 B.1: PASS (clang-format 21.1.2 on the changed lines, make check-sources, debug build of db_bench); no test binary touched.
M6 fold: Absorbs GC35 Q4: `tools/partition_wal_sweep.py` `--bandwidths-mbps` (cells, labels, parsing of `size_sleep_micros`, comparisons and trigger per bandwidth) and `db_bench` `--wal_slow_partition` taking a tenth of the WAL bandwidths.
M6 B.1: PASS (debug build of db_bench; no test binary touched).
Differential Revision: https://phabricator.intern.facebook.com/D126533195
JustinGaoF
added a commit
that referenced
this pull request
Nov 19, 2026
Summary:
**Measured before GC17.** Every number in this summary and its test plan was measured on the code before GC17 changed the N>1 sync path. Since GC17, a sync write fsyncs from its completion gate, and concurrent gate syncs coalesce; that change is folded into D123551605. The tables below describe the earlier code, not the current stack.
GC17's own paired, interleaved run (this harness; N=8, 1000 us injected append and sync latency, sync mix 1 in 20, 1 KB values; 3 rounds, base then GC17) measured these N=8 mixed-sync ranges:
| threads | ops/s, before GC17 | ops/s, after GC17 |
|---|---|---|
| 8 | 920–1004 | 2136–2198 |
| 16 | 970–1216 | 3054–3535 |
| 32 | 1458–1514 | 5454–5685 |
The same N=8 cell at 16 threads reads 1399 ops/s in the table below, from a different run. In GC17's run, async-only cells were unchanged within run-to-run noise.
Mixed-sync throughput at N>1 is still below N=1. This summary's N=1 kNone figure for the same profile is 5658 ops/s at 16 threads, against 3054–3535 for N=8 after GC17. The two come from different runs, so the size of the gap is not established. A same-run N=1 vs N>1 comparison under mixed sync is pending, on the final code.
`compute_trigger` in `tools/partition_wal_sweep.py` unpacks each cell's thread count into `cell_threads` and matches it against the requested `threads` (TRIGGER_THREAD_COUNTS is 8, 16, 32), so a narrowed grid reports the verdict of the requested thread count. Verdicts from runs before the M5 fold used the earlier version, which could compare against the last cell's thread count.
M1 standalone S-D (from GC16 Q1-Q3): reproducible WAL partition sweep harness (`tools/partition_wal_sweep.py`) plus `db_bench --sync_write_one_in` and `--wal_slow_partition`. Carved from GC16 D126232422, which is abandoned at M1.
At-M1 corrections to the GC16 summary below (applied inline): (1) reproducibility: the second `--quick` run's medians moved up to -8.3% (write p99) and -21% (gate p99) from the first, not "~2% on every median"; (2) the N=1 to N=16 async gain at 50us for 1024B values is +92% (47075 to 90571 ops/s); +77% is the 100B row; (3) join p99 at N=16/mix reaches 350ms; the 192ms figure was N=8/5000us/mix/1024B.
[GC] GC16: the N sweep and the abandon trigger, measured reproducibly (G-53). Benchmark tooling only: a checked-in sweep script plus two new `db_bench` flags, with the Tasks:975 abandon trigger evaluated under D-G53 (A). Also closes the GC15 carry-over: G-50 evidence for the multi-partition `synced_size` advance (Q4), a regression test for GC03's claim-time `SyncWAL` horizon (Q5), proof that the oracle's crashes lose data (G-54, Q6), and the `CrashMidRotationUnderSkewRecoversPrefix` drop fix (N-7-4, Q7). Q4's test idea, Q5's test, Q6's drop check and the Q7 finding are ported from D126193958 (MuseCode) as the requirement allows; its oracle, hooks, `SyncWalImpl` advance, latency FileSystem, per-WAL flag and Q8 labelling are not.
Reviewer question: Can anyone rerun this sweep and get the same picture, and does the watermark wait trip the abandon trigger at N=8? Anyone can: one command reproduces the 435-run matrix below (plus `--quick` in ~100s), and a second `--quick` run matches the first within −8.3% write p99 / −21% gate p99 at worst (see header). The trigger does not fire: 0.0012 at the designated N=8 profile, 50x below the 0.10 threshold on every sync-containing cell.
Q1: `tools/partition_wal_sweep.py` takes a `db_bench` binary and an output directory and runs the Q2 matrix with 3 reps per cell, emitting `results.json` (one row per rep: config, rep index, seed, throughput, p50/p99/p99.9 write latency, every Q2 histogram, FS counters; plus median/min-max aggregates), `results.md` (human table), per-cell command lines and raw logs, and the environment (host, CPUs, storage, opt build mode, commit hash, FS wait mode and concurrency cap). Injected and uninjected cells render in separate tables and the trigger refuses uninjected input. Reproducibility: two `--quick` runs from this commit (18 runs each, tables below) agree within −8.3% write p99 / −21% gate p99 at worst; strict min-max containment fails narrowly on 7 of 18 checked medians (worst -2.2%) because 3-rep spreads are extremely tight, and with n=3 a fresh median lands outside the previous min-max half the time by chance alone, so the small relative deviation, not strict containment, is the reproducibility evidence.
First `--quick` table (medians; commit 9c7f9a9b5188, opt, 166x AMD EPYC-Genoa):
## Injected cells (median across reps)
N usage append_us sync size slow ops/s us/op wr_p50 wr_p99 wr_p99.9 gate_p50 gate_p99 join_p50 join_p99 fsync/wr cap_med fanout_med
1 knone 500 mix 100 -1 9213 1707 1660 4309 6014 0.000 0.000 1291 4254 0.024 0.000 0.000
1 knone 500 none 100 -1 13884 1118 1321 1895 2886 0.000 0.000 989.5 1874 0.000 0.000 0.000
1 idx 500 mix 100 -1 9126 1713 1644 4300 6172 0.000 0.000 1292 4250 0.024 0.000 0.000
1 idx 500 none 100 -1 13908 1114 1318 1890 3625 0.000 0.000 987.3 1869 0.000 0.000 0.000
8 idx 500 mix 100 -1 2024 7721 867.9 49064 74742 0.553 43.9 269.3 44354 0.267 0.000 8.00
8 idx 500 none 100 -1 18247 866.2 820.4 1415 2716 0.558 41.8 597.6 1271 0.000 0.000 0.000
Second --quick table (medians):
## Injected cells (median across reps)
N usage append_us sync size slow ops/s us/op wr_p50 wr_p99 wr_p99.9 gate_p50 gate_p99 join_p50 join_p99 fsync/wr cap_med fanout_med
1 knone 500 mix 100 -1 9013 1729 1670 4323 6485 0.000 0.000 1306 4270 0.025 0.000 0.000
1 knone 500 none 100 -1 13746 1118 1314 1890 2770 0.000 0.000 994.9 1868 0.000 0.000 0.000
1 idx 500 mix 100 -1 8815 1796 1675 4393 8014 0.000 0.000 1333 4335 0.025 0.000 0.000
1 idx 500 none 100 -1 13938 1120 1322 1891 2668 0.000 0.000 993.4 1871 0.000 0.000 0.000
8 idx 500 mix 100 -1 2013 7755 867.4 49739 77800 0.554 44.0 309.6 44902 0.265 0.000 8.00
8 idx 500 none 100 -1 17845 864.9 818.0 1298 1882 0.555 33.0 588.7 1267 0.000 0.000 0.000
Q2: matrix is N in {1 kNone, 1 indexed, 2, 4, 8, 16} x append latency {50, 200, 1000, 5000}us (sync = append, jitter = append/10, seeded per rep) x sync {none, mix 1-in-20 via `--sync_write_one_in`, all} x value sizes {100, 1024} x 3 reps, 32k writes per cell on 64 CFs fixed across N (per-WAL counters verify every partition is covered in every N>1 cell; 8 CFs covered only 6/8 partitions in a pilot, hence 64), plus the N=8 one-slow-partition cell (`--wal_slow_partition=7`, 10x, mirroring the trigger profile). Steady state is inherent (WAL append cost is constant; the benchmark loop excludes open/CF setup) and confirmed by tight 3-rep spreads (e.g., trigger cell ops/s 1385-1417). New code only: the two flags live next to GC15's latency flags; no D118371518 line is touched. Cells use default write buffers (single generation; the slow override's rotation re-apply is validated in a separate small-buffer pilot where a stability check keeps mid-rotation tails from being misread as generations). Readings, one per bullet: baseline: N=1 indexed is within ~5% of kNone on every cell (e.g., 1000/mix/1024: 5376 vs 5658 ops/s) and byte-identical per the check below, so the stack costs ~nothing at N=1 (pre-stack-base comparison at 217951834332: not run, needs a second opt build; covered by byte-identity plus indexed-vs-kNone instead). N/BDP sweep: partitioning helps async writes at every latency (none/1024B N=1 to N=16: +92% at 50us (1024B: 47075 to 90571 ops/s; +77% is the 100B row), +40% at 1000us, +34% at 5000us) and hurts sync-containing ones (mix/1024B at 1000us: 5658 to 905 ops/s, -84%; all: 2874 to 582, -80%), driven by sync fan-out, not the gate. Cap-hit rate at N=8: `cap_excluded` sum is 0 in every cell over 10k-20k groups each, so the group cap never binds at N>1 here (M0.4: no). Join-wait vs watermark-wait: join p99 exceeds gate p99 by 7x (none) to 650x (mix) at N=8 (mix/1000/1024: 61ms vs 0.09ms); queueing dwarfs the watermark wait in every cell. Sync barrier: fan-out median is exactly N; barrier p50/p99 at N=8/1000/1024 is 21/49ms (all) and 36/102ms (mix); fsyncs/write is 0.33 (all) and 0.27 (mix), rising to 0.48/0.44 at N=16. One slow partition: throughput -53% (1399 to 661 ops/s), write p99 +126% (74 to 167ms), gate p99 x108 (91us to 9868us); the straggler cost lands almost entirely in the gate wait. Contention at N=8: the single-partition WAL mutex is uncontended (p99 1us); the all-partition mutex is taken per sync write (21k takes at all, p99 4.3ms; 2.8k takes at mix, p99 21.6ms) while async barely takes it (9 takes), so cross-partition serialization is the sync path's lock cost. Highlight (1000us, mix, 1024B medians): N=1 kNone 5658 ops/s wr_p99 6497us; N=1 idx 5376/6570; N=2 3615/17241; N=4 2275/34590; N=8 1399/73761 gate_p99 90.9us; N=8 slow 661/166813 gate_p99 9868us; N=16 905/157617. Full 145-row table (medians; commit 9c7f9a9b5188, opt, 166x AMD EPYC-Genoa):
## Injected cells (median across reps)
N usage append_us sync size slow ops/s us/op wr_p50 wr_p99 wr_p99.9 gate_p50 gate_p99 join_p50 join_p99 fsync/wr cap_med fanout_med
1 knone 50 all 100 -1 6955 2144 1837 4392 9100 0.000 0.000 1768 4346 0.092 0.000 0.000
1 knone 50 all 1024 -1 6764 2246 1870 4384 8360 0.000 0.000 1803 4364 0.094 0.000 0.000
1 knone 50 mix 100 -1 19060 827.4 369.9 2867 4317 0.000 0.000 331.3 2710 0.025 0.000 0.000
1 knone 50 mix 1024 -1 18416 851.3 467.6 2749 4569 0.000 0.000 340.8 2623 0.025 0.000 0.000
1 knone 50 none 100 -1 52029 298.1 289.4 547.9 784.1 0.000 0.000 278.6 378.5 0.000 0.000 0.000
1 knone 50 none 1024 -1 47075 328.7 304.2 799.5 2900 0.000 0.000 276.9 532.3 0.000 0.000 0.000
1 knone 200 all 100 -1 5864 2555 2127 5104 11634 0.000 0.000 1842 4392 0.095 0.000 0.000
1 knone 200 all 1024 -1 5186 2936 2819 6054 11152 0.000 0.000 2396 5488 0.099 0.000 0.000
1 knone 200 mix 100 -1 13826 1133 783.6 2895 5909 0.000 0.000 751.0 2865 0.025 0.000 0.000
1 knone 200 mix 1024 -1 13194 1195 793.7 3448 7385 0.000 0.000 752.8 2879 0.025 0.000 0.000
1 knone 200 none 100 -1 26404 578.7 660.0 868.5 1621 0.000 0.000 638.1 865.8 0.000 0.000 0.000
1 knone 200 none 1024 -1 25858 598.2 655.7 970.0 1732 0.000 0.000 634.7 866.4 0.000 0.000 0.000
1 knone 1000 all 100 -1 2954 5049 4184 9834 12417 0.000 0.000 4060 9817 0.094 0.000 0.000
1 knone 1000 all 1024 -1 2874 5215 4239 9844 13632 0.000 0.000 4110 9831 0.095 0.000 0.000
1 knone 1000 mix 100 -1 5633 2723 2565 6513 9417 0.000 0.000 2453 6414 0.025 0.000 0.000
1 knone 1000 mix 1024 -1 5658 2760 2569 6497 9424 0.000 0.000 2459 6410 0.025 0.000 0.000
1 knone 1000 none 100 -1 7702 1997 2146 2887 3828 0.000 0.000 2079 2884 0.000 0.000 0.000
1 knone 1000 none 1024 -1 7588 2026 2139 2887 3511 0.000 0.000 2070 2883 0.000 0.000 0.000
1 knone 5000 all 100 -1 857 17711 13717 32780 45952 0.000 0.000 13352 32746 0.096 0.000 0.000
1 knone 5000 all 1024 -1 843 17630 13599 32787 44333 0.000 0.000 13243 32759 0.097 0.000 0.000
1 knone 5000 mix 100 -1 1441 10811 11403 27626 34000 0.000 0.000 11105 21824 0.026 0.000 0.000
1 knone 5000 mix 1024 -1 1393 11108 11556 28820 48827 0.000 0.000 11254 21991 0.027 0.000 0.000
1 knone 5000 none 100 -1 1636 9191 11013 13943 13996 0.000 0.000 10747 13166 0.000 0.000 0.000
1 knone 5000 none 1024 -1 1646 9117 10908 13941 13996 0.000 0.000 10626 12602 0.000 0.000 0.000
1 idx 50 all 100 -1 7064 2168 1846 4374 7920 0.000 0.000 1782 4350 0.092 0.000 0.000
1 idx 50 all 1024 -1 6825 2220 1869 4366 6578 0.000 0.000 1804 4344 0.094 0.000 0.000
1 idx 50 mix 100 -1 19277 816.4 373.6 2656 4279 0.000 0.000 336.5 2514 0.026 0.000 0.000
1 idx 50 mix 1024 -1 18639 843.4 484.9 2757 4203 0.000 0.000 344.4 2595 0.025 0.000 0.000
1 idx 50 none 100 -1 51514 301.2 291.4 566.0 937.9 0.000 0.000 277.6 379.2 0.000 0.000 0.000
1 idx 50 none 1024 -1 49359 316.1 301.8 574.3 1231 0.000 0.000 275.8 490.9 0.000 0.000 0.000
1 idx 200 all 100 -1 5825 2596 2343 4840 8014 0.000 0.000 1870 4387 0.095 0.000 0.000
1 idx 200 all 1024 -1 5410 2795 2747 6311 8910 0.000 0.000 2441 6185 0.097 0.000 0.000
1 idx 200 mix 100 -1 13807 1135 780.7 2881 4569 0.000 0.000 754.3 2862 0.025 0.000 0.000
1 idx 200 mix 1024 -1 13350 1182 784.4 3069 5700 0.000 0.000 755.6 2874 0.025 0.000 0.000
1 idx 200 none 100 -1 26815 582.8 659.9 968.4 2900 0.000 0.000 637.3 866.9 0.000 0.000 0.000
1 idx 200 none 1024 -1 24464 637.1 667.5 1686 3922 0.000 0.000 638.3 869.8 0.000 0.000 0.000
1 idx 1000 all 100 -1 2799 5308 4213 11187 20780 0.000 0.000 4079 10327 0.095 0.000 0.000
1 idx 1000 all 1024 -1 2767 5391 4326 9893 13819 0.000 0.000 4175 9867 0.097 0.000 0.000
1 idx 1000 mix 100 -1 5465 2811 2571 6542 9845 0.000 0.000 2439 6451 0.026 0.000 0.000
1 idx 1000 mix 1024 -1 5376 2804 2564 6570 11266 0.000 0.000 2430 6459 0.026 0.000 0.000
1 idx 1000 none 100 -1 7531 2009 2141 2890 4266 0.000 0.000 2070 2884 0.000 0.000 0.000
1 idx 1000 none 1024 -1 7275 2080 2175 3272 6355 0.000 0.000 2106 2889 0.000 0.000 0.000
1 idx 5000 all 100 -1 835 18449 22425 32826 45265 0.000 0.000 13761 32778 0.099 0.000 0.000
1 idx 5000 all 1024 -1 849 17924 13812 32804 42208 0.000 0.000 13421 32778 0.097 0.000 0.000
1 idx 5000 mix 100 -1 1474 10462 11192 25826 32667 0.000 0.000 10899 21554 0.025 0.000 0.000
1 idx 5000 mix 1024 -1 1470 10612 11227 26240 32679 0.000 0.000 10926 21628 0.026 0.000 0.000
1 idx 5000 none 100 -1 1713 8883 10730 13938 13996 0.000 0.000 10421 13000 0.000 0.000 0.000
1 idx 5000 none 1024 -1 1685 9065 10878 13943 13999 0.000 0.000 10594 13533 0.000 0.000 0.000
2 idx 50 all 100 -1 3173 5010 4817 10548 18717 0.500 0.990 4146 9837 0.157 0.000 2.00
2 idx 50 all 1024 -1 3253 4881 4584 9844 13883 0.500 0.991 3990 9737 0.157 0.000 2.00
2 idx 50 mix 100 -1 9613 1632 530.9 6555 9705 0.501 0.992 326.0 6348 0.072 0.000 2.00
2 idx 50 mix 1024 -1 7238 2182 535.5 10814 13913 0.501 0.993 332.4 9763 0.072 0.000 2.00
2 idx 50 none 100 -1 73703 212.3 196.4 378.1 1054 0.501 0.992 152.7 372.7 0.000 0.000 0.000
2 idx 50 none 1024 -1 58770 233.9 219.8 759.8 2900 0.505 0.999 160.3 455.9 0.000 0.000 0.000
2 idx 200 all 100 -1 3007 5295 5069 11021 15756 0.500 0.991 4350 9876 0.157 0.000 2.00
2 idx 200 all 1024 -1 3507 4537 4482 8705 13672 0.500 0.991 3980 7920 0.157 0.000 2.00
2 idx 200 mix 100 -1 5592 2831 856.8 13065 20918 0.501 0.993 708.3 11987 0.071 0.000 2.00
2 idx 200 mix 1024 -1 5360 2944 863.0 13563 28000 0.501 0.993 720.6 12924 0.071 0.000 2.00
2 idx 200 none 100 -1 36498 435.4 371.1 860.0 1660 0.501 0.991 335.0 842.5 0.000 0.000 0.000
2 idx 200 none 1024 -1 35377 448.3 385.8 859.5 1900 0.501 0.991 339.0 845.5 0.000 0.000 0.000
2 idx 1000 all 100 -1 1823 8740 9873 13967 21764 0.500 0.991 8830 13928 0.157 0.000 2.00
2 idx 1000 all 1024 -1 1749 9091 9913 13974 21810 0.500 0.991 8879 13929 0.157 0.000 2.00
2 idx 1000 mix 100 -1 3677 4298 2723 16638 21509 0.504 0.998 2381 13766 0.071 0.000 2.00
2 idx 1000 mix 1024 -1 3615 4350 2742 17241 21887 0.506 5.06 2389 13746 0.071 0.000 2.00
2 idx 1000 none 100 -1 10378 1528 1285 2862 3136 0.502 0.995 1169 2837 0.000 0.000 0.000
2 idx 1000 none 1024 -1 10328 1538 1281 2865 3542 0.502 0.994 1168 2843 0.000 0.000 0.000
2 idx 5000 all 100 -1 527 30190 33019 49746 68939 0.500 0.991 29637 49610 0.157 0.000 2.00
2 idx 5000 all 1024 -1 524 30321 32999 49710 69078 0.500 0.991 29615 49566 0.157 0.000 2.00
2 idx 5000 mix 100 -1 985 16047 12484 55452 73373 0.541 296.0 11359 48332 0.072 0.000 2.00
2 idx 5000 mix 1024 -1 977 16107 12512 53021 73347 0.538 262.4 11407 48122 0.072 0.000 2.00
2 idx 5000 none 100 -1 2271 6987 6264 13715 13983 0.508 46.0 5811 12824 0.000 0.000 0.000
2 idx 5000 none 1024 -1 2236 7095 6344 13721 13989 0.508 53.5 5852 13541 0.000 0.000 0.000
4 idx 50 all 100 -1 3132 5052 4757 9900 19523 0.501 0.991 3436 9757 0.220 0.000 4.00
4 idx 50 all 1024 -1 2981 5328 5059 12450 19304 0.500 0.990 3752 10256 0.220 0.000 4.00
4 idx 50 mix 100 -1 5206 2994 362.7 16734 21957 0.513 15.5 209.2 13481 0.146 0.000 4.00
4 idx 50 mix 1024 -1 5116 3089 417.6 17175 21767 0.519 93.9 225.1 13734 0.147 0.000 4.00
4 idx 50 none 100 -1 75704 206.7 197.1 375.7 531.4 0.503 0.995 145.0 363.1 0.000 0.000 0.000
4 idx 50 none 1024 -1 72385 214.7 205.4 376.7 1335 0.504 0.997 147.2 366.4 0.000 0.000 0.000
4 idx 200 all 100 -1 2557 6199 6379 13396 21463 0.500 0.991 4657 12400 0.219 0.000 4.00
4 idx 200 all 1024 -1 2469 6413 6528 13829 21784 0.500 0.990 4721 12782 0.220 0.000 4.00
4 idx 200 mix 100 -1 4487 3493 781.0 19880 26685 0.515 14.2 371.2 17212 0.145 0.000 4.00
4 idx 200 mix 1024 -1 4341 3612 827.3 19957 26529 0.517 22.2 389.9 17764 0.145 0.000 4.00
4 idx 200 none 100 -1 35151 449.1 416.6 864.5 1796 0.505 0.999 323.2 815.6 0.000 0.000 0.000
4 idx 200 none 1024 -1 34343 461.6 431.4 866.4 3650 0.504 0.999 326.9 840.0 0.000 0.000 0.000
4 idx 1000 all 100 -1 1297 12186 12349 25183 33000 0.500 0.991 10115 21877 0.219 0.000 4.00
4 idx 1000 all 1024 -1 1264 12488 13023 25700 41225 0.500 0.990 10220 21925 0.219 0.000 4.00
4 idx 1000 mix 100 -1 2255 6946 2644 34819 49792 0.540 65.4 1266 30316 0.149 0.000 4.00
4 idx 1000 mix 1024 -1 2275 6908 2613 34590 55952 0.538 67.8 1270 30184 0.147 0.000 4.00
4 idx 1000 none 100 -1 9766 1627 1516 2875 3800 0.522 35.1 1138 2839 0.000 0.000 0.000
4 idx 1000 none 1024 -1 9644 1648 1559 2885 5866 0.523 66.5 1145 2851 0.000 0.000 0.000
4 idx 5000 all 100 -1 378 41788 40944 75336 107477 0.500 0.991 33643 73855 0.218 0.000 4.00
4 idx 5000 all 1024 -1 375 42333 41105 78277 108731 0.500 0.991 33890 74077 0.218 0.000 4.00
4 idx 5000 mix 100 -1 631 24937 12239 136600 197826 0.590 373.8 6387 102624 0.151 0.000 4.00
4 idx 5000 mix 1024 -1 626 24990 12237 129052 187297 0.584 369.4 6385 101482 0.152 0.000 4.00
4 idx 5000 none 100 -1 2085 7609 6598 13854 13990 0.550 292.9 5628 12498 0.000 0.000 0.000
4 idx 5000 none 1024 -1 2071 7654 6698 13858 13991 0.550 306.8 5648 12430 0.000 0.000 0.000
8 idx 50 all 100 -1 2129 7442 7339 21040 41904 0.500 0.990 3655 18016 0.329 0.000 8.00
8 idx 50 all 1024 -1 1991 7965 7726 20817 31412 0.500 0.990 3943 18174 0.330 0.000 8.00
8 idx 50 mix 100 -1 3202 4871 225.7 31709 47000 0.531 21.8 69.8 29138 0.260 0.000 8.00
8 idx 50 mix 1024 -1 3108 5067 233.7 32225 47820 0.531 27.8 74.5 30062 0.256 0.000 8.00
8 idx 50 none 100 -1 82431 188.7 178.4 372.4 501.7 0.512 5.47 116.1 327.5 0.000 0.000 0.000
8 idx 50 none 1024 -1 80988 195.0 185.6 374.4 568.9 0.513 6.83 117.6 343.0 0.000 0.000 0.000
8 idx 200 all 100 -1 1729 9168 9338 21970 32715 0.500 0.991 5025 20367 0.330 0.000 8.00
8 idx 200 all 1024 -1 1652 9603 9627 25015 34888 0.500 0.991 5143 20962 0.331 0.000 8.00
8 idx 200 mix 100 -1 2694 5791 445.2 39174 53125 0.534 26.0 151.0 31635 0.259 0.000 8.00
8 idx 200 mix 1024 -1 2614 5992 471.6 40379 49928 0.536 51.4 177.5 32085 0.256 0.000 8.00
8 idx 200 none 100 -1 37460 422.0 379.5 851.2 1062 0.523 13.5 272.6 728.2 0.000 0.000 0.000
8 idx 200 none 1024 -1 36931 426.4 393.3 851.3 869.3 0.522 12.4 271.5 741.5 0.000 0.000 0.000
8 idx 1000 all 100 -1 857 18445 17511 47477 73571 0.500 0.990 10538 42973 0.330 0.000 8.00
8 idx 1000 all 1024 -1 845 18738 17946 47829 72670 0.500 0.991 10756 42949 0.329 0.000 8.00
8 idx 1000 mix 100 -1 1402 11165 1741 74393 108959 0.585 93.4 312.5 60059 0.276 0.000 8.00
8 idx 1000 mix 1024 -1 1399 11114 1802 73761 109023 0.578 90.9 880.4 60966 0.270 0.000 8.00
8 idx 1000 mix 1024 7 661 23760 11139 166812 244581 0.732 9867 870.7 108682 0.295 0.000 8.00
8 idx 1000 none 100 -1 9843 1609 1451 2875 3650 0.598 98.5 994.0 2806 0.000 0.000 0.000
8 idx 1000 none 1024 -1 9552 1655 1523 3025 5377 0.603 414.8 991.9 2828 0.000 0.000 0.000
8 idx 5000 all 100 -1 250 63159 58084 159190 222173 0.500 0.990 35234 140991 0.330 0.000 8.00
8 idx 5000 all 1024 -1 247 63715 58555 161949 232028 0.500 0.991 35455 144577 0.331 0.000 8.00
8 idx 5000 mix 100 -1 410 38438 6810 289671 378652 0.643 494.2 889.1 197712 0.283 0.000 8.00
8 idx 5000 mix 1024 -1 412 38123 7160 254511 372618 0.641 486.1 1900 191509 0.282 0.000 8.00
8 idx 5000 none 100 -1 2075 7651 6478 13876 13991 0.658 395.1 4996 13349 0.000 0.000 0.000
8 idx 5000 none 1024 -1 2074 7648 6445 13878 13991 0.658 408.6 5002 11790 0.000 0.000 0.000
16 idx 50 all 100 -1 1491 10629 10610 31645 49569 0.500 0.990 1960 24014 0.484 0.000 16.0
16 idx 50 all 1024 -1 1437 11010 10980 31891 48539 0.500 0.991 1993 25956 0.484 0.000 16.0
16 idx 50 mix 100 -1 2130 7392 162.9 62961 78181 0.541 27.9 0.782 48548 0.405 0.000 16.0
16 idx 50 mix 1024 -1 2007 7818 164.6 65696 98068 0.540 32.0 0.780 49673 0.404 0.000 16.0
16 idx 50 none 100 -1 92287 169.7 159.3 366.9 379.8 0.527 11.3 44.4 249.1 0.000 0.000 0.000
16 idx 50 none 1024 -1 90571 173.0 160.6 368.9 379.7 0.530 12.1 45.3 285.3 0.000 0.000 0.000
16 idx 200 all 100 -1 1181 13431 13356 38860 63571 0.500 0.990 2991 30479 0.484 0.000 16.0
16 idx 200 all 1024 -1 949 16720 15013 72363 118108 0.500 0.990 3108 48272 0.486 0.000 16.0
16 idx 200 mix 100 -1 1778 8789 355.4 71340 105314 0.546 44.1 0.782 61541 0.409 0.000 16.0
16 idx 200 mix 1024 -1 1727 9101 356.4 72268 104615 0.544 39.9 0.787 65150 0.407 0.000 16.0
16 idx 200 none 100 -1 40927 385.7 353.6 837.2 869.8 0.551 19.1 85.8 573.0 0.000 0.000 0.000
16 idx 200 none 1024 -1 40675 389.0 355.3 840.6 870.0 0.545 15.7 88.9 578.4 0.000 0.000 0.000
16 idx 1000 all 100 -1 589 26867 26163 74241 108472 0.500 0.991 6078 64161 0.483 0.000 16.0
16 idx 1000 all 1024 -1 582 27175 26211 74011 131818 0.500 0.991 6756 63614 0.481 0.000 16.0
16 idx 1000 mix 100 -1 954 16309 1212 149831 231600 0.604 84.9 0.773 104478 0.439 0.000 16.0
16 idx 1000 mix 1024 -1 905 17307 1216 157617 238930 0.603 90.3 0.776 108960 0.438 0.000 16.0
16 idx 1000 none 100 -1 10625 1490 1224 2868 2900 0.693 78.3 170.1 2725 0.000 0.000 0.000
16 idx 1000 none 1024 -1 10610 1491 1226 2866 2898 0.689 75.0 166.4 2724 0.000 0.000 0.000
16 idx 5000 all 100 -1 171 92232 88833 246299 368560 0.500 0.990 22354 210692 0.482 0.000 16.0
16 idx 5000 all 1024 -1 169 93424 89851 246061 368288 0.500 0.990 22052 212761 0.485 0.000 16.0
16 idx 5000 mix 100 -1 278 55903 6118 533996 815050 0.660 517.5 0.751 348988 0.471 0.000 16.0
16 idx 5000 mix 1024 -1 279 55956 6123 533486 817263 0.655 508.0 0.757 350460 0.468 0.000 16.0
16 idx 5000 none 100 -1 2223 7125 6114 13834 13986 0.752 487.9 787.9 11836 0.000 0.000 0.000
16 idx 5000 none 1024 -1 2205 7131 6109 13839 13986 0.754 485.5 743.3 11352 0.000 0.000 0.000
Q3: D-G53 = (A) share of the tail (Recommended; the choice cell is blank). Metric is p99(`rocksdb.wal.durability.wait.micros`) / p99(write) at N=8 per (latency, sync) cell; the designated profile is append=1000us, mix, 1024B (mid-range networked-WAL latency, realistic sync ratio, KB-scale values, per the doc's own example). Number: 0.0012. Verdict: DOES NOT FIRE. The verdict is robust: every sync-containing cell at N=8 is at most 0.0019 (5000us mix), 50x below threshold, and all-sync cells round to 0.0000 (writes serialize through the barrier, so the gate never waits). The highest ratio anywhere is 0.1371 at (1000us, none, 1024B), a no-sync extreme where the denominator has no barrier (write p99 3.0ms) while the gate tail reaches 415us consistently across reps (281/415/531us); the 100B sibling is 0.034. That cell is reported, not the verdict: the trigger refers to the realistic sync mix, but the none-mode tail's value-size sensitivity is flagged for GC17.
## Abandon trigger (D-G53 (A)) at N=8
append_us sync size gate_p99_us write_p99_us ratio
50 all 100 0.990 21040 0.0000
50 all 1024 0.990 20817 0.0000
50 mix 100 21.8 31709 0.0007
50 mix 1024 27.8 32225 0.0009
50 none 100 5.47 372.4 0.0147
50 none 1024 6.83 374.4 0.0183
200 all 100 0.991 21970 0.0000
200 all 1024 0.991 25015 0.0000
200 mix 100 26.0 39174 0.0007
200 mix 1024 51.4 40379 0.0013
200 none 100 13.5 851.2 0.0159
200 none 1024 12.4 851.3 0.0146
1000 all 100 0.990 47477 0.0000
1000 all 1024 0.991 47829 0.0000
1000 mix 100 93.4 74393 0.0013
1000 mix 1024 90.9 73761 0.0012
1000 none 100 98.5 2875 0.0343
1000 none 1024 414.8 3025 0.1371
5000 all 100 0.990 159190 0.0000
5000 all 1024 0.991 161949 0.0000
5000 mix 100 494.2 289671 0.0017
5000 mix 1024 486.1 254511 0.0019
5000 none 100 395.1 13876 0.0285
5000 none 1024 408.6 13878 0.0294
TRIGGER: ratio 0.0012 at N=8 append=1000us sync=mix size=1024B does not fire (threshold 0.10)
Q4: `SyncWalAdvancesOtherPartitionsSyncedSize` syncs both partitions, writes nothing more, then a sync write on partition 0 must record sum 0 on `WAL_SYNC_UNSYNCED_PARTITIONS`. Neuter (drop the `note_synced` in the `wal.number > up_to` branch; dropping the whole branch would still advance via the active-WAL path): fails with sum 1. Existing `NonLeadershipSyncsAdvanceSyncedSize` passes unmodified.
Q5: `SyncWalClaimTimeHorizonExcludesCoupledRotation` holds a manual `SyncWAL` in its fsync loop with 100ms slow syncs, lands a coupled rotation inside (counter-observed, order proven by `DBImpl::SyncWAL:Begin` < switch < `DBImpl::SyncWAL:BeforeMarkLogsSynced:1`), writes into the rotated-in WALs, and requires a later sync write to count all 4 partitions unsynced, with marks clear and deques consistent. Neuter (finish-time horizon): aborts on `assert(wal.IsSyncing())` on the unmarked rotated-in WAL.
Q6: the oracle records per power-loss cycle whether an acknowledged write is absent after recovery, prints the count in the summary line, and `RecoveredStateIsPrefixOfHistory` fails when power-loss cycles ran but none lost a write (runs with zero power-loss cycles, i.e. single-cycle reruns of process-crash seeds, are exempt: nothing to prove). 1000-cycle run from this commit: pass, 313 of 528 power-loss cycles lost a write. Neuter (crash keeps unsynced data): 40-cycle run fails with "power loss lost an acknowledged write in 0".
Q7: `CrashMidRotationUnderSkewRecoversPrefix` now sets `SetInjectUnsyncedDataLoss(true)` before the open (files capture the flag at creation) and requires `missing_seen` past the last sync. Neuter (flag off again): fails on "the crash dropped no acknowledged write". Listed under Invariant 4 as the one modified test.
GC17 pointers (numbers only, no decisions): D-G11: mean unsynced partitions under the mix is 1.3-2.3 of 8 (well below N) and the barrier dominates sync-write p99 (barrier p99 102ms over 1321 sync groups vs write p99 74ms over 32k mixed writes at N=8/1000/mix/1024; different populations, noted). G-19a: writers/group p50 is 1-2.4 while join p99 reaches 350ms at N=16/mix (191.5ms is N=8/5000us/mix/1024B); the index-allocation mutex has no dedicated histogram, so the harness bounds group-formation queueing but does not isolate the allocator. muse #22: per-partition mutex waits are ~0 at all N (p99 1us); no contention signature that padding would relieve in these workloads. N-2-6: 0.27-0.48 fsyncs/write sit on the write path at N=8-16 sync workloads; a background fsync's prize is bounded by the barrier numbers above minus the all-mutex claim, which stays.
Fold-back split: Q1-Q3 (script + `--sync_write_one_in` + `--wal_slow_partition` in `tools/db_bench_tool.cc`) stays a standalone diff (new code; no D118371518 line touched; no D-G53 (B) bypass). Q4 test folds with GC15's `NonLeadershipSyncsAdvanceSyncedSize` (D123971668, or D123551605). Q5 test to GC15's standalone diff (needs the latency FS). Q6 (oracle drop count + failure) to GC15's standalone diff. Q7 (test change) to D123928339. No hunk is unplaceable at its target.
Assumptions: D-G53 blank, so Recommended (A) per AB section 4 rule 2. Trigger profile (1000us append, mix 1-in-20, 1024B) chosen per rule 5 (mid-range networked-WAL latency, realistic sync ratio, KB-scale values; every cell tabulated so the choice is auditable). Sync latency = append latency and jitter = append/10 per rule 5 (one profile knob; seeded jitter keeps reps reproducible). 64 fixed CFs per rule 5 (isolates N; coverage verified from per-WAL counters). Cells use default write buffers (single generation; rotation re-apply validated in a separate small-buffer pilot) per rule 5 (cleanest numbers). Q4 neuter removes the `note_synced` call rather than the whole branch per rule 5 (the literal branch drop still advances via the active path and would not fail). Q6 exempts runs with zero power-loss cycles per rule 5 (single-cycle reruns must stay green). Cap-hit rate is reported as mean excluded/group plus P99 (ToString exposes no non-zero fraction) per rule 5.
Not done: (empty).
M2 fold (2026-10-22, `M2-FoldTasks.md` + `M2-Amendment.md`): Absorbs (M2) GC10 Q8/Q9: `SlowWalPartitionFileSystem`, sweep comparisons, steady state, `--compare_to`, trigger table; GC07 Q9: sweep dedup and N=1 baselines. This diff now edits S-C's db_bench lines: it moves S-C's latency-FS install block below its own slow-partition validation.
Changes visible to existing users:
- db_bench gains --sync_write_one_in (default 0) and --wal_slow_partition (default -1).
- db_bench now exits with an error when --wal_append_bandwidth_mbps or --wal_sync_bandwidth_mbps is set without --inject_wal_latency or outside [0, 1e12].
- db_bench fill/write benchmarks copy WriteOptions once per batch.
- New script tools/partition_wal_sweep.py.
Test Plan:
- `buck2 test fbcode//internal_repo_rocksdb/repo:db_write_test fbcode//internal_repo_rocksdb/repo:latency_injection_fs_test`: 199 pass, 0 fail.
- `buck2 test fbcode//internal_repo_rocksdb/repo:db_wal_oracle_test` (40 cycles): 3 pass; drop count 13/17 power-loss cycles.
- 1000-cycle oracle run from this commit (`ROCKSDB_WAL_ORACLE_CYCLES=1000`): pass; 313 of 528 power-loss cycles lost a write; 2 known lower-bound holes (non-strict, expected). A pre-format run gave 310/528; the committed run above is the evidence.
- Q5+Q7 x100 repeats (`--gtest_repeat=100`): 100/100 iterations pass, 0 failures.
- Q5+Q7 under `@fbcode//mode/dev-tsan`: 4 pass, no TSan warnings.
- Q4 neuter (no `note_synced` past the horizon): `SyncWalAdvancesOtherPartitionsSyncedSize` fails with sum 1 (expected). Q5 neuter (finish-time horizon): aborts on `assert(wal.IsSyncing())` (expected). Q6 neuter (crash keeps unsynced data): 40-cycle run fails "no power-loss cycle lost an acknowledged write" with count 0 (expected). Q7 neuter (flag off): fails "the crash dropped no acknowledged write" (expected). All neuters reverted; `db_impl.cc` clean.
- Full matrix: 435/435 runs ok from this commit (opt `db_bench`); trigger verdict DOES NOT FIRE (0.0012 at N=8/1000us/mix/1024B; max 0.0019 on any sync-containing cell).
- Two `--quick` runs from this commit: 18/18 each; second run's medians within −8.3% write p99 / −21% gate p99 of the first at worst (7 of 18 narrowly outside the tight 3-rep min-max; worst -2.2%); tables in summary.
- N=1 byte-identity check (base vs this commit, `none` and `partition_by_column_family`): pass; hashes equal the documented values (`6d135111...` off, `9a69a3fc...` on).
- 180s `db_stress` blackbox crash test at N=1 with `partition_wal_usage` on: first run failed early (checkpoint "WAL index merge: WAL 3 unreadable" under injected read faults), retry passed ("Crash-recovery verification passed"). Engine code is untouched by this diff (benchmark tooling + tests only), so the intermittent failure is a pre-existing base finding, reported, not fixed.
- Pre-stack-base N=1 comparison at 217951834332: not run (needs a second opt build; covered by byte-identity plus N=1 indexed-vs-kNone instead).
- Repo-pinned clang-format clean on all touched C++ files; `arc lint -a` and the script's lint clean.
(M1 standalone carved from GC16 D126232422; that round diff is abandoned at M1.)
M1 re-verification (2026-10-20, after rebasing the stack onto master f0c3a35689fc and clang-formatting D117251769, D117251771, D123079329, D123551605):
- Per-diff gate, all 35 commits bottom-up: CI format check, `rocksdb_lib` build, every touched test target: all pass, 0 failures.
- Tip suites (23 targets): 8126 pass, 0 fail.
- N=1 byte identity at the tip: `6d135111...` (off) and `9a69a3fc...` (on), equal to T0.
- 180s blackbox crash test at N=1 with `partition_wal_usage=partition_by_column_family`: pass.
- Trigger rerun, opt `db_bench`, N=8/1000us/1024B, this harness: sync mix 0.0014 / 0.0013 / 0.0011 at 8 / 16 / 32 threads; all-async 0.026 / 0.025 / 0.018. Does not fire in either profile (the earlier 0.137 and dev-mode 0.108 readings do not reproduce in opt).
M2 fold: new or moved tests here: (none). B.1 at this diff (format check, `rocksdb_lib`, touched test targets): PASS; no test targets; `db_bench` and `db_stress` build; `partition_wal_sweep.py` compiles.
M3 B.1 at this diff (clang-format 21.1.2 on its changed lines, make check-sources, debug librocksdb build; no test file touched): PASS.
Note (2026-10-27): every number above predates GC17's sync-path change; see the first paragraph of the summary. The pre-stack-base comparison is still not run.
M5 fold: Absorbs 10 A.1 entries (GC28 5, GC27 1, GC29b 4): GC28 Q5 (b)/Q6: TRIGGER_THREAD_COUNTS, compute_trigger, --stats_level comments; GC27's zero guard; GC29b's docstrings and report heading. M5-F1 (A.8): F1.3: partition_wal_sweep.py's docstring placeholders.
M5 B.1: PASS (clang-format 21.1.2 on the changed lines, make check-sources, debug build of db_bench); no test binary touched.
M6 fold: Absorbs GC35 Q4: `tools/partition_wal_sweep.py` `--bandwidths-mbps` (cells, labels, parsing of `size_sleep_micros`, comparisons and trigger per bandwidth) and `db_bench` `--wal_slow_partition` taking a tenth of the WAL bandwidths.
M6 B.1: PASS (debug build of db_bench; no test binary touched).
Differential Revision: https://phabricator.intern.facebook.com/D126533195
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.
[GC] GC25
Reviewer question: Is a sync write now visible only once durable, with async writes behaving as at N=1, and is the failed-sync hiding machinery gone without losing D-1 handling?
Short answer. Yes. At N>1 a sync group's sync writers are inserted and published only after their records, and every lower record on every partition, are fsynced (RunSyncGate). Visibility stays the applied contiguous prefix. A failed fsync is handled as a failed append (D-1): the group's range is pinned under an open fence, the DB stops, every unreturned write above it fails with the background error, and Resume's flush plus the fence close keep it invisible, including after a reopen that follows Resume (Q1). In a sync-led group the async writers take the lower sequences and return as soon as those are visible, before the fsync. 2PC pre-release callbacks of sync writers run only after the fsync succeeds (Q2). The read mask, masked memtables, the masked flush drops, MemPurge mask inheritance, mask retirement, the exact (closed) failed-sync fence, the sync-group registration and the fence intent are removed; D-1's pinned ranges, open fences, recovery flush drop at UnreleasedWalGateFenceLow and the Resume fence close stay (Q3). Q4 updates the option doc, adds the release note and pins the reopen-without-Resume rule. Q5 gates an empty disableWAL commit that creates a snapshot. Q6 is measurement.
GC26 areas: ExplainBurnedWALIndices, CoverBurnedWALIndex, the recovery merge and the open path are not touched.
Answers
Q1. A sync write is visible only once durable
Property: at N>1 a sync write is visible (Get, MultiGet, plain iterators, new snapshots, LastSequence()) only after its record and every lower record on every partition are fsynced. Visibility stays a contiguous prefix. On fsync failure the write returns the error and is never visible: not before Resume, not after it, not after a reopen that follows Resume; every higher write that has not returned fails with the background error; the DB stops and Resume recovers as for an append failure; coalescing stays.
How:
sync_group), allocates the group's sequences in two runs: the async writers first ([low, sync_first_sequence - 1]), then the sync writers ([sync_first_sequence, high]). AllocateSequenceAndWALIndex registers them as two applied ranges (newleading_sequence_count). MergeBatch merges in the same order, so the WAL record's sequence layout matches.published=false, which syncs again if the first fsync's safe point was below the group's target), then the sync writers' pre-release callbacks, their memtable insert (concurrent insert, leader's write options), and only then PublishLastSequence. It then waits until the range is published (WaitForWalDurability(target, wal_record, published)).Evidence:
Neuters (each applied to this commit, rebuilt, its tests run one by one, then the tree restored and checked identical to HEAD; every listed test fails):
Q2. Async writes as at N=1; 2PC callbacks after the fsync
Property: async members of a sync-led group take the lower sequences and return without waiting for the fsync. 2PC pre-release callbacks run only after the fsync succeeds. A failed commit is never visible and Rollback() then works. A failed sync Prepare leaves no prepared-heap entry. WriteCommitted and N=1 are unchanged.
How:
sync_first_sequenceandasync_writers_gate. In ExitAsBatchGroupLeader (non-pipelined path), after the next leader is promoted and before the completion gate, the leader runs async_writers_gate: WaitForWalDurability(sync_first_sequence - 1, wal_record, published), then the async writers' post-memtable callbacks. CompleteAsyncWriters then completes the async writers (status, STATE_COMPLETED) and relinks the group to the leader and the sync writers only, so RunSyncGate and the exit see just those.sync_grouprequires N>1): byte identity below.Evidence:
Neuters:
evicted.prep_seq != prepare_seq).Q3. Removed machinery; D-1 handling kept
Removed:
highparameter of InstallWalGateFence, the closed_fence recompute in ClearWalDurabilityBGError, OpenWalGateFenceLowLocked (folded back into UnreleasedWalGateFenceLow).Kept (D-1): failed_wal_ranges_ pinned in WALIOStatusCheck under the same mutex_ hold as the error; open fences (InstallWalGateFence, released_by_recovery) and WalGateFenceStatusLocked; the flush drop at UnreleasedWalGateFenceLow, recovery's included; ClearWalDurabilityBGError's fence close, indeterminate record and range release at Resume; SignalWalDurabilityWaitersOnBGError.
Evidence:
git grep -nE '<removed symbols>'at this commit: no match (exit 1); the same pattern has 195 matches at the base. Pattern: WalGateReadMask|LiveWalGateReadMask|wal_gate_read_mask|NewTailingWalGateReadMask|RegisterTailingWalGateReadMaskCleanup|SetMaskedSequenceRanges|GetMaskedSequenceRanges|HasMaskedSequenceRanges|DropMaskedSequenceRanges|MaskedSequenceRanges|has_masked_ranges_|masked_ranges_|wal_gate_masked_memtables_|wal_gate_read_masked_|MaybeRetireWalGateReadMasks|FailedGateSyncFlushDrops|InstallFailedGateSyncFence|FenceFailedGateSync|GateSyncFenceIntent|gate_sync_fence_intent|RegisterGateSyncGroup|EndGateSyncGroup|WalGateSyncWaiter|wal_gate_sync_waiters_|OpenWalGateFenceLowLocked|TEST_WalGateReadMaskRanges.Removed tests, with reasons:
Renamed and rewritten: FailedGateSyncMaskRetiresUnderTransactionDB -> FailedGateSyncAbsentUnderTransactionDB (no mask to retire; asserts absence through every read path and after reopen).
Other rewritten tests: FailedZeroCountSyncLeavesNoIndeterminateRecord and FailedZeroCountGateSyncRecordsNoIndeterminate (fences close empty, low > high), FailedSyncPrepareLeavesNoStaleFence (an open fence at L + 1 after the failure, empty after Resume), the mask lines of FailedGateSyncRangeDeletionStaysHidden dropped, comments of AsyncOnSyncingPartitionWaitsForItsFsync and SyncWriteAboveAsyncWriteSurvivesCrash.
Neuters (each applied to this commit, rebuilt, its tests run one by one, then the tree restored and checked identical to HEAD; every listed test fails):
Q4. Docs and the reopen pin
wal_partitions: only the sync/failed-sync paragraph is replaced (D-9 text: sequence-order visibility; a sync write visible once it and everything before it is synced; async writes do not wait for a sync they precede; a later write waits for a pending sync; a failed sync is never visible, later unreturned writes fail and writes stop until Resume; a reopen without Resume, or a backup or checkpoint taken before Resume, may recover a failed write whose record reached the WAL, as with one WAL).Q5. An empty disableWAL commit's snapshot is at or below the published frontier
Property: a snapshot created by an empty disableWAL commit (CommitAndTryCreateSnapshot) is at or below LastSequence() when created.
How: WriteImpl installs the disableWAL completion gate also for a group that consumes no sequence when it has a post-memtable callback (
seq_inc > 0 || has_post_memtable_callback); the wrapper that runs post-memtable callbacks after the gate now requires a gate. The callback (snapshot creation) runs once every sequence at or below the group's is published.Evidence: new TransactionPartitionedWalTest.EmptyDisableWalCommitSnapshotIsPublished: W (other partition) held after allocation, before insert; T's empty disableWAL commit parks (TEST_WalDurabilityWaiters() == 1); released, T's snapshot equals published_before + 1 and is at or below LastSequence(); reads through it repeat.
Neuter: N6, the old condition (seq_inc > 0 only): the test aborts on SnapshotCreationCallback's assertion
db_impl_->GetLastPublishedSequence() >= seq(the snapshot lies above the published sequence).Q6. Measurement
Paired, interleaved runs (base = pwal/gc24 @ 121a5a0, commit = this commit; order base/commit, commit/base, base/commit), release static db_bench built in worktrees under the tmp dir, DBs under TEST_TMPDIR. Measured values only, three runs each, in run order. The host is shared: the load average (uptime) before each run was 15 to 26 for every cell except the trigger cell's first pair (about 42); per-run values in q6/results.jsonl.
GC16 trigger cell: fillrandom, N=8, partition_by_column_family, 64 CFs, 16 threads x 2000, value 1024, 1-in-20 sync, injected append and sync latency 1000 us (jitter 100):
| | ops/s | p99 us (Microseconds per write) |
| base | 3593, 3174, 3440 | 49293, 68429, 61664 |
| commit | 1270, 1190, 1289 | 47980, 49670, 48089 |
fillrandom, N=8, 64 CFs, 16 threads x 2000, value 100, no latency injection (real fsync):
| sync | base ops/s | commit ops/s | base p99 us | commit p99 us |
| 0% | 397111, 355943, 351953 | 398044, 390329, 391959 | 82, 106, 108 | 92, 89, 93 |
| 5% (1 in 20) | 12659, 12970, 9406 | 3123, 3302, 3222 | 22081, 20780, 20865 | 21359, 23751, 21636 |
| 50% (1 in 2) | 2368, 501, 564 | 1745, 301, 288 | 29066, 131753, 108260 | 25924, 149803, 156883 |
WritePrepared, mixed sync (wp_bench: 16 threads x 1000 transactions, each SetName, one Put, Prepare, Commit; 1 in 20 transactions sync=true; 16 CFs; latency per transaction):
| | txn/s | p50 us | p99 us | p99.9 us |
| N=8 base | 1585, 1828, 1231 | 36, 33, 34 | 199546, 148736, 236271 | 260420, 208453, 320997 |
| N=8 commit | 320, 292, 220 | 39915, 46439, 61643 | 174118, 236034, 351703 | 2390630, 1125430, 2044203 |
| N=1 base (reference) | 1892, 1708, 1857 | 8068, 7714, 5647 | 29450, 38614, 51742 | 179506, 249160, 441419 |
| N=1 commit (reference) | 1756, 1681, 1153 | 8269, 6593, 8039 | 60104, 67362, 129329 | 156925, 345776, 895572 |
Reads: one db_bench run per side does fillrandom, readrandom, then seekrandom with use_tailing_iterator=1 and seek_nexts=10 (8 threads, num 50000, reads 50000, 8 CFs, value 100); also compared with pwal/gc20-base (fbea767), interleaved three ways:
| | readrandom ops/s | readrandom p99 us | tailing seek ops/s | tailing seek p99 us |
| N=1 base | 3689049, 3715710, 3952295 | 4.50, 4.76, 4.19 | 684409, 751556, 804992 | 21.56, 20.21, 20.25 |
| N=1 commit | 3090497, 3471920, 3852414 | 5.08, 4.77, 3.99 | 753659, 969917, 730109 | 21.80, 19.33, 20.23 |
| N=1 gc20-base | 3774688, 3743740, 3538507 | 3.99, 4.22, 4.76 | 721474, 660189, 608579 | 20.51, 21.89, 23.50 |
| N=8 base | 3570950, 3659351, 3568019 | 4.68, 3.98, 4.81 | 717411, 667664, 565904 | 21.80, 20.70, 21.79 |
| N=8 commit | 3477172, 3550600, 3499409 | 4.73, 4.28, 4.20 | 708674, 647485, 611655 | 21.56, 21.45, 21.78 |
| N=8 gc20-base | 3915311, 3545564, 3832996 | 4.05, 4.80, 4.35 | 800160, 756279, 575762 | 21.62, 21.47, 21.61 |
Reading: with no sync, writes and reads are unchanged within run-to-run spread (no read mask is consulted any more). With mixed sync at N=8, throughput falls by about 3x and an async write's median latency rises from tens of microseconds to tens of milliseconds, because every write ordered after a pending sync now waits for that sync's fsync of every partition (D-9); GC24 published sync writes before their fsync. At N=1 the same workload's median already includes that wait. The spec sets no numeric perf target for this round, so none is listed as met or missed.
Fold-back split
Blame at the base plus the Differential Revision line. GC commits carry no such line; per the doc, their lines go to the diff their round's split named: GC18 and GC20 gate-sync lines to D123551605; GC20, GC21 and GC24 fence, mask, retirement and flush-drop lines to D123701876.
publishedparameter: D123551605 and GC20 lines.leading_sequence_countand the two applied ranges (D123476301 lines); db_impl.h its overload and PublishOnGroupExit; the WriteImpl exit publication through PublishOnGroupExit and the release_unapplied_range path (D123476301 lines).Assumptions
Not done
Test plan
FORMAT_UPSTREAM=121a5a07 make check-format: "Nothing needs to be reformatted!" (clang-format 21.1.2; formatting applied to changed lines only, with clang-format-diff).make check-sources: pass.git grepfor the removed symbols: 0 matches (195 at the base).