-
-
Save qingping209/356febd14f2d7db7b46212b11477ebf4 to your computer and use it in GitHub Desktop.
StalledWritesNotBlockForever
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TEST_F(DBTest, StalledWritesNotBlockForever) { | |
Options options = CurrentOptions(); | |
options.disable_auto_compactions = true; | |
Reopen(options); | |
Random rnd(403); | |
ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->SetCallBack( | |
"BackgroundCallCompaction:1", [&](void* /* arg */) { | |
env_->SleepForMicroseconds(2*1000*1000); | |
}); | |
ROCKSDB_NAMESPACE::SyncPoint::GetInstance()->EnableProcessing(); | |
for (int i = 0; i < 20; i++) { | |
for (int j = 0; j < 100; j++) { | |
std::string value = rnd.RandomString(1000); | |
ASSERT_OK(Put("key_" + std::to_string(j), value)); | |
} | |
Flush(); | |
} | |
ASSERT_EQ(GetSstFileCount(dbname_), 20); | |
options.level0_stop_writes_trigger = 20; | |
options.disable_auto_compactions = false; | |
Reopen(options); | |
std::thread thd([&]() { | |
ASSERT_OK(Put("key_" + std::to_string(11), "1111")); | |
}); | |
CancelAllBackgroundWork(db_, true); | |
LogFlush(options.info_log); | |
thd.join(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment