From 811933be96547f926e2f811d12494c5d45db6cd3 Mon Sep 17 00:00:00 2001 From: wqfish Date: Wed, 8 Jan 2020 06:45:10 -0800 Subject: [PATCH] Add set_max_total_wal_size to Options (#366) --- src/db_options.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/db_options.rs b/src/db_options.rs index 94ca34c..165ed06 100644 --- a/src/db_options.rs +++ b/src/db_options.rs @@ -1179,6 +1179,27 @@ impl Options { } } + /// Once write-ahead logs exceed this size, we will start forcing the flush of + /// column families whose memtables are backed by the oldest live WAL file + /// (i.e. the ones that are causing all the space amplification). + /// + /// Default: `0` + /// + /// # Example + /// + /// ``` + /// use rocksdb::Options; + /// + /// let mut opts = Options::default(); + /// // Set max total wal size to 1G. + /// opts.set_max_total_wal_size(1 << 30); + /// ``` + pub fn set_max_total_wal_size(&mut self, size: u64) { + unsafe { + ffi::rocksdb_options_set_max_total_wal_size(self.inner, size); + } + } + /// Recovery mode to control the consistency while replaying WAL. /// /// Default: DBRecoveryMode::PointInTime