Fix intermittent hang in ColumnFamilyTest.FlushAndDropRaceCondition

Summary:
ColumnFamilyTest.FlushAndDropRaceCondition sometimes
hangs because the sync point, "FlushJob::InstallResults", sleeps
holding the DB mutex. Fixing it by releasing the mutex before sleeping.

Test Plan:
seq 1000 |parallel --gnu --eta 't=/dev/shm/rdb-{}; rm -rf $t;
mkdir $t && export TEST_TMPDIR=$t; ./column_family_test
-gtest_filter=*FlushAndDropRaceCondition* > $t/log-{}'

Reviewers: IslamAbdelRahman, anthony, kradhakrishnan, yhchiang, sdong

Reviewed By: sdong

Subscribers: dhruba, leveldb

Differential Revision: https://reviews.facebook.net/D53349
This commit is contained in:
Venkatesh Radhakrishnan 2016-01-26 09:12:20 -08:00
parent 38e1d7fea3
commit b7ecf3d214
3 changed files with 5 additions and 1 deletions

View File

@ -1999,7 +1999,9 @@ TEST_F(ColumnFamilyTest, FlushAndDropRaceCondition) {
Reopen({options, options}); Reopen({options, options});
rocksdb::SyncPoint::GetInstance()->LoadDependency( rocksdb::SyncPoint::GetInstance()->LoadDependency(
{{"VersionSet::LogAndApply::ColumnFamilyDrop:1", {{"VersionSet::LogAndApply::ColumnFamilyDrop:0",
"FlushJob::WriteLevel0Table"},
{"VersionSet::LogAndApply::ColumnFamilyDrop:1",
"FlushJob::InstallResults"}, "FlushJob::InstallResults"},
{"FlushJob::InstallResults", {"FlushJob::InstallResults",
"VersionSet::LogAndApply::ColumnFamilyDrop:2"}}); "VersionSet::LogAndApply::ColumnFamilyDrop:2"}});

View File

@ -270,6 +270,7 @@ Status FlushJob::WriteLevel0Table(const autovector<MemTable*>& mems,
if (!db_options_.disableDataSync && output_file_directory_ != nullptr) { if (!db_options_.disableDataSync && output_file_directory_ != nullptr) {
output_file_directory_->Fsync(); output_file_directory_->Fsync();
} }
TEST_SYNC_POINT("FlushJob::WriteLevel0Table");
db_mutex_->Lock(); db_mutex_->Lock();
} }
base->Unref(); base->Unref();

View File

@ -2218,6 +2218,7 @@ Status VersionSet::LogAndApply(ColumnFamilyData* column_family_data,
} }
if (edit->is_column_family_drop_) { if (edit->is_column_family_drop_) {
TEST_SYNC_POINT("VersionSet::LogAndApply::ColumnFamilyDrop:0");
TEST_SYNC_POINT("VersionSet::LogAndApply::ColumnFamilyDrop:1"); TEST_SYNC_POINT("VersionSet::LogAndApply::ColumnFamilyDrop:1");
TEST_SYNC_POINT("VersionSet::LogAndApply::ColumnFamilyDrop:2"); TEST_SYNC_POINT("VersionSet::LogAndApply::ColumnFamilyDrop:2");
} }