diff --git a/db/db_bench.cc b/db/db_bench.cc index b74ce28e7..af83487a1 100644 --- a/db/db_bench.cc +++ b/db/db_bench.cc @@ -538,6 +538,9 @@ DEFINE_string(memtablerep, "skip_list", ""); DEFINE_int64(hash_bucket_count, 1024 * 1024, "hash bucket count"); DEFINE_bool(use_plain_table, false, "if use plain table " "instead of block-based table format"); +DEFINE_bool(use_hash_search, false, "if use kHashSearch " + "instead of kBinarySearch. " + "This is valid if only we use BlockTable"); DEFINE_string(merge_operator, "", "The merge operator to use with the database." "If a new merge operator is specified, be sure to use fresh" @@ -1624,7 +1627,7 @@ class Benchmark { options.compaction_style = FLAGS_compaction_style_e; options.block_size = FLAGS_block_size; options.filter_policy = filter_policy_; - if (FLAGS_use_plain_table) { + if (FLAGS_prefix_size != 0) { options.prefix_extractor.reset( NewFixedPrefixTransform(FLAGS_prefix_size)); } @@ -1685,8 +1688,17 @@ class Benchmark { if (bloom_bits_per_key < 0) { bloom_bits_per_key = 0; } - options.table_factory = std::shared_ptr( + options.table_factory.reset( NewPlainTableFactory(FLAGS_key_size, bloom_bits_per_key, 0.75)); + } else { + BlockBasedTableOptions block_based_options; + if (FLAGS_use_hash_search) { + block_based_options.index_type = BlockBasedTableOptions::kHashSearch; + } else { + block_based_options.index_type = BlockBasedTableOptions::kBinarySearch; + } + options.table_factory.reset( + NewBlockBasedTableFactory(block_based_options)); } if (FLAGS_max_bytes_for_level_multiplier_additional_v.size() > 0) { if (FLAGS_max_bytes_for_level_multiplier_additional_v.size() !=