Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

move dump stats to a separate thread #4382

Closed
Closed
Prev Previous commit
Next Next commit
fix deadlock
  • Loading branch information
miasantreble committed Oct 4, 2018
commit c071d5b086f7df6f7fd976172c45a52cff438358
3 changes: 1 addition & 2 deletions db/db_impl.cc
Original file line number Diff line number Diff line change
Expand Up @@ -359,8 +359,6 @@ void DBImpl::WaitForBackgroundWork() {

// Will lock the mutex_, will wait for completion if wait is true
void DBImpl::CancelAllBackgroundWork(bool wait) {
InstrumentedMutexLock l(&mutex_);

if (thread_dump_stats_ != nullptr) {
thread_dump_stats_->cancel();
thread_dump_stats_ = nullptr;
Expand All @@ -369,6 +367,7 @@ void DBImpl::CancelAllBackgroundWork(bool wait) {
ROCKS_LOG_INFO(immutable_db_options_.info_log,
"Shutdown: canceling all background work");

InstrumentedMutexLock l(&mutex_);
if (!shutting_down_.load(std::memory_order_acquire) &&
has_unpersisted_data_.load(std::memory_order_relaxed) &&
!mutable_db_options_.avoid_flush_during_shutdown) {
Expand Down