@ -412,8 +412,8 @@ size_t PartitionedFilterBlockReader::ApproximateMemoryUsage() const {
}
}
// TODO(myabandeh): merge this with the same function in IndexReader
// TODO(myabandeh): merge this with the same function in IndexReader
void PartitionedFilterBlockReader : : CacheDependencies ( const ReadOptions & ro ,
Status PartitionedFilterBlockReader : : CacheDependencies ( const ReadOptions & ro ,
bool pin ) {
bool pin ) {
assert ( table ( ) ) ;
assert ( table ( ) ) ;
const BlockBasedTable : : Rep * const rep = table ( ) - > get_rep ( ) ;
const BlockBasedTable : : Rep * const rep = table ( ) - > get_rep ( ) ;
@ -426,12 +426,11 @@ void PartitionedFilterBlockReader::CacheDependencies(const ReadOptions& ro,
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 ) ;
if ( ! s . ok ( ) ) {
if ( ! s . ok ( ) ) {
ROCKS_LOG_WARN ( rep - > ioptions . info_log ,
ROCKS_LOG_ERROR ( rep - > ioptions . info_log ,
" Error retrieving top-level filter block while trying to "
" Error retrieving top-level filter block while trying to "
" cache filter partitions: %s " ,
" cache filter partitions: %s " ,
s . ToString ( ) . c_str ( ) ) ;
s . ToString ( ) . c_str ( ) ) ;
IGNORE_STATUS_IF_ERROR ( s ) ;
return s ;
return ;
}
}
// Before read partitions, prefetch them to avoid lots of IOs
// Before read partitions, prefetch them to avoid lots of IOs
@ -465,6 +464,9 @@ void PartitionedFilterBlockReader::CacheDependencies(const ReadOptions& ro,
s = prefetch_buffer - > Prefetch ( opts , rep - > file . get ( ) , prefetch_off ,
s = prefetch_buffer - > Prefetch ( opts , rep - > file . get ( ) , prefetch_off ,
static_cast < size_t > ( prefetch_len ) ) ;
static_cast < size_t > ( prefetch_len ) ) ;
}
}
if ( ! s . ok ( ) ) {
return s ;
}
// After prefetch, read the partitions one by one
// After prefetch, read the partitions one by one
for ( biter . SeekToFirst ( ) ; biter . Valid ( ) ; biter . Next ( ) ) {
for ( biter . SeekToFirst ( ) ; biter . Valid ( ) ; biter . Next ( ) ) {
@ -477,17 +479,20 @@ void PartitionedFilterBlockReader::CacheDependencies(const ReadOptions& ro,
prefetch_buffer . get ( ) , ro , handle , UncompressionDict : : GetEmptyDict ( ) ,
prefetch_buffer . get ( ) , ro , handle , UncompressionDict : : GetEmptyDict ( ) ,
& block , BlockType : : kFilter , nullptr /* get_context */ , & lookup_context ,
& block , BlockType : : kFilter , nullptr /* get_context */ , & lookup_context ,
nullptr /* contents */ ) ;
nullptr /* contents */ ) ;
if ( ! s . ok ( ) ) {
return s ;
}
assert ( s . ok ( ) | | block . GetValue ( ) = = nullptr ) ;
assert ( s . ok ( ) | | block . GetValue ( ) = = nullptr ) ;
if ( s . ok ( ) & & block . GetValue ( ) ! = nullptr ) {
if ( block . GetValue ( ) ! = nullptr ) {
if ( block . IsCached ( ) ) {
if ( block . IsCached ( ) ) {
if ( pin ) {
if ( pin ) {
filter_map_ [ handle . offset ( ) ] = std : : move ( block ) ;
filter_map_ [ handle . offset ( ) ] = std : : move ( block ) ;
}
}
}
}
}
}
IGNORE_STATUS_IF_ERROR ( s ) ;
}
}
return biter . status ( ) ;
}
}
const InternalKeyComparator * PartitionedFilterBlockReader : : internal_comparator ( )
const InternalKeyComparator * PartitionedFilterBlockReader : : internal_comparator ( )