Skip to content

Commit

Permalink
Fix DBFlushTest::ManualFlushWithMinWriteBufferNumberToMerge dead lock
Browse files Browse the repository at this point in the history
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 facebook#3436

Differential Revision: D6841334

Pulled By: yiwu-arbug

fbshipit-source-id: b020768ac94e166e40953c5d09e505515a5f244d
  • Loading branch information
Yi Wu authored and facebook-github-bot committed Jan 30, 2018
1 parent 3073b1c commit 4bdf06e
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
2 changes: 1 addition & 1 deletion db/db_flush_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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"));
Expand Down
1 change: 0 additions & 1 deletion db/db_impl_compaction_flush.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

0 comments on commit 4bdf06e

Please sign in to comment.