diff --git a/table/block_based_table_reader.cc b/table/block_based_table_reader.cc index 71fff659a..e5cc58ccb 100644 --- a/table/block_based_table_reader.cc +++ b/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. bool BlockBasedTable::PrefixMayMatch(const Slice& internal_key) { + if (!rep_->options.filter_policy) { + return true; + } + assert(rep_->options.prefix_extractor != nullptr); auto prefix = rep_->options.prefix_extractor->Transform( ExtractUserKey(internal_key)); @@ -923,10 +927,6 @@ bool BlockBasedTable::PrefixMayMatch(const Slice& internal_key) { bool may_match = true; Status s; - if (!rep_->options.filter_policy) { - return true; - } - // 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 // loaded to memory.