Skip to content

db_bench and db_stress support for WriteBufferManager flush policy - #15048

Open
rban1 wants to merge 2 commits into
facebook:mainfrom
rban1:export-D114638570
Open

db_bench and db_stress support for WriteBufferManager flush policy#15048
rban1 wants to merge 2 commits into
facebook:mainfrom
rban1:export-D114638570

Conversation

@rban1

@rban1 rban1 commented Aug 3, 2026

Copy link
Copy Markdown

Summary:
Exposes the WriteBufferFlushPolicy added in D112396106 to the benchmarking and stress-testing tools, per the repo convention that a new option ships with db_bench and stress coverage.

db_bench: new -write_buffer_manager_flush_policy flag accepting oldest, largest, and largest_across_dbs, parsed by a StringToWriteBufferFlushPolicy helper that mirrors the existing StringToAdmissionPolicy idiom. Also adds -write_buffer_manager_allow_stall, since the WriteBufferManager constructor takes allow_stall immediately before the policy and db_bench previously had no way to set it. Both are consumed at the single WriteBufferManager construction site in InitializeOptionsFromFlags. Note the flags only take effect when -db_write_buffer_size or -cost_write_buffer_to_cache is set, since otherwise db_bench creates no WriteBufferManager; -num_multi_db=N already shares one manager across all DBs, which is what largest_across_dbs needs.

db_stress: new -wbm_flush_policy int flag (0 = oldest, 1 = largest, 2 = largest across DBs), following the prepopulate_block_cache / compaction_style int-enum idiom rather than adding a string parser. It is passed at the shared wbm construction site in db_stress_tool.cc.

db_crashtest.py: randomizes wbm_flush_policy over [0, 1, 2], and finalize_and_sanitize forces it back to 0 when use_write_buffer_manager is disabled, so repro commands do not carry a policy that has no effect.

No behavior change to the engine itself; this diff is tooling only.

Differential Revision: D114638570

Ranjan Banerjee added 2 commits August 3, 2026 14:08
Summary: Pull Request resolved: facebook#15047

Differential Revision: D112396106
Summary:
Exposes the `WriteBufferFlushPolicy` added in D112396106 to the benchmarking and stress-testing tools, per the repo convention that a new option ships with `db_bench` and stress coverage.

`db_bench`: new `-write_buffer_manager_flush_policy` flag accepting `oldest`, `largest`, and `largest_across_dbs`, parsed by a `StringToWriteBufferFlushPolicy` helper that mirrors the existing `StringToAdmissionPolicy` idiom. Also adds `-write_buffer_manager_allow_stall`, since the `WriteBufferManager` constructor takes `allow_stall` immediately before the policy and db_bench previously had no way to set it. Both are consumed at the single `WriteBufferManager` construction site in `InitializeOptionsFromFlags`. Note the flags only take effect when `-db_write_buffer_size` or `-cost_write_buffer_to_cache` is set, since otherwise db_bench creates no `WriteBufferManager`; `-num_multi_db=N` already shares one manager across all DBs, which is what `largest_across_dbs` needs.

`db_stress`: new `-wbm_flush_policy` int flag (0 = oldest, 1 = largest, 2 = largest across DBs), following the `prepopulate_block_cache` / `compaction_style` int-enum idiom rather than adding a string parser. It is passed at the shared `wbm` construction site in `db_stress_tool.cc`.

`db_crashtest.py`: randomizes `wbm_flush_policy` over `[0, 1, 2]`, and `finalize_and_sanitize` forces it back to `0` when `use_write_buffer_manager` is disabled, so repro commands do not carry a policy that has no effect.

No behavior change to the engine itself; this diff is tooling only.

Differential Revision: D114638570
@meta-cla meta-cla Bot added the CLA Signed label Aug 3, 2026
@meta-codesync

meta-codesync Bot commented Aug 3, 2026

Copy link
Copy Markdown

@rban1 has exported this pull request. If you are a Meta employee, you can view the originating Diff in D114638570.

@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

⚠️ clang-tidy: 3 warning(s) on changed lines

Completed in 335.5s.

Summary by check

Check Count
modernize-make-shared 3
Total 3

Details

db/db_write_buffer_manager_test.cc (2 warning(s))
db/db_write_buffer_manager_test.cc:862:32: warning: use std::make_shared instead [modernize-make-shared]
db/db_write_buffer_manager_test.cc:948:32: warning: use std::make_shared instead [modernize-make-shared]
tools/db_bench_tool.cc (1 warning(s))
tools/db_bench_tool.cc:5201:36: warning: use std::make_shared instead [modernize-make-shared]

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant