diff options
Diffstat (limited to 'db/db_impl.cc')
-rw-r--r-- | db/db_impl.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/db/db_impl.cc b/db/db_impl.cc index 1a4e459..1ec2afb 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -1368,8 +1368,22 @@ Status DBImpl::MakeRoomForWrite(bool force) { versions_->ReuseFileNumber(new_log_number); break; } + delete log_; + + s = logfile_->Close(); + if (!s.ok()) { + // We may have lost some data written to the previous log file. + // Switch to the new log file anyway, but record as a background + // error so we do not attempt any more writes. + // + // We could perhaps attempt to save the memtable corresponding + // to log file and suppress the error if that works, but that + // would add more complexity in a critical code path. + RecordBackgroundError(s); + } delete logfile_; + logfile_ = lfile; logfile_number_ = new_log_number; log_ = new log::Writer(lfile); |