Skip to content

Commit

Permalink
db_bench rebase fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
RoyBenMoshe committed Aug 6, 2023
1 parent c05b0e8 commit 25ecc10
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 38 deletions.
2 changes: 1 addition & 1 deletion options/options.cc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
#include <cinttypes>
#include <limits>

#include "db/write_controller.h"
#include "rocksdb/write_controller.h"
#include "logging/logging.h"
#include "monitoring/statistics.h"
#include "options/db_options.h"
Expand Down
2 changes: 1 addition & 1 deletion options/options_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

#include "cache/lru_cache.h"
#include "cache/sharded_cache.h"
#include "db/write_controller.h"
#include "rocksdb/write_controller.h"
#include "options/options_helper.h"
#include "options/options_parser.h"
#include "port/port.h"
Expand Down
61 changes: 25 additions & 36 deletions tools/db_bench_tool.cc
Original file line number Diff line number Diff line change
Expand Up @@ -303,8 +303,6 @@ DEFINE_string(
"\twaitforcompaction - pause until compaction is (probably) done\n"
"\tflush - flush the memtable\n"
"\tstats -- Print DB stats\n"
"\ttable-readers-mem -- Print table readers memory. excluding memory "
"used in block cache\n"
"\tresetstats -- Reset DB stats\n"
"\tlevelstats -- Print the number of files and bytes per level\n"
"\tmemstats -- Print memtable stats\n"
Expand Down Expand Up @@ -1864,11 +1862,9 @@ DEFINE_int64(multiread_stride, 0,
DEFINE_bool(multiread_batched, false, "Use the new MultiGet API");

DEFINE_string(memtablerep, "speedb.HashSpdRepFactory", "");

DEFINE_int64(hash_bucket_count, 1000000, "hash bucket count");
DEFINE_bool(use_seek_parallel_threshold, true,
"if use seek parallel threshold .");

DEFINE_bool(use_seek_parralel_threshold, true,
"if use seek parralel threshold .");
DEFINE_bool(use_plain_table, false,
"if use plain table instead of block-based table format");
DEFINE_bool(use_cuckoo_table, false, "if use cuckoo table format");
Expand Down Expand Up @@ -1955,8 +1951,9 @@ std::vector<uint64_t> db_idxs_to_use;

DEFINE_bool(enable_speedb_features, false,
"If true, Speedb features will be enabled "
"It is recomended to provide total_ram_size in bytes ,"
"delayed_write_rate and max_background_jobs.");
"You must provide total_ram_size in bytes ,"
" and max_background_jobs. "
"delayed_write_rate is recommended. ");

DEFINE_uint64(total_ram_size, 512 * 1024 * 1024ul,
"SharedOptions total ram size bytes. ");
Expand Down Expand Up @@ -3670,15 +3667,9 @@ class Benchmark {
std::unique_ptr<ExpiredTimeFilter> filter;
while (std::getline(benchmark_stream, name, ',')) {
if (open_options_.write_buffer_manager) {
fprintf(stderr,
"\nWBM's Usage Info [BEFORE Benchmark (%s)]: %s OF %s\n\n",
name.c_str(),
BytesToHumanString(
open_options_.write_buffer_manager->memory_usage())
.c_str(),
BytesToHumanString(
open_options_.write_buffer_manager->buffer_size())
.c_str());
fprintf(stderr, "\nBEFORE Benchmark (%s): %lu OF %lu\n\n", name.c_str(),
open_options_.write_buffer_manager->memory_usage(),
open_options_.write_buffer_manager->buffer_size());
}

// Sanitize parameters
Expand Down Expand Up @@ -3981,9 +3972,6 @@ class Benchmark {
PrintStats("rocksdb.block-cache-entry-stats");
} else if (name == "stats") {
PrintStats("rocksdb.stats");
} else if (name == "table-readers-mem") {
fprintf(stdout, "table-readers-mem");
PrintStats("rocksdb.estimate-table-readers-mem");
} else if (name == "resetstats") {
ResetStats();
} else if (name == "verify") {
Expand Down Expand Up @@ -4140,15 +4128,9 @@ class Benchmark {
}

if (open_options_.write_buffer_manager) {
fprintf(stderr,
"\nWBM's Usage Info [AFTER Benchmark (%s)]: %s OF %s\n\n",
name.c_str(),
BytesToHumanString(
open_options_.write_buffer_manager->memory_usage())
.c_str(),
BytesToHumanString(
open_options_.write_buffer_manager->buffer_size())
.c_str());
fprintf(stderr, "\nAFTER Benchmark (%s): %lu OF %lu\n", name.c_str(),
open_options_.write_buffer_manager->memory_usage(),
open_options_.write_buffer_manager->buffer_size());
}
}

Expand Down Expand Up @@ -4979,16 +4961,16 @@ class Benchmark {
FLAGS_max_num_parallel_flushes;
}
if (options.write_buffer_manager == nullptr) {
if (FLAGS_cost_write_buffer_to_cache) {
options.write_buffer_manager.reset(new WriteBufferManager(
if (FLAGS_cost_write_buffer_to_cache) {
options.write_buffer_manager.reset(new WriteBufferManager(
FLAGS_db_write_buffer_size, cache_, FLAGS_allow_wbm_stalls,
FLAGS_initiate_wbm_flushes, flush_initiation_options,
static_cast<uint16_t>(FLAGS_start_delay_percent)));
} else {
options.write_buffer_manager.reset(new WriteBufferManager(
FLAGS_initiate_wbm_flushes, flush_initiation_options,
static_cast<uint16_t>(FLAGS_start_delay_percent)));
} else {
options.write_buffer_manager.reset(new WriteBufferManager(
FLAGS_db_write_buffer_size, {} /* cache */, FLAGS_allow_wbm_stalls,
FLAGS_initiate_wbm_flushes, flush_initiation_options,
static_cast<uint16_t>(FLAGS_start_delay_percent)));
static_cast<uint16_t>(FLAGS_start_delay_percent)));
}
}

Expand Down Expand Up @@ -9550,6 +9532,13 @@ int db_bench_tool_run_group(int group_num, int num_groups, int argc,
"settable");
}

if (FLAGS_enable_speedb_features) {
if (gflags::GetCommandLineFlagInfoOrDie("max_background_jobs").is_default ||
gflags::GetCommandLineFlagInfoOrDie("total_ram_size").is_default) {
ErrorExit("enable_speedb_features - Please provide explicitly total_ram_size in bytes and max_background_jobs ");
}
}

if (!strcasecmp(FLAGS_compaction_fadvice.c_str(), "NONE"))
FLAGS_compaction_fadvice_e = ROCKSDB_NAMESPACE::Options::NONE;
else if (!strcasecmp(FLAGS_compaction_fadvice.c_str(), "NORMAL"))
Expand Down

0 comments on commit 25ecc10

Please sign in to comment.