Skip to content

Commit

Permalink
Fix extra compaction tasks scheduled after D16767 in some cases
Browse files Browse the repository at this point in the history
Summary:
With D16767, there is a case compaction tasks are scheduled infinitely:
(1) no flush thread is configured and more than 1 compaction threads
(2) a flush is going on by one compaction hread
(3) the state of SST files is in the state that versions_->current()->NeedsCompaction() will generate a false positive (return true actually there is no work to be done)
In that case, a infinite loop will be formed.

This patch would fix it.

Test Plan: make all check

Reviewers: haobo, igor, ljin

Reviewed By: igor

CC: dhruba, yhchiang, leveldb

Differential Revision: https://reviews.facebook.net/D16863
  • Loading branch information
siying committed Mar 13, 2014
1 parent 04a1035 commit 5aa81f0
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion db/db_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1842,7 +1842,7 @@ void DBImpl::MaybeScheduleFlushOrCompaction() {
// memtable flush needed
bg_flush_scheduled_++;
env_->Schedule(&DBImpl::BGWorkFlush, this, Env::Priority::HIGH);
} else {
} else if (options_.max_background_flushes > 0) {
bg_schedule_needed_ = true;
}
}
Expand Down

0 comments on commit 5aa81f0

Please sign in to comment.