Merge pull request #524 from stanislav-tkach/set_zstd_max_train_bytes

Set zstd max train bytes
master
Stanislav Tkach 4 years ago committed by GitHub
commit 7efa1ca525
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      CHANGELOG.md
  2. 13
      src/db_options.rs
  3. 4
      tests/test_db.rs
  4. 12
      tests/test_rocksdb_options.rs

@ -3,6 +3,8 @@
## [Unreleased]
* Bump `librocksdb-sys` up to 6.19.3 (olegnn)
* 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)
@ -17,13 +19,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)

@ -1051,6 +1051,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.

@ -974,7 +974,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();
@ -988,7 +988,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,15 @@ 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_compression_options(4, 5, 6, 7);
opts.set_zstd_max_train_bytes(100);
let _db = DB::open(&opts, &path).unwrap();
}
}

Loading…
Cancel
Save