From 5956ef008983aa709ef1fca6ea388f7f0f452666 Mon Sep 17 00:00:00 2001 From: Akanksha Mahajan Date: Thu, 18 Aug 2022 18:03:44 -0700 Subject: [PATCH] Add initial_auto_readahead_size and max_auto_readahead_size to db_bench (#10539) Summary: Pull Request resolved: https://github.com/facebook/rocksdb/pull/10539 Reviewed By: anand1976 Differential Revision: D38837111 Pulled By: akankshamahajan15 fbshipit-source-id: eb845c6e15a3c823ff6113395817388ff15a20b1 --- tools/db_bench_tool.cc | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/tools/db_bench_tool.cc b/tools/db_bench_tool.cc index f0b3ed46c7..cd7596e31f 100644 --- a/tools/db_bench_tool.cc +++ b/tools/db_bench_tool.cc @@ -1218,6 +1218,20 @@ DEFINE_string(backup_dir, "", DEFINE_string(restore_dir, "", "If not empty string, use the given dir for restore."); +DEFINE_uint64( + initial_auto_readahead_size, + ROCKSDB_NAMESPACE::BlockBasedTableOptions().initial_auto_readahead_size, + "RocksDB does auto-readahead for iterators on noticing more than two reads " + "for a table file if user doesn't provide readahead_size. The readahead " + "size starts at initial_auto_readahead_size"); + +DEFINE_uint64( + max_auto_readahead_size, + ROCKSDB_NAMESPACE::BlockBasedTableOptions().max_auto_readahead_size, + "Rocksdb implicit readahead starts at " + "BlockBasedTableOptions.initial_auto_readahead_size and doubles on every " + "additional read upto max_auto_readahead_size"); + static enum ROCKSDB_NAMESPACE::CompressionType StringToCompressionType( const char* ctype) { assert(ctype); @@ -4349,6 +4363,10 @@ class Benchmark { FLAGS_enable_index_compression; block_based_options.block_align = FLAGS_block_align; block_based_options.whole_key_filtering = FLAGS_whole_key_filtering; + block_based_options.max_auto_readahead_size = + FLAGS_max_auto_readahead_size; + block_based_options.initial_auto_readahead_size = + FLAGS_initial_auto_readahead_size; BlockBasedTableOptions::PrepopulateBlockCache prepopulate_block_cache = block_based_options.prepopulate_block_cache; switch (FLAGS_prepopulate_block_cache) {