db_bench and db_stress support for WriteBufferManager flush policy - #15048
Open
rban1 wants to merge 2 commits into
Open
db_bench and db_stress support for WriteBufferManager flush policy#15048rban1 wants to merge 2 commits into
rban1 wants to merge 2 commits into
Conversation
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
|
@rban1 has exported this pull request. If you are a Meta employee, you can view the originating Diff in D114638570. |
|
| 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]
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:
Exposes the
WriteBufferFlushPolicyadded in D112396106 to the benchmarking and stress-testing tools, per the repo convention that a new option ships withdb_benchand stress coverage.db_bench: new-write_buffer_manager_flush_policyflag acceptingoldest,largest, andlargest_across_dbs, parsed by aStringToWriteBufferFlushPolicyhelper that mirrors the existingStringToAdmissionPolicyidiom. Also adds-write_buffer_manager_allow_stall, since theWriteBufferManagerconstructor takesallow_stallimmediately before the policy and db_bench previously had no way to set it. Both are consumed at the singleWriteBufferManagerconstruction site inInitializeOptionsFromFlags. Note the flags only take effect when-db_write_buffer_sizeor-cost_write_buffer_to_cacheis set, since otherwise db_bench creates noWriteBufferManager;-num_multi_db=Nalready shares one manager across all DBs, which is whatlargest_across_dbsneeds.db_stress: new-wbm_flush_policyint flag (0 = oldest, 1 = largest, 2 = largest across DBs), following theprepopulate_block_cache/compaction_styleint-enum idiom rather than adding a string parser. It is passed at the sharedwbmconstruction site indb_stress_tool.cc.db_crashtest.py: randomizeswbm_flush_policyover[0, 1, 2], andfinalize_and_sanitizeforces it back to0whenuse_write_buffer_manageris 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