@ -2168,6 +2168,8 @@ TEST_F(BackupableDBTest, TableFileCorruptionBeforeIncremental) {
// between incremental backups
TEST_F ( BackupableDBTest , FileSizeForIncremental ) {
const auto share_no_checksum = static_cast < ShareFilesNaming > ( 0 ) ;
// TODO: enable blob files once Integrated BlobDB supports DB session id.
options_ . enable_blob_files = false ;
for ( ShareFilesNaming option : { share_no_checksum , kLegacyCrc32cAndFileSize ,
kNamingDefault , kUseDbSessionId } ) {
@ -2192,9 +2194,9 @@ TEST_F(BackupableDBTest, FileSizeForIncremental) {
ASSERT_OK ( backup_engine_ - > CreateNewBackup ( db_ . get ( ) , true /*flush*/ ) ) ;
CloseDBAndBackupEngine ( ) ;
// Corrupt backup SST and blob file
// Corrupt backup SST file
ASSERT_OK ( file_manager_ - > GetChildrenFileAttributes ( shared_dir , & children ) ) ;
ASSERT_EQ ( children . size ( ) , 2 U) ; // one sst and one blob file
ASSERT_EQ ( children . size ( ) , 1 U) ; // one sst
for ( const auto & child : children ) {
if ( child . name . size ( ) > 4 & & child . size_bytes > 0 ) {
ASSERT_OK (
@ -2251,10 +2253,10 @@ TEST_F(BackupableDBTest, FileSizeForIncremental) {
OpenDBAndBackupEngine ( false , false , share ) ;
ASSERT_OK ( db_ - > Put ( WriteOptions ( ) , " y " , Random ( 42 ) . RandomString ( 500 ) ) ) ;
// Count backup SSTs and blob files.
// Count backup SSTs files.
children . clear ( ) ;
ASSERT_OK ( file_manager_ - > GetChildrenFileAttributes ( shared_dir , & children ) ) ;
ASSERT_EQ ( children . size ( ) , 4 U) ; // two sst and two blob files
ASSERT_EQ ( children . size ( ) , 2 U) ; // two sst files
// Try create backup 3
s = backup_engine_ - > CreateNewBackup ( db_ . get ( ) , true /*flush*/ ) ;
@ -2267,18 +2269,18 @@ TEST_F(BackupableDBTest, FileSizeForIncremental) {
// Acceptable to call it corruption if size is not in name and
// db session id collision is practically impossible.
EXPECT_TRUE ( s . IsCorruption ( ) ) ;
EXPECT_EQ ( children . size ( ) , 4 U) ; // no SST/Blob file added
EXPECT_EQ ( children . size ( ) , 2 U) ; // no SST file added
} else if ( option = = share_no_checksum ) {
// Good to call it corruption if both backups cannot be
// accommodated.
EXPECT_TRUE ( s . IsCorruption ( ) ) ;
EXPECT_EQ ( children . size ( ) , 4 U) ; // no SST/Blob file added
EXPECT_EQ ( children . size ( ) , 2 U) ; // no SST file added
} else {
// Since opening a DB seems sufficient for detecting size corruption
// on the DB side, this should be a good thing, ...
EXPECT_OK ( s ) ;
// ... as long as we did actually treat it as a distinct SST file.
EXPECT_EQ ( children . size ( ) , 6 U) ; // Another SST and blob added
EXPECT_EQ ( children . size ( ) , 3 U) ; // Another SST added
}
CloseDBAndBackupEngine ( ) ;
ASSERT_OK ( DestroyDB ( dbname_ , options_ ) ) ;