Repository navigation
Conversation
|
@jaykorean has exported this pull request. If you are a Meta employee, you can view the originating Diff in D129449804. |
✅ clang-tidy: No findings on changed linesCompleted in 0.0s. |
Summary: **Why the change is required** `inplace_update_support` has had no crash test coverage since D101739997 (T265679928) hard-coded it to 0 in `default_params` "until the sanitization can account for cross-run incompatibility". **Previous behavior** Before D101739997, `default_params` drew `inplace_update_support` once per `db_crashtest.py` invocation (10%), so it was meant to stay fixed for every db_stress run on that DB. But `finalize_and_sanitize()`, which runs once per run on freshly drawn per-run values, also turned it off whenever that run drew something it considered incompatible: `min_tombstones_for_range_conversion > 0` (drawn per run and nonzero 80% of the time; added by D96203950 two weeks before T265679928), `remote_compaction_worker_threads > 0` (drawn per run in blackbox), `test_batches_snapshots`, `memtablerep=vector`, blob direct write or best-efforts recovery. Those rules are still on master, so even today an explicit `--inplace_update_support=1` is turned on and off from run to run. A run without in-place updates can write `DeleteRange` tombstones (and read-path converted range tombstones) that a later run with them still sees in its memtable, e.g. after WAL recovery with `avoid_flush_during_recovery`. An in-place `Put` keeps the older sequence number of the entry it overwrites, so a range tombstone in the same memtable with a sequence number in between hides the new value: "Get verification: Value not found" as in T265679928. **New behavior** - `inplace_update_support` is drawn once per invocation (10%, as before) and `finalize_and_sanitize()` never changes it. Every run of the series, including whitebox reopen/check-mode runs and the blackbox final verification run, uses the same value. - When it is on, `finalize_and_sanitize()` turns off the incompatible per-run features in every run instead: `delrangepercent` (and with it `test_ingest_standalone_range_deletion_one_in`), `min_tombstones_for_range_conversion`, prefix scans, iterators and snapshot users (existing rule), `memtable_verify_per_key_checksum_on_seek`, `test_batches_snapshots`, `allow_concurrent_memtable_write`, remote compaction, `lazy_entity_read_one_in`, and unsynced data loss (`sync_fault_injection`, `disable_wal`, `manual_wal_flush_one_in`). No run of such a series writes a range tombstone, so nothing incompatible is left in the DB for a later run. - `gen_cmd_params()`, which runs once per invocation, keeps it off for the whole series and prints `inplace_update_support is off for all runs as it is incompatible with: ...` when: - a profile that cannot be turned off per run is used: transactions (pessimistic, optimistic, multi-ops), `--cf_consistency`, best-efforts recovery, blob direct write, file-scoped WAL write faults, or `memtablerep=vector`; - the command line explicitly enables one of the per-run features above (e.g. `--delrangepercent=1`, `--test_batches_snapshots=1`); - unparsed arguments are forwarded to db_stress (random selection only, like the file-scoped WAL fault profile). An explicit `--inplace_update_support=1` is still honored here. - An explicit `--inplace_update_support=1` now also keeps the random blob overlay to `blob_params` (blob direct write requires it off) and suppresses the automatic file-scoped WAL fault profile, like other explicit opt-outs. **Implementation** - New `resolve_inplace_update_support()` at the end of `gen_cmd_params()`, driven by two lists: `_INPLACE_UPDATE_INCOMPATIBLE_PROFILE_PARAMS` (checked on the merged params, i.e. presets and command line) and `_INPLACE_UPDATE_INCOMPATIBLE_RUN_PARAMS` (checked on explicit command-line values only). - All six `dest_params["inplace_update_support"] = 0` statements are removed from `finalize_and_sanitize()`. The per-run rules for in-place updates now sit in one block at its start, before the `test_batches_snapshots`, remote compaction and range-conversion rules, so those no longer fire needlessly in in-place runs. If `finalize_and_sanitize()` is handed `inplace_update_support=1` together with a profile conflict it raises `ValueError` rather than silently toggling the option for one run, so a profile that later becomes per-run random cannot quietly reintroduce the cross-run bug. - `lazy_entity_read_one_in` was found by this diff's crash runs: the lazy entity read checks (added after D101739997) assert `read_opts.snapshot != nullptr`, but `DB::GetSnapshot()` returns nullptr with in-place updates. - No db_stress or RocksDB change. **Safety, compatibility, and limitations** - Measured selection rate through the real `main()` path over seeds 1..1000: 83/1000 for `blackbox` and `whitebox`, 86/1000 with `--simple`, 85/1000 with `--enable_ts` (the 10% draw minus series that pick blob direct write or file-scoped WAL faults); 0 for `--txn`, `--cf_consistency`, `--test_best_efforts_recovery` and explicit `--delrangepercent=1`. - Series with in-place updates lose the features above for that series only. `test_batches_snapshots` now yields to `inplace_update_support` (before, it was the other way round), which costs about 10% of batched-ops series. - Internal CI jobs that forward unparsed db_stress flags (autotune, secondary_cache, warm_storage) never pick it at random; the plain `fbcode_*crash*` jobs can. - "Once per invocation" equals "once per DB lifetime" because crash_test.mk passes `--destroy_db_initially=1` and a successful invocation destroys its DB. A manual invocation that reuses a DB left behind by an earlier, different invocation can still mix settings, the same as for the other fixed-per-invocation params such as `max_key` and `use_put_entity_one_in`. - Unchanged from before D101739997: `VerifyDb()` can pick its iterator method while other threads update in place. Requested by: Jay Huh (jewoongh) Reviewed By: xingbowang Differential Revision: D129449804
jaykorean
force-pushed
the
export-D129449804
branch
from
November 10, 2026 20:58
9d05626 to
4f8fe4f
Compare
|
This pull request has been merged in 9abad49. |
JustinGaoF
added a commit
to JustinGaoF/rocksdb
that referenced
this pull request
Nov 19, 2026
Summary:
M1 standalone S-B (S-GC13), carved from GC13 Q2 (see that round summary
for question evidence):
- `db_crashtest.py`: N sweep over {1,2,8,16} plus both sanitize stages
(N>1 admits indexed WALs only).
- `db_stress --sync_write_one_in` (flag and use) and `SetOptions`
`max_successive_merges` at N>1.
Placed above S-C (no dependency; order follows the M1 plan).
M2 fold (2026-10-22, `M2-FoldTasks.md` + `M2-Amendment.md`): Absorbs (M2) GC06's and GC11's N=1 crashtest fallbacks (`track_and_verify_wals`, OCC serial validation, `file_scope_wal_write_faults`).
Rebase onto facebook/rocksdb eb12834 (review round 15): upstream meta#15626 moved the inplace_update_support sanitizing to the start of `finalize_and_sanitize`, so the N>1 overrides that used to run there turned allow_concurrent_memtable_write back on after it, and DB::Open rejected the result. The same overrides also replaced explicitly passed flags (for example `--disable_wal=1`) and made `tools/db_crashtest_test.py` (`make db_crashtest_tests`, part of `make check`) fail in about 5 of 6 runs; that was already true before this rebase. The overrides now run in `gen_cmd_params` before command-line flags are merged, following the file-scoped WAL fault selection there, keyed on the effective wal_partitions (an explicit `--wal_partitions` included), and they fix the per-run test_secondary draw so wal_partitions does not change between runs of a series. The late N>1 check falls back to one partition on any conflict.
db_stress: the LockWAL check accepts GetCurrentWalFile() returning NotSupported at wal_partitions > 1 (each partition has its own current WAL); the sequence number check still runs. It lived in D130396596 until fbcode CI on the eb12834 rebase showed this diff's whitebox crash tests failing at wal_partitions=16 with "GetCurrentWalFile() failed: Not implemented": this diff is the first to draw wal_partitions > 1, so the check moved here.
Changes visible to existing users:
- db_crashtest.py now picks wal_partitions 2, 8 or 16 for about 1 in 3 invocations (or takes `--wal_partitions`). In those series `gen_cmd_params` sets partition_wal_usage, disable_wal, enable_pipelined_write, allow_concurrent_memtable_write, memtablerep, sync, test_secondary and continuous_verification_interval to values N>1 accepts, once for the series and before it applies command-line flags. An explicitly passed incompatible flag, or inplace_update_support=1, keeps the series at one partition. At N>1 the runs turn off ingest_wbwi_one_in and commit_bypass_memtable_one_in.
- New db_stress flag --sync_write_one_in (default 0). db_crashtest.py sets it to 10 or 100 in half of its runs at any wal_partitions, so default crash tests now mix sync and non-sync writes.
Test Plan:
`db_stress` builds at placement. Tip suites pass.
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_crashtest.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.
M4 fold: Absorbs
- GC26 Q5(e): db_crashtest.py runs no secondary and no continuous verification at N>1 (code only; no crash test was run).
- Net-zero pairs dropped (rule 2.7): none.
M4 B.1: PASS (clang-format 21.1.2 on the changed lines, make check-sources, debug build of db_stress; no test binary touched).
Rebased stack (facebook/rocksdb eb12834, fbcode/master b1d9881f429e): `tools/db_crashtest_test.py` gains `test_wal_partitions_steers_randomized_settings`, `test_explicit_flag_wins_over_wal_partitions`, `test_inplace_update_support_keeps_one_wal_partition`, `test_wal_partitions_stays_fixed_across_runs` and `test_explicit_wal_partitions_is_steered`, and `test_cf_consistency_randomizes_secondary` pins wal_partitions=1. The suite passes 89/89 in 40 runs with the random draw and in 5 runs each with wal_partitions pinned to 1, 2, 8 and 16; before the fix it failed in 6 of 6 runs at the previous stack. Neuters: with the old overrides restored the first three new tests fail; without the steering block the first fails; without fixing test_secondary and continuous_verification_interval `test_wal_partitions_stays_fixed_across_runs` fails; keying the steering on the drawn value only fails `test_explicit_wal_partitions_is_steered`.
Reviewers: generatedunixname1864816080879669
Differential Revision: https://phabricator.intern.facebook.com/D126533194
Tags: skip_dr_passed
JustinGaoF
pushed a commit
to JustinGaoF/rocksdb
that referenced
this pull request
Nov 19, 2026
…n builds Summary: The flip of the PartitionWAL stack (GC18 Q1-Q5). DB::Open accepts wal_partitions > 1 with an indexing partition_wal_usage in release and debug builds, with no sync point and no opt-in. kNone with N>1 and every other M1.4 rejection still fail with their exact Status. The wal_partitions doc and the release notes describe the shipped behaviour and the rollout order (readers first). Removes: - the N>1 gate in DBImpl::ValidateOptions and its debug sync point DBImpl::ValidateOptions:AllowWalPartitions; - the GC13 opt-in experimental_allow_wal_partitions_for_testing (D-G18k (i)): the option, its OPTIONS-map entry, Dump line, generated C accessors (two "removed" entries are added to tools/c_api_gen/api_compatibility_allowlist.json); db_bench, db_stress and test::SetWalPartitions stop setting it; - every use of the hook in tests and tools, including the hooks that tests folded below this commit carry at M4 (exception X14: FailedSyncPrepareLeavesNoStaleFence, GC23TimestampedSnapshotsSurviveFlushStress, GC19TornFirstRecordInBrandNewNTwoDbModes, CreateBrandNewPartitionedDb, GC23FloorOffForLaterGenerationHeads, GC24HistoryFloorScopeOnUpgrade) and the original hooks of SyncPrepareAfterSyncCommitSurvivesCrash, FU14SnapshotRace and FU14H6TornFirstRecordInBrandNewNTwoDb (GC26 Q5(d)). Adds db_wal_partitions_open_test (GC18 Q1, with GC20 Q9's edits), GC20 Q9's "with indexing it opens" leg of WalPartitionsValidation (exception X6), GC23 Q8's wal_partitions doc sentences (exception X6), and the release notes unreleased_history/new_features/wal_partitions.md, behavior_changes/partition_wal_sync_visibility.md (GC25) and behavior_changes/partition_wal_recovery_modes.md (GC26) (exception X19: they describe behaviour production builds reach only from this commit). Recorded exception: this commit stays a standalone diff on top of the stack and is never folded (GC18 round decision, design audit G3-C-2), so it can be reviewed, landed and reverted alone, and N>1 never becomes legal partway up the stack. M5 fold: Absorbs 10 A.1 entries (GC28 1, GC27 3, GC30 2, GC29a 2, GC31 1, GC32 1): the five new release-note files (X19-M5); the post-flip wal_partitions doc lines (GC27, GC30, GC29a); wal_partitions.md. Exceptions: X19-M5. Release notes added here (X19-M5): bug_fixes/partition_wal_recovery_and_visibility_fixes.md, new_features/partition_wal_file_scoped_resume.md, performance_improvements/partition_wal_targeted_gate_sync.md, performance_improvements/partition_wal_write_path_locks.md, performance_improvements/partition_wal_write_pipeline.md. Removes the X14-M5 hook lines: the AllowWalPartitions callbacks D123079329, D123701876, D123928339, D123971668, D127093323 and D127275775 added to their folded N>1 tests. M6 fold: removes the `DBImpl::ValidateOptions:AllowWalPartitions` hook lines added below the flip to the GC34 Q1 tests (`RunReplayedPrepareIsNotCut`); no other change. Benchmark (rebased stack, paired and interleaved): Release `db_bench` built at the rebased stack (fork f4c2cc3436 on facebook/rocksdb e732049; the final 7fd6043 differs only in transaction_test.cc). Workload: `fillrandom`, 3000 ops per thread, 4 KiB values, 64 column families, pipelined write off, auto compactions off, DB on /dev/shm. The latency-injection FileSystem adds a 200 us WAL append latency and a 200 us WAL sync latency (20 us jitter, fixed seed 1001). Profile S caps WAL append and sync bandwidth at 50 MB/s each. Profile S-sync caps only sync bandwidth (50 MB/s). There are three rounds, and each round runs every cell, rotating the cell order. The table reports the median of the three runs (min-max across runs). The ratio is the median of the per-round ratios against N=1 kNone. Host is shared: 1-minute load average 12-67 during the runs (other users). Sync column: `all` = `--sync`, `1-in-20` = `--sync_write_one_in=20`, `none` = no sync. | Profile | Sync | Cell | ops/s (median of 3) | min-max | vs N=1 kNone | mean write us | p99 write us | WAL appends | WAL syncs | |---|---|---|---|---|---|---|---|---|---| | S | all | N=1 kNone | 5425 | 5282-5490 | 1.00x | 11646 | 13984 | 6002 | 6002 | | S | all | N=1 indexed | 5374 | 4871-5456 | 0.98x | 11716 | 14528 | 6007 | 6005 | | S | all | N=8 | 20104 | 20098-20516 | 3.71x | 3163 | 6351 | 90202 | 48470 | | S | all | N=16 | 22746 | 21715-23222 | 4.14x | 2794 | 5075 | 133766 | 80580 | | S | 1-in-20 | N=1 kNone | 5659 | 5645-5672 | 1.00x | 11283 | 58960 | 6149 | 2042 | | S | 1-in-20 | N=1 indexed | 5669 | 5624-5680 | 1.00x | 11270 | 60891 | 6027 | 1916 | | S | 1-in-20 | N=8 | 21635 | 20743-21835 | 3.81x | 2940 | 6587 | 63675 | 20851 | | S | 1-in-20 | N=16 | 24240 | 23984-24506 | 4.29x | 2620 | 6208 | 105691 | 38739 | | S | none | N=1 kNone | 10627 | 10435-10702 | 1.00x | 6015 | 6595 | 6005 | 0 | | S | none | N=1 indexed | 10631 | 10433-10650 | 1.00x | 6012 | 6598 | 6007 | 0 | | S | none | N=8 | 48068 | 47452-48281 | 4.52x | 1318 | 2788 | 48464 | 0 | | S | none | N=16 | 63757 | 63551-63974 | 6.00x | 992 | 1881 | 83100 | 0 | | S-sync | all | N=1 kNone | 9725 | 9722-9781 | 1.00x | 6570 | 9790 | 6003 | 6003 | | S-sync | all | N=1 indexed | 9776 | 9770-9792 | 1.00x | 6539 | 9621 | 6006 | 6004 | | S-sync | all | N=8 | 28877 | 27685-29180 | 2.97x | 2208 | 4214 | 88995 | 46361 | | S-sync | all | N=16 | 27734 | 26727-29899 | 2.85x | 2292 | 4318 | 134123 | 78895 | | S-sync | 1-in-20 | N=1 kNone | 10263 | 10190-10338 | 1.00x | 6220 | 19308 | 6029 | 2525 | | S-sync | 1-in-20 | N=1 indexed | 10330 | 10159-10355 | 1.00x | 6180 | 28946 | 6029 | 2329 | | S-sync | 1-in-20 | N=8 | 29514 | 29500-29519 | 2.88x | 2152 | 5876 | 61844 | 21538 | | S-sync | 1-in-20 | N=16 | 30808 | 30736-31239 | 3.02x | 2059 | 4387 | 103682 | 39121 | | S-sync | none | N=1 kNone | 72763 | 72596-74166 | 1.00x | 873 | 1293 | 6013 | 0 | | S-sync | none | N=1 indexed | 74786 | 72987-75086 | 1.01x | 850 | 1285 | 6016 | 0 | | S-sync | none | N=8 | 123028 | 120951-124222 | 1.67x | 512 | 862 | 39044 | 0 | | S-sync | none | N=16 | 133228 | 129421-133491 | 1.80x | 471 | 855 | 71038 | 0 | | S, 16 threads | all | N=1 kNone | 4724 | 4387-4738 | 1.00x | 3346 | 6482 | 4022 | 4022 | | S, 16 threads | all | N=1 indexed | 4713 | 4707-4736 | 1.00x | 3334 | 6478 | 3958 | 3956 | | S, 16 threads | all | N=8 | 8494 | 8464-8529 | 1.80x | 1873 | 2895 | 40476 | 27290 | | S, 16 threads | all | N=16 | 9294 | 9250-9323 | 1.97x | 1711 | 2876 | 44226 | 34317 | All 84 runs exited 0. Command per cell: ``` db_bench --benchmarks=fillrandom --threads=64 --num=3000 --value_size=4096 \ --num_column_families=64 --wal_partitions=<N> --partition_wal_usage=<none|partition_by_column_family> \ --enable_pipelined_write=false --disable_auto_compactions=1 --statistics --histogram \ --inject_wal_latency --wal_append_latency_us=200 --wal_sync_latency_us=200 \ --wal_latency_jitter_us=20 --wal_latency_seed=1001 --seed=1001 \ --wal_append_bandwidth_mbps=<50|0> --wal_sync_bandwidth_mbps=50 [--sync | --sync_write_one_in=20] ``` N=1 against upstream (default options, no partitioning flags, no latency injection): release `db_bench` of this stack against release `db_bench` of facebook/rocksdb e732049, five rounds, alternating which binary runs first, DB on /dev/shm. | Workload | upstream e732049 ops/s (median) | min-max | this stack ops/s (median) | min-max | stack/upstream (median of per-round) | |---|---|---|---|---|---| | fillrandom, 64 threads x 20000, 64 CFs, 4 KiB values, no sync | 224575 | 219463-232611 | 220572 | 213377-226176 | 0.972x | | fillrandom, 16 threads x 200000, 1 KiB values, --sync | 532901 | 524086-611361 | 530771 | 525389-541405 | 0.999x | Per-round stack/upstream ratios: --sync 0.996, 0.999, 1.032, 1.000, 0.860; no sync 0.972, 1.007, 0.948, 0.951, 0.990. 1-minute load average 11-22 during the runs. All 20 runs exited 0. The earlier run of the same comparison on e591f5f measured 0.996x (--sync) and 0.979x (no sync). Stress (db_stress crash test with the latency-injection FileSystem wired in): `tools/db_crashtest.py` blackbox and whitebox, 1800 s each, at wal_partitions 1 and 8, on the stack rebased onto facebook/rocksdb eb12834 (fork 286fdab796, debug db_stress; the final stack differs only in clang-format line wrapping and in `tools/db_crashtest.py`/`db_crashtest_test.py`). Pinned: `--disable_wal=0 --partition_wal_usage=partition_by_column_family --enable_blob_direct_write=0 --best_efforts_recovery=0 --two_write_queues=0 --enable_pipelined_write=0 --unordered_write=0 --recycle_log_file_num=0 --track_and_verify_wals=0 --inplace_update_support=0 --use_optimistic_txn=0`, plus `--inject_wal_latency=1 --wal_append_latency_us=50 --wal_sync_latency_us=300 --wal_latency_jitter_us=50 --wal_append_bandwidth_mbps=200 --wal_sync_bandwidth_mbps=100`. Every db_stress command line in the logs was checked for WAL on, latency injection on and the intended wal_partitions; randomized overrides did not disable them. | Mode | wal_partitions | db_stress command lines | Result | |---|---|---|---| | blackbox | 1 | 31 | exit 0 | | blackbox | 8 | 31 | exit 0 | | whitebox | 1 | 16 | exit 0 | | whitebox | 8 | 26 | exit 0 | The same runs on the previous base (fork f4c2cc3436 on e732049) also exited 0 (31/31/22/12 command lines). The two fbcode sandcastle crash-test command lines that failed on the previous version (ASAN and blackbox, with `read_fault_one_in=1000`) were rerun locally against this stack, three times each for 1200 s: no failure. fbcode sandcastle crash tests: The six `rocksdb-contrun.sky` crash-test workflows ran on stack top 32fe728cb06b, scheduled 2026-11-10 05:32 UTC. The final stack differs from it only in test code, one comment and one line break (the ASAN and format fixes below); db_stress is unchanged. All six passed. | Workflow | Result | Finished (PST, 2026-11-10) | |---|---|---| | fbcode_blackbox_crash_test | pass | 00:57 | | fbcode_asan_blackbox_crash_test | pass | 00:57 | | fbcode_tsan_blackbox_crash_test | pass | 01:16 | | fbcode_whitebox_crash_test | pass | 03:37 | | fbcode_asan_whitebox_crash_test | pass | 03:37 | | fbcode_tsan_whitebox_crash_test | pass | 03:28 | Sandcastle jobs: 49539596750420932, 49539596750421833, 40532397491966602, 49539596750421523, 45035997124599077, 22518001256897652 (https://www.internalfb.com/intern/sandcastle/job/<id>/). On the previous submitted version two of these workflows had failed (the sandcastle P1 below); that fix is in this stack. Comprehensive review (15 rounds, whole 39-diff stack): Each round ran the comprehensive-diff-review protocol (read-only Opus reviewers; round 1 used four reviewers by area, later rounds one) against the cumulative stack, on facebook/rocksdb d6a7847 for rounds 1-7 and, after the rebase onto e591f5f (the RocksDB subtree of fbcode/warm), on the rebased stack for rounds 8-11, on facebook/rocksdb e732049 (fbcode/warm 4df7e0a0db7b) for rounds 12-13, on 9ce1bfb (fbcode/warm 37d097c1b953) for round 14 and on eb12834 (fbcode/master b1d9881f429e) for round 15. Rounds 14 and 15 reviewed the rebase delta. Rows marked sandcastle, external and crash test are defects found outside the review rounds and fixed the same way. Every P1/P2 was re-checked against the code, reproduced by a new test that fails first, fixed in the diff that introduced the code, and verified by a neuter (reverting the fix makes the test fail). Candidates are the fork's review folds of pwal/m6. | Round | Candidate | P1/P2 found | Fixed in | Regression test | |---|---|---|---|---| | 1 | pwal/m6 69c13fc | 4 P2: CMake missed db/log_merge.cc and log_merge_test; a secondary could not open or catch up beside an indexed primary with async_wal_precreate; a damaged first record in a WAL with an intact head floor and no span made the DB unopenable; commit_bypass_memtable failed after Prepare at N>1 | D120624825 (CMake), D127093323 (async_wal_precreate sanitized off when partition_wal_usage != kNone), D120649665 (HeadBounded counts the WAL's own head floor), D123079329 (bypass falls back to the memtable commit at N>1) | DBSecondaryTest.IndexedPrimaryDisablesAsyncWalPrecreate; DBWalPartitionCoverageTest.DamagedFirstRecordAfterUpgradeToTwoPartitions; TransactionPartitionedWalTest.CommitBypassMemtableCommitsNormally | | 2 | fold2 2e8c56707a8f | 2 P2: GetSortedWalFiles returned a false Corruption once coupled rotation retired an idle partition's metadata-only WAL that the MANIFEST tracks; GC24HistoryFloorScopeOnUpgrade still pinned the pre-fix outcome | D127093323, D127837663 | DBWritePartitionTest.SortedWalFilesListsIdlePartitionWals | | 3 | fold3 8b6590498 | 1 P2: that fix was keyed to the opener's wal_partitions, so read-only or N=1 openers still got the Corruption. Writing its test exposed a read-only open with WAL tracking off hitting `assert(recovery_ctx != nullptr)` in Recover; fixed too | D127093323 | DBWritePartitionTest.SortedWalFilesListsIdlePartitionWalsReadOnly | | 4 | fold5 c3c369362 | 1 P2: at N=1 indexed, a data-less current WAL got a cached synthetic start sequence 1, so GetUpdatesSince skipped the older WAL holding the requested sequence | D127093323 | DBWalIteratorTest.IndexedDataLessCurrentWalKeepsOlderWal | | 5 | fold6 6e3ad3889 | None. The per-diff gate then failed WalPartitions8/WritePreparedTransactionTest.{WC_WP_ForwardCompatibility, WP_WC_DBBackwardCompatibility}: listing every metadata-only WAL changed GetSortedWalFiles after a flush; reworked to upstream listing semantics | D127093323 | the two WritePrepared tests, unmodified | | 6 | fold7 376fac935 | 1 P2: the rework left MANIFEST-tracked metadata-only WALs out of GetSortedWalFiles, so a GetLiveFiles(flush_memtable=false) + GetSortedWalFiles copy failed to open ("Missing WAL with log number"). Now a tracked metadata-only WAL is listed (start sequence 1, not cached) and an untracked one is skipped | D127093323 | DBWritePartitionTest.LiveFilesAndSortedWalFilesCopyOpens | | 7 | fold8 431f2a98e | None (1 P3, below) | | | | 8 | rebased 188e02204b43 (onto e591f5f; two reviewers) | None | | | | sandcastle | previous submitted version | 1 P1 (fbcode crash tests with `read_fault_one_in=1000`): an injected WAL read I/O error during recovery surfaced as `Corruption: WAL index merge: WAL <n> head damaged and unattested` in the merged replay, and the classification pass ignored it | D120624825 (the merger keeps the read's IOError), D121636079/D121674557 (classification returns it), D123928339 (merged replay returns the merger's error before the damage checks) | LogMergeTest.FailedReadKeepsTheReadError; DBWALIndexTest.ClassificationReadIOErrorFailsRecovery; DBWalPartitionCoverageTest.MergeReadIOErrorFailsWithTheReadError | | 9 | 805ea60 | 2 P3 + 1 gap, fixed: sequential indexed replay replaced the read IOError with a generic one; the merger's error dropped the read's retryable/data-loss/scope attributes | D120415420, D120624825 | DBWALIndexTest.SequentialIndexedReplayReadIOErrorKeepsTheReadError; LogMergeTest.FailedReadKeepsTheReadErrorAttributes | | external | D119751506 reviewer comment | 1 P2: with manual_wal_flush the burned-index void cover appended to the WAL buffer without wal_write_mutex_, racing an application FlushWAL | D119751506 (takes the mutex as WriteToWAL does), D122412677 (per-partition mutex) | DBWALIndexTest.BurnedWALIndexCoverHoldsWALMutexWithManualFlush | | crash test | 805ea60 | 1 P2 (debug only): whitebox crash test at N=8 hit the FlushScheduler::Empty consistency assertion when another partition leader dequeued concurrently | D123079329 (Empty reads the head under the debug checking mutex; release builds unchanged) | DBWritePartitionTest.FlushSchedulerEmptyRacesAnotherLeadersDequeue | | 10 | 12aad1d | 1 P2: statuses on the merged-recovery read-error path left unchecked (ASSERT_STATUS_CHECKED abort) | D120624825, D123551605, D123701876, D123928339, D123971668, D127093323 (holders permitted, ignored reports marked) | the read-error tests above under ASSERT_STATUS_CHECKED | | 11 | 69a91e9 | None | | | | fbcode CI | previous submitted version | 1 P2 (build): D120624825 declared two private fields (`last_sequence_index_`, `last_sequence_wal_`) first used in D120649665, so clang failed with -Werror,-Wunused-private-field at D120624825 | D120624825 (the fields move to D120649665; later diffs unchanged) | clang per-diff build gate | | 12 | f4c2cc3436 (rebased onto e732049) | 1 P2 (tests): upstream's new TransactionTest.InplaceUpdateSupportRequiresWriteCommitted also runs in this stack's WalPartitions8 instantiation, where Open rejects its options; 3 deterministic failures | D127275775 (at wal_partitions > 1 the test asserts NotSupported) | the test itself: 3 failures before, 33/33 after | | 12 (re-review) | 7fd6043 | None | | | | fbcode CI | 7fd6043 | 1 P2 (ASAN, test-only): GC31FollowerExitGroup freed its local Env while the fixture's last options still pointed at it, so the next DestroyAndReopen read freed memory (heap-use-after-free in NGreaterThan1FollowerExitHandsFailureToLeader); and the rocks format check flagged a comment over 80 columns and one unjoined condition | D123701876 (the helper resets the fixture's env on exit); D121858039, D123079329, D123551605, D123971668 (clang-format output) | the test under ASAN: heap-use-after-free before, 4/4 and db_write_test 581/581 after; check-format.sh passes on all 39 diffs | | strict status | b19275b | 1 P2 (ASSERT_STATUS_CHECKED, GitHub CI): 27 aborts from unchecked statuses: a reader report superseded by a more specific recovery error, a per-record pending report on early returns, the gate sync's covered path, a background-error return, an ingestion early return, and three test-side cases. Release behaviour unchanged | D120415420, D120649665, D123476301, D123701876, D123928339, D123971668, D127837663 | the ASSERT_STATUS_CHECKED suite: 27 aborts before, 0 after | | 13 | f658359 | None | | | | 14 | m6-rb10 (rebased onto 9ce1bfb) | 1 P2 (tests, from my rebase resolution): upstream's new kSortedHash option config was not skipped at wal_partitions > 1, where Open accepts only the SkipList memtable, so 7 WalPartitions8/ExternalSSTFileTestN tests walking ChangeOptions failed to reopen | D127275775 (kSortedHash joins the N>1 skip list) | the 7 tests: fail before, pass after | | 15 | 286fdab796 (rebased onto eb12834) | 1 P2 (crash test): upstream meta#15626 moved the inplace_update_support sanitizing ahead of this stack's N>1 overrides, which turned allow_concurrent_memtable_write back on, so about 3% of default crash-test series failed DB::Open. Found while verifying it: the same overrides replaced explicitly passed flags and made `make db_crashtest_tests` fail in about 5 of 6 runs, already on the previous stack (1 more P2) | D126533194 (N>1 steering moved into gen_cmd_params, before command-line flags) | db_crashtest_test.py: 3 new tests, each failing with the old overrides | | 15 (re-review) | 0d68d5f821 | 2 P2 + 1 P3 in that fix: test_secondary was still drawn per run, so wal_partitions flipped between runs and a secondary could open over partition WALs; an explicit --wal_partitions was not steered; the new test helper did not pin the trie index (about 4% flaky) | D126533194 | test_wal_partitions_stays_fixed_across_runs, test_explicit_wal_partitions_is_steered (each fails under its neuter); suite 89/89 in 40 runs | | fbcode CI | V1.2 drafts (1686cdb39f) | 1 P2 (stack order, crash test): D126533194 is the first diff whose crash test draws wal_partitions > 1, but the db_stress LockWAL check that accepts GetCurrentWalFile() NotSupported at N>1 lived in this diff, so whitebox runs at D126533194 failed with "GetCurrentWalFile() failed: Not implemented" | D126533194 (the check moves down from this diff; the final tree is unchanged) | local blackbox at wal_partitions=8, lock_wal_one_in=2000: the old D126533194 fails on its 2nd run (192 errors), the new one passes 11/11 | Final state: all 39 diffs at fork 1686cdb39f on facebook/rocksdb eb12834, each mirrored byte-identically into its fbsource diff on fbcode/master b1d9881f429e (master has since gained one RocksDB commit, c043e8dfa272, touching include/rocksdb/options.h about 180 lines from this stack's hunks). At 286fdab796 (the final stack differs only in clang-format line wrapping and the crash-test Python): per-diff clang gate for all 39 diffs; full make suite 11192/11192; clang TSan once 709/709 and 100x 2600/2600; ASSERT_STATUS_CHECKED suite with no failures from this stack (range_locking_test only, below); crash tests above. At 1686cdb39f: db_write_test 581/581, the gap-filler tests, `tools/db_crashtest_test.py` 89/89, and fbcode/rocks/sandcastle/check-format.sh at every diff. Totals: 1 P1 and 20 P2 fixed. Open items (P3 or validation gaps, tracked as follow-ups, not fixed here): - ASSERT_STATUS_CHECKED: range_locking_test fails in that build mode at upstream e732049 too; it is not part of this stack. - Rebase gap (pre-existing): with recycle_log_file_num > 0, an indexed one-partition DB gets no WAL sequence-gap filler (upstream meta#15581 covers kNone only), so an ingestion gap at a WAL boundary can still stop point-in-time recovery there, as it did for every DB before meta#15581. - Round 9 F-002 (P3): consumer head checks report a WAL read I/O error as NotSupported. - Round 11 gap (low confidence, pre-existing): the void re-read during recovery can swallow a transient read IOError. - TSan with the gcc 11 runtime (libtsan.so.0) reports false "double lock of a mutex" on any std::condition_variable::wait_for mutex, upstream TransactionDB code included, because it does not intercept pthread_cond_clockwait. Use clang TSan. - Round 7 P3: after an open that writes supersession records without a dummy write (for example a WalFilter stop with avoid_flush_during_recovery=true), partition 0's untracked, data-less current WAL carries the supersession record. GetSortedWalFiles skips it, so a GetLiveFiles + GetSortedWalFiles copy could fail with "two live records share index". Checkpoint and BackupEngine are unaffected. Inferred from code, not reproduced. - Round 2 P3: WriteRecoverableState at N>1 can stamp the cached recoverable state inside an open fence during an auto-resumed retryable WAL error. - Round 1 P3s: the checkpoint/backup LockWAL race tests can stop on an ASSERT before joining their threads; GC31FollowerExitGroup orders writers with sleeps; standalone db_stress at N>1 trips on the default get_current_wal_file_one_in; checkpoint/backup at N>1 wait out a write stop. - Gaps: an indexed DB with wal_compression still caches start sequence 1 for a data-less WAL (as upstream does for compression-only WALs); HeadFloor() for a member with no surviving data is the last progress bound read (no production-reachable loss found). Reports (MetaMate): - Round 1: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-69c13fcb72e2-20261107t093444z - Round 2: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-fold2-2e8c56707a8f-20261107t175411z - Round 3: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-fold3-8b6590498-20261107t185930z - Round 4: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-fold5-c3c369362-20261107t192653z - Round 5: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-fold6-6e3ad3889-20261107t193256z - Round 6: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-fold7-376fac935-20261108t054421z - Round 7: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-fold8-431f2a98e-20261108t055310z - Round 11: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-rb2-69a91e9ba-20261110t022328z - Round 13: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-rb8-f6583590ed-20261110t195418z - Round 15 (final stack): https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-rb15-1686cdb39f-20261111t191953z Changes visible to existing users: - Removes DBOptions::experimental_allow_wal_partitions_for_testing, its "experimental_allow_wal_partitions_for_testing" options-string key (which no longer parses) and the C API functions rocksdb_options_set/get_experimental_allow_wal_partitions_for_testing. All were added earlier in this stack (D117251769) and never released. - The --wal_partitions help text of db_bench and db_stress changed. Test Plan: M4 B.1: PASS (clang-format 21.1.2 on the changed lines, make check-sources, debug build of db_options_test, db_wal_oracle_test, db_wal_partitions_open_test, db_write_test, latency_injection_fs_test, ldb_cmd_test, optimistic_transaction_test, options_settable_test, transaction_test, write_prepared_transaction_test, db_stress, db_bench, ldb); 4974 tests, 0 failed. M5 B.1: PASS (clang-format 21.1.2 on the changed lines, make check-sources, debug build of compaction_service_test, db_options_test, db_wal_oracle_test, db_wal_partitions_open_test, db_wal_test, db_write_test, latency_injection_fs_test, ldb_cmd_test, optimistic_transaction_test, options_settable_test, transaction_test, write_prepared_transaction_test, db_stress, db_bench, ldb); 7324 tests, 0 failed. M6 B.1: PASS (debug build and build_tools/gtest-parallel run of compaction_service_test db_options_test db_wal_oracle_test db_wal_partitions_open_test db_wal_test db_write_test latency_injection_fs_test ldb_cmd_test optimistic_transaction_test options_settable_test transaction_test write_prepared_transaction_test: 7340/7340). Rebased stack (e591f5f): PASS. Debug build and build_tools/gtest-parallel run of compaction_service_test db_options_test db_wal_oracle_test db_wal_partitions_open_test db_wal_test db_write_test latency_injection_fs_test ldb_cmd_test optimistic_transaction_test options_settable_test transaction_test write_prepared_transaction_test: 7559/7559. Full make suite 10540/10540. Rebased stack (e732049, fbcode/warm 4df7e0a0db7b) final: clang per-diff gates for all 39 diffs; full make suite 10576/10579 at f4c2cc3436 with the 3 round-12 failures fixed at 7fd6043 (transaction_test 3475/3475); clang TSan; crash tests and the two sandcastle repro command lines above. At b19275b: db_write_test under ASAN/UBSAN (clang) 581/581; clang per-diff gates for D121858039 through D123971668 rerun and pass; fbcode/rocks/sandcastle/check-format.sh passes at every diff. fbcode sandcastle crash tests (blackbox and whitebox; plain, ASAN, TSAN): 6/6 pass on 32fe728cb06b. Strict status (ASSERT_STATUS_CHECKED=1) suite at f658359: 0 aborts from this stack (27 before the fix). Rebased stack (facebook/rocksdb eb12834, fbcode/master b1d9881f429e) final: clang per-diff gates for all 39 diffs; full make suite 11192/11192; clang TSan 709/709 once and 2600/2600 at 100x; ASSERT_STATUS_CHECKED with only range_locking_test failing (not touched by this stack); crash tests blackbox and whitebox at wal_partitions 1 and 8 exit 0; `tools/db_crashtest_test.py` 89/89; check-format.sh passes at every diff. Differential Revision: https://phabricator.intern.facebook.com/D130396596
JustinGaoF
added a commit
to JustinGaoF/rocksdb
that referenced
this pull request
Nov 19, 2026
Summary:
M1 standalone S-B (S-GC13), carved from GC13 Q2 (see that round summary
for question evidence):
- `db_crashtest.py`: N sweep over {1,2,8,16} plus both sanitize stages
(N>1 admits indexed WALs only).
- `db_stress --sync_write_one_in` (flag and use) and `SetOptions`
`max_successive_merges` at N>1.
Placed above S-C (no dependency; order follows the M1 plan).
M2 fold (2026-10-22, `M2-FoldTasks.md` + `M2-Amendment.md`): Absorbs (M2) GC06's and GC11's N=1 crashtest fallbacks (`track_and_verify_wals`, OCC serial validation, `file_scope_wal_write_faults`).
Rebase onto facebook/rocksdb eb12834 (review round 15): upstream meta#15626 moved the inplace_update_support sanitizing to the start of `finalize_and_sanitize`, so the N>1 overrides that used to run there turned allow_concurrent_memtable_write back on after it, and DB::Open rejected the result. The same overrides also replaced explicitly passed flags (for example `--disable_wal=1`) and made `tools/db_crashtest_test.py` (`make db_crashtest_tests`, part of `make check`) fail in about 5 of 6 runs; that was already true before this rebase. The overrides now run in `gen_cmd_params` before command-line flags are merged, following the file-scoped WAL fault selection there, keyed on the effective wal_partitions (an explicit `--wal_partitions` included), and they fix the per-run test_secondary draw so wal_partitions does not change between runs of a series. The late N>1 check falls back to one partition on any conflict.
db_stress: the LockWAL check accepts GetCurrentWalFile() returning NotSupported at wal_partitions > 1 (each partition has its own current WAL); the sequence number check still runs. It lived in D130396596 until fbcode CI on the eb12834 rebase showed this diff's whitebox crash tests failing at wal_partitions=16 with "GetCurrentWalFile() failed: Not implemented": this diff is the first to draw wal_partitions > 1, so the check moved here.
Changes visible to existing users:
- db_crashtest.py now picks wal_partitions 2, 8 or 16 for about 1 in 3 invocations (or takes `--wal_partitions`). In those series `gen_cmd_params` sets partition_wal_usage, disable_wal, enable_pipelined_write, allow_concurrent_memtable_write, memtablerep, sync, test_secondary and continuous_verification_interval to values N>1 accepts, once for the series and before it applies command-line flags. An explicitly passed incompatible flag, or inplace_update_support=1, keeps the series at one partition. At N>1 the runs turn off ingest_wbwi_one_in and commit_bypass_memtable_one_in.
- New db_stress flag --sync_write_one_in (default 0). db_crashtest.py sets it to 10 or 100 in half of its runs at any wal_partitions, so default crash tests now mix sync and non-sync writes.
Test Plan:
`db_stress` builds at placement. Tip suites pass.
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_crashtest.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.
M4 fold: Absorbs
- GC26 Q5(e): db_crashtest.py runs no secondary and no continuous verification at N>1 (code only; no crash test was run).
- Net-zero pairs dropped (rule 2.7): none.
M4 B.1: PASS (clang-format 21.1.2 on the changed lines, make check-sources, debug build of db_stress; no test binary touched).
Rebased stack (facebook/rocksdb eb12834, fbcode/master b1d9881f429e): `tools/db_crashtest_test.py` gains `test_wal_partitions_steers_randomized_settings`, `test_explicit_flag_wins_over_wal_partitions`, `test_inplace_update_support_keeps_one_wal_partition`, `test_wal_partitions_stays_fixed_across_runs` and `test_explicit_wal_partitions_is_steered`, and `test_cf_consistency_randomizes_secondary` pins wal_partitions=1. The suite passes 89/89 in 40 runs with the random draw and in 5 runs each with wal_partitions pinned to 1, 2, 8 and 16; before the fix it failed in 6 of 6 runs at the previous stack. Neuters: with the old overrides restored the first three new tests fail; without the steering block the first fails; without fixing test_secondary and continuous_verification_interval `test_wal_partitions_stays_fixed_across_runs` fails; keying the steering on the drawn value only fails `test_explicit_wal_partitions_is_steered`.
Reviewers: generatedunixname1864816080879669
Differential Revision: https://phabricator.intern.facebook.com/D126533194
Tags: skip_dr_passed
JustinGaoF
pushed a commit
to JustinGaoF/rocksdb
that referenced
this pull request
Nov 19, 2026
…n builds Summary: The flip of the PartitionWAL stack (GC18 Q1-Q5). DB::Open accepts wal_partitions > 1 with an indexing partition_wal_usage in release and debug builds, with no sync point and no opt-in. kNone with N>1 and every other M1.4 rejection still fail with their exact Status. The wal_partitions doc and the release notes describe the shipped behaviour and the rollout order (readers first). Removes: - the N>1 gate in DBImpl::ValidateOptions and its debug sync point DBImpl::ValidateOptions:AllowWalPartitions; - the GC13 opt-in experimental_allow_wal_partitions_for_testing (D-G18k (i)): the option, its OPTIONS-map entry, Dump line, generated C accessors (two "removed" entries are added to tools/c_api_gen/api_compatibility_allowlist.json); db_bench, db_stress and test::SetWalPartitions stop setting it; - every use of the hook in tests and tools, including the hooks that tests folded below this commit carry at M4 (exception X14: FailedSyncPrepareLeavesNoStaleFence, GC23TimestampedSnapshotsSurviveFlushStress, GC19TornFirstRecordInBrandNewNTwoDbModes, CreateBrandNewPartitionedDb, GC23FloorOffForLaterGenerationHeads, GC24HistoryFloorScopeOnUpgrade) and the original hooks of SyncPrepareAfterSyncCommitSurvivesCrash, FU14SnapshotRace and FU14H6TornFirstRecordInBrandNewNTwoDb (GC26 Q5(d)). Adds db_wal_partitions_open_test (GC18 Q1, with GC20 Q9's edits), GC20 Q9's "with indexing it opens" leg of WalPartitionsValidation (exception X6), GC23 Q8's wal_partitions doc sentences (exception X6), and the release notes unreleased_history/new_features/wal_partitions.md, behavior_changes/partition_wal_sync_visibility.md (GC25) and behavior_changes/partition_wal_recovery_modes.md (GC26) (exception X19: they describe behaviour production builds reach only from this commit). Recorded exception: this commit stays a standalone diff on top of the stack and is never folded (GC18 round decision, design audit G3-C-2), so it can be reviewed, landed and reverted alone, and N>1 never becomes legal partway up the stack. M5 fold: Absorbs 10 A.1 entries (GC28 1, GC27 3, GC30 2, GC29a 2, GC31 1, GC32 1): the five new release-note files (X19-M5); the post-flip wal_partitions doc lines (GC27, GC30, GC29a); wal_partitions.md. Exceptions: X19-M5. Release notes added here (X19-M5): bug_fixes/partition_wal_recovery_and_visibility_fixes.md, new_features/partition_wal_file_scoped_resume.md, performance_improvements/partition_wal_targeted_gate_sync.md, performance_improvements/partition_wal_write_path_locks.md, performance_improvements/partition_wal_write_pipeline.md. Removes the X14-M5 hook lines: the AllowWalPartitions callbacks D123079329, D123701876, D123928339, D123971668, D127093323 and D127275775 added to their folded N>1 tests. M6 fold: removes the `DBImpl::ValidateOptions:AllowWalPartitions` hook lines added below the flip to the GC34 Q1 tests (`RunReplayedPrepareIsNotCut`); no other change. Benchmark (rebased stack, paired and interleaved): Release `db_bench` built at the rebased stack (fork f4c2cc3436 on facebook/rocksdb e732049; the final 7fd6043 differs only in transaction_test.cc). Workload: `fillrandom`, 3000 ops per thread, 4 KiB values, 64 column families, pipelined write off, auto compactions off, DB on /dev/shm. The latency-injection FileSystem adds a 200 us WAL append latency and a 200 us WAL sync latency (20 us jitter, fixed seed 1001). Profile S caps WAL append and sync bandwidth at 50 MB/s each. Profile S-sync caps only sync bandwidth (50 MB/s). There are three rounds, and each round runs every cell, rotating the cell order. The table reports the median of the three runs (min-max across runs). The ratio is the median of the per-round ratios against N=1 kNone. Host is shared: 1-minute load average 12-67 during the runs (other users). Sync column: `all` = `--sync`, `1-in-20` = `--sync_write_one_in=20`, `none` = no sync. | Profile | Sync | Cell | ops/s (median of 3) | min-max | vs N=1 kNone | mean write us | p99 write us | WAL appends | WAL syncs | |---|---|---|---|---|---|---|---|---|---| | S | all | N=1 kNone | 5425 | 5282-5490 | 1.00x | 11646 | 13984 | 6002 | 6002 | | S | all | N=1 indexed | 5374 | 4871-5456 | 0.98x | 11716 | 14528 | 6007 | 6005 | | S | all | N=8 | 20104 | 20098-20516 | 3.71x | 3163 | 6351 | 90202 | 48470 | | S | all | N=16 | 22746 | 21715-23222 | 4.14x | 2794 | 5075 | 133766 | 80580 | | S | 1-in-20 | N=1 kNone | 5659 | 5645-5672 | 1.00x | 11283 | 58960 | 6149 | 2042 | | S | 1-in-20 | N=1 indexed | 5669 | 5624-5680 | 1.00x | 11270 | 60891 | 6027 | 1916 | | S | 1-in-20 | N=8 | 21635 | 20743-21835 | 3.81x | 2940 | 6587 | 63675 | 20851 | | S | 1-in-20 | N=16 | 24240 | 23984-24506 | 4.29x | 2620 | 6208 | 105691 | 38739 | | S | none | N=1 kNone | 10627 | 10435-10702 | 1.00x | 6015 | 6595 | 6005 | 0 | | S | none | N=1 indexed | 10631 | 10433-10650 | 1.00x | 6012 | 6598 | 6007 | 0 | | S | none | N=8 | 48068 | 47452-48281 | 4.52x | 1318 | 2788 | 48464 | 0 | | S | none | N=16 | 63757 | 63551-63974 | 6.00x | 992 | 1881 | 83100 | 0 | | S-sync | all | N=1 kNone | 9725 | 9722-9781 | 1.00x | 6570 | 9790 | 6003 | 6003 | | S-sync | all | N=1 indexed | 9776 | 9770-9792 | 1.00x | 6539 | 9621 | 6006 | 6004 | | S-sync | all | N=8 | 28877 | 27685-29180 | 2.97x | 2208 | 4214 | 88995 | 46361 | | S-sync | all | N=16 | 27734 | 26727-29899 | 2.85x | 2292 | 4318 | 134123 | 78895 | | S-sync | 1-in-20 | N=1 kNone | 10263 | 10190-10338 | 1.00x | 6220 | 19308 | 6029 | 2525 | | S-sync | 1-in-20 | N=1 indexed | 10330 | 10159-10355 | 1.00x | 6180 | 28946 | 6029 | 2329 | | S-sync | 1-in-20 | N=8 | 29514 | 29500-29519 | 2.88x | 2152 | 5876 | 61844 | 21538 | | S-sync | 1-in-20 | N=16 | 30808 | 30736-31239 | 3.02x | 2059 | 4387 | 103682 | 39121 | | S-sync | none | N=1 kNone | 72763 | 72596-74166 | 1.00x | 873 | 1293 | 6013 | 0 | | S-sync | none | N=1 indexed | 74786 | 72987-75086 | 1.01x | 850 | 1285 | 6016 | 0 | | S-sync | none | N=8 | 123028 | 120951-124222 | 1.67x | 512 | 862 | 39044 | 0 | | S-sync | none | N=16 | 133228 | 129421-133491 | 1.80x | 471 | 855 | 71038 | 0 | | S, 16 threads | all | N=1 kNone | 4724 | 4387-4738 | 1.00x | 3346 | 6482 | 4022 | 4022 | | S, 16 threads | all | N=1 indexed | 4713 | 4707-4736 | 1.00x | 3334 | 6478 | 3958 | 3956 | | S, 16 threads | all | N=8 | 8494 | 8464-8529 | 1.80x | 1873 | 2895 | 40476 | 27290 | | S, 16 threads | all | N=16 | 9294 | 9250-9323 | 1.97x | 1711 | 2876 | 44226 | 34317 | All 84 runs exited 0. Command per cell: ``` db_bench --benchmarks=fillrandom --threads=64 --num=3000 --value_size=4096 \ --num_column_families=64 --wal_partitions=<N> --partition_wal_usage=<none|partition_by_column_family> \ --enable_pipelined_write=false --disable_auto_compactions=1 --statistics --histogram \ --inject_wal_latency --wal_append_latency_us=200 --wal_sync_latency_us=200 \ --wal_latency_jitter_us=20 --wal_latency_seed=1001 --seed=1001 \ --wal_append_bandwidth_mbps=<50|0> --wal_sync_bandwidth_mbps=50 [--sync | --sync_write_one_in=20] ``` N=1 against upstream (default options, no partitioning flags, no latency injection): release `db_bench` of this stack against release `db_bench` of facebook/rocksdb e732049, five rounds, alternating which binary runs first, DB on /dev/shm. | Workload | upstream e732049 ops/s (median) | min-max | this stack ops/s (median) | min-max | stack/upstream (median of per-round) | |---|---|---|---|---|---| | fillrandom, 64 threads x 20000, 64 CFs, 4 KiB values, no sync | 224575 | 219463-232611 | 220572 | 213377-226176 | 0.972x | | fillrandom, 16 threads x 200000, 1 KiB values, --sync | 532901 | 524086-611361 | 530771 | 525389-541405 | 0.999x | Per-round stack/upstream ratios: --sync 0.996, 0.999, 1.032, 1.000, 0.860; no sync 0.972, 1.007, 0.948, 0.951, 0.990. 1-minute load average 11-22 during the runs. All 20 runs exited 0. The earlier run of the same comparison on e591f5f measured 0.996x (--sync) and 0.979x (no sync). Stress (db_stress crash test with the latency-injection FileSystem wired in): `tools/db_crashtest.py` blackbox and whitebox, 1800 s each, at wal_partitions 1 and 8, on the stack rebased onto facebook/rocksdb eb12834 (fork 286fdab796, debug db_stress; the final stack differs only in clang-format line wrapping and in `tools/db_crashtest.py`/`db_crashtest_test.py`). Pinned: `--disable_wal=0 --partition_wal_usage=partition_by_column_family --enable_blob_direct_write=0 --best_efforts_recovery=0 --two_write_queues=0 --enable_pipelined_write=0 --unordered_write=0 --recycle_log_file_num=0 --track_and_verify_wals=0 --inplace_update_support=0 --use_optimistic_txn=0`, plus `--inject_wal_latency=1 --wal_append_latency_us=50 --wal_sync_latency_us=300 --wal_latency_jitter_us=50 --wal_append_bandwidth_mbps=200 --wal_sync_bandwidth_mbps=100`. Every db_stress command line in the logs was checked for WAL on, latency injection on and the intended wal_partitions; randomized overrides did not disable them. | Mode | wal_partitions | db_stress command lines | Result | |---|---|---|---| | blackbox | 1 | 31 | exit 0 | | blackbox | 8 | 31 | exit 0 | | whitebox | 1 | 16 | exit 0 | | whitebox | 8 | 26 | exit 0 | The same runs on the previous base (fork f4c2cc3436 on e732049) also exited 0 (31/31/22/12 command lines). The two fbcode sandcastle crash-test command lines that failed on the previous version (ASAN and blackbox, with `read_fault_one_in=1000`) were rerun locally against this stack, three times each for 1200 s: no failure. fbcode sandcastle crash tests: The six `rocksdb-contrun.sky` crash-test workflows ran on stack top 32fe728cb06b, scheduled 2026-11-10 05:32 UTC. The final stack differs from it only in test code, one comment and one line break (the ASAN and format fixes below); db_stress is unchanged. All six passed. | Workflow | Result | Finished (PST, 2026-11-10) | |---|---|---| | fbcode_blackbox_crash_test | pass | 00:57 | | fbcode_asan_blackbox_crash_test | pass | 00:57 | | fbcode_tsan_blackbox_crash_test | pass | 01:16 | | fbcode_whitebox_crash_test | pass | 03:37 | | fbcode_asan_whitebox_crash_test | pass | 03:37 | | fbcode_tsan_whitebox_crash_test | pass | 03:28 | Sandcastle jobs: 49539596750420932, 49539596750421833, 40532397491966602, 49539596750421523, 45035997124599077, 22518001256897652 (https://www.internalfb.com/intern/sandcastle/job/<id>/). On the previous submitted version two of these workflows had failed (the sandcastle P1 below); that fix is in this stack. Comprehensive review (15 rounds, whole 39-diff stack): Each round ran the comprehensive-diff-review protocol (read-only Opus reviewers; round 1 used four reviewers by area, later rounds one) against the cumulative stack, on facebook/rocksdb d6a7847 for rounds 1-7 and, after the rebase onto e591f5f (the RocksDB subtree of fbcode/warm), on the rebased stack for rounds 8-11, on facebook/rocksdb e732049 (fbcode/warm 4df7e0a0db7b) for rounds 12-13, on 9ce1bfb (fbcode/warm 37d097c1b953) for round 14 and on eb12834 (fbcode/master b1d9881f429e) for round 15. Rounds 14 and 15 reviewed the rebase delta. Rows marked sandcastle, external and crash test are defects found outside the review rounds and fixed the same way. Every P1/P2 was re-checked against the code, reproduced by a new test that fails first, fixed in the diff that introduced the code, and verified by a neuter (reverting the fix makes the test fail). Candidates are the fork's review folds of pwal/m6. | Round | Candidate | P1/P2 found | Fixed in | Regression test | |---|---|---|---|---| | 1 | pwal/m6 69c13fc | 4 P2: CMake missed db/log_merge.cc and log_merge_test; a secondary could not open or catch up beside an indexed primary with async_wal_precreate; a damaged first record in a WAL with an intact head floor and no span made the DB unopenable; commit_bypass_memtable failed after Prepare at N>1 | D120624825 (CMake), D127093323 (async_wal_precreate sanitized off when partition_wal_usage != kNone), D120649665 (HeadBounded counts the WAL's own head floor), D123079329 (bypass falls back to the memtable commit at N>1) | DBSecondaryTest.IndexedPrimaryDisablesAsyncWalPrecreate; DBWalPartitionCoverageTest.DamagedFirstRecordAfterUpgradeToTwoPartitions; TransactionPartitionedWalTest.CommitBypassMemtableCommitsNormally | | 2 | fold2 2e8c56707a8f | 2 P2: GetSortedWalFiles returned a false Corruption once coupled rotation retired an idle partition's metadata-only WAL that the MANIFEST tracks; GC24HistoryFloorScopeOnUpgrade still pinned the pre-fix outcome | D127093323, D127837663 | DBWritePartitionTest.SortedWalFilesListsIdlePartitionWals | | 3 | fold3 8b6590498 | 1 P2: that fix was keyed to the opener's wal_partitions, so read-only or N=1 openers still got the Corruption. Writing its test exposed a read-only open with WAL tracking off hitting `assert(recovery_ctx != nullptr)` in Recover; fixed too | D127093323 | DBWritePartitionTest.SortedWalFilesListsIdlePartitionWalsReadOnly | | 4 | fold5 c3c369362 | 1 P2: at N=1 indexed, a data-less current WAL got a cached synthetic start sequence 1, so GetUpdatesSince skipped the older WAL holding the requested sequence | D127093323 | DBWalIteratorTest.IndexedDataLessCurrentWalKeepsOlderWal | | 5 | fold6 6e3ad3889 | None. The per-diff gate then failed WalPartitions8/WritePreparedTransactionTest.{WC_WP_ForwardCompatibility, WP_WC_DBBackwardCompatibility}: listing every metadata-only WAL changed GetSortedWalFiles after a flush; reworked to upstream listing semantics | D127093323 | the two WritePrepared tests, unmodified | | 6 | fold7 376fac935 | 1 P2: the rework left MANIFEST-tracked metadata-only WALs out of GetSortedWalFiles, so a GetLiveFiles(flush_memtable=false) + GetSortedWalFiles copy failed to open ("Missing WAL with log number"). Now a tracked metadata-only WAL is listed (start sequence 1, not cached) and an untracked one is skipped | D127093323 | DBWritePartitionTest.LiveFilesAndSortedWalFilesCopyOpens | | 7 | fold8 431f2a98e | None (1 P3, below) | | | | 8 | rebased 188e02204b43 (onto e591f5f; two reviewers) | None | | | | sandcastle | previous submitted version | 1 P1 (fbcode crash tests with `read_fault_one_in=1000`): an injected WAL read I/O error during recovery surfaced as `Corruption: WAL index merge: WAL <n> head damaged and unattested` in the merged replay, and the classification pass ignored it | D120624825 (the merger keeps the read's IOError), D121636079/D121674557 (classification returns it), D123928339 (merged replay returns the merger's error before the damage checks) | LogMergeTest.FailedReadKeepsTheReadError; DBWALIndexTest.ClassificationReadIOErrorFailsRecovery; DBWalPartitionCoverageTest.MergeReadIOErrorFailsWithTheReadError | | 9 | 805ea60 | 2 P3 + 1 gap, fixed: sequential indexed replay replaced the read IOError with a generic one; the merger's error dropped the read's retryable/data-loss/scope attributes | D120415420, D120624825 | DBWALIndexTest.SequentialIndexedReplayReadIOErrorKeepsTheReadError; LogMergeTest.FailedReadKeepsTheReadErrorAttributes | | external | D119751506 reviewer comment | 1 P2: with manual_wal_flush the burned-index void cover appended to the WAL buffer without wal_write_mutex_, racing an application FlushWAL | D119751506 (takes the mutex as WriteToWAL does), D122412677 (per-partition mutex) | DBWALIndexTest.BurnedWALIndexCoverHoldsWALMutexWithManualFlush | | crash test | 805ea60 | 1 P2 (debug only): whitebox crash test at N=8 hit the FlushScheduler::Empty consistency assertion when another partition leader dequeued concurrently | D123079329 (Empty reads the head under the debug checking mutex; release builds unchanged) | DBWritePartitionTest.FlushSchedulerEmptyRacesAnotherLeadersDequeue | | 10 | 12aad1d | 1 P2: statuses on the merged-recovery read-error path left unchecked (ASSERT_STATUS_CHECKED abort) | D120624825, D123551605, D123701876, D123928339, D123971668, D127093323 (holders permitted, ignored reports marked) | the read-error tests above under ASSERT_STATUS_CHECKED | | 11 | 69a91e9 | None | | | | fbcode CI | previous submitted version | 1 P2 (build): D120624825 declared two private fields (`last_sequence_index_`, `last_sequence_wal_`) first used in D120649665, so clang failed with -Werror,-Wunused-private-field at D120624825 | D120624825 (the fields move to D120649665; later diffs unchanged) | clang per-diff build gate | | 12 | f4c2cc3436 (rebased onto e732049) | 1 P2 (tests): upstream's new TransactionTest.InplaceUpdateSupportRequiresWriteCommitted also runs in this stack's WalPartitions8 instantiation, where Open rejects its options; 3 deterministic failures | D127275775 (at wal_partitions > 1 the test asserts NotSupported) | the test itself: 3 failures before, 33/33 after | | 12 (re-review) | 7fd6043 | None | | | | fbcode CI | 7fd6043 | 1 P2 (ASAN, test-only): GC31FollowerExitGroup freed its local Env while the fixture's last options still pointed at it, so the next DestroyAndReopen read freed memory (heap-use-after-free in NGreaterThan1FollowerExitHandsFailureToLeader); and the rocks format check flagged a comment over 80 columns and one unjoined condition | D123701876 (the helper resets the fixture's env on exit); D121858039, D123079329, D123551605, D123971668 (clang-format output) | the test under ASAN: heap-use-after-free before, 4/4 and db_write_test 581/581 after; check-format.sh passes on all 39 diffs | | strict status | b19275b | 1 P2 (ASSERT_STATUS_CHECKED, GitHub CI): 27 aborts from unchecked statuses: a reader report superseded by a more specific recovery error, a per-record pending report on early returns, the gate sync's covered path, a background-error return, an ingestion early return, and three test-side cases. Release behaviour unchanged | D120415420, D120649665, D123476301, D123701876, D123928339, D123971668, D127837663 | the ASSERT_STATUS_CHECKED suite: 27 aborts before, 0 after | | 13 | f658359 | None | | | | 14 | m6-rb10 (rebased onto 9ce1bfb) | 1 P2 (tests, from my rebase resolution): upstream's new kSortedHash option config was not skipped at wal_partitions > 1, where Open accepts only the SkipList memtable, so 7 WalPartitions8/ExternalSSTFileTestN tests walking ChangeOptions failed to reopen | D127275775 (kSortedHash joins the N>1 skip list) | the 7 tests: fail before, pass after | | 15 | 286fdab796 (rebased onto eb12834) | 1 P2 (crash test): upstream meta#15626 moved the inplace_update_support sanitizing ahead of this stack's N>1 overrides, which turned allow_concurrent_memtable_write back on, so about 3% of default crash-test series failed DB::Open. Found while verifying it: the same overrides replaced explicitly passed flags and made `make db_crashtest_tests` fail in about 5 of 6 runs, already on the previous stack (1 more P2) | D126533194 (N>1 steering moved into gen_cmd_params, before command-line flags) | db_crashtest_test.py: 3 new tests, each failing with the old overrides | | 15 (re-review) | 0d68d5f821 | 2 P2 + 1 P3 in that fix: test_secondary was still drawn per run, so wal_partitions flipped between runs and a secondary could open over partition WALs; an explicit --wal_partitions was not steered; the new test helper did not pin the trie index (about 4% flaky) | D126533194 | test_wal_partitions_stays_fixed_across_runs, test_explicit_wal_partitions_is_steered (each fails under its neuter); suite 89/89 in 40 runs | | fbcode CI | V1.2 drafts (1686cdb39f) | 1 P2 (stack order, crash test): D126533194 is the first diff whose crash test draws wal_partitions > 1, but the db_stress LockWAL check that accepts GetCurrentWalFile() NotSupported at N>1 lived in this diff, so whitebox runs at D126533194 failed with "GetCurrentWalFile() failed: Not implemented" | D126533194 (the check moves down from this diff; the final tree is unchanged) | local blackbox at wal_partitions=8, lock_wal_one_in=2000: the old D126533194 fails on its 2nd run (192 errors), the new one passes 11/11 | Final state: all 39 diffs at fork 1686cdb39f on facebook/rocksdb eb12834, each mirrored byte-identically into its fbsource diff on fbcode/master b1d9881f429e (master has since gained one RocksDB commit, c043e8dfa272, touching include/rocksdb/options.h about 180 lines from this stack's hunks). At 286fdab796 (the final stack differs only in clang-format line wrapping and the crash-test Python): per-diff clang gate for all 39 diffs; full make suite 11192/11192; clang TSan once 709/709 and 100x 2600/2600; ASSERT_STATUS_CHECKED suite with no failures from this stack (range_locking_test only, below); crash tests above. At 1686cdb39f: db_write_test 581/581, the gap-filler tests, `tools/db_crashtest_test.py` 89/89, and fbcode/rocks/sandcastle/check-format.sh at every diff. Totals: 1 P1 and 20 P2 fixed. Open items (P3 or validation gaps, tracked as follow-ups, not fixed here): - ASSERT_STATUS_CHECKED: range_locking_test fails in that build mode at upstream e732049 too; it is not part of this stack. - Rebase gap (pre-existing): with recycle_log_file_num > 0, an indexed one-partition DB gets no WAL sequence-gap filler (upstream meta#15581 covers kNone only), so an ingestion gap at a WAL boundary can still stop point-in-time recovery there, as it did for every DB before meta#15581. - Round 9 F-002 (P3): consumer head checks report a WAL read I/O error as NotSupported. - Round 11 gap (low confidence, pre-existing): the void re-read during recovery can swallow a transient read IOError. - TSan with the gcc 11 runtime (libtsan.so.0) reports false "double lock of a mutex" on any std::condition_variable::wait_for mutex, upstream TransactionDB code included, because it does not intercept pthread_cond_clockwait. Use clang TSan. - Round 7 P3: after an open that writes supersession records without a dummy write (for example a WalFilter stop with avoid_flush_during_recovery=true), partition 0's untracked, data-less current WAL carries the supersession record. GetSortedWalFiles skips it, so a GetLiveFiles + GetSortedWalFiles copy could fail with "two live records share index". Checkpoint and BackupEngine are unaffected. Inferred from code, not reproduced. - Round 2 P3: WriteRecoverableState at N>1 can stamp the cached recoverable state inside an open fence during an auto-resumed retryable WAL error. - Round 1 P3s: the checkpoint/backup LockWAL race tests can stop on an ASSERT before joining their threads; GC31FollowerExitGroup orders writers with sleeps; standalone db_stress at N>1 trips on the default get_current_wal_file_one_in; checkpoint/backup at N>1 wait out a write stop. - Gaps: an indexed DB with wal_compression still caches start sequence 1 for a data-less WAL (as upstream does for compression-only WALs); HeadFloor() for a member with no surviving data is the last progress bound read (no production-reachable loss found). Reports (MetaMate): - Round 1: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-69c13fcb72e2-20261107t093444z - Round 2: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-fold2-2e8c56707a8f-20261107t175411z - Round 3: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-fold3-8b6590498-20261107t185930z - Round 4: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-fold5-c3c369362-20261107t192653z - Round 5: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-fold6-6e3ad3889-20261107t193256z - Round 6: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-fold7-376fac935-20261108t054421z - Round 7: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-fold8-431f2a98e-20261108t055310z - Round 11: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-rb2-69a91e9ba-20261110t022328z - Round 13: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-rb8-f6583590ed-20261110t195418z - Round 15 (final stack): https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-rb15-1686cdb39f-20261111t191953z Changes visible to existing users: - Removes DBOptions::experimental_allow_wal_partitions_for_testing, its "experimental_allow_wal_partitions_for_testing" options-string key (which no longer parses) and the C API functions rocksdb_options_set/get_experimental_allow_wal_partitions_for_testing. All were added earlier in this stack (D117251769) and never released. - The --wal_partitions help text of db_bench and db_stress changed. Test Plan: M4 B.1: PASS (clang-format 21.1.2 on the changed lines, make check-sources, debug build of db_options_test, db_wal_oracle_test, db_wal_partitions_open_test, db_write_test, latency_injection_fs_test, ldb_cmd_test, optimistic_transaction_test, options_settable_test, transaction_test, write_prepared_transaction_test, db_stress, db_bench, ldb); 4974 tests, 0 failed. M5 B.1: PASS (clang-format 21.1.2 on the changed lines, make check-sources, debug build of compaction_service_test, db_options_test, db_wal_oracle_test, db_wal_partitions_open_test, db_wal_test, db_write_test, latency_injection_fs_test, ldb_cmd_test, optimistic_transaction_test, options_settable_test, transaction_test, write_prepared_transaction_test, db_stress, db_bench, ldb); 7324 tests, 0 failed. M6 B.1: PASS (debug build and build_tools/gtest-parallel run of compaction_service_test db_options_test db_wal_oracle_test db_wal_partitions_open_test db_wal_test db_write_test latency_injection_fs_test ldb_cmd_test optimistic_transaction_test options_settable_test transaction_test write_prepared_transaction_test: 7340/7340). Rebased stack (e591f5f): PASS. Debug build and build_tools/gtest-parallel run of compaction_service_test db_options_test db_wal_oracle_test db_wal_partitions_open_test db_wal_test db_write_test latency_injection_fs_test ldb_cmd_test optimistic_transaction_test options_settable_test transaction_test write_prepared_transaction_test: 7559/7559. Full make suite 10540/10540. Rebased stack (e732049, fbcode/warm 4df7e0a0db7b) final: clang per-diff gates for all 39 diffs; full make suite 10576/10579 at f4c2cc3436 with the 3 round-12 failures fixed at 7fd6043 (transaction_test 3475/3475); clang TSan; crash tests and the two sandcastle repro command lines above. At b19275b: db_write_test under ASAN/UBSAN (clang) 581/581; clang per-diff gates for D121858039 through D123971668 rerun and pass; fbcode/rocks/sandcastle/check-format.sh passes at every diff. fbcode sandcastle crash tests (blackbox and whitebox; plain, ASAN, TSAN): 6/6 pass on 32fe728cb06b. Strict status (ASSERT_STATUS_CHECKED=1) suite at f658359: 0 aborts from this stack (27 before the fix). Rebased stack (facebook/rocksdb eb12834, fbcode/master b1d9881f429e) final: clang per-diff gates for all 39 diffs; full make suite 11192/11192; clang TSan 709/709 once and 2600/2600 at 100x; ASSERT_STATUS_CHECKED with only range_locking_test failing (not touched by this stack); crash tests blackbox and whitebox at wal_partitions 1 and 8 exit 0; `tools/db_crashtest_test.py` 89/89; check-format.sh passes at every diff. Differential Revision: https://phabricator.intern.facebook.com/D130396596
JustinGaoF
added a commit
to JustinGaoF/rocksdb
that referenced
this pull request
Nov 19, 2026
Summary:
M1 standalone S-B (S-GC13), carved from GC13 Q2 (see that round summary
for question evidence):
- `db_crashtest.py`: N sweep over {1,2,8,16} plus both sanitize stages
(N>1 admits indexed WALs only).
- `db_stress --sync_write_one_in` (flag and use) and `SetOptions`
`max_successive_merges` at N>1.
Placed above S-C (no dependency; order follows the M1 plan).
M2 fold (2026-10-22, `M2-FoldTasks.md` + `M2-Amendment.md`): Absorbs (M2) GC06's and GC11's N=1 crashtest fallbacks (`track_and_verify_wals`, OCC serial validation, `file_scope_wal_write_faults`).
Rebase onto facebook/rocksdb eb12834 (review round 15): upstream meta#15626 moved the inplace_update_support sanitizing to the start of `finalize_and_sanitize`, so the N>1 overrides that used to run there turned allow_concurrent_memtable_write back on after it, and DB::Open rejected the result. The same overrides also replaced explicitly passed flags (for example `--disable_wal=1`) and made `tools/db_crashtest_test.py` (`make db_crashtest_tests`, part of `make check`) fail in about 5 of 6 runs; that was already true before this rebase. The overrides now run in `gen_cmd_params` before command-line flags are merged, following the file-scoped WAL fault selection there, keyed on the effective wal_partitions (an explicit `--wal_partitions` included), and they fix the per-run test_secondary draw so wal_partitions does not change between runs of a series. The late N>1 check falls back to one partition on any conflict.
db_stress: the LockWAL check accepts GetCurrentWalFile() returning NotSupported at wal_partitions > 1 (each partition has its own current WAL); the sequence number check still runs. It lived in D130396596 until fbcode CI on the eb12834 rebase showed this diff's whitebox crash tests failing at wal_partitions=16 with "GetCurrentWalFile() failed: Not implemented": this diff is the first to draw wal_partitions > 1, so the check moved here.
Changes visible to existing users:
- db_crashtest.py now picks wal_partitions 2, 8 or 16 for about 1 in 3 invocations (or takes `--wal_partitions`). In those series `gen_cmd_params` sets partition_wal_usage, disable_wal, enable_pipelined_write, allow_concurrent_memtable_write, memtablerep, sync, test_secondary and continuous_verification_interval to values N>1 accepts, once for the series and before it applies command-line flags. An explicitly passed incompatible flag, or inplace_update_support=1, keeps the series at one partition. At N>1 the runs turn off ingest_wbwi_one_in and commit_bypass_memtable_one_in.
- New db_stress flag --sync_write_one_in (default 0). db_crashtest.py sets it to 10 or 100 in half of its runs at any wal_partitions, so default crash tests now mix sync and non-sync writes.
Test Plan:
`db_stress` builds at placement. Tip suites pass.
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_crashtest.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.
M4 fold: Absorbs
- GC26 Q5(e): db_crashtest.py runs no secondary and no continuous verification at N>1 (code only; no crash test was run).
- Net-zero pairs dropped (rule 2.7): none.
M4 B.1: PASS (clang-format 21.1.2 on the changed lines, make check-sources, debug build of db_stress; no test binary touched).
Rebased stack (facebook/rocksdb eb12834, fbcode/master b1d9881f429e): `tools/db_crashtest_test.py` gains `test_wal_partitions_steers_randomized_settings`, `test_explicit_flag_wins_over_wal_partitions`, `test_inplace_update_support_keeps_one_wal_partition`, `test_wal_partitions_stays_fixed_across_runs` and `test_explicit_wal_partitions_is_steered`, and `test_cf_consistency_randomizes_secondary` pins wal_partitions=1. The suite passes 89/89 in 40 runs with the random draw and in 5 runs each with wal_partitions pinned to 1, 2, 8 and 16; before the fix it failed in 6 of 6 runs at the previous stack. Neuters: with the old overrides restored the first three new tests fail; without the steering block the first fails; without fixing test_secondary and continuous_verification_interval `test_wal_partitions_stays_fixed_across_runs` fails; keying the steering on the drawn value only fails `test_explicit_wal_partitions_is_steered`.
Reviewers: generatedunixname1864816080879669
Differential Revision: https://phabricator.intern.facebook.com/D126533194
Tags: skip_dr_passed
JustinGaoF
pushed a commit
to JustinGaoF/rocksdb
that referenced
this pull request
Nov 19, 2026
…n builds Summary: The flip of the PartitionWAL stack (GC18 Q1-Q5). DB::Open accepts wal_partitions > 1 with an indexing partition_wal_usage in release and debug builds, with no sync point and no opt-in. kNone with N>1 and every other M1.4 rejection still fail with their exact Status. The wal_partitions doc and the release notes describe the shipped behaviour and the rollout order (readers first). Removes: - the N>1 gate in DBImpl::ValidateOptions and its debug sync point DBImpl::ValidateOptions:AllowWalPartitions; - the GC13 opt-in experimental_allow_wal_partitions_for_testing (D-G18k (i)): the option, its OPTIONS-map entry, Dump line, generated C accessors (two "removed" entries are added to tools/c_api_gen/api_compatibility_allowlist.json); db_bench, db_stress and test::SetWalPartitions stop setting it; - every use of the hook in tests and tools, including the hooks that tests folded below this commit carry at M4 (exception X14: FailedSyncPrepareLeavesNoStaleFence, GC23TimestampedSnapshotsSurviveFlushStress, GC19TornFirstRecordInBrandNewNTwoDbModes, CreateBrandNewPartitionedDb, GC23FloorOffForLaterGenerationHeads, GC24HistoryFloorScopeOnUpgrade) and the original hooks of SyncPrepareAfterSyncCommitSurvivesCrash, FU14SnapshotRace and FU14H6TornFirstRecordInBrandNewNTwoDb (GC26 Q5(d)). Adds db_wal_partitions_open_test (GC18 Q1, with GC20 Q9's edits), GC20 Q9's "with indexing it opens" leg of WalPartitionsValidation (exception X6), GC23 Q8's wal_partitions doc sentences (exception X6), and the release notes unreleased_history/new_features/wal_partitions.md, behavior_changes/partition_wal_sync_visibility.md (GC25) and behavior_changes/partition_wal_recovery_modes.md (GC26) (exception X19: they describe behaviour production builds reach only from this commit). Recorded exception: this commit stays a standalone diff on top of the stack and is never folded (GC18 round decision, design audit G3-C-2), so it can be reviewed, landed and reverted alone, and N>1 never becomes legal partway up the stack. M5 fold: Absorbs 10 A.1 entries (GC28 1, GC27 3, GC30 2, GC29a 2, GC31 1, GC32 1): the five new release-note files (X19-M5); the post-flip wal_partitions doc lines (GC27, GC30, GC29a); wal_partitions.md. Exceptions: X19-M5. Release notes added here (X19-M5): bug_fixes/partition_wal_recovery_and_visibility_fixes.md, new_features/partition_wal_file_scoped_resume.md, performance_improvements/partition_wal_targeted_gate_sync.md, performance_improvements/partition_wal_write_path_locks.md, performance_improvements/partition_wal_write_pipeline.md. Removes the X14-M5 hook lines: the AllowWalPartitions callbacks D123079329, D123701876, D123928339, D123971668, D127093323 and D127275775 added to their folded N>1 tests. M6 fold: removes the `DBImpl::ValidateOptions:AllowWalPartitions` hook lines added below the flip to the GC34 Q1 tests (`RunReplayedPrepareIsNotCut`); no other change. Benchmark (rebased stack, paired and interleaved): Release `db_bench` built at the rebased stack (fork f4c2cc3436 on facebook/rocksdb e732049; the final 7fd6043 differs only in transaction_test.cc). Workload: `fillrandom`, 3000 ops per thread, 4 KiB values, 64 column families, pipelined write off, auto compactions off, DB on /dev/shm. The latency-injection FileSystem adds a 200 us WAL append latency and a 200 us WAL sync latency (20 us jitter, fixed seed 1001). Profile S caps WAL append and sync bandwidth at 50 MB/s each. Profile S-sync caps only sync bandwidth (50 MB/s). There are three rounds, and each round runs every cell, rotating the cell order. The table reports the median of the three runs (min-max across runs). The ratio is the median of the per-round ratios against N=1 kNone. Host is shared: 1-minute load average 12-67 during the runs (other users). Sync column: `all` = `--sync`, `1-in-20` = `--sync_write_one_in=20`, `none` = no sync. | Profile | Sync | Cell | ops/s (median of 3) | min-max | vs N=1 kNone | mean write us | p99 write us | WAL appends | WAL syncs | |---|---|---|---|---|---|---|---|---|---| | S | all | N=1 kNone | 5425 | 5282-5490 | 1.00x | 11646 | 13984 | 6002 | 6002 | | S | all | N=1 indexed | 5374 | 4871-5456 | 0.98x | 11716 | 14528 | 6007 | 6005 | | S | all | N=8 | 20104 | 20098-20516 | 3.71x | 3163 | 6351 | 90202 | 48470 | | S | all | N=16 | 22746 | 21715-23222 | 4.14x | 2794 | 5075 | 133766 | 80580 | | S | 1-in-20 | N=1 kNone | 5659 | 5645-5672 | 1.00x | 11283 | 58960 | 6149 | 2042 | | S | 1-in-20 | N=1 indexed | 5669 | 5624-5680 | 1.00x | 11270 | 60891 | 6027 | 1916 | | S | 1-in-20 | N=8 | 21635 | 20743-21835 | 3.81x | 2940 | 6587 | 63675 | 20851 | | S | 1-in-20 | N=16 | 24240 | 23984-24506 | 4.29x | 2620 | 6208 | 105691 | 38739 | | S | none | N=1 kNone | 10627 | 10435-10702 | 1.00x | 6015 | 6595 | 6005 | 0 | | S | none | N=1 indexed | 10631 | 10433-10650 | 1.00x | 6012 | 6598 | 6007 | 0 | | S | none | N=8 | 48068 | 47452-48281 | 4.52x | 1318 | 2788 | 48464 | 0 | | S | none | N=16 | 63757 | 63551-63974 | 6.00x | 992 | 1881 | 83100 | 0 | | S-sync | all | N=1 kNone | 9725 | 9722-9781 | 1.00x | 6570 | 9790 | 6003 | 6003 | | S-sync | all | N=1 indexed | 9776 | 9770-9792 | 1.00x | 6539 | 9621 | 6006 | 6004 | | S-sync | all | N=8 | 28877 | 27685-29180 | 2.97x | 2208 | 4214 | 88995 | 46361 | | S-sync | all | N=16 | 27734 | 26727-29899 | 2.85x | 2292 | 4318 | 134123 | 78895 | | S-sync | 1-in-20 | N=1 kNone | 10263 | 10190-10338 | 1.00x | 6220 | 19308 | 6029 | 2525 | | S-sync | 1-in-20 | N=1 indexed | 10330 | 10159-10355 | 1.00x | 6180 | 28946 | 6029 | 2329 | | S-sync | 1-in-20 | N=8 | 29514 | 29500-29519 | 2.88x | 2152 | 5876 | 61844 | 21538 | | S-sync | 1-in-20 | N=16 | 30808 | 30736-31239 | 3.02x | 2059 | 4387 | 103682 | 39121 | | S-sync | none | N=1 kNone | 72763 | 72596-74166 | 1.00x | 873 | 1293 | 6013 | 0 | | S-sync | none | N=1 indexed | 74786 | 72987-75086 | 1.01x | 850 | 1285 | 6016 | 0 | | S-sync | none | N=8 | 123028 | 120951-124222 | 1.67x | 512 | 862 | 39044 | 0 | | S-sync | none | N=16 | 133228 | 129421-133491 | 1.80x | 471 | 855 | 71038 | 0 | | S, 16 threads | all | N=1 kNone | 4724 | 4387-4738 | 1.00x | 3346 | 6482 | 4022 | 4022 | | S, 16 threads | all | N=1 indexed | 4713 | 4707-4736 | 1.00x | 3334 | 6478 | 3958 | 3956 | | S, 16 threads | all | N=8 | 8494 | 8464-8529 | 1.80x | 1873 | 2895 | 40476 | 27290 | | S, 16 threads | all | N=16 | 9294 | 9250-9323 | 1.97x | 1711 | 2876 | 44226 | 34317 | All 84 runs exited 0. Command per cell: ``` db_bench --benchmarks=fillrandom --threads=64 --num=3000 --value_size=4096 \ --num_column_families=64 --wal_partitions=<N> --partition_wal_usage=<none|partition_by_column_family> \ --enable_pipelined_write=false --disable_auto_compactions=1 --statistics --histogram \ --inject_wal_latency --wal_append_latency_us=200 --wal_sync_latency_us=200 \ --wal_latency_jitter_us=20 --wal_latency_seed=1001 --seed=1001 \ --wal_append_bandwidth_mbps=<50|0> --wal_sync_bandwidth_mbps=50 [--sync | --sync_write_one_in=20] ``` N=1 against upstream (default options, no partitioning flags, no latency injection): release `db_bench` of this stack against release `db_bench` of facebook/rocksdb e732049, five rounds, alternating which binary runs first, DB on /dev/shm. | Workload | upstream e732049 ops/s (median) | min-max | this stack ops/s (median) | min-max | stack/upstream (median of per-round) | |---|---|---|---|---|---| | fillrandom, 64 threads x 20000, 64 CFs, 4 KiB values, no sync | 224575 | 219463-232611 | 220572 | 213377-226176 | 0.972x | | fillrandom, 16 threads x 200000, 1 KiB values, --sync | 532901 | 524086-611361 | 530771 | 525389-541405 | 0.999x | Per-round stack/upstream ratios: --sync 0.996, 0.999, 1.032, 1.000, 0.860; no sync 0.972, 1.007, 0.948, 0.951, 0.990. 1-minute load average 11-22 during the runs. All 20 runs exited 0. The earlier run of the same comparison on e591f5f measured 0.996x (--sync) and 0.979x (no sync). Stress (db_stress crash test with the latency-injection FileSystem wired in): `tools/db_crashtest.py` blackbox and whitebox, 1800 s each, at wal_partitions 1 and 8, on the stack rebased onto facebook/rocksdb eb12834 (fork 286fdab796, debug db_stress; the final stack differs only in clang-format line wrapping and in `tools/db_crashtest.py`/`db_crashtest_test.py`). Pinned: `--disable_wal=0 --partition_wal_usage=partition_by_column_family --enable_blob_direct_write=0 --best_efforts_recovery=0 --two_write_queues=0 --enable_pipelined_write=0 --unordered_write=0 --recycle_log_file_num=0 --track_and_verify_wals=0 --inplace_update_support=0 --use_optimistic_txn=0`, plus `--inject_wal_latency=1 --wal_append_latency_us=50 --wal_sync_latency_us=300 --wal_latency_jitter_us=50 --wal_append_bandwidth_mbps=200 --wal_sync_bandwidth_mbps=100`. Every db_stress command line in the logs was checked for WAL on, latency injection on and the intended wal_partitions; randomized overrides did not disable them. | Mode | wal_partitions | db_stress command lines | Result | |---|---|---|---| | blackbox | 1 | 31 | exit 0 | | blackbox | 8 | 31 | exit 0 | | whitebox | 1 | 16 | exit 0 | | whitebox | 8 | 26 | exit 0 | The same runs on the previous base (fork f4c2cc3436 on e732049) also exited 0 (31/31/22/12 command lines). The two fbcode sandcastle crash-test command lines that failed on the previous version (ASAN and blackbox, with `read_fault_one_in=1000`) were rerun locally against this stack, three times each for 1200 s: no failure. fbcode sandcastle crash tests: The six `rocksdb-contrun.sky` crash-test workflows ran on stack top 32fe728cb06b, scheduled 2026-11-10 05:32 UTC. The final stack differs from it only in test code, one comment and one line break (the ASAN and format fixes below); db_stress is unchanged. All six passed. | Workflow | Result | Finished (PST, 2026-11-10) | |---|---|---| | fbcode_blackbox_crash_test | pass | 00:57 | | fbcode_asan_blackbox_crash_test | pass | 00:57 | | fbcode_tsan_blackbox_crash_test | pass | 01:16 | | fbcode_whitebox_crash_test | pass | 03:37 | | fbcode_asan_whitebox_crash_test | pass | 03:37 | | fbcode_tsan_whitebox_crash_test | pass | 03:28 | Sandcastle jobs: 49539596750420932, 49539596750421833, 40532397491966602, 49539596750421523, 45035997124599077, 22518001256897652 (https://www.internalfb.com/intern/sandcastle/job/<id>/). On the previous submitted version two of these workflows had failed (the sandcastle P1 below); that fix is in this stack. Comprehensive review (15 rounds, whole 39-diff stack): Each round ran the comprehensive-diff-review protocol (read-only Opus reviewers; round 1 used four reviewers by area, later rounds one) against the cumulative stack, on facebook/rocksdb d6a7847 for rounds 1-7 and, after the rebase onto e591f5f (the RocksDB subtree of fbcode/warm), on the rebased stack for rounds 8-11, on facebook/rocksdb e732049 (fbcode/warm 4df7e0a0db7b) for rounds 12-13, on 9ce1bfb (fbcode/warm 37d097c1b953) for round 14 and on eb12834 (fbcode/master b1d9881f429e) for round 15. Rounds 14 and 15 reviewed the rebase delta. Rows marked sandcastle, external and crash test are defects found outside the review rounds and fixed the same way. Every P1/P2 was re-checked against the code, reproduced by a new test that fails first, fixed in the diff that introduced the code, and verified by a neuter (reverting the fix makes the test fail). Candidates are the fork's review folds of pwal/m6. | Round | Candidate | P1/P2 found | Fixed in | Regression test | |---|---|---|---|---| | 1 | pwal/m6 69c13fc | 4 P2: CMake missed db/log_merge.cc and log_merge_test; a secondary could not open or catch up beside an indexed primary with async_wal_precreate; a damaged first record in a WAL with an intact head floor and no span made the DB unopenable; commit_bypass_memtable failed after Prepare at N>1 | D120624825 (CMake), D127093323 (async_wal_precreate sanitized off when partition_wal_usage != kNone), D120649665 (HeadBounded counts the WAL's own head floor), D123079329 (bypass falls back to the memtable commit at N>1) | DBSecondaryTest.IndexedPrimaryDisablesAsyncWalPrecreate; DBWalPartitionCoverageTest.DamagedFirstRecordAfterUpgradeToTwoPartitions; TransactionPartitionedWalTest.CommitBypassMemtableCommitsNormally | | 2 | fold2 2e8c56707a8f | 2 P2: GetSortedWalFiles returned a false Corruption once coupled rotation retired an idle partition's metadata-only WAL that the MANIFEST tracks; GC24HistoryFloorScopeOnUpgrade still pinned the pre-fix outcome | D127093323, D127837663 | DBWritePartitionTest.SortedWalFilesListsIdlePartitionWals | | 3 | fold3 8b6590498 | 1 P2: that fix was keyed to the opener's wal_partitions, so read-only or N=1 openers still got the Corruption. Writing its test exposed a read-only open with WAL tracking off hitting `assert(recovery_ctx != nullptr)` in Recover; fixed too | D127093323 | DBWritePartitionTest.SortedWalFilesListsIdlePartitionWalsReadOnly | | 4 | fold5 c3c369362 | 1 P2: at N=1 indexed, a data-less current WAL got a cached synthetic start sequence 1, so GetUpdatesSince skipped the older WAL holding the requested sequence | D127093323 | DBWalIteratorTest.IndexedDataLessCurrentWalKeepsOlderWal | | 5 | fold6 6e3ad3889 | None. The per-diff gate then failed WalPartitions8/WritePreparedTransactionTest.{WC_WP_ForwardCompatibility, WP_WC_DBBackwardCompatibility}: listing every metadata-only WAL changed GetSortedWalFiles after a flush; reworked to upstream listing semantics | D127093323 | the two WritePrepared tests, unmodified | | 6 | fold7 376fac935 | 1 P2: the rework left MANIFEST-tracked metadata-only WALs out of GetSortedWalFiles, so a GetLiveFiles(flush_memtable=false) + GetSortedWalFiles copy failed to open ("Missing WAL with log number"). Now a tracked metadata-only WAL is listed (start sequence 1, not cached) and an untracked one is skipped | D127093323 | DBWritePartitionTest.LiveFilesAndSortedWalFilesCopyOpens | | 7 | fold8 431f2a98e | None (1 P3, below) | | | | 8 | rebased 188e02204b43 (onto e591f5f; two reviewers) | None | | | | sandcastle | previous submitted version | 1 P1 (fbcode crash tests with `read_fault_one_in=1000`): an injected WAL read I/O error during recovery surfaced as `Corruption: WAL index merge: WAL <n> head damaged and unattested` in the merged replay, and the classification pass ignored it | D120624825 (the merger keeps the read's IOError), D121636079/D121674557 (classification returns it), D123928339 (merged replay returns the merger's error before the damage checks) | LogMergeTest.FailedReadKeepsTheReadError; DBWALIndexTest.ClassificationReadIOErrorFailsRecovery; DBWalPartitionCoverageTest.MergeReadIOErrorFailsWithTheReadError | | 9 | 805ea60 | 2 P3 + 1 gap, fixed: sequential indexed replay replaced the read IOError with a generic one; the merger's error dropped the read's retryable/data-loss/scope attributes | D120415420, D120624825 | DBWALIndexTest.SequentialIndexedReplayReadIOErrorKeepsTheReadError; LogMergeTest.FailedReadKeepsTheReadErrorAttributes | | external | D119751506 reviewer comment | 1 P2: with manual_wal_flush the burned-index void cover appended to the WAL buffer without wal_write_mutex_, racing an application FlushWAL | D119751506 (takes the mutex as WriteToWAL does), D122412677 (per-partition mutex) | DBWALIndexTest.BurnedWALIndexCoverHoldsWALMutexWithManualFlush | | crash test | 805ea60 | 1 P2 (debug only): whitebox crash test at N=8 hit the FlushScheduler::Empty consistency assertion when another partition leader dequeued concurrently | D123079329 (Empty reads the head under the debug checking mutex; release builds unchanged) | DBWritePartitionTest.FlushSchedulerEmptyRacesAnotherLeadersDequeue | | 10 | 12aad1d | 1 P2: statuses on the merged-recovery read-error path left unchecked (ASSERT_STATUS_CHECKED abort) | D120624825, D123551605, D123701876, D123928339, D123971668, D127093323 (holders permitted, ignored reports marked) | the read-error tests above under ASSERT_STATUS_CHECKED | | 11 | 69a91e9 | None | | | | fbcode CI | previous submitted version | 1 P2 (build): D120624825 declared two private fields (`last_sequence_index_`, `last_sequence_wal_`) first used in D120649665, so clang failed with -Werror,-Wunused-private-field at D120624825 | D120624825 (the fields move to D120649665; later diffs unchanged) | clang per-diff build gate | | 12 | f4c2cc3436 (rebased onto e732049) | 1 P2 (tests): upstream's new TransactionTest.InplaceUpdateSupportRequiresWriteCommitted also runs in this stack's WalPartitions8 instantiation, where Open rejects its options; 3 deterministic failures | D127275775 (at wal_partitions > 1 the test asserts NotSupported) | the test itself: 3 failures before, 33/33 after | | 12 (re-review) | 7fd6043 | None | | | | fbcode CI | 7fd6043 | 1 P2 (ASAN, test-only): GC31FollowerExitGroup freed its local Env while the fixture's last options still pointed at it, so the next DestroyAndReopen read freed memory (heap-use-after-free in NGreaterThan1FollowerExitHandsFailureToLeader); and the rocks format check flagged a comment over 80 columns and one unjoined condition | D123701876 (the helper resets the fixture's env on exit); D121858039, D123079329, D123551605, D123971668 (clang-format output) | the test under ASAN: heap-use-after-free before, 4/4 and db_write_test 581/581 after; check-format.sh passes on all 39 diffs | | strict status | b19275b | 1 P2 (ASSERT_STATUS_CHECKED, GitHub CI): 27 aborts from unchecked statuses: a reader report superseded by a more specific recovery error, a per-record pending report on early returns, the gate sync's covered path, a background-error return, an ingestion early return, and three test-side cases. Release behaviour unchanged | D120415420, D120649665, D123476301, D123701876, D123928339, D123971668, D127837663 | the ASSERT_STATUS_CHECKED suite: 27 aborts before, 0 after | | 13 | f658359 | None | | | | 14 | m6-rb10 (rebased onto 9ce1bfb) | 1 P2 (tests, from my rebase resolution): upstream's new kSortedHash option config was not skipped at wal_partitions > 1, where Open accepts only the SkipList memtable, so 7 WalPartitions8/ExternalSSTFileTestN tests walking ChangeOptions failed to reopen | D127275775 (kSortedHash joins the N>1 skip list) | the 7 tests: fail before, pass after | | 15 | 286fdab796 (rebased onto eb12834) | 1 P2 (crash test): upstream meta#15626 moved the inplace_update_support sanitizing ahead of this stack's N>1 overrides, which turned allow_concurrent_memtable_write back on, so about 3% of default crash-test series failed DB::Open. Found while verifying it: the same overrides replaced explicitly passed flags and made `make db_crashtest_tests` fail in about 5 of 6 runs, already on the previous stack (1 more P2) | D126533194 (N>1 steering moved into gen_cmd_params, before command-line flags) | db_crashtest_test.py: 3 new tests, each failing with the old overrides | | 15 (re-review) | 0d68d5f821 | 2 P2 + 1 P3 in that fix: test_secondary was still drawn per run, so wal_partitions flipped between runs and a secondary could open over partition WALs; an explicit --wal_partitions was not steered; the new test helper did not pin the trie index (about 4% flaky) | D126533194 | test_wal_partitions_stays_fixed_across_runs, test_explicit_wal_partitions_is_steered (each fails under its neuter); suite 89/89 in 40 runs | | fbcode CI | V1.2 drafts (1686cdb39f) | 1 P2 (stack order, crash test): D126533194 is the first diff whose crash test draws wal_partitions > 1, but the db_stress LockWAL check that accepts GetCurrentWalFile() NotSupported at N>1 lived in this diff, so whitebox runs at D126533194 failed with "GetCurrentWalFile() failed: Not implemented" | D126533194 (the check moves down from this diff; the final tree is unchanged) | local blackbox at wal_partitions=8, lock_wal_one_in=2000: the old D126533194 fails on its 2nd run (192 errors), the new one passes 11/11 | Final state: all 39 diffs at fork 1686cdb39f on facebook/rocksdb eb12834, each mirrored byte-identically into its fbsource diff on fbcode/master b1d9881f429e (master has since gained one RocksDB commit, c043e8dfa272, touching include/rocksdb/options.h about 180 lines from this stack's hunks). At 286fdab796 (the final stack differs only in clang-format line wrapping and the crash-test Python): per-diff clang gate for all 39 diffs; full make suite 11192/11192; clang TSan once 709/709 and 100x 2600/2600; ASSERT_STATUS_CHECKED suite with no failures from this stack (range_locking_test only, below); crash tests above. At 1686cdb39f: db_write_test 581/581, the gap-filler tests, `tools/db_crashtest_test.py` 89/89, and fbcode/rocks/sandcastle/check-format.sh at every diff. Totals: 1 P1 and 20 P2 fixed. Open items (P3 or validation gaps, tracked as follow-ups, not fixed here): - ASSERT_STATUS_CHECKED: range_locking_test fails in that build mode at upstream e732049 too; it is not part of this stack. - Rebase gap (pre-existing): with recycle_log_file_num > 0, an indexed one-partition DB gets no WAL sequence-gap filler (upstream meta#15581 covers kNone only), so an ingestion gap at a WAL boundary can still stop point-in-time recovery there, as it did for every DB before meta#15581. - Round 9 F-002 (P3): consumer head checks report a WAL read I/O error as NotSupported. - Round 11 gap (low confidence, pre-existing): the void re-read during recovery can swallow a transient read IOError. - TSan with the gcc 11 runtime (libtsan.so.0) reports false "double lock of a mutex" on any std::condition_variable::wait_for mutex, upstream TransactionDB code included, because it does not intercept pthread_cond_clockwait. Use clang TSan. - Round 7 P3: after an open that writes supersession records without a dummy write (for example a WalFilter stop with avoid_flush_during_recovery=true), partition 0's untracked, data-less current WAL carries the supersession record. GetSortedWalFiles skips it, so a GetLiveFiles + GetSortedWalFiles copy could fail with "two live records share index". Checkpoint and BackupEngine are unaffected. Inferred from code, not reproduced. - Round 2 P3: WriteRecoverableState at N>1 can stamp the cached recoverable state inside an open fence during an auto-resumed retryable WAL error. - Round 1 P3s: the checkpoint/backup LockWAL race tests can stop on an ASSERT before joining their threads; GC31FollowerExitGroup orders writers with sleeps; standalone db_stress at N>1 trips on the default get_current_wal_file_one_in; checkpoint/backup at N>1 wait out a write stop. - Gaps: an indexed DB with wal_compression still caches start sequence 1 for a data-less WAL (as upstream does for compression-only WALs); HeadFloor() for a member with no surviving data is the last progress bound read (no production-reachable loss found). Reports (MetaMate): - Round 1: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-69c13fcb72e2-20261107t093444z - Round 2: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-fold2-2e8c56707a8f-20261107t175411z - Round 3: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-fold3-8b6590498-20261107t185930z - Round 4: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-fold5-c3c369362-20261107t192653z - Round 5: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-fold6-6e3ad3889-20261107t193256z - Round 6: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-fold7-376fac935-20261108t054421z - Round 7: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-fold8-431f2a98e-20261108t055310z - Round 11: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-rb2-69a91e9ba-20261110t022328z - Round 13: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-rb8-f6583590ed-20261110t195418z - Round 15 (final stack): https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-rb15-1686cdb39f-20261111t191953z Changes visible to existing users: - Removes DBOptions::experimental_allow_wal_partitions_for_testing, its "experimental_allow_wal_partitions_for_testing" options-string key (which no longer parses) and the C API functions rocksdb_options_set/get_experimental_allow_wal_partitions_for_testing. All were added earlier in this stack (D117251769) and never released. - The --wal_partitions help text of db_bench and db_stress changed. Test Plan: M4 B.1: PASS (clang-format 21.1.2 on the changed lines, make check-sources, debug build of db_options_test, db_wal_oracle_test, db_wal_partitions_open_test, db_write_test, latency_injection_fs_test, ldb_cmd_test, optimistic_transaction_test, options_settable_test, transaction_test, write_prepared_transaction_test, db_stress, db_bench, ldb); 4974 tests, 0 failed. M5 B.1: PASS (clang-format 21.1.2 on the changed lines, make check-sources, debug build of compaction_service_test, db_options_test, db_wal_oracle_test, db_wal_partitions_open_test, db_wal_test, db_write_test, latency_injection_fs_test, ldb_cmd_test, optimistic_transaction_test, options_settable_test, transaction_test, write_prepared_transaction_test, db_stress, db_bench, ldb); 7324 tests, 0 failed. M6 B.1: PASS (debug build and build_tools/gtest-parallel run of compaction_service_test db_options_test db_wal_oracle_test db_wal_partitions_open_test db_wal_test db_write_test latency_injection_fs_test ldb_cmd_test optimistic_transaction_test options_settable_test transaction_test write_prepared_transaction_test: 7340/7340). Rebased stack (e591f5f): PASS. Debug build and build_tools/gtest-parallel run of compaction_service_test db_options_test db_wal_oracle_test db_wal_partitions_open_test db_wal_test db_write_test latency_injection_fs_test ldb_cmd_test optimistic_transaction_test options_settable_test transaction_test write_prepared_transaction_test: 7559/7559. Full make suite 10540/10540. Rebased stack (e732049, fbcode/warm 4df7e0a0db7b) final: clang per-diff gates for all 39 diffs; full make suite 10576/10579 at f4c2cc3436 with the 3 round-12 failures fixed at 7fd6043 (transaction_test 3475/3475); clang TSan; crash tests and the two sandcastle repro command lines above. At b19275b: db_write_test under ASAN/UBSAN (clang) 581/581; clang per-diff gates for D121858039 through D123971668 rerun and pass; fbcode/rocks/sandcastle/check-format.sh passes at every diff. fbcode sandcastle crash tests (blackbox and whitebox; plain, ASAN, TSAN): 6/6 pass on 32fe728cb06b. Strict status (ASSERT_STATUS_CHECKED=1) suite at f658359: 0 aborts from this stack (27 before the fix). Rebased stack (facebook/rocksdb eb12834, fbcode/master b1d9881f429e) final: clang per-diff gates for all 39 diffs; full make suite 11192/11192; clang TSan 709/709 once and 2600/2600 at 100x; ASSERT_STATUS_CHECKED with only range_locking_test failing (not touched by this stack); crash tests blackbox and whitebox at wal_partitions 1 and 8 exit 0; `tools/db_crashtest_test.py` 89/89; check-format.sh passes at every diff. Differential Revision: https://phabricator.intern.facebook.com/D130396596
JustinGaoF
pushed a commit
to JustinGaoF/rocksdb
that referenced
this pull request
Nov 19, 2026
…n builds Summary: The flip of the PartitionWAL stack (GC18 Q1-Q5). DB::Open accepts wal_partitions > 1 with an indexing partition_wal_usage in release and debug builds, with no sync point and no opt-in. kNone with N>1 and every other M1.4 rejection still fail with their exact Status. The wal_partitions doc and the release notes describe the shipped behaviour and the rollout order (readers first). Removes: - the N>1 gate in DBImpl::ValidateOptions and its debug sync point DBImpl::ValidateOptions:AllowWalPartitions; - the GC13 opt-in experimental_allow_wal_partitions_for_testing (D-G18k (i)): the option, its OPTIONS-map entry, Dump line, generated C accessors (two "removed" entries are added to tools/c_api_gen/api_compatibility_allowlist.json); db_bench, db_stress and test::SetWalPartitions stop setting it; - every use of the hook in tests and tools, including the hooks that tests folded below this commit carry at M4 (exception X14: FailedSyncPrepareLeavesNoStaleFence, GC23TimestampedSnapshotsSurviveFlushStress, GC19TornFirstRecordInBrandNewNTwoDbModes, CreateBrandNewPartitionedDb, GC23FloorOffForLaterGenerationHeads, GC24HistoryFloorScopeOnUpgrade) and the original hooks of SyncPrepareAfterSyncCommitSurvivesCrash, FU14SnapshotRace and FU14H6TornFirstRecordInBrandNewNTwoDb (GC26 Q5(d)). Adds db_wal_partitions_open_test (GC18 Q1, with GC20 Q9's edits), GC20 Q9's "with indexing it opens" leg of WalPartitionsValidation (exception X6), GC23 Q8's wal_partitions doc sentences (exception X6), and the release notes unreleased_history/new_features/wal_partitions.md, behavior_changes/partition_wal_sync_visibility.md (GC25) and behavior_changes/partition_wal_recovery_modes.md (GC26) (exception X19: they describe behaviour production builds reach only from this commit). Recorded exception: this commit stays a standalone diff on top of the stack and is never folded (GC18 round decision, design audit G3-C-2), so it can be reviewed, landed and reverted alone, and N>1 never becomes legal partway up the stack. M5 fold: Absorbs 10 A.1 entries (GC28 1, GC27 3, GC30 2, GC29a 2, GC31 1, GC32 1): the five new release-note files (X19-M5); the post-flip wal_partitions doc lines (GC27, GC30, GC29a); wal_partitions.md. Exceptions: X19-M5. Release notes added here (X19-M5): bug_fixes/partition_wal_recovery_and_visibility_fixes.md, new_features/partition_wal_file_scoped_resume.md, performance_improvements/partition_wal_targeted_gate_sync.md, performance_improvements/partition_wal_write_path_locks.md, performance_improvements/partition_wal_write_pipeline.md. Removes the X14-M5 hook lines: the AllowWalPartitions callbacks D123079329, D123701876, D123928339, D123971668, D127093323 and D127275775 added to their folded N>1 tests. M6 fold: removes the `DBImpl::ValidateOptions:AllowWalPartitions` hook lines added below the flip to the GC34 Q1 tests (`RunReplayedPrepareIsNotCut`); no other change. Benchmark (rebased stack, paired and interleaved): Release `db_bench` built at the rebased stack (fork f4c2cc3436 on facebook/rocksdb e732049; the final 7fd6043 differs only in transaction_test.cc). Workload: `fillrandom`, 3000 ops per thread, 4 KiB values, 64 column families, pipelined write off, auto compactions off, DB on /dev/shm. The latency-injection FileSystem adds a 200 us WAL append latency and a 200 us WAL sync latency (20 us jitter, fixed seed 1001). Profile S caps WAL append and sync bandwidth at 50 MB/s each. Profile S-sync caps only sync bandwidth (50 MB/s). There are three rounds, and each round runs every cell, rotating the cell order. The table reports the median of the three runs (min-max across runs). The ratio is the median of the per-round ratios against N=1 kNone. Host is shared: 1-minute load average 12-67 during the runs (other users). Sync column: `all` = `--sync`, `1-in-20` = `--sync_write_one_in=20`, `none` = no sync. | Profile | Sync | Cell | ops/s (median of 3) | min-max | vs N=1 kNone | mean write us | p99 write us | WAL appends | WAL syncs | |---|---|---|---|---|---|---|---|---|---| | S | all | N=1 kNone | 5425 | 5282-5490 | 1.00x | 11646 | 13984 | 6002 | 6002 | | S | all | N=1 indexed | 5374 | 4871-5456 | 0.98x | 11716 | 14528 | 6007 | 6005 | | S | all | N=8 | 20104 | 20098-20516 | 3.71x | 3163 | 6351 | 90202 | 48470 | | S | all | N=16 | 22746 | 21715-23222 | 4.14x | 2794 | 5075 | 133766 | 80580 | | S | 1-in-20 | N=1 kNone | 5659 | 5645-5672 | 1.00x | 11283 | 58960 | 6149 | 2042 | | S | 1-in-20 | N=1 indexed | 5669 | 5624-5680 | 1.00x | 11270 | 60891 | 6027 | 1916 | | S | 1-in-20 | N=8 | 21635 | 20743-21835 | 3.81x | 2940 | 6587 | 63675 | 20851 | | S | 1-in-20 | N=16 | 24240 | 23984-24506 | 4.29x | 2620 | 6208 | 105691 | 38739 | | S | none | N=1 kNone | 10627 | 10435-10702 | 1.00x | 6015 | 6595 | 6005 | 0 | | S | none | N=1 indexed | 10631 | 10433-10650 | 1.00x | 6012 | 6598 | 6007 | 0 | | S | none | N=8 | 48068 | 47452-48281 | 4.52x | 1318 | 2788 | 48464 | 0 | | S | none | N=16 | 63757 | 63551-63974 | 6.00x | 992 | 1881 | 83100 | 0 | | S-sync | all | N=1 kNone | 9725 | 9722-9781 | 1.00x | 6570 | 9790 | 6003 | 6003 | | S-sync | all | N=1 indexed | 9776 | 9770-9792 | 1.00x | 6539 | 9621 | 6006 | 6004 | | S-sync | all | N=8 | 28877 | 27685-29180 | 2.97x | 2208 | 4214 | 88995 | 46361 | | S-sync | all | N=16 | 27734 | 26727-29899 | 2.85x | 2292 | 4318 | 134123 | 78895 | | S-sync | 1-in-20 | N=1 kNone | 10263 | 10190-10338 | 1.00x | 6220 | 19308 | 6029 | 2525 | | S-sync | 1-in-20 | N=1 indexed | 10330 | 10159-10355 | 1.00x | 6180 | 28946 | 6029 | 2329 | | S-sync | 1-in-20 | N=8 | 29514 | 29500-29519 | 2.88x | 2152 | 5876 | 61844 | 21538 | | S-sync | 1-in-20 | N=16 | 30808 | 30736-31239 | 3.02x | 2059 | 4387 | 103682 | 39121 | | S-sync | none | N=1 kNone | 72763 | 72596-74166 | 1.00x | 873 | 1293 | 6013 | 0 | | S-sync | none | N=1 indexed | 74786 | 72987-75086 | 1.01x | 850 | 1285 | 6016 | 0 | | S-sync | none | N=8 | 123028 | 120951-124222 | 1.67x | 512 | 862 | 39044 | 0 | | S-sync | none | N=16 | 133228 | 129421-133491 | 1.80x | 471 | 855 | 71038 | 0 | | S, 16 threads | all | N=1 kNone | 4724 | 4387-4738 | 1.00x | 3346 | 6482 | 4022 | 4022 | | S, 16 threads | all | N=1 indexed | 4713 | 4707-4736 | 1.00x | 3334 | 6478 | 3958 | 3956 | | S, 16 threads | all | N=8 | 8494 | 8464-8529 | 1.80x | 1873 | 2895 | 40476 | 27290 | | S, 16 threads | all | N=16 | 9294 | 9250-9323 | 1.97x | 1711 | 2876 | 44226 | 34317 | All 84 runs exited 0. Command per cell: ``` db_bench --benchmarks=fillrandom --threads=64 --num=3000 --value_size=4096 \ --num_column_families=64 --wal_partitions=<N> --partition_wal_usage=<none|partition_by_column_family> \ --enable_pipelined_write=false --disable_auto_compactions=1 --statistics --histogram \ --inject_wal_latency --wal_append_latency_us=200 --wal_sync_latency_us=200 \ --wal_latency_jitter_us=20 --wal_latency_seed=1001 --seed=1001 \ --wal_append_bandwidth_mbps=<50|0> --wal_sync_bandwidth_mbps=50 [--sync | --sync_write_one_in=20] ``` N=1 against upstream (default options, no partitioning flags, no latency injection): release `db_bench` of this stack against release `db_bench` of facebook/rocksdb e732049, five rounds, alternating which binary runs first, DB on /dev/shm. | Workload | upstream e732049 ops/s (median) | min-max | this stack ops/s (median) | min-max | stack/upstream (median of per-round) | |---|---|---|---|---|---| | fillrandom, 64 threads x 20000, 64 CFs, 4 KiB values, no sync | 224575 | 219463-232611 | 220572 | 213377-226176 | 0.972x | | fillrandom, 16 threads x 200000, 1 KiB values, --sync | 532901 | 524086-611361 | 530771 | 525389-541405 | 0.999x | Per-round stack/upstream ratios: --sync 0.996, 0.999, 1.032, 1.000, 0.860; no sync 0.972, 1.007, 0.948, 0.951, 0.990. 1-minute load average 11-22 during the runs. All 20 runs exited 0. The earlier run of the same comparison on e591f5f measured 0.996x (--sync) and 0.979x (no sync). Stress (db_stress crash test with the latency-injection FileSystem wired in): `tools/db_crashtest.py` blackbox and whitebox, 1800 s each, at wal_partitions 1 and 8, on the stack rebased onto facebook/rocksdb eb12834 (fork 286fdab796, debug db_stress; the final stack differs only in clang-format line wrapping and in `tools/db_crashtest.py`/`db_crashtest_test.py`). Pinned: `--disable_wal=0 --partition_wal_usage=partition_by_column_family --enable_blob_direct_write=0 --best_efforts_recovery=0 --two_write_queues=0 --enable_pipelined_write=0 --unordered_write=0 --recycle_log_file_num=0 --track_and_verify_wals=0 --inplace_update_support=0 --use_optimistic_txn=0`, plus `--inject_wal_latency=1 --wal_append_latency_us=50 --wal_sync_latency_us=300 --wal_latency_jitter_us=50 --wal_append_bandwidth_mbps=200 --wal_sync_bandwidth_mbps=100`. Every db_stress command line in the logs was checked for WAL on, latency injection on and the intended wal_partitions; randomized overrides did not disable them. | Mode | wal_partitions | db_stress command lines | Result | |---|---|---|---| | blackbox | 1 | 31 | exit 0 | | blackbox | 8 | 31 | exit 0 | | whitebox | 1 | 16 | exit 0 | | whitebox | 8 | 26 | exit 0 | The same runs on the previous base (fork f4c2cc3436 on e732049) also exited 0 (31/31/22/12 command lines). The two fbcode sandcastle crash-test command lines that failed on the previous version (ASAN and blackbox, with `read_fault_one_in=1000`) were rerun locally against this stack, three times each for 1200 s: no failure. fbcode sandcastle crash tests: The six `rocksdb-contrun.sky` crash-test workflows ran on stack top 32fe728cb06b, scheduled 2026-11-10 05:32 UTC. The final stack differs from it only in test code, one comment and one line break (the ASAN and format fixes below); db_stress is unchanged. All six passed. | Workflow | Result | Finished (PST, 2026-11-10) | |---|---|---| | fbcode_blackbox_crash_test | pass | 00:57 | | fbcode_asan_blackbox_crash_test | pass | 00:57 | | fbcode_tsan_blackbox_crash_test | pass | 01:16 | | fbcode_whitebox_crash_test | pass | 03:37 | | fbcode_asan_whitebox_crash_test | pass | 03:37 | | fbcode_tsan_whitebox_crash_test | pass | 03:28 | Sandcastle jobs: 49539596750420932, 49539596750421833, 40532397491966602, 49539596750421523, 45035997124599077, 22518001256897652 (https://www.internalfb.com/intern/sandcastle/job/<id>/). On the previous submitted version two of these workflows had failed (the sandcastle P1 below); that fix is in this stack. Comprehensive review (15 rounds, whole 39-diff stack): Each round ran the comprehensive-diff-review protocol (read-only Opus reviewers; round 1 used four reviewers by area, later rounds one) against the cumulative stack, on facebook/rocksdb d6a7847 for rounds 1-7 and, after the rebase onto e591f5f (the RocksDB subtree of fbcode/warm), on the rebased stack for rounds 8-11, on facebook/rocksdb e732049 (fbcode/warm 4df7e0a0db7b) for rounds 12-13, on 9ce1bfb (fbcode/warm 37d097c1b953) for round 14 and on eb12834 (fbcode/master b1d9881f429e) for round 15. Rounds 14 and 15 reviewed the rebase delta. Rows marked sandcastle, external and crash test are defects found outside the review rounds and fixed the same way. Every P1/P2 was re-checked against the code, reproduced by a new test that fails first, fixed in the diff that introduced the code, and verified by a neuter (reverting the fix makes the test fail). Candidates are the fork's review folds of pwal/m6. | Round | Candidate | P1/P2 found | Fixed in | Regression test | |---|---|---|---|---| | 1 | pwal/m6 69c13fc | 4 P2: CMake missed db/log_merge.cc and log_merge_test; a secondary could not open or catch up beside an indexed primary with async_wal_precreate; a damaged first record in a WAL with an intact head floor and no span made the DB unopenable; commit_bypass_memtable failed after Prepare at N>1 | D120624825 (CMake), D127093323 (async_wal_precreate sanitized off when partition_wal_usage != kNone), D120649665 (HeadBounded counts the WAL's own head floor), D123079329 (bypass falls back to the memtable commit at N>1) | DBSecondaryTest.IndexedPrimaryDisablesAsyncWalPrecreate; DBWalPartitionCoverageTest.DamagedFirstRecordAfterUpgradeToTwoPartitions; TransactionPartitionedWalTest.CommitBypassMemtableCommitsNormally | | 2 | fold2 2e8c56707a8f | 2 P2: GetSortedWalFiles returned a false Corruption once coupled rotation retired an idle partition's metadata-only WAL that the MANIFEST tracks; GC24HistoryFloorScopeOnUpgrade still pinned the pre-fix outcome | D127093323, D127837663 | DBWritePartitionTest.SortedWalFilesListsIdlePartitionWals | | 3 | fold3 8b6590498 | 1 P2: that fix was keyed to the opener's wal_partitions, so read-only or N=1 openers still got the Corruption. Writing its test exposed a read-only open with WAL tracking off hitting `assert(recovery_ctx != nullptr)` in Recover; fixed too | D127093323 | DBWritePartitionTest.SortedWalFilesListsIdlePartitionWalsReadOnly | | 4 | fold5 c3c369362 | 1 P2: at N=1 indexed, a data-less current WAL got a cached synthetic start sequence 1, so GetUpdatesSince skipped the older WAL holding the requested sequence | D127093323 | DBWalIteratorTest.IndexedDataLessCurrentWalKeepsOlderWal | | 5 | fold6 6e3ad3889 | None. The per-diff gate then failed WalPartitions8/WritePreparedTransactionTest.{WC_WP_ForwardCompatibility, WP_WC_DBBackwardCompatibility}: listing every metadata-only WAL changed GetSortedWalFiles after a flush; reworked to upstream listing semantics | D127093323 | the two WritePrepared tests, unmodified | | 6 | fold7 376fac935 | 1 P2: the rework left MANIFEST-tracked metadata-only WALs out of GetSortedWalFiles, so a GetLiveFiles(flush_memtable=false) + GetSortedWalFiles copy failed to open ("Missing WAL with log number"). Now a tracked metadata-only WAL is listed (start sequence 1, not cached) and an untracked one is skipped | D127093323 | DBWritePartitionTest.LiveFilesAndSortedWalFilesCopyOpens | | 7 | fold8 431f2a98e | None (1 P3, below) | | | | 8 | rebased 188e02204b43 (onto e591f5f; two reviewers) | None | | | | sandcastle | previous submitted version | 1 P1 (fbcode crash tests with `read_fault_one_in=1000`): an injected WAL read I/O error during recovery surfaced as `Corruption: WAL index merge: WAL <n> head damaged and unattested` in the merged replay, and the classification pass ignored it | D120624825 (the merger keeps the read's IOError), D121636079/D121674557 (classification returns it), D123928339 (merged replay returns the merger's error before the damage checks) | LogMergeTest.FailedReadKeepsTheReadError; DBWALIndexTest.ClassificationReadIOErrorFailsRecovery; DBWalPartitionCoverageTest.MergeReadIOErrorFailsWithTheReadError | | 9 | 805ea60 | 2 P3 + 1 gap, fixed: sequential indexed replay replaced the read IOError with a generic one; the merger's error dropped the read's retryable/data-loss/scope attributes | D120415420, D120624825 | DBWALIndexTest.SequentialIndexedReplayReadIOErrorKeepsTheReadError; LogMergeTest.FailedReadKeepsTheReadErrorAttributes | | external | D119751506 reviewer comment | 1 P2: with manual_wal_flush the burned-index void cover appended to the WAL buffer without wal_write_mutex_, racing an application FlushWAL | D119751506 (takes the mutex as WriteToWAL does), D122412677 (per-partition mutex) | DBWALIndexTest.BurnedWALIndexCoverHoldsWALMutexWithManualFlush | | crash test | 805ea60 | 1 P2 (debug only): whitebox crash test at N=8 hit the FlushScheduler::Empty consistency assertion when another partition leader dequeued concurrently | D123079329 (Empty reads the head under the debug checking mutex; release builds unchanged) | DBWritePartitionTest.FlushSchedulerEmptyRacesAnotherLeadersDequeue | | 10 | 12aad1d | 1 P2: statuses on the merged-recovery read-error path left unchecked (ASSERT_STATUS_CHECKED abort) | D120624825, D123551605, D123701876, D123928339, D123971668, D127093323 (holders permitted, ignored reports marked) | the read-error tests above under ASSERT_STATUS_CHECKED | | 11 | 69a91e9 | None | | | | fbcode CI | previous submitted version | 1 P2 (build): D120624825 declared two private fields (`last_sequence_index_`, `last_sequence_wal_`) first used in D120649665, so clang failed with -Werror,-Wunused-private-field at D120624825 | D120624825 (the fields move to D120649665; later diffs unchanged) | clang per-diff build gate | | 12 | f4c2cc3436 (rebased onto e732049) | 1 P2 (tests): upstream's new TransactionTest.InplaceUpdateSupportRequiresWriteCommitted also runs in this stack's WalPartitions8 instantiation, where Open rejects its options; 3 deterministic failures | D127275775 (at wal_partitions > 1 the test asserts NotSupported) | the test itself: 3 failures before, 33/33 after | | 12 (re-review) | 7fd6043 | None | | | | fbcode CI | 7fd6043 | 1 P2 (ASAN, test-only): GC31FollowerExitGroup freed its local Env while the fixture's last options still pointed at it, so the next DestroyAndReopen read freed memory (heap-use-after-free in NGreaterThan1FollowerExitHandsFailureToLeader); and the rocks format check flagged a comment over 80 columns and one unjoined condition | D123701876 (the helper resets the fixture's env on exit); D121858039, D123079329, D123551605, D123971668 (clang-format output) | the test under ASAN: heap-use-after-free before, 4/4 and db_write_test 581/581 after; check-format.sh passes on all 39 diffs | | strict status | b19275b | 1 P2 (ASSERT_STATUS_CHECKED, GitHub CI): 27 aborts from unchecked statuses: a reader report superseded by a more specific recovery error, a per-record pending report on early returns, the gate sync's covered path, a background-error return, an ingestion early return, and three test-side cases. Release behaviour unchanged | D120415420, D120649665, D123476301, D123701876, D123928339, D123971668, D127837663 | the ASSERT_STATUS_CHECKED suite: 27 aborts before, 0 after | | 13 | f658359 | None | | | | 14 | m6-rb10 (rebased onto 9ce1bfb) | 1 P2 (tests, from my rebase resolution): upstream's new kSortedHash option config was not skipped at wal_partitions > 1, where Open accepts only the SkipList memtable, so 7 WalPartitions8/ExternalSSTFileTestN tests walking ChangeOptions failed to reopen | D127275775 (kSortedHash joins the N>1 skip list) | the 7 tests: fail before, pass after | | 15 | 286fdab796 (rebased onto eb12834) | 1 P2 (crash test): upstream meta#15626 moved the inplace_update_support sanitizing ahead of this stack's N>1 overrides, which turned allow_concurrent_memtable_write back on, so about 3% of default crash-test series failed DB::Open. Found while verifying it: the same overrides replaced explicitly passed flags and made `make db_crashtest_tests` fail in about 5 of 6 runs, already on the previous stack (1 more P2) | D126533194 (N>1 steering moved into gen_cmd_params, before command-line flags) | db_crashtest_test.py: 3 new tests, each failing with the old overrides | | 15 (re-review) | 0d68d5f821 | 2 P2 + 1 P3 in that fix: test_secondary was still drawn per run, so wal_partitions flipped between runs and a secondary could open over partition WALs; an explicit --wal_partitions was not steered; the new test helper did not pin the trie index (about 4% flaky) | D126533194 | test_wal_partitions_stays_fixed_across_runs, test_explicit_wal_partitions_is_steered (each fails under its neuter); suite 89/89 in 40 runs | | fbcode CI | V1.2 drafts (1686cdb39f) | 1 P2 (stack order, crash test): D126533194 is the first diff whose crash test draws wal_partitions > 1, but the db_stress LockWAL check that accepts GetCurrentWalFile() NotSupported at N>1 lived in this diff, so whitebox runs at D126533194 failed with "GetCurrentWalFile() failed: Not implemented" | D126533194 (the check moves down from this diff; the final tree is unchanged) | local blackbox at wal_partitions=8, lock_wal_one_in=2000: the old D126533194 fails on its 2nd run (192 errors), the new one passes 11/11 | Final state: all 39 diffs at fork 1686cdb39f on facebook/rocksdb eb12834, each mirrored byte-identically into its fbsource diff on fbcode/master b1d9881f429e (master has since gained one RocksDB commit, c043e8dfa272, touching include/rocksdb/options.h about 180 lines from this stack's hunks). At 286fdab796 (the final stack differs only in clang-format line wrapping and the crash-test Python): per-diff clang gate for all 39 diffs; full make suite 11192/11192; clang TSan once 709/709 and 100x 2600/2600; ASSERT_STATUS_CHECKED suite with no failures from this stack (range_locking_test only, below); crash tests above. At 1686cdb39f: db_write_test 581/581, the gap-filler tests, `tools/db_crashtest_test.py` 89/89, and fbcode/rocks/sandcastle/check-format.sh at every diff. Totals: 1 P1 and 20 P2 fixed. Open items (P3 or validation gaps, tracked as follow-ups, not fixed here): - ASSERT_STATUS_CHECKED: range_locking_test fails in that build mode at upstream e732049 too; it is not part of this stack. - Rebase gap (pre-existing): with recycle_log_file_num > 0, an indexed one-partition DB gets no WAL sequence-gap filler (upstream meta#15581 covers kNone only), so an ingestion gap at a WAL boundary can still stop point-in-time recovery there, as it did for every DB before meta#15581. - Round 9 F-002 (P3): consumer head checks report a WAL read I/O error as NotSupported. - Round 11 gap (low confidence, pre-existing): the void re-read during recovery can swallow a transient read IOError. - TSan with the gcc 11 runtime (libtsan.so.0) reports false "double lock of a mutex" on any std::condition_variable::wait_for mutex, upstream TransactionDB code included, because it does not intercept pthread_cond_clockwait. Use clang TSan. - Round 7 P3: after an open that writes supersession records without a dummy write (for example a WalFilter stop with avoid_flush_during_recovery=true), partition 0's untracked, data-less current WAL carries the supersession record. GetSortedWalFiles skips it, so a GetLiveFiles + GetSortedWalFiles copy could fail with "two live records share index". Checkpoint and BackupEngine are unaffected. Inferred from code, not reproduced. - Round 2 P3: WriteRecoverableState at N>1 can stamp the cached recoverable state inside an open fence during an auto-resumed retryable WAL error. - Round 1 P3s: the checkpoint/backup LockWAL race tests can stop on an ASSERT before joining their threads; GC31FollowerExitGroup orders writers with sleeps; standalone db_stress at N>1 trips on the default get_current_wal_file_one_in; checkpoint/backup at N>1 wait out a write stop. - Gaps: an indexed DB with wal_compression still caches start sequence 1 for a data-less WAL (as upstream does for compression-only WALs); HeadFloor() for a member with no surviving data is the last progress bound read (no production-reachable loss found). Reports (MetaMate): - Round 1: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-69c13fcb72e2-20261107t093444z - Round 2: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-fold2-2e8c56707a8f-20261107t175411z - Round 3: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-fold3-8b6590498-20261107t185930z - Round 4: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-fold5-c3c369362-20261107t192653z - Round 5: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-fold6-6e3ad3889-20261107t193256z - Round 6: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-fold7-376fac935-20261108t054421z - Round 7: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-fold8-431f2a98e-20261108t055310z - Round 11: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-rb2-69a91e9ba-20261110t022328z - Round 13: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-rb8-f6583590ed-20261110t195418z - Round 15 (final stack): https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-rb15-1686cdb39f-20261111t191953z Changes visible to existing users: - Removes DBOptions::experimental_allow_wal_partitions_for_testing, its "experimental_allow_wal_partitions_for_testing" options-string key (which no longer parses) and the C API functions rocksdb_options_set/get_experimental_allow_wal_partitions_for_testing. All were added earlier in this stack (D117251769) and never released. - The --wal_partitions help text of db_bench and db_stress changed. Test Plan: M4 B.1: PASS (clang-format 21.1.2 on the changed lines, make check-sources, debug build of db_options_test, db_wal_oracle_test, db_wal_partitions_open_test, db_write_test, latency_injection_fs_test, ldb_cmd_test, optimistic_transaction_test, options_settable_test, transaction_test, write_prepared_transaction_test, db_stress, db_bench, ldb); 4974 tests, 0 failed. M5 B.1: PASS (clang-format 21.1.2 on the changed lines, make check-sources, debug build of compaction_service_test, db_options_test, db_wal_oracle_test, db_wal_partitions_open_test, db_wal_test, db_write_test, latency_injection_fs_test, ldb_cmd_test, optimistic_transaction_test, options_settable_test, transaction_test, write_prepared_transaction_test, db_stress, db_bench, ldb); 7324 tests, 0 failed. M6 B.1: PASS (debug build and build_tools/gtest-parallel run of compaction_service_test db_options_test db_wal_oracle_test db_wal_partitions_open_test db_wal_test db_write_test latency_injection_fs_test ldb_cmd_test optimistic_transaction_test options_settable_test transaction_test write_prepared_transaction_test: 7340/7340). Rebased stack (e591f5f): PASS. Debug build and build_tools/gtest-parallel run of compaction_service_test db_options_test db_wal_oracle_test db_wal_partitions_open_test db_wal_test db_write_test latency_injection_fs_test ldb_cmd_test optimistic_transaction_test options_settable_test transaction_test write_prepared_transaction_test: 7559/7559. Full make suite 10540/10540. Rebased stack (e732049, fbcode/warm 4df7e0a0db7b) final: clang per-diff gates for all 39 diffs; full make suite 10576/10579 at f4c2cc3436 with the 3 round-12 failures fixed at 7fd6043 (transaction_test 3475/3475); clang TSan; crash tests and the two sandcastle repro command lines above. At b19275b: db_write_test under ASAN/UBSAN (clang) 581/581; clang per-diff gates for D121858039 through D123971668 rerun and pass; fbcode/rocks/sandcastle/check-format.sh passes at every diff. fbcode sandcastle crash tests (blackbox and whitebox; plain, ASAN, TSAN): 6/6 pass on 32fe728cb06b. Strict status (ASSERT_STATUS_CHECKED=1) suite at f658359: 0 aborts from this stack (27 before the fix). Rebased stack (facebook/rocksdb eb12834, fbcode/master b1d9881f429e) final: clang per-diff gates for all 39 diffs; full make suite 11192/11192; clang TSan 709/709 once and 2600/2600 at 100x; ASSERT_STATUS_CHECKED with only range_locking_test failing (not touched by this stack); crash tests blackbox and whitebox at wal_partitions 1 and 8 exit 0; `tools/db_crashtest_test.py` 89/89; check-format.sh passes at every diff. Differential Revision: https://phabricator.intern.facebook.com/D130396596
JustinGaoF
added a commit
to JustinGaoF/rocksdb
that referenced
this pull request
Nov 19, 2026
Summary:
M1 standalone S-B (S-GC13), carved from GC13 Q2 (see that round summary
for question evidence):
- `db_crashtest.py`: N sweep over {1,2,8,16} plus both sanitize stages
(N>1 admits indexed WALs only).
- `db_stress --sync_write_one_in` (flag and use) and `SetOptions`
`max_successive_merges` at N>1.
Placed above S-C (no dependency; order follows the M1 plan).
M2 fold (2026-10-22, `M2-FoldTasks.md` + `M2-Amendment.md`): Absorbs (M2) GC06's and GC11's N=1 crashtest fallbacks (`track_and_verify_wals`, OCC serial validation, `file_scope_wal_write_faults`).
Rebase onto facebook/rocksdb eb12834 (review round 15): upstream meta#15626 moved the inplace_update_support sanitizing to the start of `finalize_and_sanitize`, so the N>1 overrides that used to run there turned allow_concurrent_memtable_write back on after it, and DB::Open rejected the result. The same overrides also replaced explicitly passed flags (for example `--disable_wal=1`) and made `tools/db_crashtest_test.py` (`make db_crashtest_tests`, part of `make check`) fail in about 5 of 6 runs; that was already true before this rebase. The overrides now run in `gen_cmd_params` before command-line flags are merged, following the file-scoped WAL fault selection there, keyed on the effective wal_partitions (an explicit `--wal_partitions` included), and they fix the per-run test_secondary draw so wal_partitions does not change between runs of a series. The late N>1 check falls back to one partition on any conflict.
db_stress: the LockWAL check accepts GetCurrentWalFile() returning NotSupported at wal_partitions > 1 (each partition has its own current WAL); the sequence number check still runs. It lived in D130396596 until fbcode CI on the eb12834 rebase showed this diff's whitebox crash tests failing at wal_partitions=16 with "GetCurrentWalFile() failed: Not implemented": this diff is the first to draw wal_partitions > 1, so the check moved here.
Changes visible to existing users:
- db_crashtest.py now picks wal_partitions 2, 8 or 16 for about 1 in 3 invocations (or takes `--wal_partitions`). In those series `gen_cmd_params` sets partition_wal_usage, disable_wal, enable_pipelined_write, allow_concurrent_memtable_write, memtablerep, sync, test_secondary and continuous_verification_interval to values N>1 accepts, once for the series and before it applies command-line flags. An explicitly passed incompatible flag, or inplace_update_support=1, keeps the series at one partition. At N>1 the runs turn off ingest_wbwi_one_in and commit_bypass_memtable_one_in.
- New db_stress flag --sync_write_one_in (default 0). db_crashtest.py sets it to 10 or 100 in half of its runs at any wal_partitions, so default crash tests now mix sync and non-sync writes.
Test Plan:
`db_stress` builds at placement. Tip suites pass.
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_crashtest.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.
M4 fold: Absorbs
- GC26 Q5(e): db_crashtest.py runs no secondary and no continuous verification at N>1 (code only; no crash test was run).
- Net-zero pairs dropped (rule 2.7): none.
M4 B.1: PASS (clang-format 21.1.2 on the changed lines, make check-sources, debug build of db_stress; no test binary touched).
Rebased stack (facebook/rocksdb eb12834, fbcode/master b1d9881f429e): `tools/db_crashtest_test.py` gains `test_wal_partitions_steers_randomized_settings`, `test_explicit_flag_wins_over_wal_partitions`, `test_inplace_update_support_keeps_one_wal_partition`, `test_wal_partitions_stays_fixed_across_runs` and `test_explicit_wal_partitions_is_steered`, and `test_cf_consistency_randomizes_secondary` pins wal_partitions=1. The suite passes 89/89 in 40 runs with the random draw and in 5 runs each with wal_partitions pinned to 1, 2, 8 and 16; before the fix it failed in 6 of 6 runs at the previous stack. Neuters: with the old overrides restored the first three new tests fail; without the steering block the first fails; without fixing test_secondary and continuous_verification_interval `test_wal_partitions_stays_fixed_across_runs` fails; keying the steering on the drawn value only fails `test_explicit_wal_partitions_is_steered`.
Reviewers: generatedunixname1864816080879669
Differential Revision: https://phabricator.intern.facebook.com/D126533194
Tags: skip_dr_passed
JustinGaoF
pushed a commit
to JustinGaoF/rocksdb
that referenced
this pull request
Nov 19, 2026
…n builds Summary: The flip of the PartitionWAL stack (GC18 Q1-Q5). DB::Open accepts wal_partitions > 1 with an indexing partition_wal_usage in release and debug builds, with no sync point and no opt-in. kNone with N>1 and every other M1.4 rejection still fail with their exact Status. The wal_partitions doc and the release notes describe the shipped behaviour and the rollout order (readers first). Removes: - the N>1 gate in DBImpl::ValidateOptions and its debug sync point DBImpl::ValidateOptions:AllowWalPartitions; - the GC13 opt-in experimental_allow_wal_partitions_for_testing (D-G18k (i)): the option, its OPTIONS-map entry, Dump line, generated C accessors (two "removed" entries are added to tools/c_api_gen/api_compatibility_allowlist.json); db_bench, db_stress and test::SetWalPartitions stop setting it; - every use of the hook in tests and tools, including the hooks that tests folded below this commit carry at M4 (exception X14: FailedSyncPrepareLeavesNoStaleFence, GC23TimestampedSnapshotsSurviveFlushStress, GC19TornFirstRecordInBrandNewNTwoDbModes, CreateBrandNewPartitionedDb, GC23FloorOffForLaterGenerationHeads, GC24HistoryFloorScopeOnUpgrade) and the original hooks of SyncPrepareAfterSyncCommitSurvivesCrash, FU14SnapshotRace and FU14H6TornFirstRecordInBrandNewNTwoDb (GC26 Q5(d)). Adds db_wal_partitions_open_test (GC18 Q1, with GC20 Q9's edits), GC20 Q9's "with indexing it opens" leg of WalPartitionsValidation (exception X6), GC23 Q8's wal_partitions doc sentences (exception X6), and the release notes unreleased_history/new_features/wal_partitions.md, behavior_changes/partition_wal_sync_visibility.md (GC25) and behavior_changes/partition_wal_recovery_modes.md (GC26) (exception X19: they describe behaviour production builds reach only from this commit). Recorded exception: this commit stays a standalone diff on top of the stack and is never folded (GC18 round decision, design audit G3-C-2), so it can be reviewed, landed and reverted alone, and N>1 never becomes legal partway up the stack. M5 fold: Absorbs 10 A.1 entries (GC28 1, GC27 3, GC30 2, GC29a 2, GC31 1, GC32 1): the five new release-note files (X19-M5); the post-flip wal_partitions doc lines (GC27, GC30, GC29a); wal_partitions.md. Exceptions: X19-M5. Release notes added here (X19-M5): bug_fixes/partition_wal_recovery_and_visibility_fixes.md, new_features/partition_wal_file_scoped_resume.md, performance_improvements/partition_wal_targeted_gate_sync.md, performance_improvements/partition_wal_write_path_locks.md, performance_improvements/partition_wal_write_pipeline.md. Removes the X14-M5 hook lines: the AllowWalPartitions callbacks D123079329, D123701876, D123928339, D123971668, D127093323 and D127275775 added to their folded N>1 tests. M6 fold: removes the `DBImpl::ValidateOptions:AllowWalPartitions` hook lines added below the flip to the GC34 Q1 tests (`RunReplayedPrepareIsNotCut`); no other change. Benchmark (rebased stack, paired and interleaved): Release `db_bench` built at the rebased stack (fork f4c2cc3436 on facebook/rocksdb e732049; the final 7fd6043 differs only in transaction_test.cc). Workload: `fillrandom`, 3000 ops per thread, 4 KiB values, 64 column families, pipelined write off, auto compactions off, DB on /dev/shm. The latency-injection FileSystem adds a 200 us WAL append latency and a 200 us WAL sync latency (20 us jitter, fixed seed 1001). Profile S caps WAL append and sync bandwidth at 50 MB/s each. Profile S-sync caps only sync bandwidth (50 MB/s). There are three rounds, and each round runs every cell, rotating the cell order. The table reports the median of the three runs (min-max across runs). The ratio is the median of the per-round ratios against N=1 kNone. Host is shared: 1-minute load average 12-67 during the runs (other users). Sync column: `all` = `--sync`, `1-in-20` = `--sync_write_one_in=20`, `none` = no sync. | Profile | Sync | Cell | ops/s (median of 3) | min-max | vs N=1 kNone | mean write us | p99 write us | WAL appends | WAL syncs | |---|---|---|---|---|---|---|---|---|---| | S | all | N=1 kNone | 5425 | 5282-5490 | 1.00x | 11646 | 13984 | 6002 | 6002 | | S | all | N=1 indexed | 5374 | 4871-5456 | 0.98x | 11716 | 14528 | 6007 | 6005 | | S | all | N=8 | 20104 | 20098-20516 | 3.71x | 3163 | 6351 | 90202 | 48470 | | S | all | N=16 | 22746 | 21715-23222 | 4.14x | 2794 | 5075 | 133766 | 80580 | | S | 1-in-20 | N=1 kNone | 5659 | 5645-5672 | 1.00x | 11283 | 58960 | 6149 | 2042 | | S | 1-in-20 | N=1 indexed | 5669 | 5624-5680 | 1.00x | 11270 | 60891 | 6027 | 1916 | | S | 1-in-20 | N=8 | 21635 | 20743-21835 | 3.81x | 2940 | 6587 | 63675 | 20851 | | S | 1-in-20 | N=16 | 24240 | 23984-24506 | 4.29x | 2620 | 6208 | 105691 | 38739 | | S | none | N=1 kNone | 10627 | 10435-10702 | 1.00x | 6015 | 6595 | 6005 | 0 | | S | none | N=1 indexed | 10631 | 10433-10650 | 1.00x | 6012 | 6598 | 6007 | 0 | | S | none | N=8 | 48068 | 47452-48281 | 4.52x | 1318 | 2788 | 48464 | 0 | | S | none | N=16 | 63757 | 63551-63974 | 6.00x | 992 | 1881 | 83100 | 0 | | S-sync | all | N=1 kNone | 9725 | 9722-9781 | 1.00x | 6570 | 9790 | 6003 | 6003 | | S-sync | all | N=1 indexed | 9776 | 9770-9792 | 1.00x | 6539 | 9621 | 6006 | 6004 | | S-sync | all | N=8 | 28877 | 27685-29180 | 2.97x | 2208 | 4214 | 88995 | 46361 | | S-sync | all | N=16 | 27734 | 26727-29899 | 2.85x | 2292 | 4318 | 134123 | 78895 | | S-sync | 1-in-20 | N=1 kNone | 10263 | 10190-10338 | 1.00x | 6220 | 19308 | 6029 | 2525 | | S-sync | 1-in-20 | N=1 indexed | 10330 | 10159-10355 | 1.00x | 6180 | 28946 | 6029 | 2329 | | S-sync | 1-in-20 | N=8 | 29514 | 29500-29519 | 2.88x | 2152 | 5876 | 61844 | 21538 | | S-sync | 1-in-20 | N=16 | 30808 | 30736-31239 | 3.02x | 2059 | 4387 | 103682 | 39121 | | S-sync | none | N=1 kNone | 72763 | 72596-74166 | 1.00x | 873 | 1293 | 6013 | 0 | | S-sync | none | N=1 indexed | 74786 | 72987-75086 | 1.01x | 850 | 1285 | 6016 | 0 | | S-sync | none | N=8 | 123028 | 120951-124222 | 1.67x | 512 | 862 | 39044 | 0 | | S-sync | none | N=16 | 133228 | 129421-133491 | 1.80x | 471 | 855 | 71038 | 0 | | S, 16 threads | all | N=1 kNone | 4724 | 4387-4738 | 1.00x | 3346 | 6482 | 4022 | 4022 | | S, 16 threads | all | N=1 indexed | 4713 | 4707-4736 | 1.00x | 3334 | 6478 | 3958 | 3956 | | S, 16 threads | all | N=8 | 8494 | 8464-8529 | 1.80x | 1873 | 2895 | 40476 | 27290 | | S, 16 threads | all | N=16 | 9294 | 9250-9323 | 1.97x | 1711 | 2876 | 44226 | 34317 | All 84 runs exited 0. Command per cell: ``` db_bench --benchmarks=fillrandom --threads=64 --num=3000 --value_size=4096 \ --num_column_families=64 --wal_partitions=<N> --partition_wal_usage=<none|partition_by_column_family> \ --enable_pipelined_write=false --disable_auto_compactions=1 --statistics --histogram \ --inject_wal_latency --wal_append_latency_us=200 --wal_sync_latency_us=200 \ --wal_latency_jitter_us=20 --wal_latency_seed=1001 --seed=1001 \ --wal_append_bandwidth_mbps=<50|0> --wal_sync_bandwidth_mbps=50 [--sync | --sync_write_one_in=20] ``` N=1 against upstream (default options, no partitioning flags, no latency injection): release `db_bench` of this stack against release `db_bench` of facebook/rocksdb e732049, five rounds, alternating which binary runs first, DB on /dev/shm. | Workload | upstream e732049 ops/s (median) | min-max | this stack ops/s (median) | min-max | stack/upstream (median of per-round) | |---|---|---|---|---|---| | fillrandom, 64 threads x 20000, 64 CFs, 4 KiB values, no sync | 224575 | 219463-232611 | 220572 | 213377-226176 | 0.972x | | fillrandom, 16 threads x 200000, 1 KiB values, --sync | 532901 | 524086-611361 | 530771 | 525389-541405 | 0.999x | Per-round stack/upstream ratios: --sync 0.996, 0.999, 1.032, 1.000, 0.860; no sync 0.972, 1.007, 0.948, 0.951, 0.990. 1-minute load average 11-22 during the runs. All 20 runs exited 0. The earlier run of the same comparison on e591f5f measured 0.996x (--sync) and 0.979x (no sync). Stress (db_stress crash test with the latency-injection FileSystem wired in): `tools/db_crashtest.py` blackbox and whitebox, 1800 s each, at wal_partitions 1 and 8, on the stack rebased onto facebook/rocksdb eb12834 (fork 286fdab796, debug db_stress; the final stack differs only in clang-format line wrapping and in `tools/db_crashtest.py`/`db_crashtest_test.py`). Pinned: `--disable_wal=0 --partition_wal_usage=partition_by_column_family --enable_blob_direct_write=0 --best_efforts_recovery=0 --two_write_queues=0 --enable_pipelined_write=0 --unordered_write=0 --recycle_log_file_num=0 --track_and_verify_wals=0 --inplace_update_support=0 --use_optimistic_txn=0`, plus `--inject_wal_latency=1 --wal_append_latency_us=50 --wal_sync_latency_us=300 --wal_latency_jitter_us=50 --wal_append_bandwidth_mbps=200 --wal_sync_bandwidth_mbps=100`. Every db_stress command line in the logs was checked for WAL on, latency injection on and the intended wal_partitions; randomized overrides did not disable them. | Mode | wal_partitions | db_stress command lines | Result | |---|---|---|---| | blackbox | 1 | 31 | exit 0 | | blackbox | 8 | 31 | exit 0 | | whitebox | 1 | 16 | exit 0 | | whitebox | 8 | 26 | exit 0 | The same runs on the previous base (fork f4c2cc3436 on e732049) also exited 0 (31/31/22/12 command lines). The two fbcode sandcastle crash-test command lines that failed on the previous version (ASAN and blackbox, with `read_fault_one_in=1000`) were rerun locally against this stack, three times each for 1200 s: no failure. fbcode sandcastle crash tests: The six `rocksdb-contrun.sky` crash-test workflows ran on stack top 32fe728cb06b, scheduled 2026-11-10 05:32 UTC. The final stack differs from it only in test code, one comment and one line break (the ASAN and format fixes below); db_stress is unchanged. All six passed. | Workflow | Result | Finished (PST, 2026-11-10) | |---|---|---| | fbcode_blackbox_crash_test | pass | 00:57 | | fbcode_asan_blackbox_crash_test | pass | 00:57 | | fbcode_tsan_blackbox_crash_test | pass | 01:16 | | fbcode_whitebox_crash_test | pass | 03:37 | | fbcode_asan_whitebox_crash_test | pass | 03:37 | | fbcode_tsan_whitebox_crash_test | pass | 03:28 | Sandcastle jobs: 49539596750420932, 49539596750421833, 40532397491966602, 49539596750421523, 45035997124599077, 22518001256897652 (https://www.internalfb.com/intern/sandcastle/job/<id>/). On the previous submitted version two of these workflows had failed (the sandcastle P1 below); that fix is in this stack. Comprehensive review (15 rounds, whole 39-diff stack): Each round ran the comprehensive-diff-review protocol (read-only Opus reviewers; round 1 used four reviewers by area, later rounds one) against the cumulative stack, on facebook/rocksdb d6a7847 for rounds 1-7 and, after the rebase onto e591f5f (the RocksDB subtree of fbcode/warm), on the rebased stack for rounds 8-11, on facebook/rocksdb e732049 (fbcode/warm 4df7e0a0db7b) for rounds 12-13, on 9ce1bfb (fbcode/warm 37d097c1b953) for round 14 and on eb12834 (fbcode/master b1d9881f429e) for round 15. Rounds 14 and 15 reviewed the rebase delta. Rows marked sandcastle, external and crash test are defects found outside the review rounds and fixed the same way. Every P1/P2 was re-checked against the code, reproduced by a new test that fails first, fixed in the diff that introduced the code, and verified by a neuter (reverting the fix makes the test fail). Candidates are the fork's review folds of pwal/m6. | Round | Candidate | P1/P2 found | Fixed in | Regression test | |---|---|---|---|---| | 1 | pwal/m6 69c13fc | 4 P2: CMake missed db/log_merge.cc and log_merge_test; a secondary could not open or catch up beside an indexed primary with async_wal_precreate; a damaged first record in a WAL with an intact head floor and no span made the DB unopenable; commit_bypass_memtable failed after Prepare at N>1 | D120624825 (CMake), D127093323 (async_wal_precreate sanitized off when partition_wal_usage != kNone), D120649665 (HeadBounded counts the WAL's own head floor), D123079329 (bypass falls back to the memtable commit at N>1) | DBSecondaryTest.IndexedPrimaryDisablesAsyncWalPrecreate; DBWalPartitionCoverageTest.DamagedFirstRecordAfterUpgradeToTwoPartitions; TransactionPartitionedWalTest.CommitBypassMemtableCommitsNormally | | 2 | fold2 2e8c56707a8f | 2 P2: GetSortedWalFiles returned a false Corruption once coupled rotation retired an idle partition's metadata-only WAL that the MANIFEST tracks; GC24HistoryFloorScopeOnUpgrade still pinned the pre-fix outcome | D127093323, D127837663 | DBWritePartitionTest.SortedWalFilesListsIdlePartitionWals | | 3 | fold3 8b6590498 | 1 P2: that fix was keyed to the opener's wal_partitions, so read-only or N=1 openers still got the Corruption. Writing its test exposed a read-only open with WAL tracking off hitting `assert(recovery_ctx != nullptr)` in Recover; fixed too | D127093323 | DBWritePartitionTest.SortedWalFilesListsIdlePartitionWalsReadOnly | | 4 | fold5 c3c369362 | 1 P2: at N=1 indexed, a data-less current WAL got a cached synthetic start sequence 1, so GetUpdatesSince skipped the older WAL holding the requested sequence | D127093323 | DBWalIteratorTest.IndexedDataLessCurrentWalKeepsOlderWal | | 5 | fold6 6e3ad3889 | None. The per-diff gate then failed WalPartitions8/WritePreparedTransactionTest.{WC_WP_ForwardCompatibility, WP_WC_DBBackwardCompatibility}: listing every metadata-only WAL changed GetSortedWalFiles after a flush; reworked to upstream listing semantics | D127093323 | the two WritePrepared tests, unmodified | | 6 | fold7 376fac935 | 1 P2: the rework left MANIFEST-tracked metadata-only WALs out of GetSortedWalFiles, so a GetLiveFiles(flush_memtable=false) + GetSortedWalFiles copy failed to open ("Missing WAL with log number"). Now a tracked metadata-only WAL is listed (start sequence 1, not cached) and an untracked one is skipped | D127093323 | DBWritePartitionTest.LiveFilesAndSortedWalFilesCopyOpens | | 7 | fold8 431f2a98e | None (1 P3, below) | | | | 8 | rebased 188e02204b43 (onto e591f5f; two reviewers) | None | | | | sandcastle | previous submitted version | 1 P1 (fbcode crash tests with `read_fault_one_in=1000`): an injected WAL read I/O error during recovery surfaced as `Corruption: WAL index merge: WAL <n> head damaged and unattested` in the merged replay, and the classification pass ignored it | D120624825 (the merger keeps the read's IOError), D121636079/D121674557 (classification returns it), D123928339 (merged replay returns the merger's error before the damage checks) | LogMergeTest.FailedReadKeepsTheReadError; DBWALIndexTest.ClassificationReadIOErrorFailsRecovery; DBWalPartitionCoverageTest.MergeReadIOErrorFailsWithTheReadError | | 9 | 805ea60 | 2 P3 + 1 gap, fixed: sequential indexed replay replaced the read IOError with a generic one; the merger's error dropped the read's retryable/data-loss/scope attributes | D120415420, D120624825 | DBWALIndexTest.SequentialIndexedReplayReadIOErrorKeepsTheReadError; LogMergeTest.FailedReadKeepsTheReadErrorAttributes | | external | D119751506 reviewer comment | 1 P2: with manual_wal_flush the burned-index void cover appended to the WAL buffer without wal_write_mutex_, racing an application FlushWAL | D119751506 (takes the mutex as WriteToWAL does), D122412677 (per-partition mutex) | DBWALIndexTest.BurnedWALIndexCoverHoldsWALMutexWithManualFlush | | crash test | 805ea60 | 1 P2 (debug only): whitebox crash test at N=8 hit the FlushScheduler::Empty consistency assertion when another partition leader dequeued concurrently | D123079329 (Empty reads the head under the debug checking mutex; release builds unchanged) | DBWritePartitionTest.FlushSchedulerEmptyRacesAnotherLeadersDequeue | | 10 | 12aad1d | 1 P2: statuses on the merged-recovery read-error path left unchecked (ASSERT_STATUS_CHECKED abort) | D120624825, D123551605, D123701876, D123928339, D123971668, D127093323 (holders permitted, ignored reports marked) | the read-error tests above under ASSERT_STATUS_CHECKED | | 11 | 69a91e9 | None | | | | fbcode CI | previous submitted version | 1 P2 (build): D120624825 declared two private fields (`last_sequence_index_`, `last_sequence_wal_`) first used in D120649665, so clang failed with -Werror,-Wunused-private-field at D120624825 | D120624825 (the fields move to D120649665; later diffs unchanged) | clang per-diff build gate | | 12 | f4c2cc3436 (rebased onto e732049) | 1 P2 (tests): upstream's new TransactionTest.InplaceUpdateSupportRequiresWriteCommitted also runs in this stack's WalPartitions8 instantiation, where Open rejects its options; 3 deterministic failures | D127275775 (at wal_partitions > 1 the test asserts NotSupported) | the test itself: 3 failures before, 33/33 after | | 12 (re-review) | 7fd6043 | None | | | | fbcode CI | 7fd6043 | 1 P2 (ASAN, test-only): GC31FollowerExitGroup freed its local Env while the fixture's last options still pointed at it, so the next DestroyAndReopen read freed memory (heap-use-after-free in NGreaterThan1FollowerExitHandsFailureToLeader); and the rocks format check flagged a comment over 80 columns and one unjoined condition | D123701876 (the helper resets the fixture's env on exit); D121858039, D123079329, D123551605, D123971668 (clang-format output) | the test under ASAN: heap-use-after-free before, 4/4 and db_write_test 581/581 after; check-format.sh passes on all 39 diffs | | strict status | b19275b | 1 P2 (ASSERT_STATUS_CHECKED, GitHub CI): 27 aborts from unchecked statuses: a reader report superseded by a more specific recovery error, a per-record pending report on early returns, the gate sync's covered path, a background-error return, an ingestion early return, and three test-side cases. Release behaviour unchanged | D120415420, D120649665, D123476301, D123701876, D123928339, D123971668, D127837663 | the ASSERT_STATUS_CHECKED suite: 27 aborts before, 0 after | | 13 | f658359 | None | | | | 14 | m6-rb10 (rebased onto 9ce1bfb) | 1 P2 (tests, from my rebase resolution): upstream's new kSortedHash option config was not skipped at wal_partitions > 1, where Open accepts only the SkipList memtable, so 7 WalPartitions8/ExternalSSTFileTestN tests walking ChangeOptions failed to reopen | D127275775 (kSortedHash joins the N>1 skip list) | the 7 tests: fail before, pass after | | 15 | 286fdab796 (rebased onto eb12834) | 1 P2 (crash test): upstream meta#15626 moved the inplace_update_support sanitizing ahead of this stack's N>1 overrides, which turned allow_concurrent_memtable_write back on, so about 3% of default crash-test series failed DB::Open. Found while verifying it: the same overrides replaced explicitly passed flags and made `make db_crashtest_tests` fail in about 5 of 6 runs, already on the previous stack (1 more P2) | D126533194 (N>1 steering moved into gen_cmd_params, before command-line flags) | db_crashtest_test.py: 3 new tests, each failing with the old overrides | | 15 (re-review) | 0d68d5f821 | 2 P2 + 1 P3 in that fix: test_secondary was still drawn per run, so wal_partitions flipped between runs and a secondary could open over partition WALs; an explicit --wal_partitions was not steered; the new test helper did not pin the trie index (about 4% flaky) | D126533194 | test_wal_partitions_stays_fixed_across_runs, test_explicit_wal_partitions_is_steered (each fails under its neuter); suite 89/89 in 40 runs | | fbcode CI | V1.2 drafts (1686cdb39f) | 1 P2 (stack order, crash test): D126533194 is the first diff whose crash test draws wal_partitions > 1, but the db_stress LockWAL check that accepts GetCurrentWalFile() NotSupported at N>1 lived in this diff, so whitebox runs at D126533194 failed with "GetCurrentWalFile() failed: Not implemented" | D126533194 (the check moves down from this diff; the final tree is unchanged) | local blackbox at wal_partitions=8, lock_wal_one_in=2000: the old D126533194 fails on its 2nd run (192 errors), the new one passes 11/11 | Final state: all 39 diffs at fork 1686cdb39f on facebook/rocksdb eb12834, each mirrored byte-identically into its fbsource diff on fbcode/master b1d9881f429e (master has since gained one RocksDB commit, c043e8dfa272, touching include/rocksdb/options.h about 180 lines from this stack's hunks). At 286fdab796 (the final stack differs only in clang-format line wrapping and the crash-test Python): per-diff clang gate for all 39 diffs; full make suite 11192/11192; clang TSan once 709/709 and 100x 2600/2600; ASSERT_STATUS_CHECKED suite with no failures from this stack (range_locking_test only, below); crash tests above. At 1686cdb39f: db_write_test 581/581, the gap-filler tests, `tools/db_crashtest_test.py` 89/89, and fbcode/rocks/sandcastle/check-format.sh at every diff. Totals: 1 P1 and 20 P2 fixed. Open items (P3 or validation gaps, tracked as follow-ups, not fixed here): - ASSERT_STATUS_CHECKED: range_locking_test fails in that build mode at upstream e732049 too; it is not part of this stack. - Rebase gap (pre-existing): with recycle_log_file_num > 0, an indexed one-partition DB gets no WAL sequence-gap filler (upstream meta#15581 covers kNone only), so an ingestion gap at a WAL boundary can still stop point-in-time recovery there, as it did for every DB before meta#15581. - Round 9 F-002 (P3): consumer head checks report a WAL read I/O error as NotSupported. - Round 11 gap (low confidence, pre-existing): the void re-read during recovery can swallow a transient read IOError. - TSan with the gcc 11 runtime (libtsan.so.0) reports false "double lock of a mutex" on any std::condition_variable::wait_for mutex, upstream TransactionDB code included, because it does not intercept pthread_cond_clockwait. Use clang TSan. - Round 7 P3: after an open that writes supersession records without a dummy write (for example a WalFilter stop with avoid_flush_during_recovery=true), partition 0's untracked, data-less current WAL carries the supersession record. GetSortedWalFiles skips it, so a GetLiveFiles + GetSortedWalFiles copy could fail with "two live records share index". Checkpoint and BackupEngine are unaffected. Inferred from code, not reproduced. - Round 2 P3: WriteRecoverableState at N>1 can stamp the cached recoverable state inside an open fence during an auto-resumed retryable WAL error. - Round 1 P3s: the checkpoint/backup LockWAL race tests can stop on an ASSERT before joining their threads; GC31FollowerExitGroup orders writers with sleeps; standalone db_stress at N>1 trips on the default get_current_wal_file_one_in; checkpoint/backup at N>1 wait out a write stop. - Gaps: an indexed DB with wal_compression still caches start sequence 1 for a data-less WAL (as upstream does for compression-only WALs); HeadFloor() for a member with no surviving data is the last progress bound read (no production-reachable loss found). Reports (MetaMate): - Round 1: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-69c13fcb72e2-20261107t093444z - Round 2: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-fold2-2e8c56707a8f-20261107t175411z - Round 3: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-fold3-8b6590498-20261107t185930z - Round 4: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-fold5-c3c369362-20261107t192653z - Round 5: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-fold6-6e3ad3889-20261107t193256z - Round 6: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-fold7-376fac935-20261108t054421z - Round 7: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-fold8-431f2a98e-20261108t055310z - Round 11: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-rb2-69a91e9ba-20261110t022328z - Round 13: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-rb8-f6583590ed-20261110t195418z - Round 15 (final stack): https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-rb15-1686cdb39f-20261111t191953z Changes visible to existing users: - Removes DBOptions::experimental_allow_wal_partitions_for_testing, its "experimental_allow_wal_partitions_for_testing" options-string key (which no longer parses) and the C API functions rocksdb_options_set/get_experimental_allow_wal_partitions_for_testing. All were added earlier in this stack (D117251769) and never released. - The --wal_partitions help text of db_bench and db_stress changed. Test Plan: M4 B.1: PASS (clang-format 21.1.2 on the changed lines, make check-sources, debug build of db_options_test, db_wal_oracle_test, db_wal_partitions_open_test, db_write_test, latency_injection_fs_test, ldb_cmd_test, optimistic_transaction_test, options_settable_test, transaction_test, write_prepared_transaction_test, db_stress, db_bench, ldb); 4974 tests, 0 failed. M5 B.1: PASS (clang-format 21.1.2 on the changed lines, make check-sources, debug build of compaction_service_test, db_options_test, db_wal_oracle_test, db_wal_partitions_open_test, db_wal_test, db_write_test, latency_injection_fs_test, ldb_cmd_test, optimistic_transaction_test, options_settable_test, transaction_test, write_prepared_transaction_test, db_stress, db_bench, ldb); 7324 tests, 0 failed. M6 B.1: PASS (debug build and build_tools/gtest-parallel run of compaction_service_test db_options_test db_wal_oracle_test db_wal_partitions_open_test db_wal_test db_write_test latency_injection_fs_test ldb_cmd_test optimistic_transaction_test options_settable_test transaction_test write_prepared_transaction_test: 7340/7340). Rebased stack (e591f5f): PASS. Debug build and build_tools/gtest-parallel run of compaction_service_test db_options_test db_wal_oracle_test db_wal_partitions_open_test db_wal_test db_write_test latency_injection_fs_test ldb_cmd_test optimistic_transaction_test options_settable_test transaction_test write_prepared_transaction_test: 7559/7559. Full make suite 10540/10540. Rebased stack (e732049, fbcode/warm 4df7e0a0db7b) final: clang per-diff gates for all 39 diffs; full make suite 10576/10579 at f4c2cc3436 with the 3 round-12 failures fixed at 7fd6043 (transaction_test 3475/3475); clang TSan; crash tests and the two sandcastle repro command lines above. At b19275b: db_write_test under ASAN/UBSAN (clang) 581/581; clang per-diff gates for D121858039 through D123971668 rerun and pass; fbcode/rocks/sandcastle/check-format.sh passes at every diff. fbcode sandcastle crash tests (blackbox and whitebox; plain, ASAN, TSAN): 6/6 pass on 32fe728cb06b. Strict status (ASSERT_STATUS_CHECKED=1) suite at f658359: 0 aborts from this stack (27 before the fix). Rebased stack (facebook/rocksdb eb12834, fbcode/master b1d9881f429e) final: clang per-diff gates for all 39 diffs; full make suite 11192/11192; clang TSan 709/709 once and 2600/2600 at 100x; ASSERT_STATUS_CHECKED with only range_locking_test failing (not touched by this stack); crash tests blackbox and whitebox at wal_partitions 1 and 8 exit 0; `tools/db_crashtest_test.py` 89/89; check-format.sh passes at every diff. Differential Revision: https://phabricator.intern.facebook.com/D130396596
JustinGaoF
added a commit
to JustinGaoF/rocksdb
that referenced
this pull request
Nov 19, 2026
Summary:
M1 standalone S-B (S-GC13), carved from GC13 Q2 (see that round summary
for question evidence):
- `db_crashtest.py`: N sweep over {1,2,8,16} plus both sanitize stages
(N>1 admits indexed WALs only).
- `db_stress --sync_write_one_in` (flag and use) and `SetOptions`
`max_successive_merges` at N>1.
Placed above S-C (no dependency; order follows the M1 plan).
M2 fold (2026-10-22, `M2-FoldTasks.md` + `M2-Amendment.md`): Absorbs (M2) GC06's and GC11's N=1 crashtest fallbacks (`track_and_verify_wals`, OCC serial validation, `file_scope_wal_write_faults`).
Rebase onto facebook/rocksdb eb12834 (review round 15): upstream meta#15626 moved the inplace_update_support sanitizing to the start of `finalize_and_sanitize`, so the N>1 overrides that used to run there turned allow_concurrent_memtable_write back on after it, and DB::Open rejected the result. The same overrides also replaced explicitly passed flags (for example `--disable_wal=1`) and made `tools/db_crashtest_test.py` (`make db_crashtest_tests`, part of `make check`) fail in about 5 of 6 runs; that was already true before this rebase. The overrides now run in `gen_cmd_params` before command-line flags are merged, following the file-scoped WAL fault selection there, keyed on the effective wal_partitions (an explicit `--wal_partitions` included), and they fix the per-run test_secondary draw so wal_partitions does not change between runs of a series. The late N>1 check falls back to one partition on any conflict.
db_stress: the LockWAL check accepts GetCurrentWalFile() returning NotSupported at wal_partitions > 1 (each partition has its own current WAL); the sequence number check still runs. It lived in D130396596 until fbcode CI on the eb12834 rebase showed this diff's whitebox crash tests failing at wal_partitions=16 with "GetCurrentWalFile() failed: Not implemented": this diff is the first to draw wal_partitions > 1, so the check moved here.
Changes visible to existing users:
- db_crashtest.py now picks wal_partitions 2, 8 or 16 for about 1 in 3 invocations (or takes `--wal_partitions`). In those series `gen_cmd_params` sets partition_wal_usage, disable_wal, enable_pipelined_write, allow_concurrent_memtable_write, memtablerep, sync, test_secondary and continuous_verification_interval to values N>1 accepts, once for the series and before it applies command-line flags. An explicitly passed incompatible flag, or inplace_update_support=1, keeps the series at one partition. At N>1 the runs turn off ingest_wbwi_one_in and commit_bypass_memtable_one_in.
- New db_stress flag --sync_write_one_in (default 0). db_crashtest.py sets it to 10 or 100 in half of its runs at any wal_partitions, so default crash tests now mix sync and non-sync writes.
Test Plan:
`db_stress` builds at placement. Tip suites pass.
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_crashtest.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.
M4 fold: Absorbs
- GC26 Q5(e): db_crashtest.py runs no secondary and no continuous verification at N>1 (code only; no crash test was run).
- Net-zero pairs dropped (rule 2.7): none.
M4 B.1: PASS (clang-format 21.1.2 on the changed lines, make check-sources, debug build of db_stress; no test binary touched).
Rebased stack (facebook/rocksdb eb12834, fbcode/master b1d9881f429e): `tools/db_crashtest_test.py` gains `test_wal_partitions_steers_randomized_settings`, `test_explicit_flag_wins_over_wal_partitions`, `test_inplace_update_support_keeps_one_wal_partition`, `test_wal_partitions_stays_fixed_across_runs` and `test_explicit_wal_partitions_is_steered`, and `test_cf_consistency_randomizes_secondary` pins wal_partitions=1. The suite passes 89/89 in 40 runs with the random draw and in 5 runs each with wal_partitions pinned to 1, 2, 8 and 16; before the fix it failed in 6 of 6 runs at the previous stack. Neuters: with the old overrides restored the first three new tests fail; without the steering block the first fails; without fixing test_secondary and continuous_verification_interval `test_wal_partitions_stays_fixed_across_runs` fails; keying the steering on the drawn value only fails `test_explicit_wal_partitions_is_steered`.
Reviewers: generatedunixname1864816080879669
Differential Revision: https://phabricator.intern.facebook.com/D126533194
Tags: skip_dr_passed
JustinGaoF
pushed a commit
to JustinGaoF/rocksdb
that referenced
this pull request
Nov 19, 2026
…n builds Summary: The flip of the PartitionWAL stack (GC18 Q1-Q5). DB::Open accepts wal_partitions > 1 with an indexing partition_wal_usage in release and debug builds, with no sync point and no opt-in. kNone with N>1 and every other M1.4 rejection still fail with their exact Status. The wal_partitions doc and the release notes describe the shipped behaviour and the rollout order (readers first). Removes: - the N>1 gate in DBImpl::ValidateOptions and its debug sync point DBImpl::ValidateOptions:AllowWalPartitions; - the GC13 opt-in experimental_allow_wal_partitions_for_testing (D-G18k (i)): the option, its OPTIONS-map entry, Dump line, generated C accessors (two "removed" entries are added to tools/c_api_gen/api_compatibility_allowlist.json); db_bench, db_stress and test::SetWalPartitions stop setting it; - every use of the hook in tests and tools, including the hooks that tests folded below this commit carry at M4 (exception X14: FailedSyncPrepareLeavesNoStaleFence, GC23TimestampedSnapshotsSurviveFlushStress, GC19TornFirstRecordInBrandNewNTwoDbModes, CreateBrandNewPartitionedDb, GC23FloorOffForLaterGenerationHeads, GC24HistoryFloorScopeOnUpgrade) and the original hooks of SyncPrepareAfterSyncCommitSurvivesCrash, FU14SnapshotRace and FU14H6TornFirstRecordInBrandNewNTwoDb (GC26 Q5(d)). Adds db_wal_partitions_open_test (GC18 Q1, with GC20 Q9's edits), GC20 Q9's "with indexing it opens" leg of WalPartitionsValidation (exception X6), GC23 Q8's wal_partitions doc sentences (exception X6), and the release notes unreleased_history/new_features/wal_partitions.md, behavior_changes/partition_wal_sync_visibility.md (GC25) and behavior_changes/partition_wal_recovery_modes.md (GC26) (exception X19: they describe behaviour production builds reach only from this commit). Recorded exception: this commit stays a standalone diff on top of the stack and is never folded (GC18 round decision, design audit G3-C-2), so it can be reviewed, landed and reverted alone, and N>1 never becomes legal partway up the stack. M5 fold: Absorbs 10 A.1 entries (GC28 1, GC27 3, GC30 2, GC29a 2, GC31 1, GC32 1): the five new release-note files (X19-M5); the post-flip wal_partitions doc lines (GC27, GC30, GC29a); wal_partitions.md. Exceptions: X19-M5. Release notes added here (X19-M5): bug_fixes/partition_wal_recovery_and_visibility_fixes.md, new_features/partition_wal_file_scoped_resume.md, performance_improvements/partition_wal_targeted_gate_sync.md, performance_improvements/partition_wal_write_path_locks.md, performance_improvements/partition_wal_write_pipeline.md. Removes the X14-M5 hook lines: the AllowWalPartitions callbacks D123079329, D123701876, D123928339, D123971668, D127093323 and D127275775 added to their folded N>1 tests. M6 fold: removes the `DBImpl::ValidateOptions:AllowWalPartitions` hook lines added below the flip to the GC34 Q1 tests (`RunReplayedPrepareIsNotCut`); no other change. Benchmark (rebased stack, paired and interleaved): Release `db_bench` built at the rebased stack (fork f4c2cc3436 on facebook/rocksdb e732049; the final 7fd6043 differs only in transaction_test.cc). Workload: `fillrandom`, 3000 ops per thread, 4 KiB values, 64 column families, pipelined write off, auto compactions off, DB on /dev/shm. The latency-injection FileSystem adds a 200 us WAL append latency and a 200 us WAL sync latency (20 us jitter, fixed seed 1001). Profile S caps WAL append and sync bandwidth at 50 MB/s each. Profile S-sync caps only sync bandwidth (50 MB/s). There are three rounds, and each round runs every cell, rotating the cell order. The table reports the median of the three runs (min-max across runs). The ratio is the median of the per-round ratios against N=1 kNone. Host is shared: 1-minute load average 12-67 during the runs (other users). Sync column: `all` = `--sync`, `1-in-20` = `--sync_write_one_in=20`, `none` = no sync. | Profile | Sync | Cell | ops/s (median of 3) | min-max | vs N=1 kNone | mean write us | p99 write us | WAL appends | WAL syncs | |---|---|---|---|---|---|---|---|---|---| | S | all | N=1 kNone | 5425 | 5282-5490 | 1.00x | 11646 | 13984 | 6002 | 6002 | | S | all | N=1 indexed | 5374 | 4871-5456 | 0.98x | 11716 | 14528 | 6007 | 6005 | | S | all | N=8 | 20104 | 20098-20516 | 3.71x | 3163 | 6351 | 90202 | 48470 | | S | all | N=16 | 22746 | 21715-23222 | 4.14x | 2794 | 5075 | 133766 | 80580 | | S | 1-in-20 | N=1 kNone | 5659 | 5645-5672 | 1.00x | 11283 | 58960 | 6149 | 2042 | | S | 1-in-20 | N=1 indexed | 5669 | 5624-5680 | 1.00x | 11270 | 60891 | 6027 | 1916 | | S | 1-in-20 | N=8 | 21635 | 20743-21835 | 3.81x | 2940 | 6587 | 63675 | 20851 | | S | 1-in-20 | N=16 | 24240 | 23984-24506 | 4.29x | 2620 | 6208 | 105691 | 38739 | | S | none | N=1 kNone | 10627 | 10435-10702 | 1.00x | 6015 | 6595 | 6005 | 0 | | S | none | N=1 indexed | 10631 | 10433-10650 | 1.00x | 6012 | 6598 | 6007 | 0 | | S | none | N=8 | 48068 | 47452-48281 | 4.52x | 1318 | 2788 | 48464 | 0 | | S | none | N=16 | 63757 | 63551-63974 | 6.00x | 992 | 1881 | 83100 | 0 | | S-sync | all | N=1 kNone | 9725 | 9722-9781 | 1.00x | 6570 | 9790 | 6003 | 6003 | | S-sync | all | N=1 indexed | 9776 | 9770-9792 | 1.00x | 6539 | 9621 | 6006 | 6004 | | S-sync | all | N=8 | 28877 | 27685-29180 | 2.97x | 2208 | 4214 | 88995 | 46361 | | S-sync | all | N=16 | 27734 | 26727-29899 | 2.85x | 2292 | 4318 | 134123 | 78895 | | S-sync | 1-in-20 | N=1 kNone | 10263 | 10190-10338 | 1.00x | 6220 | 19308 | 6029 | 2525 | | S-sync | 1-in-20 | N=1 indexed | 10330 | 10159-10355 | 1.00x | 6180 | 28946 | 6029 | 2329 | | S-sync | 1-in-20 | N=8 | 29514 | 29500-29519 | 2.88x | 2152 | 5876 | 61844 | 21538 | | S-sync | 1-in-20 | N=16 | 30808 | 30736-31239 | 3.02x | 2059 | 4387 | 103682 | 39121 | | S-sync | none | N=1 kNone | 72763 | 72596-74166 | 1.00x | 873 | 1293 | 6013 | 0 | | S-sync | none | N=1 indexed | 74786 | 72987-75086 | 1.01x | 850 | 1285 | 6016 | 0 | | S-sync | none | N=8 | 123028 | 120951-124222 | 1.67x | 512 | 862 | 39044 | 0 | | S-sync | none | N=16 | 133228 | 129421-133491 | 1.80x | 471 | 855 | 71038 | 0 | | S, 16 threads | all | N=1 kNone | 4724 | 4387-4738 | 1.00x | 3346 | 6482 | 4022 | 4022 | | S, 16 threads | all | N=1 indexed | 4713 | 4707-4736 | 1.00x | 3334 | 6478 | 3958 | 3956 | | S, 16 threads | all | N=8 | 8494 | 8464-8529 | 1.80x | 1873 | 2895 | 40476 | 27290 | | S, 16 threads | all | N=16 | 9294 | 9250-9323 | 1.97x | 1711 | 2876 | 44226 | 34317 | All 84 runs exited 0. Command per cell: ``` db_bench --benchmarks=fillrandom --threads=64 --num=3000 --value_size=4096 \ --num_column_families=64 --wal_partitions=<N> --partition_wal_usage=<none|partition_by_column_family> \ --enable_pipelined_write=false --disable_auto_compactions=1 --statistics --histogram \ --inject_wal_latency --wal_append_latency_us=200 --wal_sync_latency_us=200 \ --wal_latency_jitter_us=20 --wal_latency_seed=1001 --seed=1001 \ --wal_append_bandwidth_mbps=<50|0> --wal_sync_bandwidth_mbps=50 [--sync | --sync_write_one_in=20] ``` N=1 against upstream (default options, no partitioning flags, no latency injection): release `db_bench` of this stack against release `db_bench` of facebook/rocksdb e732049, five rounds, alternating which binary runs first, DB on /dev/shm. | Workload | upstream e732049 ops/s (median) | min-max | this stack ops/s (median) | min-max | stack/upstream (median of per-round) | |---|---|---|---|---|---| | fillrandom, 64 threads x 20000, 64 CFs, 4 KiB values, no sync | 224575 | 219463-232611 | 220572 | 213377-226176 | 0.972x | | fillrandom, 16 threads x 200000, 1 KiB values, --sync | 532901 | 524086-611361 | 530771 | 525389-541405 | 0.999x | Per-round stack/upstream ratios: --sync 0.996, 0.999, 1.032, 1.000, 0.860; no sync 0.972, 1.007, 0.948, 0.951, 0.990. 1-minute load average 11-22 during the runs. All 20 runs exited 0. The earlier run of the same comparison on e591f5f measured 0.996x (--sync) and 0.979x (no sync). Stress (db_stress crash test with the latency-injection FileSystem wired in): `tools/db_crashtest.py` blackbox and whitebox, 1800 s each, at wal_partitions 1 and 8, on the stack rebased onto facebook/rocksdb eb12834 (fork 286fdab796, debug db_stress; the final stack differs only in clang-format line wrapping and in `tools/db_crashtest.py`/`db_crashtest_test.py`). Pinned: `--disable_wal=0 --partition_wal_usage=partition_by_column_family --enable_blob_direct_write=0 --best_efforts_recovery=0 --two_write_queues=0 --enable_pipelined_write=0 --unordered_write=0 --recycle_log_file_num=0 --track_and_verify_wals=0 --inplace_update_support=0 --use_optimistic_txn=0`, plus `--inject_wal_latency=1 --wal_append_latency_us=50 --wal_sync_latency_us=300 --wal_latency_jitter_us=50 --wal_append_bandwidth_mbps=200 --wal_sync_bandwidth_mbps=100`. Every db_stress command line in the logs was checked for WAL on, latency injection on and the intended wal_partitions; randomized overrides did not disable them. | Mode | wal_partitions | db_stress command lines | Result | |---|---|---|---| | blackbox | 1 | 31 | exit 0 | | blackbox | 8 | 31 | exit 0 | | whitebox | 1 | 16 | exit 0 | | whitebox | 8 | 26 | exit 0 | The same runs on the previous base (fork f4c2cc3436 on e732049) also exited 0 (31/31/22/12 command lines). The two fbcode sandcastle crash-test command lines that failed on the previous version (ASAN and blackbox, with `read_fault_one_in=1000`) were rerun locally against this stack, three times each for 1200 s: no failure. fbcode sandcastle crash tests: The six `rocksdb-contrun.sky` crash-test workflows ran on stack top 32fe728cb06b, scheduled 2026-11-10 05:32 UTC. The final stack differs from it only in test code, one comment and one line break (the ASAN and format fixes below); db_stress is unchanged. All six passed. | Workflow | Result | Finished (PST, 2026-11-10) | |---|---|---| | fbcode_blackbox_crash_test | pass | 00:57 | | fbcode_asan_blackbox_crash_test | pass | 00:57 | | fbcode_tsan_blackbox_crash_test | pass | 01:16 | | fbcode_whitebox_crash_test | pass | 03:37 | | fbcode_asan_whitebox_crash_test | pass | 03:37 | | fbcode_tsan_whitebox_crash_test | pass | 03:28 | Sandcastle jobs: 49539596750420932, 49539596750421833, 40532397491966602, 49539596750421523, 45035997124599077, 22518001256897652 (https://www.internalfb.com/intern/sandcastle/job/<id>/). On the previous submitted version two of these workflows had failed (the sandcastle P1 below); that fix is in this stack. Comprehensive review (15 rounds, whole 39-diff stack): Each round ran the comprehensive-diff-review protocol (read-only Opus reviewers; round 1 used four reviewers by area, later rounds one) against the cumulative stack, on facebook/rocksdb d6a7847 for rounds 1-7 and, after the rebase onto e591f5f (the RocksDB subtree of fbcode/warm), on the rebased stack for rounds 8-11, on facebook/rocksdb e732049 (fbcode/warm 4df7e0a0db7b) for rounds 12-13, on 9ce1bfb (fbcode/warm 37d097c1b953) for round 14 and on eb12834 (fbcode/master b1d9881f429e) for round 15. Rounds 14 and 15 reviewed the rebase delta. Rows marked sandcastle, external and crash test are defects found outside the review rounds and fixed the same way. Every P1/P2 was re-checked against the code, reproduced by a new test that fails first, fixed in the diff that introduced the code, and verified by a neuter (reverting the fix makes the test fail). Candidates are the fork's review folds of pwal/m6. | Round | Candidate | P1/P2 found | Fixed in | Regression test | |---|---|---|---|---| | 1 | pwal/m6 69c13fc | 4 P2: CMake missed db/log_merge.cc and log_merge_test; a secondary could not open or catch up beside an indexed primary with async_wal_precreate; a damaged first record in a WAL with an intact head floor and no span made the DB unopenable; commit_bypass_memtable failed after Prepare at N>1 | D120624825 (CMake), D127093323 (async_wal_precreate sanitized off when partition_wal_usage != kNone), D120649665 (HeadBounded counts the WAL's own head floor), D123079329 (bypass falls back to the memtable commit at N>1) | DBSecondaryTest.IndexedPrimaryDisablesAsyncWalPrecreate; DBWalPartitionCoverageTest.DamagedFirstRecordAfterUpgradeToTwoPartitions; TransactionPartitionedWalTest.CommitBypassMemtableCommitsNormally | | 2 | fold2 2e8c56707a8f | 2 P2: GetSortedWalFiles returned a false Corruption once coupled rotation retired an idle partition's metadata-only WAL that the MANIFEST tracks; GC24HistoryFloorScopeOnUpgrade still pinned the pre-fix outcome | D127093323, D127837663 | DBWritePartitionTest.SortedWalFilesListsIdlePartitionWals | | 3 | fold3 8b6590498 | 1 P2: that fix was keyed to the opener's wal_partitions, so read-only or N=1 openers still got the Corruption. Writing its test exposed a read-only open with WAL tracking off hitting `assert(recovery_ctx != nullptr)` in Recover; fixed too | D127093323 | DBWritePartitionTest.SortedWalFilesListsIdlePartitionWalsReadOnly | | 4 | fold5 c3c369362 | 1 P2: at N=1 indexed, a data-less current WAL got a cached synthetic start sequence 1, so GetUpdatesSince skipped the older WAL holding the requested sequence | D127093323 | DBWalIteratorTest.IndexedDataLessCurrentWalKeepsOlderWal | | 5 | fold6 6e3ad3889 | None. The per-diff gate then failed WalPartitions8/WritePreparedTransactionTest.{WC_WP_ForwardCompatibility, WP_WC_DBBackwardCompatibility}: listing every metadata-only WAL changed GetSortedWalFiles after a flush; reworked to upstream listing semantics | D127093323 | the two WritePrepared tests, unmodified | | 6 | fold7 376fac935 | 1 P2: the rework left MANIFEST-tracked metadata-only WALs out of GetSortedWalFiles, so a GetLiveFiles(flush_memtable=false) + GetSortedWalFiles copy failed to open ("Missing WAL with log number"). Now a tracked metadata-only WAL is listed (start sequence 1, not cached) and an untracked one is skipped | D127093323 | DBWritePartitionTest.LiveFilesAndSortedWalFilesCopyOpens | | 7 | fold8 431f2a98e | None (1 P3, below) | | | | 8 | rebased 188e02204b43 (onto e591f5f; two reviewers) | None | | | | sandcastle | previous submitted version | 1 P1 (fbcode crash tests with `read_fault_one_in=1000`): an injected WAL read I/O error during recovery surfaced as `Corruption: WAL index merge: WAL <n> head damaged and unattested` in the merged replay, and the classification pass ignored it | D120624825 (the merger keeps the read's IOError), D121636079/D121674557 (classification returns it), D123928339 (merged replay returns the merger's error before the damage checks) | LogMergeTest.FailedReadKeepsTheReadError; DBWALIndexTest.ClassificationReadIOErrorFailsRecovery; DBWalPartitionCoverageTest.MergeReadIOErrorFailsWithTheReadError | | 9 | 805ea60 | 2 P3 + 1 gap, fixed: sequential indexed replay replaced the read IOError with a generic one; the merger's error dropped the read's retryable/data-loss/scope attributes | D120415420, D120624825 | DBWALIndexTest.SequentialIndexedReplayReadIOErrorKeepsTheReadError; LogMergeTest.FailedReadKeepsTheReadErrorAttributes | | external | D119751506 reviewer comment | 1 P2: with manual_wal_flush the burned-index void cover appended to the WAL buffer without wal_write_mutex_, racing an application FlushWAL | D119751506 (takes the mutex as WriteToWAL does), D122412677 (per-partition mutex) | DBWALIndexTest.BurnedWALIndexCoverHoldsWALMutexWithManualFlush | | crash test | 805ea60 | 1 P2 (debug only): whitebox crash test at N=8 hit the FlushScheduler::Empty consistency assertion when another partition leader dequeued concurrently | D123079329 (Empty reads the head under the debug checking mutex; release builds unchanged) | DBWritePartitionTest.FlushSchedulerEmptyRacesAnotherLeadersDequeue | | 10 | 12aad1d | 1 P2: statuses on the merged-recovery read-error path left unchecked (ASSERT_STATUS_CHECKED abort) | D120624825, D123551605, D123701876, D123928339, D123971668, D127093323 (holders permitted, ignored reports marked) | the read-error tests above under ASSERT_STATUS_CHECKED | | 11 | 69a91e9 | None | | | | fbcode CI | previous submitted version | 1 P2 (build): D120624825 declared two private fields (`last_sequence_index_`, `last_sequence_wal_`) first used in D120649665, so clang failed with -Werror,-Wunused-private-field at D120624825 | D120624825 (the fields move to D120649665; later diffs unchanged) | clang per-diff build gate | | 12 | f4c2cc3436 (rebased onto e732049) | 1 P2 (tests): upstream's new TransactionTest.InplaceUpdateSupportRequiresWriteCommitted also runs in this stack's WalPartitions8 instantiation, where Open rejects its options; 3 deterministic failures | D127275775 (at wal_partitions > 1 the test asserts NotSupported) | the test itself: 3 failures before, 33/33 after | | 12 (re-review) | 7fd6043 | None | | | | fbcode CI | 7fd6043 | 1 P2 (ASAN, test-only): GC31FollowerExitGroup freed its local Env while the fixture's last options still pointed at it, so the next DestroyAndReopen read freed memory (heap-use-after-free in NGreaterThan1FollowerExitHandsFailureToLeader); and the rocks format check flagged a comment over 80 columns and one unjoined condition | D123701876 (the helper resets the fixture's env on exit); D121858039, D123079329, D123551605, D123971668 (clang-format output) | the test under ASAN: heap-use-after-free before, 4/4 and db_write_test 581/581 after; check-format.sh passes on all 39 diffs | | strict status | b19275b | 1 P2 (ASSERT_STATUS_CHECKED, GitHub CI): 27 aborts from unchecked statuses: a reader report superseded by a more specific recovery error, a per-record pending report on early returns, the gate sync's covered path, a background-error return, an ingestion early return, and three test-side cases. Release behaviour unchanged | D120415420, D120649665, D123476301, D123701876, D123928339, D123971668, D127837663 | the ASSERT_STATUS_CHECKED suite: 27 aborts before, 0 after | | 13 | f658359 | None | | | | 14 | m6-rb10 (rebased onto 9ce1bfb) | 1 P2 (tests, from my rebase resolution): upstream's new kSortedHash option config was not skipped at wal_partitions > 1, where Open accepts only the SkipList memtable, so 7 WalPartitions8/ExternalSSTFileTestN tests walking ChangeOptions failed to reopen | D127275775 (kSortedHash joins the N>1 skip list) | the 7 tests: fail before, pass after | | 15 | 286fdab796 (rebased onto eb12834) | 1 P2 (crash test): upstream meta#15626 moved the inplace_update_support sanitizing ahead of this stack's N>1 overrides, which turned allow_concurrent_memtable_write back on, so about 3% of default crash-test series failed DB::Open. Found while verifying it: the same overrides replaced explicitly passed flags and made `make db_crashtest_tests` fail in about 5 of 6 runs, already on the previous stack (1 more P2) | D126533194 (N>1 steering moved into gen_cmd_params, before command-line flags) | db_crashtest_test.py: 3 new tests, each failing with the old overrides | | 15 (re-review) | 0d68d5f821 | 2 P2 + 1 P3 in that fix: test_secondary was still drawn per run, so wal_partitions flipped between runs and a secondary could open over partition WALs; an explicit --wal_partitions was not steered; the new test helper did not pin the trie index (about 4% flaky) | D126533194 | test_wal_partitions_stays_fixed_across_runs, test_explicit_wal_partitions_is_steered (each fails under its neuter); suite 89/89 in 40 runs | | fbcode CI | V1.2 drafts (1686cdb39f) | 1 P2 (stack order, crash test): D126533194 is the first diff whose crash test draws wal_partitions > 1, but the db_stress LockWAL check that accepts GetCurrentWalFile() NotSupported at N>1 lived in this diff, so whitebox runs at D126533194 failed with "GetCurrentWalFile() failed: Not implemented" | D126533194 (the check moves down from this diff; the final tree is unchanged) | local blackbox at wal_partitions=8, lock_wal_one_in=2000: the old D126533194 fails on its 2nd run (192 errors), the new one passes 11/11 | Final state: all 39 diffs at fork 1686cdb39f on facebook/rocksdb eb12834, each mirrored byte-identically into its fbsource diff on fbcode/master b1d9881f429e (master has since gained one RocksDB commit, c043e8dfa272, touching include/rocksdb/options.h about 180 lines from this stack's hunks). At 286fdab796 (the final stack differs only in clang-format line wrapping and the crash-test Python): per-diff clang gate for all 39 diffs; full make suite 11192/11192; clang TSan once 709/709 and 100x 2600/2600; ASSERT_STATUS_CHECKED suite with no failures from this stack (range_locking_test only, below); crash tests above. At 1686cdb39f: db_write_test 581/581, the gap-filler tests, `tools/db_crashtest_test.py` 89/89, and fbcode/rocks/sandcastle/check-format.sh at every diff. Totals: 1 P1 and 20 P2 fixed. Open items (P3 or validation gaps, tracked as follow-ups, not fixed here): - ASSERT_STATUS_CHECKED: range_locking_test fails in that build mode at upstream e732049 too; it is not part of this stack. - Rebase gap (pre-existing): with recycle_log_file_num > 0, an indexed one-partition DB gets no WAL sequence-gap filler (upstream meta#15581 covers kNone only), so an ingestion gap at a WAL boundary can still stop point-in-time recovery there, as it did for every DB before meta#15581. - Round 9 F-002 (P3): consumer head checks report a WAL read I/O error as NotSupported. - Round 11 gap (low confidence, pre-existing): the void re-read during recovery can swallow a transient read IOError. - TSan with the gcc 11 runtime (libtsan.so.0) reports false "double lock of a mutex" on any std::condition_variable::wait_for mutex, upstream TransactionDB code included, because it does not intercept pthread_cond_clockwait. Use clang TSan. - Round 7 P3: after an open that writes supersession records without a dummy write (for example a WalFilter stop with avoid_flush_during_recovery=true), partition 0's untracked, data-less current WAL carries the supersession record. GetSortedWalFiles skips it, so a GetLiveFiles + GetSortedWalFiles copy could fail with "two live records share index". Checkpoint and BackupEngine are unaffected. Inferred from code, not reproduced. - Round 2 P3: WriteRecoverableState at N>1 can stamp the cached recoverable state inside an open fence during an auto-resumed retryable WAL error. - Round 1 P3s: the checkpoint/backup LockWAL race tests can stop on an ASSERT before joining their threads; GC31FollowerExitGroup orders writers with sleeps; standalone db_stress at N>1 trips on the default get_current_wal_file_one_in; checkpoint/backup at N>1 wait out a write stop. - Gaps: an indexed DB with wal_compression still caches start sequence 1 for a data-less WAL (as upstream does for compression-only WALs); HeadFloor() for a member with no surviving data is the last progress bound read (no production-reachable loss found). Reports (MetaMate): - Round 1: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-69c13fcb72e2-20261107t093444z - Round 2: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-fold2-2e8c56707a8f-20261107t175411z - Round 3: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-fold3-8b6590498-20261107t185930z - Round 4: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-fold5-c3c369362-20261107t192653z - Round 5: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-fold6-6e3ad3889-20261107t193256z - Round 6: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-fold7-376fac935-20261108t054421z - Round 7: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-fold8-431f2a98e-20261108t055310z - Round 11: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-rb2-69a91e9ba-20261110t022328z - Round 13: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-rb8-f6583590ed-20261110t195418z - Round 15 (final stack): https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-rb15-1686cdb39f-20261111t191953z Changes visible to existing users: - Removes DBOptions::experimental_allow_wal_partitions_for_testing, its "experimental_allow_wal_partitions_for_testing" options-string key (which no longer parses) and the C API functions rocksdb_options_set/get_experimental_allow_wal_partitions_for_testing. All were added earlier in this stack (D117251769) and never released. - The --wal_partitions help text of db_bench and db_stress changed. Test Plan: M4 B.1: PASS (clang-format 21.1.2 on the changed lines, make check-sources, debug build of db_options_test, db_wal_oracle_test, db_wal_partitions_open_test, db_write_test, latency_injection_fs_test, ldb_cmd_test, optimistic_transaction_test, options_settable_test, transaction_test, write_prepared_transaction_test, db_stress, db_bench, ldb); 4974 tests, 0 failed. M5 B.1: PASS (clang-format 21.1.2 on the changed lines, make check-sources, debug build of compaction_service_test, db_options_test, db_wal_oracle_test, db_wal_partitions_open_test, db_wal_test, db_write_test, latency_injection_fs_test, ldb_cmd_test, optimistic_transaction_test, options_settable_test, transaction_test, write_prepared_transaction_test, db_stress, db_bench, ldb); 7324 tests, 0 failed. M6 B.1: PASS (debug build and build_tools/gtest-parallel run of compaction_service_test db_options_test db_wal_oracle_test db_wal_partitions_open_test db_wal_test db_write_test latency_injection_fs_test ldb_cmd_test optimistic_transaction_test options_settable_test transaction_test write_prepared_transaction_test: 7340/7340). Rebased stack (e591f5f): PASS. Debug build and build_tools/gtest-parallel run of compaction_service_test db_options_test db_wal_oracle_test db_wal_partitions_open_test db_wal_test db_write_test latency_injection_fs_test ldb_cmd_test optimistic_transaction_test options_settable_test transaction_test write_prepared_transaction_test: 7559/7559. Full make suite 10540/10540. Rebased stack (e732049, fbcode/warm 4df7e0a0db7b) final: clang per-diff gates for all 39 diffs; full make suite 10576/10579 at f4c2cc3436 with the 3 round-12 failures fixed at 7fd6043 (transaction_test 3475/3475); clang TSan; crash tests and the two sandcastle repro command lines above. At b19275b: db_write_test under ASAN/UBSAN (clang) 581/581; clang per-diff gates for D121858039 through D123971668 rerun and pass; fbcode/rocks/sandcastle/check-format.sh passes at every diff. fbcode sandcastle crash tests (blackbox and whitebox; plain, ASAN, TSAN): 6/6 pass on 32fe728cb06b. Strict status (ASSERT_STATUS_CHECKED=1) suite at f658359: 0 aborts from this stack (27 before the fix). Rebased stack (facebook/rocksdb eb12834, fbcode/master b1d9881f429e) final: clang per-diff gates for all 39 diffs; full make suite 11192/11192; clang TSan 709/709 once and 2600/2600 at 100x; ASSERT_STATUS_CHECKED with only range_locking_test failing (not touched by this stack); crash tests blackbox and whitebox at wal_partitions 1 and 8 exit 0; `tools/db_crashtest_test.py` 89/89; check-format.sh passes at every diff. Differential Revision: https://phabricator.intern.facebook.com/D130396596
JustinGaoF
added a commit
to JustinGaoF/rocksdb
that referenced
this pull request
Nov 19, 2026
Summary:
M1 standalone S-B (S-GC13), carved from GC13 Q2 (see that round summary
for question evidence):
- `db_crashtest.py`: N sweep over {1,2,8,16} plus both sanitize stages
(N>1 admits indexed WALs only).
- `db_stress --sync_write_one_in` (flag and use) and `SetOptions`
`max_successive_merges` at N>1.
Placed above S-C (no dependency; order follows the M1 plan).
M2 fold (2026-10-22, `M2-FoldTasks.md` + `M2-Amendment.md`): Absorbs (M2) GC06's and GC11's N=1 crashtest fallbacks (`track_and_verify_wals`, OCC serial validation, `file_scope_wal_write_faults`).
Rebase onto facebook/rocksdb eb12834 (review round 15): upstream meta#15626 moved the inplace_update_support sanitizing to the start of `finalize_and_sanitize`, so the N>1 overrides that used to run there turned allow_concurrent_memtable_write back on after it, and DB::Open rejected the result. The same overrides also replaced explicitly passed flags (for example `--disable_wal=1`) and made `tools/db_crashtest_test.py` (`make db_crashtest_tests`, part of `make check`) fail in about 5 of 6 runs; that was already true before this rebase. The overrides now run in `gen_cmd_params` before command-line flags are merged, following the file-scoped WAL fault selection there, keyed on the effective wal_partitions (an explicit `--wal_partitions` included), and they fix the per-run test_secondary draw so wal_partitions does not change between runs of a series. The late N>1 check falls back to one partition on any conflict.
db_stress: the LockWAL check accepts GetCurrentWalFile() returning NotSupported at wal_partitions > 1 (each partition has its own current WAL); the sequence number check still runs. It lived in D130396596 until fbcode CI on the eb12834 rebase showed this diff's whitebox crash tests failing at wal_partitions=16 with "GetCurrentWalFile() failed: Not implemented": this diff is the first to draw wal_partitions > 1, so the check moved here.
Changes visible to existing users:
- db_crashtest.py now picks wal_partitions 2, 8 or 16 for about 1 in 3 invocations (or takes `--wal_partitions`). In those series `gen_cmd_params` sets partition_wal_usage, disable_wal, enable_pipelined_write, allow_concurrent_memtable_write, memtablerep, sync, test_secondary and continuous_verification_interval to values N>1 accepts, once for the series and before it applies command-line flags. An explicitly passed incompatible flag, or inplace_update_support=1, keeps the series at one partition. At N>1 the runs turn off ingest_wbwi_one_in and commit_bypass_memtable_one_in.
- New db_stress flag --sync_write_one_in (default 0). db_crashtest.py sets it to 10 or 100 in half of its runs at any wal_partitions, so default crash tests now mix sync and non-sync writes.
Test Plan:
`db_stress` builds at placement. Tip suites pass.
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_crashtest.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.
M4 fold: Absorbs
- GC26 Q5(e): db_crashtest.py runs no secondary and no continuous verification at N>1 (code only; no crash test was run).
- Net-zero pairs dropped (rule 2.7): none.
M4 B.1: PASS (clang-format 21.1.2 on the changed lines, make check-sources, debug build of db_stress; no test binary touched).
Rebased stack (facebook/rocksdb eb12834, fbcode/master b1d9881f429e): `tools/db_crashtest_test.py` gains `test_wal_partitions_steers_randomized_settings`, `test_explicit_flag_wins_over_wal_partitions`, `test_inplace_update_support_keeps_one_wal_partition`, `test_wal_partitions_stays_fixed_across_runs` and `test_explicit_wal_partitions_is_steered`, and `test_cf_consistency_randomizes_secondary` pins wal_partitions=1. The suite passes 89/89 in 40 runs with the random draw and in 5 runs each with wal_partitions pinned to 1, 2, 8 and 16; before the fix it failed in 6 of 6 runs at the previous stack. Neuters: with the old overrides restored the first three new tests fail; without the steering block the first fails; without fixing test_secondary and continuous_verification_interval `test_wal_partitions_stays_fixed_across_runs` fails; keying the steering on the drawn value only fails `test_explicit_wal_partitions_is_steered`.
Reviewers: generatedunixname1864816080879669
Differential Revision: https://phabricator.intern.facebook.com/D126533194
Tags: skip_dr_passed
JustinGaoF
pushed a commit
to JustinGaoF/rocksdb
that referenced
this pull request
Nov 19, 2026
…n builds Summary: The flip of the PartitionWAL stack (GC18 Q1-Q5). DB::Open accepts wal_partitions > 1 with an indexing partition_wal_usage in release and debug builds, with no sync point and no opt-in. kNone with N>1 and every other M1.4 rejection still fail with their exact Status. The wal_partitions doc and the release notes describe the shipped behaviour and the rollout order (readers first). Removes: - the N>1 gate in DBImpl::ValidateOptions and its debug sync point DBImpl::ValidateOptions:AllowWalPartitions; - the GC13 opt-in experimental_allow_wal_partitions_for_testing (D-G18k (i)): the option, its OPTIONS-map entry, Dump line, generated C accessors (two "removed" entries are added to tools/c_api_gen/api_compatibility_allowlist.json); db_bench, db_stress and test::SetWalPartitions stop setting it; - every use of the hook in tests and tools, including the hooks that tests folded below this commit carry at M4 (exception X14: FailedSyncPrepareLeavesNoStaleFence, GC23TimestampedSnapshotsSurviveFlushStress, GC19TornFirstRecordInBrandNewNTwoDbModes, CreateBrandNewPartitionedDb, GC23FloorOffForLaterGenerationHeads, GC24HistoryFloorScopeOnUpgrade) and the original hooks of SyncPrepareAfterSyncCommitSurvivesCrash, FU14SnapshotRace and FU14H6TornFirstRecordInBrandNewNTwoDb (GC26 Q5(d)). Adds db_wal_partitions_open_test (GC18 Q1, with GC20 Q9's edits), GC20 Q9's "with indexing it opens" leg of WalPartitionsValidation (exception X6), GC23 Q8's wal_partitions doc sentences (exception X6), and the release notes unreleased_history/new_features/wal_partitions.md, behavior_changes/partition_wal_sync_visibility.md (GC25) and behavior_changes/partition_wal_recovery_modes.md (GC26) (exception X19: they describe behaviour production builds reach only from this commit). Recorded exception: this commit stays a standalone diff on top of the stack and is never folded (GC18 round decision, design audit G3-C-2), so it can be reviewed, landed and reverted alone, and N>1 never becomes legal partway up the stack. M5 fold: Absorbs 10 A.1 entries (GC28 1, GC27 3, GC30 2, GC29a 2, GC31 1, GC32 1): the five new release-note files (X19-M5); the post-flip wal_partitions doc lines (GC27, GC30, GC29a); wal_partitions.md. Exceptions: X19-M5. Release notes added here (X19-M5): bug_fixes/partition_wal_recovery_and_visibility_fixes.md, new_features/partition_wal_file_scoped_resume.md, performance_improvements/partition_wal_targeted_gate_sync.md, performance_improvements/partition_wal_write_path_locks.md, performance_improvements/partition_wal_write_pipeline.md. Removes the X14-M5 hook lines: the AllowWalPartitions callbacks D123079329, D123701876, D123928339, D123971668, D127093323 and D127275775 added to their folded N>1 tests. M6 fold: removes the `DBImpl::ValidateOptions:AllowWalPartitions` hook lines added below the flip to the GC34 Q1 tests (`RunReplayedPrepareIsNotCut`); no other change. Benchmark (rebased stack, paired and interleaved): Release `db_bench` built at the rebased stack (fork f4c2cc3436 on facebook/rocksdb e732049; the final 7fd6043 differs only in transaction_test.cc). Workload: `fillrandom`, 3000 ops per thread, 4 KiB values, 64 column families, pipelined write off, auto compactions off, DB on /dev/shm. The latency-injection FileSystem adds a 200 us WAL append latency and a 200 us WAL sync latency (20 us jitter, fixed seed 1001). Profile S caps WAL append and sync bandwidth at 50 MB/s each. Profile S-sync caps only sync bandwidth (50 MB/s). There are three rounds, and each round runs every cell, rotating the cell order. The table reports the median of the three runs (min-max across runs). The ratio is the median of the per-round ratios against N=1 kNone. Host is shared: 1-minute load average 12-67 during the runs (other users). Sync column: `all` = `--sync`, `1-in-20` = `--sync_write_one_in=20`, `none` = no sync. | Profile | Sync | Cell | ops/s (median of 3) | min-max | vs N=1 kNone | mean write us | p99 write us | WAL appends | WAL syncs | |---|---|---|---|---|---|---|---|---|---| | S | all | N=1 kNone | 5425 | 5282-5490 | 1.00x | 11646 | 13984 | 6002 | 6002 | | S | all | N=1 indexed | 5374 | 4871-5456 | 0.98x | 11716 | 14528 | 6007 | 6005 | | S | all | N=8 | 20104 | 20098-20516 | 3.71x | 3163 | 6351 | 90202 | 48470 | | S | all | N=16 | 22746 | 21715-23222 | 4.14x | 2794 | 5075 | 133766 | 80580 | | S | 1-in-20 | N=1 kNone | 5659 | 5645-5672 | 1.00x | 11283 | 58960 | 6149 | 2042 | | S | 1-in-20 | N=1 indexed | 5669 | 5624-5680 | 1.00x | 11270 | 60891 | 6027 | 1916 | | S | 1-in-20 | N=8 | 21635 | 20743-21835 | 3.81x | 2940 | 6587 | 63675 | 20851 | | S | 1-in-20 | N=16 | 24240 | 23984-24506 | 4.29x | 2620 | 6208 | 105691 | 38739 | | S | none | N=1 kNone | 10627 | 10435-10702 | 1.00x | 6015 | 6595 | 6005 | 0 | | S | none | N=1 indexed | 10631 | 10433-10650 | 1.00x | 6012 | 6598 | 6007 | 0 | | S | none | N=8 | 48068 | 47452-48281 | 4.52x | 1318 | 2788 | 48464 | 0 | | S | none | N=16 | 63757 | 63551-63974 | 6.00x | 992 | 1881 | 83100 | 0 | | S-sync | all | N=1 kNone | 9725 | 9722-9781 | 1.00x | 6570 | 9790 | 6003 | 6003 | | S-sync | all | N=1 indexed | 9776 | 9770-9792 | 1.00x | 6539 | 9621 | 6006 | 6004 | | S-sync | all | N=8 | 28877 | 27685-29180 | 2.97x | 2208 | 4214 | 88995 | 46361 | | S-sync | all | N=16 | 27734 | 26727-29899 | 2.85x | 2292 | 4318 | 134123 | 78895 | | S-sync | 1-in-20 | N=1 kNone | 10263 | 10190-10338 | 1.00x | 6220 | 19308 | 6029 | 2525 | | S-sync | 1-in-20 | N=1 indexed | 10330 | 10159-10355 | 1.00x | 6180 | 28946 | 6029 | 2329 | | S-sync | 1-in-20 | N=8 | 29514 | 29500-29519 | 2.88x | 2152 | 5876 | 61844 | 21538 | | S-sync | 1-in-20 | N=16 | 30808 | 30736-31239 | 3.02x | 2059 | 4387 | 103682 | 39121 | | S-sync | none | N=1 kNone | 72763 | 72596-74166 | 1.00x | 873 | 1293 | 6013 | 0 | | S-sync | none | N=1 indexed | 74786 | 72987-75086 | 1.01x | 850 | 1285 | 6016 | 0 | | S-sync | none | N=8 | 123028 | 120951-124222 | 1.67x | 512 | 862 | 39044 | 0 | | S-sync | none | N=16 | 133228 | 129421-133491 | 1.80x | 471 | 855 | 71038 | 0 | | S, 16 threads | all | N=1 kNone | 4724 | 4387-4738 | 1.00x | 3346 | 6482 | 4022 | 4022 | | S, 16 threads | all | N=1 indexed | 4713 | 4707-4736 | 1.00x | 3334 | 6478 | 3958 | 3956 | | S, 16 threads | all | N=8 | 8494 | 8464-8529 | 1.80x | 1873 | 2895 | 40476 | 27290 | | S, 16 threads | all | N=16 | 9294 | 9250-9323 | 1.97x | 1711 | 2876 | 44226 | 34317 | All 84 runs exited 0. Command per cell: ``` db_bench --benchmarks=fillrandom --threads=64 --num=3000 --value_size=4096 \ --num_column_families=64 --wal_partitions=<N> --partition_wal_usage=<none|partition_by_column_family> \ --enable_pipelined_write=false --disable_auto_compactions=1 --statistics --histogram \ --inject_wal_latency --wal_append_latency_us=200 --wal_sync_latency_us=200 \ --wal_latency_jitter_us=20 --wal_latency_seed=1001 --seed=1001 \ --wal_append_bandwidth_mbps=<50|0> --wal_sync_bandwidth_mbps=50 [--sync | --sync_write_one_in=20] ``` N=1 against upstream (default options, no partitioning flags, no latency injection): release `db_bench` of this stack against release `db_bench` of facebook/rocksdb e732049, five rounds, alternating which binary runs first, DB on /dev/shm. | Workload | upstream e732049 ops/s (median) | min-max | this stack ops/s (median) | min-max | stack/upstream (median of per-round) | |---|---|---|---|---|---| | fillrandom, 64 threads x 20000, 64 CFs, 4 KiB values, no sync | 224575 | 219463-232611 | 220572 | 213377-226176 | 0.972x | | fillrandom, 16 threads x 200000, 1 KiB values, --sync | 532901 | 524086-611361 | 530771 | 525389-541405 | 0.999x | Per-round stack/upstream ratios: --sync 0.996, 0.999, 1.032, 1.000, 0.860; no sync 0.972, 1.007, 0.948, 0.951, 0.990. 1-minute load average 11-22 during the runs. All 20 runs exited 0. The earlier run of the same comparison on e591f5f measured 0.996x (--sync) and 0.979x (no sync). Stress (db_stress crash test with the latency-injection FileSystem wired in): `tools/db_crashtest.py` blackbox and whitebox, 1800 s each, at wal_partitions 1 and 8, on the stack rebased onto facebook/rocksdb eb12834 (fork 286fdab796, debug db_stress; the final stack differs only in clang-format line wrapping and in `tools/db_crashtest.py`/`db_crashtest_test.py`). Pinned: `--disable_wal=0 --partition_wal_usage=partition_by_column_family --enable_blob_direct_write=0 --best_efforts_recovery=0 --two_write_queues=0 --enable_pipelined_write=0 --unordered_write=0 --recycle_log_file_num=0 --track_and_verify_wals=0 --inplace_update_support=0 --use_optimistic_txn=0`, plus `--inject_wal_latency=1 --wal_append_latency_us=50 --wal_sync_latency_us=300 --wal_latency_jitter_us=50 --wal_append_bandwidth_mbps=200 --wal_sync_bandwidth_mbps=100`. Every db_stress command line in the logs was checked for WAL on, latency injection on and the intended wal_partitions; randomized overrides did not disable them. | Mode | wal_partitions | db_stress command lines | Result | |---|---|---|---| | blackbox | 1 | 31 | exit 0 | | blackbox | 8 | 31 | exit 0 | | whitebox | 1 | 16 | exit 0 | | whitebox | 8 | 26 | exit 0 | The same runs on the previous base (fork f4c2cc3436 on e732049) also exited 0 (31/31/22/12 command lines). The two fbcode sandcastle crash-test command lines that failed on the previous version (ASAN and blackbox, with `read_fault_one_in=1000`) were rerun locally against this stack, three times each for 1200 s: no failure. fbcode sandcastle crash tests: The six `rocksdb-contrun.sky` crash-test workflows ran on stack top 32fe728cb06b, scheduled 2026-11-10 05:32 UTC. The final stack differs from it only in test code, one comment and one line break (the ASAN and format fixes below); db_stress is unchanged. All six passed. | Workflow | Result | Finished (PST, 2026-11-10) | |---|---|---| | fbcode_blackbox_crash_test | pass | 00:57 | | fbcode_asan_blackbox_crash_test | pass | 00:57 | | fbcode_tsan_blackbox_crash_test | pass | 01:16 | | fbcode_whitebox_crash_test | pass | 03:37 | | fbcode_asan_whitebox_crash_test | pass | 03:37 | | fbcode_tsan_whitebox_crash_test | pass | 03:28 | Sandcastle jobs: 49539596750420932, 49539596750421833, 40532397491966602, 49539596750421523, 45035997124599077, 22518001256897652 (https://www.internalfb.com/intern/sandcastle/job/<id>/). On the previous submitted version two of these workflows had failed (the sandcastle P1 below); that fix is in this stack. Comprehensive review (15 rounds, whole 39-diff stack): Each round ran the comprehensive-diff-review protocol (read-only Opus reviewers; round 1 used four reviewers by area, later rounds one) against the cumulative stack, on facebook/rocksdb d6a7847 for rounds 1-7 and, after the rebase onto e591f5f (the RocksDB subtree of fbcode/warm), on the rebased stack for rounds 8-11, on facebook/rocksdb e732049 (fbcode/warm 4df7e0a0db7b) for rounds 12-13, on 9ce1bfb (fbcode/warm 37d097c1b953) for round 14 and on eb12834 (fbcode/master b1d9881f429e) for round 15. Rounds 14 and 15 reviewed the rebase delta. Rows marked sandcastle, external and crash test are defects found outside the review rounds and fixed the same way. Every P1/P2 was re-checked against the code, reproduced by a new test that fails first, fixed in the diff that introduced the code, and verified by a neuter (reverting the fix makes the test fail). Candidates are the fork's review folds of pwal/m6. | Round | Candidate | P1/P2 found | Fixed in | Regression test | |---|---|---|---|---| | 1 | pwal/m6 69c13fc | 4 P2: CMake missed db/log_merge.cc and log_merge_test; a secondary could not open or catch up beside an indexed primary with async_wal_precreate; a damaged first record in a WAL with an intact head floor and no span made the DB unopenable; commit_bypass_memtable failed after Prepare at N>1 | D120624825 (CMake), D127093323 (async_wal_precreate sanitized off when partition_wal_usage != kNone), D120649665 (HeadBounded counts the WAL's own head floor), D123079329 (bypass falls back to the memtable commit at N>1) | DBSecondaryTest.IndexedPrimaryDisablesAsyncWalPrecreate; DBWalPartitionCoverageTest.DamagedFirstRecordAfterUpgradeToTwoPartitions; TransactionPartitionedWalTest.CommitBypassMemtableCommitsNormally | | 2 | fold2 2e8c56707a8f | 2 P2: GetSortedWalFiles returned a false Corruption once coupled rotation retired an idle partition's metadata-only WAL that the MANIFEST tracks; GC24HistoryFloorScopeOnUpgrade still pinned the pre-fix outcome | D127093323, D127837663 | DBWritePartitionTest.SortedWalFilesListsIdlePartitionWals | | 3 | fold3 8b6590498 | 1 P2: that fix was keyed to the opener's wal_partitions, so read-only or N=1 openers still got the Corruption. Writing its test exposed a read-only open with WAL tracking off hitting `assert(recovery_ctx != nullptr)` in Recover; fixed too | D127093323 | DBWritePartitionTest.SortedWalFilesListsIdlePartitionWalsReadOnly | | 4 | fold5 c3c369362 | 1 P2: at N=1 indexed, a data-less current WAL got a cached synthetic start sequence 1, so GetUpdatesSince skipped the older WAL holding the requested sequence | D127093323 | DBWalIteratorTest.IndexedDataLessCurrentWalKeepsOlderWal | | 5 | fold6 6e3ad3889 | None. The per-diff gate then failed WalPartitions8/WritePreparedTransactionTest.{WC_WP_ForwardCompatibility, WP_WC_DBBackwardCompatibility}: listing every metadata-only WAL changed GetSortedWalFiles after a flush; reworked to upstream listing semantics | D127093323 | the two WritePrepared tests, unmodified | | 6 | fold7 376fac935 | 1 P2: the rework left MANIFEST-tracked metadata-only WALs out of GetSortedWalFiles, so a GetLiveFiles(flush_memtable=false) + GetSortedWalFiles copy failed to open ("Missing WAL with log number"). Now a tracked metadata-only WAL is listed (start sequence 1, not cached) and an untracked one is skipped | D127093323 | DBWritePartitionTest.LiveFilesAndSortedWalFilesCopyOpens | | 7 | fold8 431f2a98e | None (1 P3, below) | | | | 8 | rebased 188e02204b43 (onto e591f5f; two reviewers) | None | | | | sandcastle | previous submitted version | 1 P1 (fbcode crash tests with `read_fault_one_in=1000`): an injected WAL read I/O error during recovery surfaced as `Corruption: WAL index merge: WAL <n> head damaged and unattested` in the merged replay, and the classification pass ignored it | D120624825 (the merger keeps the read's IOError), D121636079/D121674557 (classification returns it), D123928339 (merged replay returns the merger's error before the damage checks) | LogMergeTest.FailedReadKeepsTheReadError; DBWALIndexTest.ClassificationReadIOErrorFailsRecovery; DBWalPartitionCoverageTest.MergeReadIOErrorFailsWithTheReadError | | 9 | 805ea60 | 2 P3 + 1 gap, fixed: sequential indexed replay replaced the read IOError with a generic one; the merger's error dropped the read's retryable/data-loss/scope attributes | D120415420, D120624825 | DBWALIndexTest.SequentialIndexedReplayReadIOErrorKeepsTheReadError; LogMergeTest.FailedReadKeepsTheReadErrorAttributes | | external | D119751506 reviewer comment | 1 P2: with manual_wal_flush the burned-index void cover appended to the WAL buffer without wal_write_mutex_, racing an application FlushWAL | D119751506 (takes the mutex as WriteToWAL does), D122412677 (per-partition mutex) | DBWALIndexTest.BurnedWALIndexCoverHoldsWALMutexWithManualFlush | | crash test | 805ea60 | 1 P2 (debug only): whitebox crash test at N=8 hit the FlushScheduler::Empty consistency assertion when another partition leader dequeued concurrently | D123079329 (Empty reads the head under the debug checking mutex; release builds unchanged) | DBWritePartitionTest.FlushSchedulerEmptyRacesAnotherLeadersDequeue | | 10 | 12aad1d | 1 P2: statuses on the merged-recovery read-error path left unchecked (ASSERT_STATUS_CHECKED abort) | D120624825, D123551605, D123701876, D123928339, D123971668, D127093323 (holders permitted, ignored reports marked) | the read-error tests above under ASSERT_STATUS_CHECKED | | 11 | 69a91e9 | None | | | | fbcode CI | previous submitted version | 1 P2 (build): D120624825 declared two private fields (`last_sequence_index_`, `last_sequence_wal_`) first used in D120649665, so clang failed with -Werror,-Wunused-private-field at D120624825 | D120624825 (the fields move to D120649665; later diffs unchanged) | clang per-diff build gate | | 12 | f4c2cc3436 (rebased onto e732049) | 1 P2 (tests): upstream's new TransactionTest.InplaceUpdateSupportRequiresWriteCommitted also runs in this stack's WalPartitions8 instantiation, where Open rejects its options; 3 deterministic failures | D127275775 (at wal_partitions > 1 the test asserts NotSupported) | the test itself: 3 failures before, 33/33 after | | 12 (re-review) | 7fd6043 | None | | | | fbcode CI | 7fd6043 | 1 P2 (ASAN, test-only): GC31FollowerExitGroup freed its local Env while the fixture's last options still pointed at it, so the next DestroyAndReopen read freed memory (heap-use-after-free in NGreaterThan1FollowerExitHandsFailureToLeader); and the rocks format check flagged a comment over 80 columns and one unjoined condition | D123701876 (the helper resets the fixture's env on exit); D121858039, D123079329, D123551605, D123971668 (clang-format output) | the test under ASAN: heap-use-after-free before, 4/4 and db_write_test 581/581 after; check-format.sh passes on all 39 diffs | | strict status | b19275b | 1 P2 (ASSERT_STATUS_CHECKED, GitHub CI): 27 aborts from unchecked statuses: a reader report superseded by a more specific recovery error, a per-record pending report on early returns, the gate sync's covered path, a background-error return, an ingestion early return, and three test-side cases. Release behaviour unchanged | D120415420, D120649665, D123476301, D123701876, D123928339, D123971668, D127837663 | the ASSERT_STATUS_CHECKED suite: 27 aborts before, 0 after | | 13 | f658359 | None | | | | 14 | m6-rb10 (rebased onto 9ce1bfb) | 1 P2 (tests, from my rebase resolution): upstream's new kSortedHash option config was not skipped at wal_partitions > 1, where Open accepts only the SkipList memtable, so 7 WalPartitions8/ExternalSSTFileTestN tests walking ChangeOptions failed to reopen | D127275775 (kSortedHash joins the N>1 skip list) | the 7 tests: fail before, pass after | | 15 | 286fdab796 (rebased onto eb12834) | 1 P2 (crash test): upstream meta#15626 moved the inplace_update_support sanitizing ahead of this stack's N>1 overrides, which turned allow_concurrent_memtable_write back on, so about 3% of default crash-test series failed DB::Open. Found while verifying it: the same overrides replaced explicitly passed flags and made `make db_crashtest_tests` fail in about 5 of 6 runs, already on the previous stack (1 more P2) | D126533194 (N>1 steering moved into gen_cmd_params, before command-line flags) | db_crashtest_test.py: 3 new tests, each failing with the old overrides | | 15 (re-review) | 0d68d5f821 | 2 P2 + 1 P3 in that fix: test_secondary was still drawn per run, so wal_partitions flipped between runs and a secondary could open over partition WALs; an explicit --wal_partitions was not steered; the new test helper did not pin the trie index (about 4% flaky) | D126533194 | test_wal_partitions_stays_fixed_across_runs, test_explicit_wal_partitions_is_steered (each fails under its neuter); suite 89/89 in 40 runs | | fbcode CI | V1.2 drafts (1686cdb39f) | 1 P2 (stack order, crash test): D126533194 is the first diff whose crash test draws wal_partitions > 1, but the db_stress LockWAL check that accepts GetCurrentWalFile() NotSupported at N>1 lived in this diff, so whitebox runs at D126533194 failed with "GetCurrentWalFile() failed: Not implemented" | D126533194 (the check moves down from this diff; the final tree is unchanged) | local blackbox at wal_partitions=8, lock_wal_one_in=2000: the old D126533194 fails on its 2nd run (192 errors), the new one passes 11/11 | Final state: all 39 diffs at fork 1686cdb39f on facebook/rocksdb eb12834, each mirrored byte-identically into its fbsource diff on fbcode/master b1d9881f429e (master has since gained one RocksDB commit, c043e8dfa272, touching include/rocksdb/options.h about 180 lines from this stack's hunks). At 286fdab796 (the final stack differs only in clang-format line wrapping and the crash-test Python): per-diff clang gate for all 39 diffs; full make suite 11192/11192; clang TSan once 709/709 and 100x 2600/2600; ASSERT_STATUS_CHECKED suite with no failures from this stack (range_locking_test only, below); crash tests above. At 1686cdb39f: db_write_test 581/581, the gap-filler tests, `tools/db_crashtest_test.py` 89/89, and fbcode/rocks/sandcastle/check-format.sh at every diff. Totals: 1 P1 and 20 P2 fixed. Open items (P3 or validation gaps, tracked as follow-ups, not fixed here): - ASSERT_STATUS_CHECKED: range_locking_test fails in that build mode at upstream e732049 too; it is not part of this stack. - Rebase gap (pre-existing): with recycle_log_file_num > 0, an indexed one-partition DB gets no WAL sequence-gap filler (upstream meta#15581 covers kNone only), so an ingestion gap at a WAL boundary can still stop point-in-time recovery there, as it did for every DB before meta#15581. - Round 9 F-002 (P3): consumer head checks report a WAL read I/O error as NotSupported. - Round 11 gap (low confidence, pre-existing): the void re-read during recovery can swallow a transient read IOError. - TSan with the gcc 11 runtime (libtsan.so.0) reports false "double lock of a mutex" on any std::condition_variable::wait_for mutex, upstream TransactionDB code included, because it does not intercept pthread_cond_clockwait. Use clang TSan. - Round 7 P3: after an open that writes supersession records without a dummy write (for example a WalFilter stop with avoid_flush_during_recovery=true), partition 0's untracked, data-less current WAL carries the supersession record. GetSortedWalFiles skips it, so a GetLiveFiles + GetSortedWalFiles copy could fail with "two live records share index". Checkpoint and BackupEngine are unaffected. Inferred from code, not reproduced. - Round 2 P3: WriteRecoverableState at N>1 can stamp the cached recoverable state inside an open fence during an auto-resumed retryable WAL error. - Round 1 P3s: the checkpoint/backup LockWAL race tests can stop on an ASSERT before joining their threads; GC31FollowerExitGroup orders writers with sleeps; standalone db_stress at N>1 trips on the default get_current_wal_file_one_in; checkpoint/backup at N>1 wait out a write stop. - Gaps: an indexed DB with wal_compression still caches start sequence 1 for a data-less WAL (as upstream does for compression-only WALs); HeadFloor() for a member with no surviving data is the last progress bound read (no production-reachable loss found). Reports (MetaMate): - Round 1: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-69c13fcb72e2-20261107t093444z - Round 2: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-fold2-2e8c56707a8f-20261107t175411z - Round 3: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-fold3-8b6590498-20261107t185930z - Round 4: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-fold5-c3c369362-20261107t192653z - Round 5: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-fold6-6e3ad3889-20261107t193256z - Round 6: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-fold7-376fac935-20261108t054421z - Round 7: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-fold8-431f2a98e-20261108t055310z - Round 11: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-rb2-69a91e9ba-20261110t022328z - Round 13: https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-rb8-f6583590ed-20261110t195418z - Round 15 (final stack): https://metamate.internalmeta.com/artifact/diff-review-pwal-m6-rb15-1686cdb39f-20261111t191953z Changes visible to existing users: - Removes DBOptions::experimental_allow_wal_partitions_for_testing, its "experimental_allow_wal_partitions_for_testing" options-string key (which no longer parses) and the C API functions rocksdb_options_set/get_experimental_allow_wal_partitions_for_testing. All were added earlier in this stack (D117251769) and never released. - The --wal_partitions help text of db_bench and db_stress changed. Test Plan: M4 B.1: PASS (clang-format 21.1.2 on the changed lines, make check-sources, debug build of db_options_test, db_wal_oracle_test, db_wal_partitions_open_test, db_write_test, latency_injection_fs_test, ldb_cmd_test, optimistic_transaction_test, options_settable_test, transaction_test, write_prepared_transaction_test, db_stress, db_bench, ldb); 4974 tests, 0 failed. M5 B.1: PASS (clang-format 21.1.2 on the changed lines, make check-sources, debug build of compaction_service_test, db_options_test, db_wal_oracle_test, db_wal_partitions_open_test, db_wal_test, db_write_test, latency_injection_fs_test, ldb_cmd_test, optimistic_transaction_test, options_settable_test, transaction_test, write_prepared_transaction_test, db_stress, db_bench, ldb); 7324 tests, 0 failed. M6 B.1: PASS (debug build and build_tools/gtest-parallel run of compaction_service_test db_options_test db_wal_oracle_test db_wal_partitions_open_test db_wal_test db_write_test latency_injection_fs_test ldb_cmd_test optimistic_transaction_test options_settable_test transaction_test write_prepared_transaction_test: 7340/7340). Rebased stack (e591f5f): PASS. Debug build and build_tools/gtest-parallel run of compaction_service_test db_options_test db_wal_oracle_test db_wal_partitions_open_test db_wal_test db_write_test latency_injection_fs_test ldb_cmd_test optimistic_transaction_test options_settable_test transaction_test write_prepared_transaction_test: 7559/7559. Full make suite 10540/10540. Rebased stack (e732049, fbcode/warm 4df7e0a0db7b) final: clang per-diff gates for all 39 diffs; full make suite 10576/10579 at f4c2cc3436 with the 3 round-12 failures fixed at 7fd6043 (transaction_test 3475/3475); clang TSan; crash tests and the two sandcastle repro command lines above. At b19275b: db_write_test under ASAN/UBSAN (clang) 581/581; clang per-diff gates for D121858039 through D123971668 rerun and pass; fbcode/rocks/sandcastle/check-format.sh passes at every diff. fbcode sandcastle crash tests (blackbox and whitebox; plain, ASAN, TSAN): 6/6 pass on 32fe728cb06b. Strict status (ASSERT_STATUS_CHECKED=1) suite at f658359: 0 aborts from this stack (27 before the fix). Rebased stack (facebook/rocksdb eb12834, fbcode/master b1d9881f429e) final: clang per-diff gates for all 39 diffs; full make suite 11192/11192; clang TSan 709/709 once and 2600/2600 at 100x; ASSERT_STATUS_CHECKED with only range_locking_test failing (not touched by this stack); crash tests blackbox and whitebox at wal_partitions 1 and 8 exit 0; `tools/db_crashtest_test.py` 89/89; check-format.sh passes at every diff. Differential Revision: https://phabricator.intern.facebook.com/D130396596
xingbowang
pushed a commit
to xingbowang/rocksdb
that referenced
this pull request
Nov 30, 2026
) Summary: **Background** With `ColumnFamilyOptions::inplace_update_support`, a `Put()` to a key whose newest entry in the mutable memtable is a value of the same type, at least as large as the new value, overwrites that entry in place (`MemTable::Update()`). The entry keeps the sequence number of the value it overwrites. With `inplace_callback`, `MemTable::UpdateCallback()` passes that entry to the callback as the existing value, and the callback can update it in place too. WAL recovery inserts through the same functions with the options of the current `DB::Open()`, so it also updates in place when the DB is opened with the option, whatever options wrote the WAL. **The problem** A range tombstone hides the entries in its range that have smaller sequence numbers. It lives in the memtable's range deletion table, which in-place updates did not look at: 1. `Put(k, v1)` gets sequence number 1. 2. `DeleteRange(a, z)` gets sequence number 2. 3. `Put(k, v2)`: `v2` fits in the space of `v1`, so the entry is overwritten in place and keeps sequence number 1. `Get(k)` then returns NotFound, although the second `Put()` came after the deletion, and flush and compaction keep that result. The same three writes in a WAL written without the option lose `v2` when the DB is reopened with it: replay updates in place, and the recovery flush makes the loss permanent. With `inplace_callback`, the callback also received the deleted value as the existing value. The crash test hit the replay case when runs with and without in-place updates shared a DB; meta#15626 then made crash test series with in-place updates write no range tombstones. **Fix** `MemTable::Update()` and `MemTable::UpdateCallback()` treat an entry that a range tombstone in the same memtable deletes (`MaxCoveringTombstoneSeqnum()` above the entry's sequence number) as missing. `Update()` then adds the new value with its own sequence number. `UpdateCallback()` returns NotFound, so `MemTableInserter::PutCFImpl()` reads the existing value through the DB, which honors the tombstone, and the callback sees no existing value. Live writes and WAL replay go through the same check. Values already lost this way before this change stay lost. Checking only the active memtable is enough. Entries in immutable memtables and SST files are older than every entry in the active memtable, so a tombstone there cannot fall between an entry and its in-place update. Ingested files are the exception to that ordering, but ingestion first flushes the memtables that overlap the ingested files, so no entry that an ingested tombstone covers stays in the active memtable. Tombstones that iterators insert when converting point tombstones (`min_tombstones_for_range_conversion`) go into the active memtable, so the check sees them. **Cost** Nothing while the memtable has no range tombstones: the check returns before creating an iterator. Otherwise every `Put()` that could update in place looks up the covering tombstone. It creates an iterator over the memtable's cached fragmented tombstone list, and the first such `Put()` after a new range tombstone rebuilds that list from all tombstones in the memtable, on the write path. During WAL replay that happens under the DB mutex, which recovery holds throughout; each new range tombstone in the recovering memtable causes at most one rebuild, over all range tombstones then in that memtable. A `Put()` to a key that a tombstone deletes appends a new entry; later `Put()`s to that key update the new entry in place. With `inplace_callback`, the appending `Put()` also reads the key through the DB. Measured with `db_bench` (release build, one thread pinned to one CPU of an AMD EPYC 9D25 host): `fillseq` then `overwrite`, 200k writes each over about 100k keys, 16-byte keys, 100-byte values overwritten in place by values of the same size, WAL disabled, and a write buffer large enough that everything stays in one memtable. `db_bench` writes the range tombstones during both phases. Time per overwrite in ns, median of 7 runs with the builds alternating, minimum and maximum in parentheses: | Range tombstones | Before | With this change | |---|---|---| | None | 1126 (1032-1176) | 1155 (1044-1237) | | One per phase, each covering 1 key | 1115 (1089-1206) | 1273 (1203-1393), +14% | | One every 100 writes, each covering 1 key, 4000 by the end | 1292 (1219-1390) | 5953 (5789-6033), 4.6x | | One every 100 writes, each covering 100 keys, 4000 by the end | 1343 (1221-1367) | 8300 (8286-8444), 6.2x | Most of the cost in the last two rows is the rebuild after every new tombstone. In this write-only benchmark nothing else rebuilds the list; when reads follow each new tombstone, the first read rebuilds it without this change too (from the code, not measured). In the last row, 37% of the overwrites hit a value that a newer tombstone deletes; without this change those writes were lost. Only the combination that lost writes before pays this, and we know of no user that combines in-place updates with range deletions, so this change keeps the precise check; a TODO in `MemTable::IsDeletedByRangeTombstone()` records the cost. Skipping the lookup when the existing entry is newer than every range tombstone in the memtable would help little: an in-place update keeps the entry's sequence number, so in the last two rows almost every entry stays older than the newest tombstone. Not updating in place at all while the memtable has range tombstones would make the check one atomic load, at the cost of appending every `Put()` until the memtable is switched. **Alternative considered** Rejecting range deletions on column families with in-place updates was not done. WAL replay still updates in place, so rejecting new range deletions cannot protect a WAL written without the option, and it would make `DeleteRange()`, write batches, ingestion, `ClipColumnFamily()` and DB split/merge fail on such column families. **Crash test** Crash test series with in-place updates write range tombstones again: `delrangepercent`, `test_ingest_standalone_range_deletion_one_in` and `min_tombstones_for_range_conversion` are no longer turned off for them, and setting one of them on the command line no longer turns in-place updates off for the series. **Recovery with `inplace_callback`, unchanged** With `inplace_callback`, `DB::Open()` already fails with NotSupported when the WAL holds a callback `Put()`: during recovery `PutCFImpl()` does not read the DB, so the first replayed `Put()` of a key, which is never in the recovering memtable yet, has no existing value to pass to the callback, and WAL recovery treats the error as fatal. With `paranoid_checks=false`, or with `wal_recovery_mode=kSkipAnyCorruptedRecords`, the error is only logged and the DB opens, but each failing `Put()` and the records after it in the same write batch are dropped. All of this happens the same way before and after this change. So this change neither fixes nor adds a recovery failure with `inplace_callback`. A fix belongs in a separate change. Reviewed By: xingbowang Differential Revision: D134285230
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.
Summary:
Why the change is required
inplace_update_supporthas had no crash test coverage since D101739997 (T265679928) hard-coded it to 0 indefault_params"until the sanitization can account for cross-run incompatibility".Previous behavior
Before D101739997,
default_paramsdrewinplace_update_supportonce perdb_crashtest.pyinvocation (10%), so it was meant to stay fixed for every db_stress run on that DB. Butfinalize_and_sanitize(), which runs once per run on freshly drawn per-run values, also turned it off whenever that run drew something it considered incompatible:min_tombstones_for_range_conversion > 0(drawn per run and nonzero 80% of the time; added by D96203950 two weeks before T265679928),remote_compaction_worker_threads > 0(drawn per run in blackbox),test_batches_snapshots,memtablerep=vector, blob direct write or best-efforts recovery. Those rules are still on master, so even today an explicit--inplace_update_support=1is turned on and off from run to run. A run without in-place updates can writeDeleteRangetombstones (and read-path converted range tombstones) that a later run with them still sees in its memtable, e.g. after WAL recovery withavoid_flush_during_recovery. An in-placePutkeeps the older sequence number of the entry it overwrites, so a range tombstone in the same memtable with a sequence number in between hides the new value: "Get verification: Value not found" as in T265679928.New behavior
inplace_update_supportis drawn once per invocation (10%, as before) andfinalize_and_sanitize()never changes it. Every run of the series, including whitebox reopen/check-mode runs and the blackbox final verification run, uses the same value.finalize_and_sanitize()turns off the incompatible per-run features in every run instead:delrangepercent(and with ittest_ingest_standalone_range_deletion_one_in),min_tombstones_for_range_conversion, prefix scans, iterators and snapshot users (existing rule),memtable_verify_per_key_checksum_on_seek,test_batches_snapshots,allow_concurrent_memtable_write, remote compaction,lazy_entity_read_one_in, and unsynced data loss (sync_fault_injection,disable_wal,manual_wal_flush_one_in). No run of such a series writes a range tombstone, so nothing incompatible is left in the DB for a later run.gen_cmd_params(), which runs once per invocation, keeps it off for the whole series and printsinplace_update_support is off for all runs as it is incompatible with: ...when:--cf_consistency, best-efforts recovery, blob direct write, file-scoped WAL write faults, ormemtablerep=vector;--delrangepercent=1,--test_batches_snapshots=1);--inplace_update_support=1is still honored here.--inplace_update_support=1now also keeps the random blob overlay toblob_params(blob direct write requires it off) and suppresses the automatic file-scoped WAL fault profile, like other explicit opt-outs.Implementation
resolve_inplace_update_support()at the end ofgen_cmd_params(), driven by two lists:_INPLACE_UPDATE_INCOMPATIBLE_PROFILE_PARAMS(checked on the merged params, i.e. presets and command line) and_INPLACE_UPDATE_INCOMPATIBLE_RUN_PARAMS(checked on explicit command-line values only).dest_params["inplace_update_support"] = 0statements are removed fromfinalize_and_sanitize(). The per-run rules for in-place updates now sit in one block at its start, before thetest_batches_snapshots, remote compaction and range-conversion rules, so those no longer fire needlessly in in-place runs. Iffinalize_and_sanitize()is handedinplace_update_support=1together with a profile conflict it raisesValueErrorrather than silently toggling the option for one run, so a profile that later becomes per-run random cannot quietly reintroduce the cross-run bug.lazy_entity_read_one_inwas found by this diff's crash runs: the lazy entity read checks (added after D101739997) assertread_opts.snapshot != nullptr, butDB::GetSnapshot()returns nullptr with in-place updates.Safety, compatibility, and limitations
main()path over seeds 1..1000: 83/1000 forblackboxandwhitebox, 86/1000 with--simple, 85/1000 with--enable_ts(the 10% draw minus series that pick blob direct write or file-scoped WAL faults); 0 for--txn,--cf_consistency,--test_best_efforts_recoveryand explicit--delrangepercent=1.test_batches_snapshotsnow yields toinplace_update_support(before, it was the other way round), which costs about 10% of batched-ops series.fbcode_*crash*jobs can.--destroy_db_initially=1and a successful invocation destroys its DB. A manual invocation that reuses a DB left behind by an earlier, different invocation can still mix settings, the same as for the other fixed-per-invocation params such asmax_keyanduse_put_entity_one_in.VerifyDb()can pick its iterator method while other threads update in place.Requested by: Jay Huh (jewoongh)
Reviewed By: xingbowang
Differential Revision: D129449804