diff --git a/librocksdb-sys/src/lib.rs b/librocksdb-sys/src/lib.rs index f2320ac..a5d9268 100644 --- a/librocksdb-sys/src/lib.rs +++ b/librocksdb-sys/src/lib.rs @@ -659,6 +659,9 @@ extern "C" { pub fn rocksdb_options_set_bytes_per_sync(opt: *mut rocksdb_options_t, v: uint64_t); + pub fn rocksdb_options_set_allow_concurrent_memtable_write(opt: *mut rocksdb_options_t, + v: c_uchar); + pub fn rocksdb_options_set_verify_checksums_in_compaction(opt: *mut rocksdb_options_t, v: c_uchar); diff --git a/librocksdb-sys/tests/ffi.rs b/librocksdb-sys/tests/ffi.rs index 15e8d9b..d230322 100644 --- a/librocksdb-sys/tests/ffi.rs +++ b/librocksdb-sys/tests/ffi.rs @@ -1030,6 +1030,7 @@ fn ffi() { rocksdb_slicetransform_create_fixed_prefix(3)); rocksdb_options_set_hash_skip_list_rep(options, 5000, 4, 4); rocksdb_options_set_plain_table_factory(options, 4, 10, 0.75, 16); + rocksdb_options_set_allow_concurrent_memtable_write(options, 0); db = rocksdb_open(options, dbname, &mut err); CheckNoError!(err); diff --git a/src/db_options.rs b/src/db_options.rs index cab0cac..eea8e97 100644 --- a/src/db_options.rs +++ b/src/db_options.rs @@ -347,6 +347,28 @@ impl Options { } } + /// If true, allow multi-writers to update mem tables in parallel. + /// Only some memtable_factory-s support concurrent writes; currently it + /// is implemented only for SkipListFactory. Concurrent memtable writes + /// are not compatible with inplace_update_support or filter_deletes. + /// It is strongly recommended to set enable_write_thread_adaptive_yield + /// if you are going to use this feature. + /// + /// Default: true + /// + /// # Example + /// + /// ``` + /// use rocksdb::Options; + /// + /// let mut opts = Options::default(); + /// opts.set_allow_concurrent_memtable_write(false); + /// ``` + pub fn set_allow_concurrent_memtable_write(&mut self, allow: bool) { + unsafe { ffi::rocksdb_options_set_allow_concurrent_memtable_write(self.inner, + allow as c_uchar) } + } + pub fn set_disable_data_sync(&mut self, disable: bool) { unsafe { ffi::rocksdb_options_set_disable_data_sync(self.inner, disable as c_int) } }