Skip to content

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

@iiibui

Description

@iiibui

#[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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions