From 4bdf06e78fa2e5196f3e82caf9f4d95fb808a61a Mon Sep 17 00:00:00 2001 From: Yi Wu Date: Mon, 29 Jan 2018 18:44:01 -0800 Subject: [PATCH] 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 --- db/db_flush_test.cc | 2 +- db/db_impl_compaction_flush.cc | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/db/db_flush_test.cc b/db/db_flush_test.cc index 83895ea6c..6c24b716e 100644 --- a/db/db_flush_test.cc +++ b/db/db_flush_test.cc @@ -137,7 +137,7 @@ TEST_F(DBFlushTest, ManualFlushWithMinWriteBufferNumberToMerge) { {{"DBImpl::BGWorkFlush", "DBFlushTest::ManualFlushWithMinWriteBufferNumberToMerge:1"}, {"DBFlushTest::ManualFlushWithMinWriteBufferNumberToMerge:2", - "DBImpl::FlushMemTableToOutputFile:BeforeInstallSV"}}); + "FlushJob::WriteLevel0Table"}}); SyncPoint::GetInstance()->EnableProcessing(); ASSERT_OK(Put("key1", "value1")); diff --git a/db/db_impl_compaction_flush.cc b/db/db_impl_compaction_flush.cc index df097f478..6776a2478 100644 --- a/db/db_impl_compaction_flush.cc +++ b/db/db_impl_compaction_flush.cc @@ -134,7 +134,6 @@ Status DBImpl::FlushMemTableToOutputFile( } if (s.ok()) { - TEST_SYNC_POINT("DBImpl::FlushMemTableToOutputFile:BeforeInstallSV"); InstallSuperVersionAndScheduleWork(cfd, &job_context->superversion_context, mutable_cf_options); if (made_progress) {