Fix Autoroll logger
Summary: If auto roll logger can't create a new LOG file on roll (if, for example, somebody deletes rocksdb directory while rocksdb is running, khm), we'll try to call Logv on invalid address and get a SIGSEGV. This diff will fix the issue Here's the paste of the stack trace: https://phabricator.fb.com/P8276386 (fb-only) Test Plan: make check is fine, although not really testing error condition Reviewers: haobo, ljin, yhchiang Reviewed By: haobo CC: leveldb Differential Revision: https://reviews.facebook.net/D17367
This commit is contained in:
parent
05080dae3f
commit
8e81caf01a
@ -47,7 +47,11 @@ void AutoRollLogger::Logv(const char* format, va_list ap) {
|
||||
if ((kLogFileTimeToRoll > 0 && LogExpired()) ||
|
||||
(kMaxLogFileSize > 0 && logger_->GetLogFileSize() >= kMaxLogFileSize)) {
|
||||
RollLogFile();
|
||||
ResetLogger();
|
||||
Status s = ResetLogger();
|
||||
if (!s.ok()) {
|
||||
// can't really log the error if creating a new LOG file failed
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// pin down the current logger_ instance before releasing the mutex.
|
||||
|
Loading…
Reference in New Issue
Block a user