From 6c66bc08d9fdee1b0a3d1d3e6df557b02fcd0e7c Mon Sep 17 00:00:00 2001 From: sdong Date: Tue, 11 Mar 2014 11:20:08 -0700 Subject: [PATCH] Temp Fix of LogBuffer flushing Summary: To temp fix the log buffer flushing. Flush the buffer inside the lock. Clean the trunk before we find an eventual fix. Test Plan: make all check Reviewers: haobo, igor Reviewed By: igor CC: ljin, leveldb, yhchiang Differential Revision: https://reviews.facebook.net/D16791 --- db/db_impl.cc | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/db/db_impl.cc b/db/db_impl.cc index ca91b5e82a7..49fd3c9fb76 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -1923,13 +1923,13 @@ void DBImpl::BackgroundCallFlush() { if (madeProgress) { MaybeScheduleFlushOrCompaction(); } + log_buffer.FlushBufferToLog(); bg_cv_.SignalAll(); // IMPORTANT: there should be no code after calling SignalAll. This call may // signal the DB destructor that it's OK to proceed with destruction. In // that case, all DB variables will be dealloacated and referencing them // will cause trouble. } - log_buffer.FlushBufferToLog(); } @@ -1996,13 +1996,13 @@ void DBImpl::BackgroundCallCompaction() { if (madeProgress) { MaybeScheduleFlushOrCompaction(); } + log_buffer.FlushBufferToLog(); bg_cv_.SignalAll(); // IMPORTANT: there should be no code after calling SignalAll. This call may // signal the DB destructor that it's OK to proceed with destruction. In // that case, all DB variables will be dealloacated and referencing them // will cause trouble. } - log_buffer.FlushBufferToLog(); } Status DBImpl::BackgroundCompaction(bool* madeProgress,