@ -27,6 +27,7 @@
# include "rocksdb/table.h"
# include "rocksdb/table.h"
# include "table/meta_blocks.h"
# include "table/meta_blocks.h"
# include "table/bloom_block.h"
# include "table/bloom_block.h"
# include "table/table_builder.h"
# include "table/plain_table_factory.h"
# include "table/plain_table_factory.h"
# include "table/plain_table_reader.h"
# include "table/plain_table_reader.h"
# include "util/hash.h"
# include "util/hash.h"
@ -256,28 +257,29 @@ class TestPlainTableFactory : public PlainTableFactory {
store_index_in_file_ ( options . store_index_in_file ) ,
store_index_in_file_ ( options . store_index_in_file ) ,
expect_bloom_not_match_ ( expect_bloom_not_match ) { }
expect_bloom_not_match_ ( expect_bloom_not_match ) { }
Status NewTableReader ( const ImmutableCFOptions & ioptions ,
Status NewTableReader ( const TableReaderOptions & table_reader_options ,
const EnvOptions & env_options ,
const InternalKeyComparator & internal_comparator ,
unique_ptr < RandomAccessFileReader > & & file ,
unique_ptr < RandomAccessFileReader > & & file ,
uint64_t file_size ,
uint64_t file_size ,
unique_ptr < TableReader > * table ) const override {
unique_ptr < TableReader > * table ) const override {
TableProperties * props = nullptr ;
TableProperties * props = nullptr ;
auto s = ReadTableProperties ( file . get ( ) , file_size , kPlainTableMagicNumber ,
auto s =
ioptions . env , ioptions . info_log , & props ) ;
ReadTableProperties ( file . get ( ) , file_size , kPlainTableMagicNumber ,
table_reader_options . ioptions . env ,
table_reader_options . ioptions . info_log , & props ) ;
EXPECT_TRUE ( s . ok ( ) ) ;
EXPECT_TRUE ( s . ok ( ) ) ;
if ( store_index_in_file_ ) {
if ( store_index_in_file_ ) {
BlockHandle bloom_block_handle ;
BlockHandle bloom_block_handle ;
s = FindMetaBlock ( file . get ( ) , file_size , kPlainTableMagicNumber ,
s = FindMetaBlock ( file . get ( ) , file_size , kPlainTableMagicNumber ,
ioptions . env , BloomBlockBuilder : : kBloomBlock ,
table_reader_options . ioptions . env ,
& bloom_block_handle ) ;
BloomBlockBuilder : : kBloomBlock , & bloom_block_handle ) ;
EXPECT_TRUE ( s . ok ( ) ) ;
EXPECT_TRUE ( s . ok ( ) ) ;
BlockHandle index_block_handle ;
BlockHandle index_block_handle ;
s = FindMetaBlock (
s = FindMetaBlock ( file . get ( ) , file_size , kPlainTableMagicNumber ,
file . get ( ) , file_size , kPlainTableMagicNumber , ioptions . env ,
table_reader_options . ioptions . env ,
PlainTableIndexBuilder : : kPlainTableIndexBlock , & index_block_handle ) ;
PlainTableIndexBuilder : : kPlainTableIndexBlock ,
& index_block_handle ) ;
EXPECT_TRUE ( s . ok ( ) ) ;
EXPECT_TRUE ( s . ok ( ) ) ;
}
}
@ -289,9 +291,10 @@ class TestPlainTableFactory : public PlainTableFactory {
DecodeFixed32 ( encoding_type_prop - > second . c_str ( ) ) ) ;
DecodeFixed32 ( encoding_type_prop - > second . c_str ( ) ) ) ;
std : : unique_ptr < PlainTableReader > new_reader ( new TestPlainTableReader (
std : : unique_ptr < PlainTableReader > new_reader ( new TestPlainTableReader (
env_options , internal_comparator , encoding_type , file_size ,
table_reader_options . env_options ,
table_reader_options . internal_comparator , encoding_type , file_size ,
bloom_bits_per_key_ , hash_table_ratio_ , index_sparseness_ , props ,
bloom_bits_per_key_ , hash_table_ratio_ , index_sparseness_ , props ,
std : : move ( file ) , ioptions , expect_bloom_not_match_ ,
std : : move ( file ) , table_reader_options . ioptions , expect_bloom_not_match_ ,
store_index_in_file_ ) ) ;
store_index_in_file_ ) ) ;
* table = std : : move ( new_reader ) ;
* table = std : : move ( new_reader ) ;