@ -383,7 +383,7 @@ Status WalManager::ReadFirstRecord(const WalFileType type,
Status s ;
Status s ;
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 , sequence ) ;
s = ReadFirstLine ( fname , number , sequence ) ;
if ( env_ - > FileExists ( fname ) . ok ( ) & & ! s . ok ( ) ) {
if ( env_ - > FileExists ( fname ) . ok ( ) & & ! s . 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 ;
@ -394,7 +394,7 @@ Status WalManager::ReadFirstRecord(const WalFileType type,
// check if the file got moved to archive.
// check if the file got moved to archive.
std : : string archived_file =
std : : string archived_file =
ArchivedLogFileName ( db_options_ . wal_dir , number ) ;
ArchivedLogFileName ( db_options_ . wal_dir , number ) ;
s = ReadFirstLine ( archived_file , sequence ) ;
s = ReadFirstLine ( archived_file , number , sequence ) ;
// maybe the file was deleted from archive dir. If that's the case, return
// maybe the file was deleted from archive dir. If that's the case, return
// Status::OK(). The caller with identify this as empty file because
// Status::OK(). The caller with identify this as empty file because
// *sequence == 0
// *sequence == 0
@ -413,6 +413,7 @@ Status WalManager::ReadFirstRecord(const WalFileType type,
// the function returns status.ok() and sequence == 0 if the file exists, but is
// the function returns status.ok() and sequence == 0 if the file exists, but is
// empty
// empty
Status WalManager : : ReadFirstLine ( const std : : string & fname ,
Status WalManager : : ReadFirstLine ( const std : : string & fname ,
const uint64_t number ,
SequenceNumber * sequence ) {
SequenceNumber * sequence ) {
struct LogReporter : public log : : Reader : : Reporter {
struct LogReporter : public log : : Reader : : Reporter {
Env * env ;
Env * env ;
@ -449,7 +450,7 @@ Status WalManager::ReadFirstLine(const std::string& fname,
reporter . status = & status ;
reporter . status = & status ;
reporter . ignore_error = ! db_options_ . paranoid_checks ;
reporter . ignore_error = ! db_options_ . paranoid_checks ;
log : : Reader reader ( db_options_ . info_log , std : : move ( file_reader ) , & reporter ,
log : : Reader reader ( db_options_ . info_log , std : : move ( file_reader ) , & reporter ,
true /*checksum*/ , 0 /*initial_offset*/ , * sequence ) ;
true /*checksum*/ , 0 /*initial_offset*/ , number ) ;
std : : string scratch ;
std : : string scratch ;
Slice record ;
Slice record ;