@ -1224,7 +1224,8 @@ bool BlockBasedTable::PrefixMayMatch(const Slice& internal_key) {
// First, try check with full filter
// First, try check with full filter
auto filter_entry = GetFilter ( true /* no io */ ) ;
auto filter_entry = GetFilter ( true /* no io */ ) ;
FilterBlockReader * filter = filter_entry . value ;
FilterBlockReader * filter = filter_entry . value ;
if ( filter ! = nullptr & & ! filter - > IsBlockBased ( ) ) {
if ( filter ! = nullptr ) {
if ( ! filter - > IsBlockBased ( ) ) {
may_match = filter - > PrefixMayMatch ( prefix ) ;
may_match = filter - > PrefixMayMatch ( prefix ) ;
} else {
} else {
// Then, try find it within each block
// Then, try find it within each block
@ -1237,8 +1238,8 @@ bool BlockBasedTable::PrefixMayMatch(const Slice& internal_key) {
// and we're not really sure that we're past the end
// and we're not really sure that we're past the end
// of the file
// of the file
may_match = iiter - > status ( ) . IsIncomplete ( ) ;
may_match = iiter - > status ( ) . IsIncomplete ( ) ;
} else if ( ExtractUserKey ( iiter - > key ( ) ) . starts_with (
} else if ( ExtractUserKey ( iiter - > key ( ) )
ExtractUserKey ( internal_prefix ) ) ) {
. starts_with ( ExtractUserKey ( internal_prefix ) ) ) {
// we need to check for this subtle case because our only
// we need to check for this subtle case because our only
// guarantee is that "the key is a string >= last key in that data
// guarantee is that "the key is a string >= last key in that data
// block" according to the doc/table_format.txt spec.
// block" according to the doc/table_format.txt spec.
@ -1249,7 +1250,7 @@ bool BlockBasedTable::PrefixMayMatch(const Slice& internal_key) {
// block. However, the next data block may contain the prefix, so
// block. However, the next data block may contain the prefix, so
// we return true to play it safe.
// we return true to play it safe.
may_match = true ;
may_match = true ;
} else if ( filter ! = nullptr & & filter - > IsBlockBased ( ) ) {
} else if ( filter - > IsBlockBased ( ) ) {
// iiter->key() does NOT start with the desired prefix. Because
// iiter->key() does NOT start with the desired prefix. Because
// Seek() finds the first key that is >= the seek target, this
// Seek() finds the first key that is >= the seek target, this
// means that iiter->key() > prefix. Thus, any data blocks coming
// means that iiter->key() > prefix. Thus, any data blocks coming
@ -1263,6 +1264,7 @@ bool BlockBasedTable::PrefixMayMatch(const Slice& internal_key) {
may_match = filter - > PrefixMayMatch ( prefix , handle . offset ( ) ) ;
may_match = filter - > PrefixMayMatch ( prefix , handle . offset ( ) ) ;
}
}
}
}
}
Statistics * statistics = rep_ - > ioptions . statistics ;
Statistics * statistics = rep_ - > ioptions . statistics ;
RecordTick ( statistics , BLOOM_FILTER_PREFIX_CHECKED ) ;
RecordTick ( statistics , BLOOM_FILTER_PREFIX_CHECKED ) ;