Summary: This is to provide a way for users to skip prefix bloom in point look-up.
Test Plan: Add a new unit test scenario.
Reviewers: IslamAbdelRahman
Subscribers: leveldb, andrewkr, dhruba
Differential Revision: https://reviews.facebook.net/D57747
ASSERT_EQ("NOT_FOUND", Get("foobarbar"));
ASSERT_EQ(TestGetTickerCount(options, BLOOM_FILTER_USEFUL), 2);
+
+ ro.total_order_seek = true;
+ ASSERT_TRUE(db_->Get(ro, "foobarbar", &value).IsNotFound());
+ ASSERT_EQ(TestGetTickerCount(options, BLOOM_FILTER_USEFUL), 2);
}
TEST_F(DBBloomFilterTest, WholeKeyFilterProp) {
// Enable a total order seek regardless of index format (e.g. hash index)
// used in the table. Some table format (e.g. plain table) may not support
// this option.
+ // If true when calling Get(), we also skip prefix bloom when reading from
+ // block based table. It provides a way to read exisiting data after
+ // changing implementation of prefix extractor.
bool total_order_seek;
// Enforce that the iterator only iterates over the same prefix as the seek.
NewIndexIterator(read_options), arena);
}
-bool BlockBasedTable::FullFilterKeyMayMatch(FilterBlockReader* filter,
+bool BlockBasedTable::FullFilterKeyMayMatch(const ReadOptions& read_options,
+ FilterBlockReader* filter,
const Slice& internal_key) const {
if (filter == nullptr || filter->IsBlockBased()) {
return true;
if (!filter->KeyMayMatch(user_key)) {
return false;
}
- if (rep_->ioptions.prefix_extractor &&
+ if (!read_options.total_order_seek && rep_->ioptions.prefix_extractor &&
rep_->ioptions.prefix_extractor->InDomain(user_key) &&
!filter->PrefixMayMatch(
rep_->ioptions.prefix_extractor->Transform(user_key))) {
// First check the full filter
// If full filter not useful, Then go into each block
- if (!FullFilterKeyMayMatch(filter, key)) {
+ if (!FullFilterKeyMayMatch(read_options, filter, key)) {
RecordTick(rep_->ioptions.statistics, BLOOM_FILTER_USEFUL);
} else {
BlockIter iiter;
IndexReader** index_reader,
InternalIterator* preloaded_meta_index_iter = nullptr);
- bool FullFilterKeyMayMatch(FilterBlockReader* filter,
+ bool FullFilterKeyMayMatch(const ReadOptions& read_options,
+ FilterBlockReader* filter,
const Slice& user_key) const;
// Read the meta block from sst.