Skip to content

Commit

Permalink
fix: only setup cache related options when cache enabled
Browse files Browse the repository at this point in the history
  • Loading branch information
quake committed Oct 27, 2023
1 parent d2ab67a commit 8354d23
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions db/src/db.rs
Original file line number Diff line number Diff line change
Expand Up @@ -72,14 +72,16 @@ impl RocksDB {
for cf in cf_descriptors.iter_mut() {
let mut block_opts = BlockBasedOptions::default();
block_opts.set_ribbon_filter(10.0);
block_opts.set_cache_index_and_filter_blocks(true);
block_opts.set_pin_l0_filter_and_index_blocks_in_cache(true);
block_opts.set_index_type(BlockBasedIndexType::TwoLevelIndexSearch);
block_opts.set_partition_filters(true);
block_opts.set_metadata_block_size(4096);
block_opts.set_pin_top_level_index_and_filter(true);
match cache {
Some(ref cache) => block_opts.set_block_cache(cache),
Some(ref cache) => {
block_opts.set_block_cache(cache);
block_opts.set_cache_index_and_filter_blocks(true);
block_opts.set_pin_l0_filter_and_index_blocks_in_cache(true);
}
None => block_opts.disable_cache(),
}
// only COLUMN_BLOCK_BODY column family use prefix seek
Expand Down

0 comments on commit 8354d23

Please sign in to comment.