@ -88,7 +88,7 @@ Status TableCache::GetTableReader(
const EnvOptions & env_options ,
const EnvOptions & env_options ,
const InternalKeyComparator & internal_comparator , const FileDescriptor & fd ,
const InternalKeyComparator & internal_comparator , const FileDescriptor & fd ,
bool sequential_mode , bool record_read_stats , HistogramImpl * file_read_hist ,
bool sequential_mode , bool record_read_stats , HistogramImpl * file_read_hist ,
unique_ptr < TableReader > * table_reader ) {
unique_ptr < TableReader > * table_reader , bool skip_filters ) {
std : : string fname =
std : : string fname =
TableFileName ( ioptions_ . db_paths , fd . GetNumber ( ) , fd . GetPathId ( ) ) ;
TableFileName ( ioptions_ . db_paths , fd . GetNumber ( ) , fd . GetPathId ( ) ) ;
unique_ptr < RandomAccessFile > file ;
unique_ptr < RandomAccessFile > file ;
@ -108,7 +108,8 @@ Status TableCache::GetTableReader(
ioptions_ . statistics , record_read_stats ,
ioptions_ . statistics , record_read_stats ,
file_read_hist ) ) ;
file_read_hist ) ) ;
s = ioptions_ . table_factory - > NewTableReader (
s = ioptions_ . table_factory - > NewTableReader (
TableReaderOptions ( ioptions_ , env_options , internal_comparator ) ,
TableReaderOptions ( ioptions_ , env_options , internal_comparator ,
skip_filters ) ,
std : : move ( file_reader ) , fd . GetFileSize ( ) , table_reader ) ;
std : : move ( file_reader ) , fd . GetFileSize ( ) , table_reader ) ;
TEST_SYNC_POINT ( " TableCache::GetTableReader:0 " ) ;
TEST_SYNC_POINT ( " TableCache::GetTableReader:0 " ) ;
}
}
@ -119,7 +120,7 @@ Status TableCache::FindTable(const EnvOptions& env_options,
const InternalKeyComparator & internal_comparator ,
const InternalKeyComparator & internal_comparator ,
const FileDescriptor & fd , Cache : : Handle * * handle ,
const FileDescriptor & fd , Cache : : Handle * * handle ,
const bool no_io , bool record_read_stats ,
const bool no_io , bool record_read_stats ,
HistogramImpl * file_read_hist ) {
HistogramImpl * file_read_hist , bool skip_filters ) {
PERF_TIMER_GUARD ( find_table_nanos ) ;
PERF_TIMER_GUARD ( find_table_nanos ) ;
Status s ;
Status s ;
uint64_t number = fd . GetNumber ( ) ;
uint64_t number = fd . GetNumber ( ) ;
@ -135,7 +136,7 @@ Status TableCache::FindTable(const EnvOptions& env_options,
unique_ptr < TableReader > table_reader ;
unique_ptr < TableReader > table_reader ;
s = GetTableReader ( env_options , internal_comparator , fd ,
s = GetTableReader ( env_options , internal_comparator , fd ,
false /* sequential mode */ , record_read_stats ,
false /* sequential mode */ , record_read_stats ,
file_read_hist , & table_reader ) ;
file_read_hist , & table_reader , skip_filters ) ;
if ( ! s . ok ( ) ) {
if ( ! s . ok ( ) ) {
assert ( table_reader = = nullptr ) ;
assert ( table_reader = = nullptr ) ;
RecordTick ( ioptions_ . statistics , NO_FILE_ERRORS ) ;
RecordTick ( ioptions_ . statistics , NO_FILE_ERRORS ) ;
@ -153,7 +154,7 @@ InternalIterator* TableCache::NewIterator(
const ReadOptions & options , const EnvOptions & env_options ,
const ReadOptions & options , const EnvOptions & env_options ,
const InternalKeyComparator & icomparator , const FileDescriptor & fd ,
const InternalKeyComparator & icomparator , const FileDescriptor & fd ,
TableReader * * table_reader_ptr , HistogramImpl * file_read_hist ,
TableReader * * table_reader_ptr , HistogramImpl * file_read_hist ,
bool for_compaction , Arena * arena ) {
bool for_compaction , Arena * arena , bool skip_filters ) {
PERF_TIMER_GUARD ( new_table_iterator_nanos ) ;
PERF_TIMER_GUARD ( new_table_iterator_nanos ) ;
if ( table_reader_ptr ! = nullptr ) {
if ( table_reader_ptr ! = nullptr ) {
@ -176,10 +177,10 @@ InternalIterator* TableCache::NewIterator(
} else {
} else {
table_reader = fd . table_reader ;
table_reader = fd . table_reader ;
if ( table_reader = = nullptr ) {
if ( table_reader = = nullptr ) {
Status s =
Status s = FindTable ( env_options , icomparator , fd , & handle ,
FindTable ( env_options , icomparator , fd , & handle ,
options . read_tier = = kBlockCacheTier /* no_io */ ,
options . read_tier = = kBlockCacheTier /* no_io */,
! for_compaction /* record read_stats */ ,
! for_compaction /* record read_stats */ , file_read_hist ) ;
file_read_hist , skip_filters ) ;
if ( ! s . ok ( ) ) {
if ( ! s . ok ( ) ) {
return NewErrorInternalIterator ( s , arena ) ;
return NewErrorInternalIterator ( s , arena ) ;
}
}
@ -187,7 +188,8 @@ InternalIterator* TableCache::NewIterator(
}
}
}
}
InternalIterator * result = table_reader - > NewIterator ( options , arena ) ;
InternalIterator * result =
table_reader - > NewIterator ( options , arena , skip_filters ) ;
if ( create_new_table_reader ) {
if ( create_new_table_reader ) {
assert ( handle = = nullptr ) ;
assert ( handle = = nullptr ) ;
@ -209,7 +211,8 @@ InternalIterator* TableCache::NewIterator(
Status TableCache : : Get ( const ReadOptions & options ,
Status TableCache : : Get ( const ReadOptions & options ,
const InternalKeyComparator & internal_comparator ,
const InternalKeyComparator & internal_comparator ,
const FileDescriptor & fd , const Slice & k ,
const FileDescriptor & fd , const Slice & k ,
GetContext * get_context , HistogramImpl * file_read_hist ) {
GetContext * get_context , HistogramImpl * file_read_hist ,
bool skip_filters ) {
TableReader * t = fd . table_reader ;
TableReader * t = fd . table_reader ;
Status s ;
Status s ;
Cache : : Handle * handle = nullptr ;
Cache : : Handle * handle = nullptr ;
@ -258,14 +261,14 @@ Status TableCache::Get(const ReadOptions& options,
if ( ! t ) {
if ( ! t ) {
s = FindTable ( env_options_ , internal_comparator , fd , & handle ,
s = FindTable ( env_options_ , internal_comparator , fd , & handle ,
options . read_tier = = kBlockCacheTier /* no_io */ ,
options . read_tier = = kBlockCacheTier /* no_io */ ,
true /* record_read_stats */ , file_read_hist ) ;
true /* record_read_stats */ , file_read_hist , skip_filters ) ;
if ( s . ok ( ) ) {
if ( s . ok ( ) ) {
t = GetTableReaderFromHandle ( handle ) ;
t = GetTableReaderFromHandle ( handle ) ;
}
}
}
}
if ( s . ok ( ) ) {
if ( s . ok ( ) ) {
get_context - > SetReplayLog ( row_cache_entry ) ; // nullptr if no cache.
get_context - > SetReplayLog ( row_cache_entry ) ; // nullptr if no cache.
s = t - > Get ( options , k , get_context ) ;
s = t - > Get ( options , k , get_context , skip_filters ) ;
get_context - > SetReplayLog ( nullptr ) ;
get_context - > SetReplayLog ( nullptr ) ;
if ( handle ! = nullptr ) {
if ( handle ! = nullptr ) {
ReleaseHandle ( handle ) ;
ReleaseHandle ( handle ) ;