]> git-server-git.apps.pok.os.sepia.ceph.com Git - rocksdb.git/commitdiff
Don't let flush preempt compaction in certain cases
authorIgor Canadi <icanadi@fb.com>
Tue, 2 Sep 2014 15:34:54 +0000 (08:34 -0700)
committerIgor Canadi <icanadi@fb.com>
Tue, 2 Sep 2014 15:34:54 +0000 (08:34 -0700)
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

db/db_impl.cc

index 16622758ff84f739197f0e1377ef01c04b943ad3..9900ff2bbd87847885fde7a9cf4ce3291375cf94 100644 (file)
@@ -2581,6 +2581,10 @@ inline SequenceNumber DBImpl::findEarliestVisibleSnapshot(
 uint64_t DBImpl::CallFlushDuringCompaction(ColumnFamilyData* cfd,
                                            DeletionState& deletion_state,
                                            LogBuffer* log_buffer) {
+  if (options_.max_background_flushes > 0) {
+    // flush thread will take care of this
+    return 0;
+  }
   if (cfd->imm()->imm_flush_needed.NoBarrier_Load() != nullptr) {
     const uint64_t imm_start = env_->NowMicros();
     mutex_.Lock();