Fix DBFlushTest::ManualFlushWithMinWriteBufferNumberToMerge dead lock

Summary:
In the test, there can be a dead lock between background flush thread and foreground main thread as following:
* background flush thread:
  - holding db mutex, while
  - waiting on "DBImpl::FlushMemTableToOutputFile:BeforeInstallSV" sync point.
* foreground thread:
  - waiting for db mutex to write "key2"

Fixing by let background flush thread wait without holding db mutex.
Closes https://github.com/facebook/rocksdb/pull/3436

Differential Revision: D6841334

Pulled By: yiwu-arbug

fbshipit-source-id: b020768ac94e166e40953c5d09e505515a5f244d
This commit is contained in:
Yi Wu 2018-01-29 18:44:01 -08:00 committed by Zhongyi Xie
parent 8cffe39efc
commit 20269d080a
2 changed files with 1 additions and 2 deletions

View File

@ -137,7 +137,7 @@ TEST_F(DBFlushTest, ManualFlushWithMinWriteBufferNumberToMerge) {
{{"DBImpl::BGWorkFlush", {{"DBImpl::BGWorkFlush",
"DBFlushTest::ManualFlushWithMinWriteBufferNumberToMerge:1"}, "DBFlushTest::ManualFlushWithMinWriteBufferNumberToMerge:1"},
{"DBFlushTest::ManualFlushWithMinWriteBufferNumberToMerge:2", {"DBFlushTest::ManualFlushWithMinWriteBufferNumberToMerge:2",
"DBImpl::FlushMemTableToOutputFile:BeforeInstallSV"}}); "FlushJob::WriteLevel0Table"}});
SyncPoint::GetInstance()->EnableProcessing(); SyncPoint::GetInstance()->EnableProcessing();
ASSERT_OK(Put("key1", "value1")); ASSERT_OK(Put("key1", "value1"));

View File

@ -134,7 +134,6 @@ Status DBImpl::FlushMemTableToOutputFile(
} }
if (s.ok()) { if (s.ok()) {
TEST_SYNC_POINT("DBImpl::FlushMemTableToOutputFile:BeforeInstallSV");
InstallSuperVersionAndScheduleWork(cfd, &job_context->superversion_context, InstallSuperVersionAndScheduleWork(cfd, &job_context->superversion_context,
mutable_cf_options); mutable_cf_options);
if (made_progress) { if (made_progress) {