Wait for CancelAllBackgroundWork before Close in db stress (#6191)

Summary:
In https://github.com/facebook/rocksdb/issues/6174 we fixed the stress test to respect the CancelAllBackgroundWork + Close order for WritePrepared transactions. The fix missed to take into account that some invocation of CancelAllBackgroundWork are with wait=false parameter which essentially breaks the order.
Pull Request resolved: https://github.com/facebook/rocksdb/pull/6191

Differential Revision: D19102709

Pulled By: maysamyabandeh

fbshipit-source-id: f4e7b5fdae47ff1c1ac284ba1cf67d5d3f3d03eb
main
Maysam Yabandeh 5 years ago committed by Facebook Github Bot
parent cddd637997
commit 68d5d82d1f
  1. 5
      db_stress_tool/db_stress_test_base.cc

@ -1794,8 +1794,9 @@ void StressTest::Reopen(ThreadState* thread) {
#ifndef ROCKSDB_LITE
bool bg_canceled = false;
if (thread->rand.OneIn(2)) {
CancelAllBackgroundWork(db_, static_cast<bool>(thread->rand.OneIn(2)));
bg_canceled = true;
const bool wait = static_cast<bool>(thread->rand.OneIn(2));
CancelAllBackgroundWork(db_, wait);
bg_canceled = wait;
}
#else
(void) thread;

Loading…
Cancel
Save