提交 e0ad0f26 编写于 作者: I Igor Canadi

Fix bloom filters

Summary: https://reviews.facebook.net/D13167 broke bloom filters. If filter is not in cache, we want to return true (safe thing). Am I right?

Test Plan: when benchmarking https://reviews.facebook.net/D14031 I got different results when using bloom filters vs. when not using them. This fixed the issue. I will also be putting this change to the other diff, but that one will probably be in review for longer time.

Reviewers: kailiu, dhruba, haobo

Reviewed By: kailiu

CC: leveldb

Differential Revision: https://reviews.facebook.net/D14085
上级 fda8142f
......@@ -904,7 +904,10 @@ bool BlockBasedTable::PrefixMayMatch(const Slice& internal_prefix) {
if (!iiter->Valid()) {
// we're past end of file
may_match = false;
// if it's incomplete, it means that we avoided I/O
// and we're not really sure that we're past the end
// of the file
may_match = iiter->status().IsIncomplete();
} else if (ExtractUserKey(iiter->key()).starts_with(
ExtractUserKey(internal_prefix))) {
// we need to check for this subtle case because our only
......@@ -930,7 +933,7 @@ bool BlockBasedTable::PrefixMayMatch(const Slice& internal_prefix) {
assert(s.ok());
auto filter_entry = GetFilter(true /* no io */);
may_match =
filter_entry.value != nullptr &&
filter_entry.value == nullptr ||
filter_entry.value->PrefixMayMatch(handle.offset(), internal_prefix);
filter_entry.Release(rep_->options.block_cache.get());
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册