@ -80,7 +80,7 @@ Status ReadBlockFromFile(
std : : unique_ptr < Block > * result , const ImmutableCFOptions & ioptions ,
std : : unique_ptr < Block > * result , const ImmutableCFOptions & ioptions ,
bool do_uncompress , const Slice & compression_dict ,
bool do_uncompress , const Slice & compression_dict ,
const PersistentCacheOptions & cache_options , SequenceNumber global_seqno ,
const PersistentCacheOptions & cache_options , SequenceNumber global_seqno ,
size_t read_amp_bytes_per_bit , Cache Allocator* allocator = nullptr ,
size_t read_amp_bytes_per_bit , Memory Allocator* allocator = nullptr ,
const bool immortal_file = false ) {
const bool immortal_file = false ) {
BlockContents contents ;
BlockContents contents ;
BlockFetcher block_fetcher (
BlockFetcher block_fetcher (
@ -95,10 +95,10 @@ Status ReadBlockFromFile(
return s ;
return s ;
}
}
inline CacheAllocator * GetCache Allocator(
inline MemoryAllocator * GetMemory Allocator(
const BlockBasedTableOptions & table_options ) {
const BlockBasedTableOptions & table_options ) {
return table_options . block_cache . get ( )
return table_options . block_cache . get ( )
? table_options . block_cache - > cache _allocator( )
? table_options . block_cache - > memory _allocator( )
: nullptr ;
: nullptr ;
}
}
@ -1160,7 +1160,7 @@ Status BlockBasedTable::ReadMetaBlock(Rep* rep,
rep - > footer . metaindex_handle ( ) , & meta , rep - > ioptions ,
rep - > footer . metaindex_handle ( ) , & meta , rep - > ioptions ,
true /* decompress */ , Slice ( ) /*compression dict*/ ,
true /* decompress */ , Slice ( ) /*compression dict*/ ,
rep - > persistent_cache_options , kDisableGlobalSequenceNumber ,
rep - > persistent_cache_options , kDisableGlobalSequenceNumber ,
0 /* read_amp_bytes_per_bit */ , GetCache Allocator ( rep - > table_options ) ) ;
0 /* read_amp_bytes_per_bit */ , GetMemory Allocator ( rep - > table_options ) ) ;
if ( ! s . ok ( ) ) {
if ( ! s . ok ( ) ) {
ROCKS_LOG_ERROR ( rep - > ioptions . info_log ,
ROCKS_LOG_ERROR ( rep - > ioptions . info_log ,
@ -1183,7 +1183,7 @@ Status BlockBasedTable::GetDataBlockFromCache(
const ImmutableCFOptions & ioptions , const ReadOptions & read_options ,
const ImmutableCFOptions & ioptions , const ReadOptions & read_options ,
BlockBasedTable : : CachableEntry < Block > * block , uint32_t format_version ,
BlockBasedTable : : CachableEntry < Block > * block , uint32_t format_version ,
const Slice & compression_dict , size_t read_amp_bytes_per_bit , bool is_index ,
const Slice & compression_dict , size_t read_amp_bytes_per_bit , bool is_index ,
GetContext * get_context , Cache Allocator* allocator ) {
GetContext * get_context , Memory Allocator* allocator ) {
Status s ;
Status s ;
Block * compressed_block = nullptr ;
Block * compressed_block = nullptr ;
Cache : : Handle * block_cache_compressed_handle = nullptr ;
Cache : : Handle * block_cache_compressed_handle = nullptr ;
@ -1303,7 +1303,7 @@ Status BlockBasedTable::PutDataBlockToCache(
CachableEntry < Block > * block , Block * raw_block , uint32_t format_version ,
CachableEntry < Block > * block , Block * raw_block , uint32_t format_version ,
const Slice & compression_dict , size_t read_amp_bytes_per_bit , bool is_index ,
const Slice & compression_dict , size_t read_amp_bytes_per_bit , bool is_index ,
Cache : : Priority priority , GetContext * get_context ,
Cache : : Priority priority , GetContext * get_context ,
Cache Allocator* allocator ) {
Memory Allocator* allocator ) {
assert ( raw_block - > compression_type ( ) = = kNoCompression | |
assert ( raw_block - > compression_type ( ) = = kNoCompression | |
block_cache_compressed ! = nullptr ) ;
block_cache_compressed ! = nullptr ) ;
@ -1414,7 +1414,7 @@ FilterBlockReader* BlockBasedTable::ReadFilter(
ReadOptions ( ) , filter_handle , & block ,
ReadOptions ( ) , filter_handle , & block ,
rep - > ioptions , false /* decompress */ ,
rep - > ioptions , false /* decompress */ ,
dummy_comp_dict , rep - > persistent_cache_options ,
dummy_comp_dict , rep - > persistent_cache_options ,
GetCache Allocator ( rep - > table_options ) ) ;
GetMemory Allocator ( rep - > table_options ) ) ;
Status s = block_fetcher . ReadBlockContents ( ) ;
Status s = block_fetcher . ReadBlockContents ( ) ;
if ( ! s . ok ( ) ) {
if ( ! s . ok ( ) ) {
@ -1713,7 +1713,7 @@ TBlockIter* BlockBasedTable::NewDataBlockIterator(
compression_dict , rep - > persistent_cache_options ,
compression_dict , rep - > persistent_cache_options ,
is_index ? kDisableGlobalSequenceNumber : rep - > global_seqno ,
is_index ? kDisableGlobalSequenceNumber : rep - > global_seqno ,
rep - > table_options . read_amp_bytes_per_bit ,
rep - > table_options . read_amp_bytes_per_bit ,
GetCache Allocator ( rep - > table_options ) , rep - > immortal_table ) ;
GetMemory Allocator ( rep - > table_options ) , rep - > immortal_table ) ;
}
}
if ( s . ok ( ) ) {
if ( s . ok ( ) ) {
block . value = block_value . release ( ) ;
block . value = block_value . release ( ) ;
@ -1806,7 +1806,7 @@ Status BlockBasedTable::MaybeLoadDataBlockToCache(
key , ckey , block_cache , block_cache_compressed , rep - > ioptions , ro ,
key , ckey , block_cache , block_cache_compressed , rep - > ioptions , ro ,
block_entry , rep - > table_options . format_version , compression_dict ,
block_entry , rep - > table_options . format_version , compression_dict ,
rep - > table_options . read_amp_bytes_per_bit , is_index , get_context ,
rep - > table_options . read_amp_bytes_per_bit , is_index , get_context ,
GetCache Allocator ( rep - > table_options ) ) ;
GetMemory Allocator ( rep - > table_options ) ) ;
if ( block_entry - > value = = nullptr & & ! no_io & & ro . fill_cache ) {
if ( block_entry - > value = = nullptr & & ! no_io & & ro . fill_cache ) {
std : : unique_ptr < Block > raw_block ;
std : : unique_ptr < Block > raw_block ;
@ -1819,7 +1819,7 @@ Status BlockBasedTable::MaybeLoadDataBlockToCache(
compression_dict , rep - > persistent_cache_options ,
compression_dict , rep - > persistent_cache_options ,
is_index ? kDisableGlobalSequenceNumber : rep - > global_seqno ,
is_index ? kDisableGlobalSequenceNumber : rep - > global_seqno ,
rep - > table_options . read_amp_bytes_per_bit ,
rep - > table_options . read_amp_bytes_per_bit ,
GetCache Allocator ( rep - > table_options ) , rep - > immortal_table ) ;
GetMemory Allocator ( rep - > table_options ) , rep - > immortal_table ) ;
}
}
if ( s . ok ( ) ) {
if ( s . ok ( ) ) {
@ -1832,7 +1832,7 @@ Status BlockBasedTable::MaybeLoadDataBlockToCache(
. cache_index_and_filter_blocks_with_high_priority
. cache_index_and_filter_blocks_with_high_priority
? Cache : : Priority : : HIGH
? Cache : : Priority : : HIGH
: Cache : : Priority : : LOW ,
: Cache : : Priority : : LOW ,
get_context , GetCache Allocator ( rep - > table_options ) ) ;
get_context , GetMemory Allocator ( rep - > table_options ) ) ;
}
}
}
}
}
}
@ -2553,11 +2553,12 @@ Status BlockBasedTable::VerifyChecksumInBlocks(
BlockHandle handle = index_iter - > value ( ) ;
BlockHandle handle = index_iter - > value ( ) ;
BlockContents contents ;
BlockContents contents ;
Slice dummy_comp_dict ;
Slice dummy_comp_dict ;
BlockFetcher block_fetcher (
BlockFetcher block_fetcher ( rep_ - > file . get ( ) , nullptr /* prefetch buffer */ ,
rep_ - > file . get ( ) , nullptr /* prefetch buffer */ , rep_ - > footer ,
rep_ - > footer , ReadOptions ( ) , handle , & contents ,
ReadOptions ( ) , handle , & contents , rep_ - > ioptions ,
rep_ - > ioptions , false /* decompress */ ,
false /* decompress */ , dummy_comp_dict /*compression dict*/ ,
dummy_comp_dict /*compression dict*/ ,
rep_ - > persistent_cache_options , GetCacheAllocator ( rep_ - > table_options ) ) ;
rep_ - > persistent_cache_options ,
GetMemoryAllocator ( rep_ - > table_options ) ) ;
s = block_fetcher . ReadBlockContents ( ) ;
s = block_fetcher . ReadBlockContents ( ) ;
if ( ! s . ok ( ) ) {
if ( ! s . ok ( ) ) {
break ;
break ;
@ -2579,11 +2580,12 @@ Status BlockBasedTable::VerifyChecksumInBlocks(
s = handle . DecodeFrom ( & input ) ;
s = handle . DecodeFrom ( & input ) ;
BlockContents contents ;
BlockContents contents ;
Slice dummy_comp_dict ;
Slice dummy_comp_dict ;
BlockFetcher block_fetcher (
BlockFetcher block_fetcher ( rep_ - > file . get ( ) , nullptr /* prefetch buffer */ ,
rep_ - > file . get ( ) , nullptr /* prefetch buffer */ , rep_ - > footer ,
rep_ - > footer , ReadOptions ( ) , handle , & contents ,
ReadOptions ( ) , handle , & contents , rep_ - > ioptions ,
rep_ - > ioptions , false /* decompress */ ,
false /* decompress */ , dummy_comp_dict /*compression dict*/ ,
dummy_comp_dict /*compression dict*/ ,
rep_ - > persistent_cache_options , GetCacheAllocator ( rep_ - > table_options ) ) ;
rep_ - > persistent_cache_options ,
GetMemoryAllocator ( rep_ - > table_options ) ) ;
s = block_fetcher . ReadBlockContents ( ) ;
s = block_fetcher . ReadBlockContents ( ) ;
if ( ! s . ok ( ) ) {
if ( ! s . ok ( ) ) {
break ;
break ;
@ -2888,7 +2890,7 @@ Status BlockBasedTable::DumpTable(WritableFile* out_file,
ReadOptions ( ) , handle , & block , rep_ - > ioptions ,
ReadOptions ( ) , handle , & block , rep_ - > ioptions ,
false /*decompress*/ , dummy_comp_dict /*compression dict*/ ,
false /*decompress*/ , dummy_comp_dict /*compression dict*/ ,
rep_ - > persistent_cache_options ,
rep_ - > persistent_cache_options ,
GetCache Allocator ( rep_ - > table_options ) ) ;
GetMemory Allocator ( rep_ - > table_options ) ) ;
s = block_fetcher . ReadBlockContents ( ) ;
s = block_fetcher . ReadBlockContents ( ) ;
if ( ! s . ok ( ) ) {
if ( ! s . ok ( ) ) {
rep_ - > filter . reset ( new BlockBasedFilterBlockReader (
rep_ - > filter . reset ( new BlockBasedFilterBlockReader (