@ -90,7 +90,7 @@ TableCache::~TableCache() {}
Status TableCache : : GetTableReader (
Status TableCache : : GetTableReader (
const ReadOptions & ro , const FileOptions & file_options ,
const ReadOptions & ro , const FileOptions & file_options ,
const InternalKeyComparator & internal_comparator ,
const InternalKeyComparator & internal_comparator ,
const FileMetaData & file_meta , bool sequential_mode , bool record_read_stats ,
const FileMetaData & file_meta , bool sequential_mode ,
uint8_t block_protection_bytes_per_key , HistogramImpl * file_read_hist ,
uint8_t block_protection_bytes_per_key , HistogramImpl * file_read_hist ,
std : : unique_ptr < TableReader > * table_reader ,
std : : unique_ptr < TableReader > * table_reader ,
const std : : shared_ptr < const SliceTransform > & prefix_extractor ,
const std : : shared_ptr < const SliceTransform > & prefix_extractor ,
@ -127,11 +127,11 @@ Status TableCache::GetTableReader(
}
}
StopWatch sw ( ioptions_ . clock , ioptions_ . stats , TABLE_OPEN_IO_MICROS ) ;
StopWatch sw ( ioptions_ . clock , ioptions_ . stats , TABLE_OPEN_IO_MICROS ) ;
std : : unique_ptr < RandomAccessFileReader > file_reader (
std : : unique_ptr < RandomAccessFileReader > file_reader (
new RandomAccessFileReader (
new RandomAccessFileReader ( std : : move ( file ) , fname , ioptions_ . clock ,
std : : move ( file ) , fname , ioptions_ . clock , io_tracer_ ,
io_tracer_ , ioptions_ . stats , SST_READ_MICROS ,
record_read_stats ? ioptions_ . stats : nullptr , SST_READ_MICROS ,
file_read_hist , ioptions_ . rate_limiter . get ( ) ,
file_read_hist , ioptions_ . rate_limiter . get ( ) , ioptions_ . listeners ,
ioptions_ . listeners , file_temperature ,
file_temperature , level = = ioptions_ . num_levels - 1 ) ) ;
level = = ioptions_ . num_levels - 1 ) ) ;
UniqueId64x2 expected_unique_id ;
UniqueId64x2 expected_unique_id ;
if ( ioptions_ . verify_sst_unique_id_in_manifest ) {
if ( ioptions_ . verify_sst_unique_id_in_manifest ) {
expected_unique_id = file_meta . unique_id ;
expected_unique_id = file_meta . unique_id ;
@ -160,8 +160,8 @@ Status TableCache::FindTable(
const FileMetaData & file_meta , TypedHandle * * handle ,
const FileMetaData & file_meta , TypedHandle * * handle ,
uint8_t block_protection_bytes_per_key ,
uint8_t block_protection_bytes_per_key ,
const std : : shared_ptr < const SliceTransform > & prefix_extractor ,
const std : : shared_ptr < const SliceTransform > & prefix_extractor ,
const bool no_io , bool record_read_stats , HistogramImpl * file_read_hist ,
const bool no_io , HistogramImpl * file_read_hist , bool skip_filters ,
bool skip_filters , int level , bool prefetch_index_and_filter_in_cache ,
int level , bool prefetch_index_and_filter_in_cache ,
size_t max_file_size_for_l0_meta_pin , Temperature file_temperature ) {
size_t max_file_size_for_l0_meta_pin , Temperature file_temperature ) {
PERF_TIMER_GUARD_WITH_CLOCK ( find_table_nanos , ioptions_ . clock ) ;
PERF_TIMER_GUARD_WITH_CLOCK ( find_table_nanos , ioptions_ . clock ) ;
uint64_t number = file_meta . fd . GetNumber ( ) ;
uint64_t number = file_meta . fd . GetNumber ( ) ;
@ -183,7 +183,7 @@ Status TableCache::FindTable(
std : : unique_ptr < TableReader > table_reader ;
std : : unique_ptr < TableReader > table_reader ;
Status s = GetTableReader ( ro , file_options , internal_comparator , file_meta ,
Status s = GetTableReader ( ro , file_options , internal_comparator , file_meta ,
false /* sequential mode */ , record_read_stats ,
false /* sequential mode */ ,
block_protection_bytes_per_key , file_read_hist ,
block_protection_bytes_per_key , file_read_hist ,
& table_reader , prefix_extractor , skip_filters ,
& table_reader , prefix_extractor , skip_filters ,
level , prefetch_index_and_filter_in_cache ,
level , prefetch_index_and_filter_in_cache ,
@ -232,8 +232,7 @@ InternalIterator* TableCache::NewIterator(
s = FindTable ( options , file_options , icomparator , file_meta , & handle ,
s = FindTable ( options , file_options , icomparator , file_meta , & handle ,
block_protection_bytes_per_key , prefix_extractor ,
block_protection_bytes_per_key , prefix_extractor ,
options . read_tier = = kBlockCacheTier /* no_io */ ,
options . read_tier = = kBlockCacheTier /* no_io */ ,
! for_compaction /* record_read_stats */ , file_read_hist ,
file_read_hist , skip_filters , level ,
skip_filters , level ,
true /* prefetch_index_and_filter_in_cache */ ,
true /* prefetch_index_and_filter_in_cache */ ,
max_file_size_for_l0_meta_pin , file_meta . temperature ) ;
max_file_size_for_l0_meta_pin , file_meta . temperature ) ;
if ( s . ok ( ) ) {
if ( s . ok ( ) ) {
@ -438,8 +437,8 @@ Status TableCache::Get(
s = FindTable ( options , file_options_ , internal_comparator , file_meta ,
s = FindTable ( options , file_options_ , internal_comparator , file_meta ,
& handle , block_protection_bytes_per_key , prefix_extractor ,
& handle , block_protection_bytes_per_key , prefix_extractor ,
options . read_tier = = kBlockCacheTier /* no_io */ ,
options . read_tier = = kBlockCacheTier /* no_io */ ,
true /* record_read_stats */ , file_read_hist , skip_filters ,
file_read_hist , skip_filters , level ,
level , true /* prefetch_index_and_filter_in_cache */ ,
true /* prefetch_index_and_filter_in_cache */ ,
max_file_size_for_l0_meta_pin , file_meta . temperature ) ;
max_file_size_for_l0_meta_pin , file_meta . temperature ) ;
if ( s . ok ( ) ) {
if ( s . ok ( ) ) {
t = cache_ . Value ( handle ) ;
t = cache_ . Value ( handle ) ;
@ -541,7 +540,7 @@ Status TableCache::MultiGetFilter(
s = FindTable ( options , file_options_ , internal_comparator , file_meta ,
s = FindTable ( options , file_options_ , internal_comparator , file_meta ,
& handle , block_protection_bytes_per_key , prefix_extractor ,
& handle , block_protection_bytes_per_key , prefix_extractor ,
options . read_tier = = kBlockCacheTier /* no_io */ ,
options . read_tier = = kBlockCacheTier /* no_io */ ,
true /* record_read_stats */ , file_read_hist ,
file_read_hist ,
/*skip_filters=*/ false , level ,
/*skip_filters=*/ false , level ,
true /* prefetch_index_and_filter_in_cache */ ,
true /* prefetch_index_and_filter_in_cache */ ,
/*max_file_size_for_l0_meta_pin=*/ 0 , file_meta . temperature ) ;
/*max_file_size_for_l0_meta_pin=*/ 0 , file_meta . temperature ) ;
@ -658,11 +657,10 @@ uint64_t TableCache::ApproximateOffsetOf(
TableReader * table_reader = file_meta . fd . table_reader ;
TableReader * table_reader = file_meta . fd . table_reader ;
TypedHandle * table_handle = nullptr ;
TypedHandle * table_handle = nullptr ;
if ( table_reader = = nullptr ) {
if ( table_reader = = nullptr ) {
const bool for_compaction = ( caller = = TableReaderCaller : : kCompaction ) ;
Status s =
Status s = FindTable (
FindTable ( read_options , file_options_ , internal_comparator , file_meta ,
read_options , file_options_ , internal_comparator , file_meta ,
& table_handle , block_protection_bytes_per_key ,
& table_handle , block_protection_bytes_per_key , prefix_extractor ,
prefix_extractor , false /* no_io */ ) ;
false /* no_io */ , ! for_compaction /* record_read_stats */ ) ;
if ( s . ok ( ) ) {
if ( s . ok ( ) ) {
table_reader = cache_ . Value ( table_handle ) ;
table_reader = cache_ . Value ( table_handle ) ;
}
}
@ -688,11 +686,10 @@ uint64_t TableCache::ApproximateSize(
TableReader * table_reader = file_meta . fd . table_reader ;
TableReader * table_reader = file_meta . fd . table_reader ;
TypedHandle * table_handle = nullptr ;
TypedHandle * table_handle = nullptr ;
if ( table_reader = = nullptr ) {
if ( table_reader = = nullptr ) {
const bool for_compaction = ( caller = = TableReaderCaller : : kCompaction ) ;
Status s =
Status s = FindTable (
FindTable ( read_options , file_options_ , internal_comparator , file_meta ,
read_options , file_options_ , internal_comparator , file_meta ,
& table_handle , block_protection_bytes_per_key ,
& table_handle , block_protection_bytes_per_key , prefix_extractor ,
prefix_extractor , false /* no_io */ ) ;
false /* no_io */ , ! for_compaction /* record_read_stats */ ) ;
if ( s . ok ( ) ) {
if ( s . ok ( ) ) {
table_reader = cache_ . Value ( table_handle ) ;
table_reader = cache_ . Value ( table_handle ) ;
}
}