From 3381e2c3e7b15acb7d43420a6a5486015903eaff Mon Sep 17 00:00:00 2001 From: Reid Horuff Date: Mon, 16 Nov 2015 12:34:55 -0800 Subject: [PATCH] Handle multiple calls to DBImpl::PauseBackgroundWork() and DBImpl::ContinueBackgroundWork() Summary: Handle multiple calls to DBImpl::PauseBackgroundWork() and DBImpl::ContinueBackgroundWork() Test Plan: rocksdb.information_schema handles this case. Reviewers: igor Reviewed By: igor Subscribers: hermanlee4, jkedgar, dhruba Differential Revision: https://reviews.facebook.net/D50781 --- db/db_impl.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/db/db_impl.cc b/db/db_impl.cc index 2f105e1a2..30da7a934 100644 --- a/db/db_impl.cc +++ b/db/db_impl.cc @@ -1850,6 +1850,9 @@ Status DBImpl::PauseBackgroundWork() { Status DBImpl::ContinueBackgroundWork() { InstrumentedMutexLock guard_lock(&mutex_); + if (bg_work_paused_ == 0) { + return Status::InvalidArgument(); + } assert(bg_work_paused_ > 0); bg_work_paused_--; if (bg_work_paused_ == 0) {