Fix segmentation fault caused by #1961

Summary:
Fixes #1961 which causes a segfault when filter_policy is nullptr and both
pin_l0_filter_and_index_blocks_in_cache/cache_index_and_filter_blocks
are set.
Closes https://github.com/facebook/rocksdb/pull/2029

Differential Revision: D4764862

Pulled By: maysamyabandeh

fbshipit-source-id: 05bd695
main
Maysam Yabandeh 8 years ago committed by Facebook Github Bot
parent 8dee8cad9e
commit 34a70859bc
  1. 2
      table/block_based_table_reader.cc

@ -732,7 +732,9 @@ Status BlockBasedTable::Open(const ImmutableCFOptions& ioptions,
if (rep->table_options.pin_l0_filter_and_index_blocks_in_cache && if (rep->table_options.pin_l0_filter_and_index_blocks_in_cache &&
level == 0) { level == 0) {
rep->filter_entry = filter_entry; rep->filter_entry = filter_entry;
if (rep->filter_entry.value != nullptr) {
rep->filter_entry.value->SetLevel(level); rep->filter_entry.value->SetLevel(level);
}
} else { } else {
filter_entry.Release(table_options.block_cache.get()); filter_entry.Release(table_options.block_cache.get());
} }

Loading…
Cancel
Save