forked from rust-rocksdb/rust-rocksdb
-
Notifications
You must be signed in to change notification settings - Fork 161
Open
Description
rust-rocksdb/tests/cases/test_rocksdb_options.rs
Lines 345 to 374 in d8b7ff8
#[test] | |
fn test_set_lru_cache() { | |
let path = tempdir_with_prefix("_rust_rocksdb_set_set_lru_cache"); | |
let mut opts = DBOptions::new(); | |
let mut cf_opts = ColumnFamilyOptions::new(); | |
opts.create_if_missing(true); | |
let mut block_opts = BlockBasedOptions::new(); | |
let mut cache_opts = LRUCacheOptions::new(); | |
cache_opts.set_capacity(8388608); | |
block_opts.set_block_cache(&Cache::new_lru_cache(cache_opts)); | |
cf_opts.set_block_based_table_factory(&block_opts); | |
DB::open_cf(opts, path.path().to_str().unwrap(), vec!["default"]).unwrap(); | |
} | |
#[cfg(feature = "jemalloc")] | |
#[test] | |
fn test_set_jemalloc_nodump_allocator_for_lru_cache() { | |
use rocksdb::MemoryAllocator; | |
let path = tempdir_with_prefix("_rust_rocksdb_set_jemalloc_nodump_allocator"); | |
let mut opts = DBOptions::new(); | |
let mut cf_opts = ColumnFamilyOptions::new(); | |
opts.create_if_missing(true); | |
let mut block_opts = BlockBasedOptions::new(); | |
let mut cache_opts = LRUCacheOptions::new(); | |
cache_opts.set_memory_allocator(MemoryAllocator::new_jemalloc_memory_allocator().unwrap()); | |
cache_opts.set_capacity(8388608); | |
block_opts.set_block_cache(&Cache::new_lru_cache(cache_opts)); | |
cf_opts.set_block_based_table_factory(&block_opts); | |
DB::open_cf(opts, path.path().to_str().unwrap(), vec!["default"]).unwrap(); | |
} |
DB::open_cf(opts, path.path().to_str().unwrap(), vec!["default"]).unwrap();
why not
DB::open_cf(opts, path.path().to_str().unwrap(), vec![("default", cf_opts)]).unwrap();
Metadata
Metadata
Assignees
Labels
No labels