Skip to content

Commit

Permalink
db_bench: Support control over WBM's allow_stall ctor parameter (#187)
Browse files Browse the repository at this point in the history
and print the allow_stall parameter to the LOG file
  • Loading branch information
udi-speedb committed Nov 12, 2023
1 parent 0fa36f9 commit 8872380
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 11 deletions.
8 changes: 6 additions & 2 deletions memtable/write_buffer_manager.cc
Original file line number Diff line number Diff line change
Expand Up @@ -220,10 +220,14 @@ std::string WriteBufferManager::GetPrintableOptions() const {
char buffer[kBufferSize];

// The assumed width of the callers display code
int field_width = 47;
int field_width = 85;

snprintf(buffer, kBufferSize, "%*s: %" ROCKSDB_PRIszt "\n", field_width,
"size", buffer_size());
"wbm.size", buffer_size());
ret.append(buffer);

snprintf(buffer, kBufferSize, "%*s: %d\n", field_width, "wbm.allow_stalls",
allow_stall_);
ret.append(buffer);

return ret;
Expand Down
13 changes: 6 additions & 7 deletions options/db_options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -851,13 +851,12 @@ void ImmutableDBOptions::Dump(Logger* log) const {
ROCKS_LOG_HEADER(
log, " Options.db_write_buffer_size: %" ROCKSDB_PRIszt,
db_write_buffer_size);
ROCKS_LOG_HEADER(log, " Options.write_buffer_manager: %p",
write_buffer_manager.get());
if (write_buffer_manager.get()) {
ROCKS_LOG_HEADER(log, " write_buffer_manager_options:");
ROCKS_LOG_HEADER(log, "%s",
write_buffer_manager->GetPrintableOptions().c_str());
}
ROCKS_LOG_HEADER(
log, " Options.write_buffer_manager: %p%s%s",
write_buffer_manager.get(), (write_buffer_manager.get() ? "\n" : ""),
(write_buffer_manager.get()
? write_buffer_manager->GetPrintableOptions().c_str()
: ""));
ROCKS_LOG_HEADER(log, " Options.access_hint_on_compaction_start: %d",
static_cast<int>(access_hint_on_compaction_start));
ROCKS_LOG_HEADER(
Expand Down
9 changes: 7 additions & 2 deletions tools/db_bench_tool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -529,6 +529,8 @@ DEFINE_int64(db_write_buffer_size,
DEFINE_bool(cost_write_buffer_to_cache, false,
"The usage of memtable is costed to the block cache");

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

DEFINE_int64(arena_block_size, ROCKSDB_NAMESPACE::Options().arena_block_size,
"The size, in bytes, of one block in arena memory allocation.");

Expand Down Expand Up @@ -4306,9 +4308,12 @@ class Benchmark {
FLAGS_compression_use_zstd_dict_trainer;

options.max_open_files = FLAGS_open_files;
if ((FLAGS_db_write_buffer_size == 0) && FLAGS_allow_wbm_stalls) {
ErrorExit("-allow_wbm_stalls is useless if db_write_buffer_size == 0");
}
if (FLAGS_cost_write_buffer_to_cache || FLAGS_db_write_buffer_size != 0) {
options.write_buffer_manager.reset(
new WriteBufferManager(FLAGS_db_write_buffer_size, cache_));
options.write_buffer_manager.reset(new WriteBufferManager(
FLAGS_db_write_buffer_size, cache_, FLAGS_allow_wbm_stalls));
}
options.arena_block_size = FLAGS_arena_block_size;
options.write_buffer_size = FLAGS_write_buffer_size;
Expand Down

0 comments on commit 8872380

Please sign in to comment.