db_bench support for OPTIONS+bloom and nicer output for perf_context (#4153)

Summary:
Adding the string "PERF_CONTEXT:" before the perf_context stats are printed. Setting the filter policy if it's a block based table even when options are being loaded from the provided FLAGS_options_file.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/4153

Differential Revision: D8905517

Pulled By: poojam23

fbshipit-source-id: 5956ed7882d39ec8ae654d5dadeb88727a36f0dd
main
Pooja Malik 6 years ago committed by Facebook Github Bot
parent 80afa84903
commit 1857576e03
  1. 26
      tools/db_bench_tool.cc

@ -3389,15 +3389,19 @@ void VerifyDBFromDB(std::string& truth_db_name) {
options.compression_opts.max_dict_bytes = FLAGS_compression_max_dict_bytes; options.compression_opts.max_dict_bytes = FLAGS_compression_max_dict_bytes;
options.compression_opts.zstd_max_train_bytes = options.compression_opts.zstd_max_train_bytes =
FLAGS_compression_zstd_max_train_bytes; FLAGS_compression_zstd_max_train_bytes;
if (FLAGS_cache_size) { // If this is a block based table, set some related options
// If this is a block based table, also need to set block_cache
if (options.table_factory->Name() == BlockBasedTableFactory::kName && if (options.table_factory->Name() == BlockBasedTableFactory::kName &&
options.table_factory->GetOptions() != nullptr) { options.table_factory->GetOptions() != nullptr) {
BlockBasedTableOptions* table_options = BlockBasedTableOptions* table_options =
reinterpret_cast<BlockBasedTableOptions*>( reinterpret_cast<BlockBasedTableOptions*>(
options.table_factory->GetOptions()); options.table_factory->GetOptions());
if (FLAGS_cache_size) {
table_options->block_cache = cache_; table_options->block_cache = cache_;
} }
if (FLAGS_bloom_bits >= 0) {
table_options->filter_policy.reset(NewBloomFilterPolicy(
FLAGS_bloom_bits, FLAGS_use_block_based_filter));
}
} }
if (FLAGS_row_cache_size) { if (FLAGS_row_cache_size) {
if (FLAGS_cache_numshardbits >= 1) { if (FLAGS_cache_numshardbits >= 1) {
@ -4174,7 +4178,8 @@ void VerifyDBFromDB(std::string& truth_db_name) {
delete iter; delete iter;
thread->stats.AddBytes(bytes); thread->stats.AddBytes(bytes);
if (FLAGS_perf_level > rocksdb::PerfLevel::kDisable) { if (FLAGS_perf_level > rocksdb::PerfLevel::kDisable) {
thread->stats.AddMessage(get_perf_context()->ToString()); thread->stats.AddMessage(
std::string("PERF_CONTEXT:\n") + get_perf_context()->ToString());
} }
} }
@ -4256,7 +4261,8 @@ void VerifyDBFromDB(std::string& truth_db_name) {
thread->stats.AddMessage(msg); thread->stats.AddMessage(msg);
if (FLAGS_perf_level > rocksdb::PerfLevel::kDisable) { if (FLAGS_perf_level > rocksdb::PerfLevel::kDisable) {
thread->stats.AddMessage(get_perf_context()->ToString()); thread->stats.AddMessage(
std::string("PERF_CONTEXT:\n") + get_perf_context()->ToString());
} }
} }
@ -4334,7 +4340,8 @@ void VerifyDBFromDB(std::string& truth_db_name) {
thread->stats.AddMessage(msg); thread->stats.AddMessage(msg);
if (FLAGS_perf_level > rocksdb::PerfLevel::kDisable) { if (FLAGS_perf_level > rocksdb::PerfLevel::kDisable) {
thread->stats.AddMessage(get_perf_context()->ToString()); thread->stats.AddMessage(
std::string("PERF_CONTEXT:\n") + get_perf_context()->ToString());
} }
} }
@ -4491,7 +4498,8 @@ void VerifyDBFromDB(std::string& truth_db_name) {
thread->stats.AddBytes(bytes); thread->stats.AddBytes(bytes);
thread->stats.AddMessage(msg); thread->stats.AddMessage(msg);
if (FLAGS_perf_level > rocksdb::PerfLevel::kDisable) { if (FLAGS_perf_level > rocksdb::PerfLevel::kDisable) {
thread->stats.AddMessage(get_perf_context()->ToString()); thread->stats.AddMessage(
std::string("PERF_CONTEXT:\n") + get_perf_context()->ToString());
} }
} }
@ -5242,7 +5250,8 @@ void VerifyDBFromDB(std::string& truth_db_name) {
thread->stats.AddMessage(msg); thread->stats.AddMessage(msg);
if (FLAGS_perf_level > rocksdb::PerfLevel::kDisable) { if (FLAGS_perf_level > rocksdb::PerfLevel::kDisable) {
thread->stats.AddMessage(get_perf_context()->ToString()); thread->stats.AddMessage(
std::string("PERF_CONTEXT:\n") + get_perf_context()->ToString());
} }
thread->stats.AddBytes(static_cast<int64_t>(inserter.GetBytesInserted())); thread->stats.AddBytes(static_cast<int64_t>(inserter.GetBytesInserted()));
} }
@ -5404,7 +5413,8 @@ void VerifyDBFromDB(std::string& truth_db_name) {
thread->stats.AddBytes(bytes); thread->stats.AddBytes(bytes);
thread->stats.AddMessage(msg); thread->stats.AddMessage(msg);
if (FLAGS_perf_level > rocksdb::PerfLevel::kDisable) { if (FLAGS_perf_level > rocksdb::PerfLevel::kDisable) {
thread->stats.AddMessage(get_perf_context()->ToString()); thread->stats.AddMessage(
std::string("PERF_CONTEXT:\n") + get_perf_context()->ToString());
} }
} }

Loading…
Cancel
Save