@ -312,14 +312,15 @@ Status WalManager::GetSortedWalsOfType(const std::string& path,
uint64_t size_bytes ;
uint64_t size_bytes ;
s = env_ - > GetFileSize ( LogFileName ( path , number ) , & size_bytes ) ;
s = env_ - > GetFileSize ( LogFileName ( path , number ) , & size_bytes ) ;
// re-try in case the alive log file has been moved to archive.
// re-try in case the alive log file has been moved to archive.
std : : string archived_file = ArchivedLogFileName ( path , number ) ;
if ( ! s . ok ( ) & & log_type = = kAliveLogFile ) {
if ( ! s . ok ( ) & & log_type = = kAliveLogFile & &
std : : string archived_file = ArchivedLogFileName ( path , number ) ;
env_ - > FileExists ( archived_file ) . ok ( ) ) {
if ( env_ - > FileExists ( archived_file ) . ok ( ) ) {
s = env_ - > GetFileSize ( archived_file , & size_bytes ) ;
s = env_ - > GetFileSize ( archived_file , & size_bytes ) ;
if ( ! s . ok ( ) & & env_ - > FileExists ( archived_file ) . IsNotFound ( ) ) {
if ( ! s . ok ( ) & & env_ - > FileExists ( archived_file ) . IsNotFound ( ) ) {
// oops, the file just got deleted from archived dir! move on
// oops, the file just got deleted from archived dir! move on
s = Status : : OK ( ) ;
s = Status : : OK ( ) ;
continue ;
continue ;
}
}
}
}
}
if ( ! s . ok ( ) ) {
if ( ! s . ok ( ) ) {
@ -388,7 +389,7 @@ Status WalManager::ReadFirstRecord(const WalFileType type,
if ( type = = kAliveLogFile ) {
if ( type = = kAliveLogFile ) {
std : : string fname = LogFileName ( db_options_ . wal_dir , number ) ;
std : : string fname = LogFileName ( db_options_ . wal_dir , number ) ;
s = ReadFirstLine ( fname , number , sequence ) ;
s = ReadFirstLine ( fname , number , sequence ) ;
if ( env_ - > FileExists ( fname ) . ok ( ) & & ! s . ok ( ) ) {
if ( ! s . ok ( ) & & env_ - > FileExists ( fname ) . ok ( ) ) {
// return any error that is not caused by non-existing file
// return any error that is not caused by non-existing file
return s ;
return s ;
}
}