@ -7,6 +7,7 @@
# include <utility>
# include <utility>
# include "block_type.h"
# include "file/random_access_file_reader.h"
# include "file/random_access_file_reader.h"
# include "logging/logging.h"
# include "logging/logging.h"
# include "monitoring/perf_context_imp.h"
# include "monitoring/perf_context_imp.h"
@ -197,9 +198,9 @@ std::unique_ptr<FilterBlockReader> PartitionedFilterBlockReader::Create(
CachableEntry < Block > filter_block ;
CachableEntry < Block > filter_block ;
if ( prefetch | | ! use_cache ) {
if ( prefetch | | ! use_cache ) {
const Status s = ReadFilterBlock ( table , prefetch_buffer , ro , use_cache ,
const Status s = ReadFilterBlock (
nullptr /* get_context */ , lookup_context ,
table , prefetch_buffer , ro , use_cache , nullptr /* get_context */ ,
& filter_block ) ;
lookup_context , & filter_block , BlockType : : kFilterPartitionIndex ) ;
if ( ! s . ok ( ) ) {
if ( ! s . ok ( ) ) {
IGNORE_STATUS_IF_ERROR ( s ) ;
IGNORE_STATUS_IF_ERROR ( s ) ;
return std : : unique_ptr < FilterBlockReader > ( ) ;
return std : : unique_ptr < FilterBlockReader > ( ) ;
@ -277,9 +278,10 @@ BlockHandle PartitionedFilterBlockReader::GetFilterPartitionHandle(
Statistics * kNullStats = nullptr ;
Statistics * kNullStats = nullptr ;
filter_block . GetValue ( ) - > NewIndexIterator (
filter_block . GetValue ( ) - > NewIndexIterator (
comparator - > user_comparator ( ) ,
comparator - > user_comparator ( ) ,
table ( ) - > get_rep ( ) - > get_global_seqno ( BlockType : : kFilter ) , & iter ,
table ( ) - > get_rep ( ) - > get_global_seqno ( BlockType : : kFilterPartitionIndex ) ,
kNullStats , true /* total_order_seek */ , false /* have_first_key */ ,
& iter , kNullStats , true /* total_order_seek */ ,
index_key_includes_seq ( ) , index_value_is_full ( ) ) ;
false /* have_first_key */ , index_key_includes_seq ( ) ,
index_value_is_full ( ) ) ;
iter . Seek ( entry ) ;
iter . Seek ( entry ) ;
if ( UNLIKELY ( ! iter . Valid ( ) ) ) {
if ( UNLIKELY ( ! iter . Valid ( ) ) ) {
// entry is larger than all the keys. However its prefix might still be
// entry is larger than all the keys. However its prefix might still be
@ -335,7 +337,8 @@ bool PartitionedFilterBlockReader::MayMatch(
FilterFunction filter_function ) const {
FilterFunction filter_function ) const {
CachableEntry < Block > filter_block ;
CachableEntry < Block > filter_block ;
Status s =
Status s =
GetOrReadFilterBlock ( no_io , get_context , lookup_context , & filter_block ) ;
GetOrReadFilterBlock ( no_io , get_context , lookup_context , & filter_block ,
BlockType : : kFilterPartitionIndex ) ;
if ( UNLIKELY ( ! s . ok ( ) ) ) {
if ( UNLIKELY ( ! s . ok ( ) ) ) {
IGNORE_STATUS_IF_ERROR ( s ) ;
IGNORE_STATUS_IF_ERROR ( s ) ;
return true ;
return true ;
@ -371,8 +374,9 @@ void PartitionedFilterBlockReader::MayMatch(
uint64_t block_offset , bool no_io , BlockCacheLookupContext * lookup_context ,
uint64_t block_offset , bool no_io , BlockCacheLookupContext * lookup_context ,
FilterManyFunction filter_function ) const {
FilterManyFunction filter_function ) const {
CachableEntry < Block > filter_block ;
CachableEntry < Block > filter_block ;
Status s = GetOrReadFilterBlock ( no_io , range - > begin ( ) - > get_context ,
Status s =
lookup_context , & filter_block ) ;
GetOrReadFilterBlock ( no_io , range - > begin ( ) - > get_context , lookup_context ,
& filter_block , BlockType : : kFilterPartitionIndex ) ;
if ( UNLIKELY ( ! s . ok ( ) ) ) {
if ( UNLIKELY ( ! s . ok ( ) ) ) {
IGNORE_STATUS_IF_ERROR ( s ) ;
IGNORE_STATUS_IF_ERROR ( s ) ;
return ; // Any/all may match
return ; // Any/all may match
@ -463,7 +467,8 @@ Status PartitionedFilterBlockReader::CacheDependencies(const ReadOptions& ro,
CachableEntry < Block > filter_block ;
CachableEntry < Block > filter_block ;
Status s = GetOrReadFilterBlock ( false /* no_io */ , nullptr /* get_context */ ,
Status s = GetOrReadFilterBlock ( false /* no_io */ , nullptr /* get_context */ ,
& lookup_context , & filter_block ) ;
& lookup_context , & filter_block ,
BlockType : : kFilterPartitionIndex ) ;
if ( ! s . ok ( ) ) {
if ( ! s . ok ( ) ) {
ROCKS_LOG_ERROR ( rep - > ioptions . logger ,
ROCKS_LOG_ERROR ( rep - > ioptions . logger ,
" Error retrieving top-level filter block while trying to "
" Error retrieving top-level filter block while trying to "
@ -479,10 +484,10 @@ Status PartitionedFilterBlockReader::CacheDependencies(const ReadOptions& ro,
const InternalKeyComparator * const comparator = internal_comparator ( ) ;
const InternalKeyComparator * const comparator = internal_comparator ( ) ;
Statistics * kNullStats = nullptr ;
Statistics * kNullStats = nullptr ;
filter_block . GetValue ( ) - > NewIndexIterator (
filter_block . GetValue ( ) - > NewIndexIterator (
comparator - > user_comparator ( ) , rep - > get_global_seqno ( BlockType : : kFilter ) ,
comparator - > user_comparator ( ) ,
& biter , kNullStats , true /* total_order_seek */ ,
rep - > get_global_seqno ( BlockType : : kFilterPartitionIndex ) , & biter ,
false /* have_first_key */ , index_key_includes_seq ( ) ,
kNullStats , true /* total_order_seek */ , false /* have_first_key */ ,
index_value_is_full ( ) ) ;
index_key_includes_seq ( ) , index_ value_is_full ( ) ) ;
// Index partitions are assumed to be consecuitive. Prefetch them all.
// Index partitions are assumed to be consecuitive. Prefetch them all.
// Read the first block offset
// Read the first block offset
biter . SeekToFirst ( ) ;
biter . SeekToFirst ( ) ;