dont skip IO for filter blocks

Summary:
Based on my experience with linkbench, We should not skip loading bloom filter blocks when they are not available in block cache when using Iterator::Seek

Actually I am not sure why this behavior existed in the first place
Closes https://github.com/facebook/rocksdb/pull/2255

Differential Revision: D5010721

Pulled By: maysamyabandeh

fbshipit-source-id: 0af545a06ac4baeecb248706ec34d009c2480ca4
This commit is contained in:
Islam AbdelRahman 2017-05-09 09:49:41 -07:00 committed by Facebook Github Bot
parent 3f73d54bbd
commit 4897eb250b
2 changed files with 7 additions and 25 deletions

View File

@ -798,36 +798,19 @@ TEST_P(BloomStatsTestWithParam, BloomStatsTestWithIter) {
ASSERT_OK(iter->status()); ASSERT_OK(iter->status());
ASSERT_TRUE(iter->Valid()); ASSERT_TRUE(iter->Valid());
ASSERT_EQ(value1, iter->value().ToString()); ASSERT_EQ(value1, iter->value().ToString());
if (partition_filters_) { ASSERT_EQ(1, perf_context.bloom_sst_hit_count);
ASSERT_EQ(0, perf_context.bloom_sst_hit_count); // no_io
ASSERT_EQ(0, perf_context.bloom_sst_miss_count); // no_io
} else {
ASSERT_EQ(1, perf_context.bloom_sst_hit_count);
}
iter->Seek(key3); iter->Seek(key3);
ASSERT_OK(iter->status()); ASSERT_OK(iter->status());
ASSERT_TRUE(iter->Valid()); ASSERT_TRUE(iter->Valid());
ASSERT_EQ(value3, iter->value().ToString()); ASSERT_EQ(value3, iter->value().ToString());
if (partition_filters_) { ASSERT_EQ(2, perf_context.bloom_sst_hit_count);
ASSERT_EQ(0, perf_context.bloom_sst_hit_count); // no_io
ASSERT_EQ(0, perf_context.bloom_sst_miss_count); // no_io
} else {
ASSERT_EQ(2, perf_context.bloom_sst_hit_count);
}
iter->Seek(key2); iter->Seek(key2);
ASSERT_OK(iter->status()); ASSERT_OK(iter->status());
if (partition_filters_) { ASSERT_TRUE(!iter->Valid());
// iter is still valid since filter did not reject the key2 ASSERT_EQ(1, perf_context.bloom_sst_miss_count);
ASSERT_TRUE(iter->Valid()); ASSERT_EQ(2, perf_context.bloom_sst_hit_count);
ASSERT_EQ(0, perf_context.bloom_sst_hit_count); // no_io
ASSERT_EQ(0, perf_context.bloom_sst_miss_count); // no_io
} else {
ASSERT_TRUE(!iter->Valid());
ASSERT_EQ(1, perf_context.bloom_sst_miss_count);
ASSERT_EQ(2, perf_context.bloom_sst_hit_count);
}
} }
INSTANTIATE_TEST_CASE_P(BloomStatsTestWithParam, BloomStatsTestWithParam, INSTANTIATE_TEST_CASE_P(BloomStatsTestWithParam, BloomStatsTestWithParam,

View File

@ -1477,14 +1477,13 @@ bool BlockBasedTable::PrefixMayMatch(const Slice& internal_key) {
Status s; Status s;
// First, try check with full filter // First, try check with full filter
const bool no_io = true; auto filter_entry = GetFilter();
auto filter_entry = GetFilter(no_io);
FilterBlockReader* filter = filter_entry.value; FilterBlockReader* filter = filter_entry.value;
if (filter != nullptr) { if (filter != nullptr) {
if (!filter->IsBlockBased()) { if (!filter->IsBlockBased()) {
const Slice* const const_ikey_ptr = &internal_key; const Slice* const const_ikey_ptr = &internal_key;
may_match = may_match =
filter->PrefixMayMatch(prefix, kNotValid, no_io, const_ikey_ptr); filter->PrefixMayMatch(prefix, kNotValid, false, const_ikey_ptr);
} else { } else {
InternalKey internal_key_prefix(prefix, kMaxSequenceNumber, kTypeValue); InternalKey internal_key_prefix(prefix, kMaxSequenceNumber, kTypeValue);
auto internal_prefix = internal_key_prefix.Encode(); auto internal_prefix = internal_key_prefix.Encode();