Skip to content

Commit

Permalink
RollLogFile tries to find non conflicting file until there is no conf…
Browse files Browse the repository at this point in the history
…lict.
  • Loading branch information
koldat committed Feb 2, 2016
1 parent 57a95a7 commit a62c519
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions db/auto_roll_logger.cc
Original file line number Diff line number Diff line change
Expand Up @@ -37,14 +37,11 @@ void AutoRollLogger::RollLogFile() {
// previous log file we increment by one micro second and try again.
uint64_t now = env_->NowMicros();
std::string old_fname;
for (int i = 0; i < 10; i++) {
do {
old_fname = OldInfoLogFileName(
dbname_, now, db_absolute_path_, db_log_dir_);
if (!env_->FileExists(old_fname).ok()) {
break;
}
now++;
};
} while (env_->FileExists(old_fname).ok());
env_->RenameFile(log_fname_, old_fname);
}

Expand Down

0 comments on commit a62c519

Please sign in to comment.