Recompute compaction score after scheduling manual compaction

Summary: After we made manual compaction runnable concurrently with automaticallly compaction, we need to run ComputeCompactionScore() to prepare a coming compaction picking call before the compaction finishes.

Test Plan: Run existing tests.

Reviewers: yhchiang, IslamAbdelRahman, andrewkr, kradhakrishnan, anthony, igor

Reviewed By: igor

Subscribers: leveldb, dhruba

Differential Revision: https://reviews.facebook.net/D54891
This commit is contained in:
sdong 2016-02-29 15:15:23 -08:00
parent 5ea9aa3c14
commit b5b1db167a

View file

@ -612,6 +612,17 @@ Compaction* CompactionPicker::CompactRange(
if (input_level == 0) { if (input_level == 0) {
level0_compactions_in_progress_.insert(compaction); level0_compactions_in_progress_.insert(compaction);
} }
// Creating a compaction influences the compaction score because the score
// takes running compactions into account (by skipping files that are already
// being compacted). Since we just changed compaction score, we recalculate it
// here
{ // this piece of code recomputes compaction score
CompactionOptionsFIFO dummy_compaction_options_fifo;
vstorage->ComputeCompactionScore(mutable_cf_options,
dummy_compaction_options_fifo);
}
return compaction; return compaction;
} }