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
This commit is contained in:
Maysam Yabandeh 2017-03-24 17:07:38 -07:00 committed by Facebook Github Bot
parent 8dee8cad9e
commit 34a70859bc

View File

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