提交 a62c519b 编写于 作者: T Tomas Kolda

RollLogFile tries to find non conflicting file until there is no conflict.

上级 57a95a70
...@@ -37,14 +37,11 @@ void AutoRollLogger::RollLogFile() { ...@@ -37,14 +37,11 @@ void AutoRollLogger::RollLogFile() {
// previous log file we increment by one micro second and try again. // previous log file we increment by one micro second and try again.
uint64_t now = env_->NowMicros(); uint64_t now = env_->NowMicros();
std::string old_fname; std::string old_fname;
for (int i = 0; i < 10; i++) { do {
old_fname = OldInfoLogFileName( old_fname = OldInfoLogFileName(
dbname_, now, db_absolute_path_, db_log_dir_); dbname_, now, db_absolute_path_, db_log_dir_);
if (!env_->FileExists(old_fname).ok()) {
break;
}
now++; now++;
}; } while (env_->FileExists(old_fname).ok());
env_->RenameFile(log_fname_, old_fname); env_->RenameFile(log_fname_, old_fname);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册