@ -14,6 +14,7 @@
# include "util/coding.h"
# include "util/coding.h"
# include "util/crc32c.h"
# include "util/crc32c.h"
# include "util/logging.h"
# include "util/logging.h"
# include "util/string_util.h"
# include "rocksdb/transaction_log.h"
# include "rocksdb/transaction_log.h"
# ifndef __STDC_FORMAT_MACROS
# ifndef __STDC_FORMAT_MACROS
@ -251,7 +252,7 @@ class BackupEngineImpl : public BackupEngine {
bool tmp = false ,
bool tmp = false ,
const std : : string & file = " " ) const {
const std : : string & file = " " ) const {
assert ( file . size ( ) = = 0 | | file [ 0 ] ! = ' / ' ) ;
assert ( file . size ( ) = = 0 | | file [ 0 ] ! = ' / ' ) ;
return GetPrivateDirRel ( ) + " / " + st d : : to_s tring( backup_id ) +
return GetPrivateDirRel ( ) + " / " + rock sdb : : ToS tring( backup_id ) +
( tmp ? " .tmp " : " " ) + " / " + file ;
( tmp ? " .tmp " : " " ) + " / " + file ;
}
}
inline std : : string GetSharedFileRel ( const std : : string & file = " " ,
inline std : : string GetSharedFileRel ( const std : : string & file = " " ,
@ -270,8 +271,8 @@ class BackupEngineImpl : public BackupEngine {
assert ( file . size ( ) = = 0 | | file [ 0 ] ! = ' / ' ) ;
assert ( file . size ( ) = = 0 | | file [ 0 ] ! = ' / ' ) ;
std : : string file_copy = file ;
std : : string file_copy = file ;
return file_copy . insert ( file_copy . find_last_of ( ' . ' ) ,
return file_copy . insert ( file_copy . find_last_of ( ' . ' ) ,
" _ " + st d : : to_s tring( checksum_value )
" _ " + rock sdb : : ToS tring( checksum_value ) + " _ " +
+ " _ " + std : : to_s tring( file_size ) ) ;
rocksdb : : ToS tring ( file_size ) ) ;
}
}
inline std : : string GetFileFromChecksumFile ( const std : : string & file ) const {
inline std : : string GetFileFromChecksumFile ( const std : : string & file ) const {
assert ( file . size ( ) = = 0 | | file [ 0 ] ! = ' / ' ) ;
assert ( file . size ( ) = = 0 | | file [ 0 ] ! = ' / ' ) ;
@ -287,7 +288,7 @@ class BackupEngineImpl : public BackupEngine {
return GetAbsolutePath ( " meta " ) ;
return GetAbsolutePath ( " meta " ) ;
}
}
inline std : : string GetBackupMetaFile ( BackupID backup_id ) const {
inline std : : string GetBackupMetaFile ( BackupID backup_id ) const {
return GetBackupMetaDir ( ) + " / " + st d : : to_s tring( backup_id ) ;
return GetBackupMetaDir ( ) + " / " + rock sdb : : ToS tring( backup_id ) ;
}
}
Status GetLatestBackupFileContents ( uint32_t * latest_backup ) ;
Status GetLatestBackupFileContents ( uint32_t * latest_backup ) ;
@ -402,7 +403,7 @@ BackupEngineImpl::BackupEngineImpl(Env* db_env,
Log ( options_ . info_log , " Detected backup %s " , file . c_str ( ) ) ;
Log ( options_ . info_log , " Detected backup %s " , file . c_str ( ) ) ;
BackupID backup_id = 0 ;
BackupID backup_id = 0 ;
sscanf ( file . c_str ( ) , " %u " , & backup_id ) ;
sscanf ( file . c_str ( ) , " %u " , & backup_id ) ;
if ( backup_id = = 0 | | file ! = st d : : to_s tring( backup_id ) ) {
if ( backup_id = = 0 | | file ! = rock sdb : : ToS tring( backup_id ) ) {
if ( ! read_only_ ) {
if ( ! read_only_ ) {
Log ( options_ . info_log , " Unrecognized meta file %s, deleting " ,
Log ( options_ . info_log , " Unrecognized meta file %s, deleting " ,
file . c_str ( ) ) ;
file . c_str ( ) ) ;
@ -1264,7 +1265,7 @@ Status BackupEngineImpl::BackupMeta::LoadFromFile(
line . remove_prefix ( checksum_prefix . size ( ) ) ;
line . remove_prefix ( checksum_prefix . size ( ) ) ;
checksum_value = static_cast < uint32_t > (
checksum_value = static_cast < uint32_t > (
strtoul ( line . data ( ) , nullptr , 10 ) ) ;
strtoul ( line . data ( ) , nullptr , 10 ) ) ;
if ( line ! = st d : : to_s tring( checksum_value ) ) {
if ( line ! = rock sdb : : ToS tring( checksum_value ) ) {
return Status : : Corruption ( " Invalid checksum value for " + filename +
return Status : : Corruption ( " Invalid checksum value for " + filename +
" in " + meta_filename_ ) ;
" in " + meta_filename_ ) ;
}
}