From 45edfd2e900d196e0d0bcd4e251e69cc8ee4e943 Mon Sep 17 00:00:00 2001 From: Roman Zeyde Date: Mon, 9 Apr 2018 21:37:58 +0300 Subject: [PATCH] Expose compaction_readahead_size option --- src/db_options.rs | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/src/db_options.rs b/src/db_options.rs index 716b6f7..912f5c6 100644 --- a/src/db_options.rs +++ b/src/db_options.rs @@ -221,6 +221,20 @@ impl Options { } } + /// If non-zero, we perform bigger reads when doing compaction. If you're + /// running RocksDB on spinning disks, you should set this to at least 2MB. + /// That way RocksDB's compaction is doing sequential instead of random reads. + /// + /// When non-zero, we also force new_table_reader_for_compaction_inputs to + /// true. + /// + /// Default: `0` + pub fn set_compaction_readahead_size(&mut self, compaction_readahead_size: usize) { + unsafe { + ffi::rocksdb_options_compaction_readahead_size(self.inner, compaction_readahead_size as usize); + } + } + pub fn set_merge_operator(&mut self, name: &str, full_merge_fn: MergeFn, partial_merge_fn: Option) {