BlockBasedTable::PrefixMayMatch() to bloom setting to the beginning of the function

Summary: In BlockBasedTable::PrefixMayMatch() we calculate prefix even if bloom is not config. Move the check before

Test Plan: make all check

Reviewers: igor, ljin

Reviewed By: ljin

Subscribers: wuj, leveldb, haobo, yhchiang, dhruba

Differential Revision: https://reviews.facebook.net/D18993
main
sdong 11 years ago
parent e2d3101cf1
commit 88a1691a1e
  1. 8
      table/block_based_table_reader.cc

@ -914,6 +914,10 @@ class BlockBasedTable::BlockEntryIteratorState : public TwoLevelIteratorState {
// //
// REQUIRES: this method shouldn't be called while the DB lock is held. // REQUIRES: this method shouldn't be called while the DB lock is held.
bool BlockBasedTable::PrefixMayMatch(const Slice& internal_key) { bool BlockBasedTable::PrefixMayMatch(const Slice& internal_key) {
if (!rep_->options.filter_policy) {
return true;
}
assert(rep_->options.prefix_extractor != nullptr); assert(rep_->options.prefix_extractor != nullptr);
auto prefix = rep_->options.prefix_extractor->Transform( auto prefix = rep_->options.prefix_extractor->Transform(
ExtractUserKey(internal_key)); ExtractUserKey(internal_key));
@ -923,10 +927,6 @@ bool BlockBasedTable::PrefixMayMatch(const Slice& internal_key) {
bool may_match = true; bool may_match = true;
Status s; Status s;
if (!rep_->options.filter_policy) {
return true;
}
// To prevent any io operation in this method, we set `read_tier` to make // To prevent any io operation in this method, we set `read_tier` to make
// sure we always read index or filter only when they have already been // sure we always read index or filter only when they have already been
// loaded to memory. // loaded to memory.

Loading…
Cancel
Save