Skip to content

Commit

Permalink
db_stress: Support control over WBM's allow_stall (#287)
Browse files Browse the repository at this point in the history
  • Loading branch information
udi-speedb committed Nov 12, 2023
1 parent 5d1b1bb commit add0291
Showing 4 changed files with 14 additions and 1 deletion.
1 change: 1 addition & 0 deletions db_stress_tool/db_stress_common.h
Original file line number Diff line number Diff line change
@@ -102,6 +102,7 @@ DECLARE_bool(destroy_db_initially);
DECLARE_bool(verbose);
DECLARE_bool(progress_reports);
DECLARE_uint64(db_write_buffer_size);
DECLARE_bool(allow_wbm_stalls);
DECLARE_int32(write_buffer_size);
DECLARE_int32(max_write_buffer_number);
DECLARE_int32(min_write_buffer_number_to_merge);
2 changes: 2 additions & 0 deletions db_stress_tool/db_stress_gflags.cc
Original file line number Diff line number Diff line change
@@ -135,6 +135,8 @@ DEFINE_uint64(db_write_buffer_size,
ROCKSDB_NAMESPACE::Options().db_write_buffer_size,
"Number of bytes to buffer in all memtables before compacting");

DEFINE_bool(allow_wbm_stalls, false, "Enable WBM write stalls and delays");

DEFINE_int32(
write_buffer_size,
static_cast<int32_t>(ROCKSDB_NAMESPACE::Options().write_buffer_size),
5 changes: 4 additions & 1 deletion db_stress_tool/db_stress_test_base.cc
Original file line number Diff line number Diff line change
@@ -3178,7 +3178,10 @@ void InitializeOptionsFromFlags(
block_based_options.num_file_reads_for_auto_readahead =
FLAGS_num_file_reads_for_auto_readahead;
options.table_factory.reset(NewBlockBasedTableFactory(block_based_options));
options.db_write_buffer_size = FLAGS_db_write_buffer_size;
if (FLAGS_db_write_buffer_size > 0) {
options.write_buffer_manager.reset(new WriteBufferManager(
FLAGS_db_write_buffer_size, {} /* cache */, FLAGS_allow_wbm_stalls));
}
options.write_buffer_size = FLAGS_write_buffer_size;
options.max_write_buffer_number = FLAGS_max_write_buffer_number;
options.min_write_buffer_number_to_merge =
7 changes: 7 additions & 0 deletions db_stress_tool/db_stress_tool.cc
Original file line number Diff line number Diff line change
@@ -367,6 +367,13 @@ int db_stress_tool(int argc, char** argv) {
keys_per_level * (levels - 1));
}
std::unique_ptr<ROCKSDB_NAMESPACE::SharedState> shared;

if ((FLAGS_db_write_buffer_size == 0) && FLAGS_allow_wbm_stalls) {
fprintf(stderr,
"-allow_wbm_stalls is useless if db_write_buffer_size == 0\n");
exit(1);
}

std::unique_ptr<ROCKSDB_NAMESPACE::StressTest> stress;
if (FLAGS_test_cf_consistency) {
stress.reset(CreateCfConsistencyStressTest());

0 comments on commit add0291

Please sign in to comment.