@ -41,7 +41,7 @@ class BlobFileBuilderTest : public testing::Test {
protected :
protected :
BlobFileBuilderTest ( ) : mock_env_ ( Env : : Default ( ) ) {
BlobFileBuilderTest ( ) : mock_env_ ( Env : : Default ( ) ) {
fs_ = mock_env_ . GetFileSystem ( ) . get ( ) ;
fs_ = mock_env_ . GetFileSystem ( ) . get ( ) ;
clock_ = mock_env_ . GetSystemClock ( ) ;
clock_ = mock_env_ . GetSystemClock ( ) . get ( ) ;
}
}
void VerifyBlobFile ( uint64_t blob_file_number ,
void VerifyBlobFile ( uint64_t blob_file_number ,
@ -110,7 +110,7 @@ class BlobFileBuilderTest : public testing::Test {
MockEnv mock_env_ ;
MockEnv mock_env_ ;
FileSystem * fs_ ;
FileSystem * fs_ ;
std : : shared_ptr < SystemClock > clock_ ;
SystemClock * clock_ ;
FileOptions file_options_ ;
FileOptions file_options_ ;
} ;
} ;
@ -127,6 +127,7 @@ TEST_F(BlobFileBuilderTest, BuildAndCheckOneFile) {
" BlobFileBuilderTest_BuildAndCheckOneFile " ) ,
" BlobFileBuilderTest_BuildAndCheckOneFile " ) ,
0 ) ;
0 ) ;
options . enable_blob_files = true ;
options . enable_blob_files = true ;
options . env = & mock_env_ ;
ImmutableCFOptions immutable_cf_options ( options ) ;
ImmutableCFOptions immutable_cf_options ( options ) ;
MutableCFOptions mutable_cf_options ( options ) ;
MutableCFOptions mutable_cf_options ( options ) ;
@ -140,11 +141,11 @@ TEST_F(BlobFileBuilderTest, BuildAndCheckOneFile) {
std : : vector < std : : string > blob_file_paths ;
std : : vector < std : : string > blob_file_paths ;
std : : vector < BlobFileAddition > blob_file_additions ;
std : : vector < BlobFileAddition > blob_file_additions ;
BlobFileBuilder builder (
BlobFileBuilder builder ( TestFileNumberGenerator ( ) , fs_ , & immutable_cf_options ,
TestFileNumberGenerator ( ) , & mock_env_ , fs_ , & immutable_cf_options ,
& mutable_cf_options , & file_options_ , job_id ,
& mutable_cf_options , & file_options_ , job_id , column_family_id ,
column_family_id , column_family_name , io_priority ,
column_family_name , io_priority , write_hint , nullptr /*IOTracer*/ ,
write_hint , nullptr /*IOTracer*/ , & blob_file_paths ,
& blob_file_paths , & blob_file_additions ) ;
& blob_file_additions ) ;
std : : vector < std : : pair < std : : string , std : : string > > expected_key_value_pairs (
std : : vector < std : : pair < std : : string , std : : string > > expected_key_value_pairs (
number_of_blobs ) ;
number_of_blobs ) ;
@ -210,6 +211,7 @@ TEST_F(BlobFileBuilderTest, BuildAndCheckMultipleFiles) {
0 ) ;
0 ) ;
options . enable_blob_files = true ;
options . enable_blob_files = true ;
options . blob_file_size = value_size ;
options . blob_file_size = value_size ;
options . env = & mock_env_ ;
ImmutableCFOptions immutable_cf_options ( options ) ;
ImmutableCFOptions immutable_cf_options ( options ) ;
MutableCFOptions mutable_cf_options ( options ) ;
MutableCFOptions mutable_cf_options ( options ) ;
@ -223,11 +225,11 @@ TEST_F(BlobFileBuilderTest, BuildAndCheckMultipleFiles) {
std : : vector < std : : string > blob_file_paths ;
std : : vector < std : : string > blob_file_paths ;
std : : vector < BlobFileAddition > blob_file_additions ;
std : : vector < BlobFileAddition > blob_file_additions ;
BlobFileBuilder builder (
BlobFileBuilder builder ( TestFileNumberGenerator ( ) , fs_ , & immutable_cf_options ,
TestFileNumberGenerator ( ) , & mock_env_ , fs_ , & immutable_cf_options ,
& mutable_cf_options , & file_options_ , job_id ,
& mutable_cf_options , & file_options_ , job_id , column_family_id ,
column_family_id , column_family_name , io_priority ,
column_family_name , io_priority , write_hint , nullptr /*IOTracer*/ ,
write_hint , nullptr /*IOTracer*/ , & blob_file_paths ,
& blob_file_paths , & blob_file_additions ) ;
& blob_file_additions ) ;
std : : vector < std : : pair < std : : string , std : : string > > expected_key_value_pairs (
std : : vector < std : : pair < std : : string , std : : string > > expected_key_value_pairs (
number_of_blobs ) ;
number_of_blobs ) ;
@ -295,6 +297,7 @@ TEST_F(BlobFileBuilderTest, InlinedValues) {
0 ) ;
0 ) ;
options . enable_blob_files = true ;
options . enable_blob_files = true ;
options . min_blob_size = 1024 ;
options . min_blob_size = 1024 ;
options . env = & mock_env_ ;
ImmutableCFOptions immutable_cf_options ( options ) ;
ImmutableCFOptions immutable_cf_options ( options ) ;
MutableCFOptions mutable_cf_options ( options ) ;
MutableCFOptions mutable_cf_options ( options ) ;
@ -308,11 +311,11 @@ TEST_F(BlobFileBuilderTest, InlinedValues) {
std : : vector < std : : string > blob_file_paths ;
std : : vector < std : : string > blob_file_paths ;
std : : vector < BlobFileAddition > blob_file_additions ;
std : : vector < BlobFileAddition > blob_file_additions ;
BlobFileBuilder builder (
BlobFileBuilder builder ( TestFileNumberGenerator ( ) , fs_ , & immutable_cf_options ,
TestFileNumberGenerator ( ) , & mock_env_ , fs_ , & immutable_cf_options ,
& mutable_cf_options , & file_options_ , job_id ,
& mutable_cf_options , & file_options_ , job_id , column_family_id ,
column_family_id , column_family_name , io_priority ,
column_family_name , io_priority , write_hint , nullptr /*IOTracer*/ ,
write_hint , nullptr /*IOTracer*/ , & blob_file_paths ,
& blob_file_paths , & blob_file_additions ) ;
& blob_file_additions ) ;
for ( size_t i = 0 ; i < number_of_blobs ; + + i ) {
for ( size_t i = 0 ; i < number_of_blobs ; + + i ) {
const std : : string key = std : : to_string ( i ) ;
const std : : string key = std : : to_string ( i ) ;
@ -347,6 +350,7 @@ TEST_F(BlobFileBuilderTest, Compression) {
test : : PerThreadDBPath ( & mock_env_ , " BlobFileBuilderTest_Compression " ) , 0 ) ;
test : : PerThreadDBPath ( & mock_env_ , " BlobFileBuilderTest_Compression " ) , 0 ) ;
options . enable_blob_files = true ;
options . enable_blob_files = true ;
options . blob_compression_type = kSnappyCompression ;
options . blob_compression_type = kSnappyCompression ;
options . env = & mock_env_ ;
ImmutableCFOptions immutable_cf_options ( options ) ;
ImmutableCFOptions immutable_cf_options ( options ) ;
MutableCFOptions mutable_cf_options ( options ) ;
MutableCFOptions mutable_cf_options ( options ) ;
@ -360,11 +364,11 @@ TEST_F(BlobFileBuilderTest, Compression) {
std : : vector < std : : string > blob_file_paths ;
std : : vector < std : : string > blob_file_paths ;
std : : vector < BlobFileAddition > blob_file_additions ;
std : : vector < BlobFileAddition > blob_file_additions ;
BlobFileBuilder builder (
BlobFileBuilder builder ( TestFileNumberGenerator ( ) , fs_ , & immutable_cf_options ,
TestFileNumberGenerator ( ) , & mock_env_ , fs_ , & immutable_cf_options ,
& mutable_cf_options , & file_options_ , job_id ,
& mutable_cf_options , & file_options_ , job_id , column_family_id ,
column_family_id , column_family_name , io_priority ,
column_family_name , io_priority , write_hint , nullptr /*IOTracer*/ ,
write_hint , nullptr /*IOTracer*/ , & blob_file_paths ,
& blob_file_paths , & blob_file_additions ) ;
& blob_file_additions ) ;
const std : : string key ( " 1 " ) ;
const std : : string key ( " 1 " ) ;
const std : : string uncompressed_value ( value_size , ' x ' ) ;
const std : : string uncompressed_value ( value_size , ' x ' ) ;
@ -429,7 +433,7 @@ TEST_F(BlobFileBuilderTest, CompressionError) {
0 ) ;
0 ) ;
options . enable_blob_files = true ;
options . enable_blob_files = true ;
options . blob_compression_type = kSnappyCompression ;
options . blob_compression_type = kSnappyCompression ;
options . env = & mock_env_ ;
ImmutableCFOptions immutable_cf_options ( options ) ;
ImmutableCFOptions immutable_cf_options ( options ) ;
MutableCFOptions mutable_cf_options ( options ) ;
MutableCFOptions mutable_cf_options ( options ) ;
@ -442,11 +446,11 @@ TEST_F(BlobFileBuilderTest, CompressionError) {
std : : vector < std : : string > blob_file_paths ;
std : : vector < std : : string > blob_file_paths ;
std : : vector < BlobFileAddition > blob_file_additions ;
std : : vector < BlobFileAddition > blob_file_additions ;
BlobFileBuilder builder (
BlobFileBuilder builder ( TestFileNumberGenerator ( ) , fs_ , & immutable_cf_options ,
TestFileNumberGenerator ( ) , & mock_env_ , fs_ , & immutable_cf_options ,
& mutable_cf_options , & file_options_ , job_id ,
& mutable_cf_options , & file_options_ , job_id , column_family_id ,
column_family_id , column_family_name , io_priority ,
column_family_name , io_priority , write_hint , nullptr /*IOTracer*/ ,
write_hint , nullptr /*IOTracer*/ , & blob_file_paths ,
& blob_file_paths , & blob_file_additions ) ;
& blob_file_additions ) ;
SyncPoint : : GetInstance ( ) - > SetCallBack ( " CompressData:TamperWithReturnValue " ,
SyncPoint : : GetInstance ( ) - > SetCallBack ( " CompressData:TamperWithReturnValue " ,
[ ] ( void * arg ) {
[ ] ( void * arg ) {
@ -506,6 +510,7 @@ TEST_F(BlobFileBuilderTest, Checksum) {
options . enable_blob_files = true ;
options . enable_blob_files = true ;
options . file_checksum_gen_factory =
options . file_checksum_gen_factory =
std : : make_shared < DummyFileChecksumGenFactory > ( ) ;
std : : make_shared < DummyFileChecksumGenFactory > ( ) ;
options . env = & mock_env_ ;
ImmutableCFOptions immutable_cf_options ( options ) ;
ImmutableCFOptions immutable_cf_options ( options ) ;
MutableCFOptions mutable_cf_options ( options ) ;
MutableCFOptions mutable_cf_options ( options ) ;
@ -519,11 +524,11 @@ TEST_F(BlobFileBuilderTest, Checksum) {
std : : vector < std : : string > blob_file_paths ;
std : : vector < std : : string > blob_file_paths ;
std : : vector < BlobFileAddition > blob_file_additions ;
std : : vector < BlobFileAddition > blob_file_additions ;
BlobFileBuilder builder (
BlobFileBuilder builder ( TestFileNumberGenerator ( ) , fs_ , & immutable_cf_options ,
TestFileNumberGenerator ( ) , & mock_env_ , fs_ , & immutable_cf_options ,
& mutable_cf_options , & file_options_ , job_id ,
& mutable_cf_options , & file_options_ , job_id , column_family_id ,
column_family_id , column_family_name , io_priority ,
column_family_name , io_priority , write_hint , nullptr /*IOTracer*/ ,
write_hint , nullptr /*IOTracer*/ , & blob_file_paths ,
& blob_file_paths , & blob_file_additions ) ;
& blob_file_additions ) ;
const std : : string key ( " 1 " ) ;
const std : : string key ( " 1 " ) ;
const std : : string value ( " deadbeef " ) ;
const std : : string value ( " deadbeef " ) ;
@ -615,11 +620,11 @@ TEST_P(BlobFileBuilderIOErrorTest, IOError) {
std : : vector < std : : string > blob_file_paths ;
std : : vector < std : : string > blob_file_paths ;
std : : vector < BlobFileAddition > blob_file_additions ;
std : : vector < BlobFileAddition > blob_file_additions ;
BlobFileBuilder builder (
BlobFileBuilder builder ( TestFileNumberGenerator ( ) , fs_ , & immutable_cf_options ,
TestFileNumberGenerator ( ) , & mock_env_ , fs_ , & immutable_cf_options ,
& mutable_cf_options , & file_options_ , job_id ,
& mutable_cf_options , & file_options_ , job_id , column_family_id ,
column_family_id , column_family_name , io_priority ,
column_family_name , io_priority , write_hint , nullptr /*IOTracer*/ ,
write_hint , nullptr /*IOTracer*/ , & blob_file_paths ,
& blob_file_paths , & blob_file_additions ) ;
& blob_file_additions ) ;
SyncPoint : : GetInstance ( ) - > SetCallBack ( sync_point_ , [ this ] ( void * arg ) {
SyncPoint : : GetInstance ( ) - > SetCallBack ( sync_point_ , [ this ] ( void * arg ) {
Status * const s = static_cast < Status * > ( arg ) ;
Status * const s = static_cast < Status * > ( arg ) ;