diff options
author | walter <w41ter.l@gmail.com> | 2022-10-11 14:48:36 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-10-11 08:48:36 +0200 |
commit | 4ac69cd978244d9c160394fb163a0d7fc2fdd49e (patch) | |
tree | 9d42bd39afc25e119600969706499c24a6fbfedb /tests | |
parent | 6cd1c020b0f0f9517ebe962fa485008938a46aab (diff) |
Add DB::open_cf_with_opts method (#689)
Diffstat (limited to 'tests')
-rw-r--r-- | tests/test_column_family.rs | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/tests/test_column_family.rs b/tests/test_column_family.rs index fc71bed..e0fb0f4 100644 --- a/tests/test_column_family.rs +++ b/tests/test_column_family.rs @@ -157,6 +157,31 @@ fn test_create_missing_column_family() { } #[test] +fn test_open_column_family_with_opts() { + let n = DBPath::new("_rust_rocksdb_open_cf_with_opts"); + + { + let mut opts = Options::default(); + opts.create_if_missing(true); + opts.create_missing_column_families(true); + + // We can use different parameters for different column family. + let mut cf1_opts = Options::default(); + cf1_opts.set_min_write_buffer_number(2); + cf1_opts.set_min_write_buffer_number_to_merge(4); + let mut cf2_opts = Options::default(); + cf2_opts.set_min_write_buffer_number(5); + cf2_opts.set_min_write_buffer_number_to_merge(10); + + let cfs = vec![("cf1", cf1_opts), ("cf2", cf2_opts)]; + match DB::open_cf_with_opts(&opts, &n, cfs) { + Ok(_db) => println!("successfully opened column family with the specified options"), + Err(e) => panic!("failed to open cf with options: {}", e), + } + } +} + +#[test] #[ignore] fn test_merge_operator() { let n = DBPath::new("_rust_rocksdb_cftest_merge"); |