Add the DB::key_may_exist_cf_opt method

master
Stanislav Tkach 3 years ago
parent 0e37e65ba4
commit 841c23b265
  1. 7
      CHANGELOG.md
  2. 13
      src/db_options.rs
  3. 4
      tests/test_db.rs
  4. 11
      tests/test_rocksdb_options.rs

@ -2,6 +2,9 @@
## [Unreleased]
* Add `DB::key_may_exist_cf_opt` method (stanislav-tkach)
* Add `Options::set_zstd_max_train_bytes` method (stanislav-tkach)
## 0.16.0 (2021-04-18)
* Add `DB::cancel_all_background_work` method (stanislav-tkach)
@ -15,13 +18,13 @@
* Bump `librocksdb-sys` up to 6.17.3 (ordian)
* Remove the need for `&mut self` in `create_cf` and `drop_cf` (v2) (ryoqun)
* Keep Cache and Env alive with Rc (acrrd)
* Add DB::open_cf_with_ttl method (fdeantoni)
* Add `DB::open_cf_with_ttl` method (fdeantoni)
## 0.15.0 (2020-08-25)
* Fix building rocksdb library on windows host (aleksuss)
* Add github actions CI for windows build (aleksuss)
* Update doc for Options::set_compression_type (wqfish)
* Update doc for `Options::set_compression_type` (wqfish)
* Add clippy linter in CI (aleksuss)
* Use DBPath for backup_restore test (wqfish)
* Allow to build RocksDB with a different stdlib (calavera)

@ -977,6 +977,19 @@ impl Options {
}
}
/// Sets maximum size of training data passed to zstd's dictionary trainer. Using zstd's
/// dictionary trainer can achieve even better compression ratio improvements than using
/// `max_dict_bytes` alone.
///
/// The training data will be used to generate a dictionary of max_dict_bytes.
///
/// Default: 0.
pub fn set_zstd_max_train_bytes(&mut self, value: c_int) {
unsafe {
ffi::rocksdb_options_set_compression_options_zstd_max_train_bytes(self.inner, value);
}
}
/// 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.

@ -968,7 +968,7 @@ fn multi_get_cf() {
#[test]
fn key_may_exist() {
let path = DBPath::new("_rust_rocksdb_multi_get");
let path = DBPath::new("_rust_key_may_exist");
{
let db = DB::open_default(&path).unwrap();
@ -982,7 +982,7 @@ fn key_may_exist() {
#[test]
fn key_may_exist_cf() {
let path = DBPath::new("_rust_rocksdb_multi_get_cf");
let path = DBPath::new("_rust_key_may_exist_cf");
{
let mut opts = Options::default();

@ -134,3 +134,14 @@ fn test_set_data_block_index_type() {
assert!(settings.contains("data_block_hash_table_util_ratio: 0.350000"));
}
}
#[test]
fn set_compression_options_zstd_max_train_bytes() {
let path = DBPath::new("_rust_set_compression_options_zstd_max_train_bytes");
{
let mut opts = Options::default();
opts.create_if_missing(true);
opts.set_zstd_max_train_bytes(100);
let _db = DB::open(&opts, &path).unwrap();
}
}

Loading…
Cancel
Save