Skip to content

Commit 7dcadb1

Browse files
committed
Don't let flush preempt compaction in certain cases
Summary: I have an application configured with 16 background threads. Write rates are high. L0->L1 compactions is very slow and it limits the concurrency of the system. While it's happening, other 15 threads are idle. However, when there is a need of a flush, that one thread busy with L0->L1 is doing flush, instead of any other 15 threads that are just sitting there. This diff prevents that. If there are threads that are idle, we don't let flush preempt compaction. Test Plan: Will run stress test Reviewers: ljin, sdong, yhchiang Reviewed By: sdong, yhchiang Subscribers: dhruba, leveldb Differential Revision: https://reviews.facebook.net/D22299
1 parent 985a31c commit 7dcadb1

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

db/db_impl.cc

+4
Original file line numberDiff line numberDiff line change
@@ -2581,6 +2581,10 @@ inline SequenceNumber DBImpl::findEarliestVisibleSnapshot(
25812581
uint64_t DBImpl::CallFlushDuringCompaction(ColumnFamilyData* cfd,
25822582
DeletionState& deletion_state,
25832583
LogBuffer* log_buffer) {
2584+
if (options_.max_background_flushes > 0) {
2585+
// flush thread will take care of this
2586+
return 0;
2587+
}
25842588
if (cfd->imm()->imm_flush_needed.NoBarrier_Load() != nullptr) {
25852589
const uint64_t imm_start = env_->NowMicros();
25862590
mutex_.Lock();

0 commit comments

Comments
 (0)