Run compactions even if workload is readonly or read-mostly.

Summary:
The events that trigger compaction:
* opening the database
* Get -> only if seek compaction is not disabled and other checks are true
* MakeRoomForWrite -> when memtable is full
* BackgroundCall ->
  If the background thread is about to do a compaction run, it schedules
  a new background task to trigger a possible compaction. This will cause
  additional background threads to find and process other compactions that
  can run concurrently.

Test Plan: ran db_bench with overwrite and readonly alternatively.

Reviewers: sheki, MarkCallaghan

Reviewed By: sheki

CC: leveldb

Differential Revision: https://reviews.facebook.net/D9579
This commit is contained in:
Dhruba Borthakur 2013-03-20 15:14:10 -07:00
parent ad96563b79
commit d0798f67f4

View File

@ -1294,6 +1294,7 @@ Status DBImpl::BackgroundCompaction(bool* madeProgress,
versions_->ReleaseCompactionFiles(c.get(), status);
*madeProgress = true;
} else {
MaybeScheduleCompaction(); // do more compaction work in parallel.
CompactionState* compact = new CompactionState(c.get());
status = DoCompactionWork(compact);
CleanupCompaction(compact);