|
|
@ -572,7 +572,7 @@ fn test_open_cf_with_ttl() { |
|
|
|
let mut opts = Options::default(); |
|
|
|
let mut opts = Options::default(); |
|
|
|
opts.create_if_missing(true); |
|
|
|
opts.create_if_missing(true); |
|
|
|
opts.create_missing_column_families(true); |
|
|
|
opts.create_missing_column_families(true); |
|
|
|
let db = DB::open_cf_with_ttl(&opts, &path, &["test_cf"], Duration::from_secs(1)).unwrap(); |
|
|
|
let db = DB::open_cf_with_ttl(&opts, &path, ["test_cf"], Duration::from_secs(1)).unwrap(); |
|
|
|
let cf = db.cf_handle("test_cf").unwrap(); |
|
|
|
let cf = db.cf_handle("test_cf").unwrap(); |
|
|
|
db.put_cf(&cf, b"key1", b"value1").unwrap(); |
|
|
|
db.put_cf(&cf, b"key1", b"value1").unwrap(); |
|
|
|
|
|
|
|
|
|
|
@ -740,7 +740,7 @@ fn env_and_dbpaths_test() { |
|
|
|
opts.create_missing_column_families(true); |
|
|
|
opts.create_missing_column_families(true); |
|
|
|
|
|
|
|
|
|
|
|
{ |
|
|
|
{ |
|
|
|
let mut env = Env::default().unwrap(); |
|
|
|
let mut env = Env::new().unwrap(); |
|
|
|
env.lower_high_priority_thread_pool_cpu_priority(); |
|
|
|
env.lower_high_priority_thread_pool_cpu_priority(); |
|
|
|
opts.set_env(&env); |
|
|
|
opts.set_env(&env); |
|
|
|
} |
|
|
|
} |
|
|
@ -909,7 +909,7 @@ fn get_with_cache_and_bulkload_test() { |
|
|
|
opts.set_stats_persist_period_sec(0); |
|
|
|
opts.set_stats_persist_period_sec(0); |
|
|
|
|
|
|
|
|
|
|
|
// test Env::Default()->SetBackgroundThreads(0, Env::Priority::BOTTOM);
|
|
|
|
// test Env::Default()->SetBackgroundThreads(0, Env::Priority::BOTTOM);
|
|
|
|
let mut env = Env::default().unwrap(); |
|
|
|
let mut env = Env::new().unwrap(); |
|
|
|
env.set_bottom_priority_background_threads(0); |
|
|
|
env.set_bottom_priority_background_threads(0); |
|
|
|
opts.set_env(&env); |
|
|
|
opts.set_env(&env); |
|
|
|
|
|
|
|
|
|
|
@ -1044,7 +1044,7 @@ fn get_with_cache_and_bulkload_and_blobs_test() { |
|
|
|
opts.set_stats_persist_period_sec(0); |
|
|
|
opts.set_stats_persist_period_sec(0); |
|
|
|
|
|
|
|
|
|
|
|
// test Env::Default()->SetBackgroundThreads(0, Env::Priority::BOTTOM);
|
|
|
|
// test Env::Default()->SetBackgroundThreads(0, Env::Priority::BOTTOM);
|
|
|
|
let mut env = Env::default().unwrap(); |
|
|
|
let mut env = Env::new().unwrap(); |
|
|
|
env.set_bottom_priority_background_threads(0); |
|
|
|
env.set_bottom_priority_background_threads(0); |
|
|
|
opts.set_env(&env); |
|
|
|
opts.set_env(&env); |
|
|
|
|
|
|
|
|
|
|
@ -1161,7 +1161,7 @@ fn multi_get() { |
|
|
|
let k1_snap = db.snapshot(); |
|
|
|
let k1_snap = db.snapshot(); |
|
|
|
db.put(b"k2", b"v2").unwrap(); |
|
|
|
db.put(b"k2", b"v2").unwrap(); |
|
|
|
|
|
|
|
|
|
|
|
let _ = db.multi_get(&[b"k0"; 40]); |
|
|
|
let _ = db.multi_get([b"k0"; 40]); |
|
|
|
|
|
|
|
|
|
|
|
let assert_values = |values: Vec<_>| { |
|
|
|
let assert_values = |values: Vec<_>| { |
|
|
|
assert_eq!(3, values.len()); |
|
|
|
assert_eq!(3, values.len()); |
|
|
@ -1171,14 +1171,14 @@ fn multi_get() { |
|
|
|
}; |
|
|
|
}; |
|
|
|
|
|
|
|
|
|
|
|
let values = db |
|
|
|
let values = db |
|
|
|
.multi_get(&[b"k0", b"k1", b"k2"]) |
|
|
|
.multi_get([b"k0", b"k1", b"k2"]) |
|
|
|
.into_iter() |
|
|
|
.into_iter() |
|
|
|
.map(Result::unwrap) |
|
|
|
.map(Result::unwrap) |
|
|
|
.collect::<Vec<_>>(); |
|
|
|
.collect::<Vec<_>>(); |
|
|
|
|
|
|
|
|
|
|
|
assert_values(values); |
|
|
|
assert_values(values); |
|
|
|
|
|
|
|
|
|
|
|
let values = DBAccess::multi_get_opt(&db, &[b"k0", b"k1", b"k2"], &Default::default()) |
|
|
|
let values = DBAccess::multi_get_opt(&db, [b"k0", b"k1", b"k2"], &Default::default()) |
|
|
|
.into_iter() |
|
|
|
.into_iter() |
|
|
|
.map(Result::unwrap) |
|
|
|
.map(Result::unwrap) |
|
|
|
.collect::<Vec<_>>(); |
|
|
|
.collect::<Vec<_>>(); |
|
|
@ -1187,7 +1187,7 @@ fn multi_get() { |
|
|
|
|
|
|
|
|
|
|
|
let values = db |
|
|
|
let values = db |
|
|
|
.snapshot() |
|
|
|
.snapshot() |
|
|
|
.multi_get(&[b"k0", b"k1", b"k2"]) |
|
|
|
.multi_get([b"k0", b"k1", b"k2"]) |
|
|
|
.into_iter() |
|
|
|
.into_iter() |
|
|
|
.map(Result::unwrap) |
|
|
|
.map(Result::unwrap) |
|
|
|
.collect::<Vec<_>>(); |
|
|
|
.collect::<Vec<_>>(); |
|
|
@ -1195,7 +1195,7 @@ fn multi_get() { |
|
|
|
assert_values(values); |
|
|
|
assert_values(values); |
|
|
|
|
|
|
|
|
|
|
|
let none_values = initial_snap |
|
|
|
let none_values = initial_snap |
|
|
|
.multi_get(&[b"k0", b"k1", b"k2"]) |
|
|
|
.multi_get([b"k0", b"k1", b"k2"]) |
|
|
|
.into_iter() |
|
|
|
.into_iter() |
|
|
|
.map(Result::unwrap) |
|
|
|
.map(Result::unwrap) |
|
|
|
.collect::<Vec<_>>(); |
|
|
|
.collect::<Vec<_>>(); |
|
|
@ -1203,7 +1203,7 @@ fn multi_get() { |
|
|
|
assert_eq!(none_values, vec![None; 3]); |
|
|
|
assert_eq!(none_values, vec![None; 3]); |
|
|
|
|
|
|
|
|
|
|
|
let k1_only = k1_snap |
|
|
|
let k1_only = k1_snap |
|
|
|
.multi_get(&[b"k0", b"k1", b"k2"]) |
|
|
|
.multi_get([b"k0", b"k1", b"k2"]) |
|
|
|
.into_iter() |
|
|
|
.into_iter() |
|
|
|
.map(Result::unwrap) |
|
|
|
.map(Result::unwrap) |
|
|
|
.collect::<Vec<_>>(); |
|
|
|
.collect::<Vec<_>>(); |
|
|
@ -1220,7 +1220,7 @@ fn multi_get_cf() { |
|
|
|
let mut opts = Options::default(); |
|
|
|
let mut opts = Options::default(); |
|
|
|
opts.create_if_missing(true); |
|
|
|
opts.create_if_missing(true); |
|
|
|
opts.create_missing_column_families(true); |
|
|
|
opts.create_missing_column_families(true); |
|
|
|
let db = DB::open_cf(&opts, &path, &["cf0", "cf1", "cf2"]).unwrap(); |
|
|
|
let db = DB::open_cf(&opts, &path, ["cf0", "cf1", "cf2"]).unwrap(); |
|
|
|
|
|
|
|
|
|
|
|
let cf0 = db.cf_handle("cf0").unwrap(); |
|
|
|
let cf0 = db.cf_handle("cf0").unwrap(); |
|
|
|
|
|
|
|
|
|
|
@ -1250,7 +1250,7 @@ fn batched_multi_get_cf() { |
|
|
|
let mut opts = Options::default(); |
|
|
|
let mut opts = Options::default(); |
|
|
|
opts.create_if_missing(true); |
|
|
|
opts.create_if_missing(true); |
|
|
|
opts.create_missing_column_families(true); |
|
|
|
opts.create_missing_column_families(true); |
|
|
|
let db = DB::open_cf(&opts, &path, &["cf0"]).unwrap(); |
|
|
|
let db = DB::open_cf(&opts, &path, ["cf0"]).unwrap(); |
|
|
|
|
|
|
|
|
|
|
|
let cf = db.cf_handle("cf0").unwrap(); |
|
|
|
let cf = db.cf_handle("cf0").unwrap(); |
|
|
|
db.put_cf(&cf, b"k1", b"v1").unwrap(); |
|
|
|
db.put_cf(&cf, b"k1", b"v1").unwrap(); |
|
|
@ -1288,7 +1288,7 @@ fn key_may_exist_cf() { |
|
|
|
let mut opts = Options::default(); |
|
|
|
let mut opts = Options::default(); |
|
|
|
opts.create_if_missing(true); |
|
|
|
opts.create_if_missing(true); |
|
|
|
opts.create_missing_column_families(true); |
|
|
|
opts.create_missing_column_families(true); |
|
|
|
let db = DB::open_cf(&opts, &path, &["cf"]).unwrap(); |
|
|
|
let db = DB::open_cf(&opts, &path, ["cf"]).unwrap(); |
|
|
|
let cf = db.cf_handle("cf").unwrap(); |
|
|
|
let cf = db.cf_handle("cf").unwrap(); |
|
|
|
|
|
|
|
|
|
|
|
assert!(!db.key_may_exist_cf(&cf, "nonexistent")); |
|
|
|
assert!(!db.key_may_exist_cf(&cf, "nonexistent")); |
|
|
|