Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

The variable 'cf_opts' is not used by 'DB::open_cf' #710

Open
iiibui opened this issue Jul 10, 2022 · 1 comment
Open

The variable 'cf_opts' is not used by 'DB::open_cf' #710

iiibui opened this issue Jul 10, 2022 · 1 comment

Comments

@iiibui
Copy link

iiibui commented Jul 10, 2022

#[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();

@tabokie
Copy link
Member

tabokie commented Jul 10, 2022

Good catch, feel free to file a fixing PR.

This particular issue could be easily detected by clippy, but there're too many of them and we never get the time to fix them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants