From a62c519bb6129bce4f2300cb07c305ad6c0c945b Mon Sep 17 00:00:00 2001 From: Tomas Kolda Date: Tue, 2 Feb 2016 10:33:49 +0100 Subject: [PATCH] RollLogFile tries to find non conflicting file until there is no conflict. --- db/auto_roll_logger.cc | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/db/auto_roll_logger.cc b/db/auto_roll_logger.cc index b8ba14c83..2349bd0c0 100644 --- a/db/auto_roll_logger.cc +++ b/db/auto_roll_logger.cc @@ -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); } -- GitLab