Skip to content

Commit

Permalink
fix : potential bug scheduling unnecessary threads
Browse files Browse the repository at this point in the history
this fix is due to facebook#6104.
unscheduled_flushes_ was not handled well in the current version (v6.1.2.)
This leads flush_scheduled_ flags to be always full.
author : Junhan
  • Loading branch information
junhanLee95 committed Jun 28, 2023
1 parent 1e841e4 commit 6a581d4
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions db/db_impl_compaction_flush.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1843,6 +1843,7 @@ void DBImpl::MaybeScheduleFlushOrCompaction() {
fta->thread_pri_ = Env::Priority::HIGH;
env_->Schedule(&DBImpl::BGWorkFlush, fta, Env::Priority::HIGH, this,
&DBImpl::UnscheduleFlushCallback);
--unscheduled_flushes_;
}

// special case -- if high-pri (flush) thread pool is empty, then schedule
Expand All @@ -1857,6 +1858,7 @@ void DBImpl::MaybeScheduleFlushOrCompaction() {
fta->thread_pri_ = Env::Priority::LOW;
env_->Schedule(&DBImpl::BGWorkFlush, fta, Env::Priority::LOW, this,
&DBImpl::UnscheduleFlushCallback);
--unscheduled_flushes_;
}
}

Expand Down

0 comments on commit 6a581d4

Please sign in to comment.