From 6fb9013441e346725520c835cd0fbe47a5406c9e Mon Sep 17 00:00:00 2001 From: Aaron Gao Date: Thu, 2 Mar 2017 17:11:18 -0800 Subject: [PATCH] sanitize readahead when direct read enabled Summary: no readahead: readseq : 8.438 micros/op 118510 ops/sec; 13.1 MB/s sanitize to 10MB: readseq : 6.051 micros/op 165248 ops/sec; 18.3 MB/s Closes https://github.com/facebook/rocksdb/pull/1945 Differential Revision: D4645811 Pulled By: lightmark fbshipit-source-id: 5d63770 --- db/db_impl.cc | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/db/db_impl.cc b/db/db_impl.cc index 8815c7b17..50677200c 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -197,6 +197,10 @@ DBOptions SanitizeOptions(const std::string& dbname, const DBOptions& src) { result.db_paths.emplace_back(dbname, std::numeric_limits::max()); } + if (result.use_direct_reads && result.compaction_readahead_size == 0) { + result.compaction_readahead_size = 1024 * 1024 * 2; + } + if (result.compaction_readahead_size > 0) { result.new_table_reader_for_compaction_inputs = true; }