Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

unit tests: fix DisableMultiManualCompaction in db_compaction_test #611

Merged
merged 2 commits into from
Aug 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
* build: Windows compilation fix (#568).
* Logger: fix Block cache stats trace by spacing it from the last trace (#578).
* WriteController: move the class to public interface which should have been done under #346.
* unit tests: fix DBCompactionTest.DisableMultiManualCompaction by blocking all bg compaction threads which increased by default to 8 in #194.

## Fig v2.5.0 (06/14/2023)
Based on RocksDB 8.1.1
Expand Down
17 changes: 12 additions & 5 deletions db/db_compaction_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -8618,9 +8618,13 @@ TEST_F(DBCompactionTest, DisableMultiManualCompaction) {
MoveFilesToLevel(1);

// Block compaction queue
test::SleepingBackgroundTask sleeping_task_low;
env_->Schedule(&test::SleepingBackgroundTask::DoSleepTask, &sleeping_task_low,
Env::Priority::LOW);
std::vector<test::SleepingBackgroundTask> sleeping_task_low(
std::max(1, env_->GetBackgroundThreads(Env::Priority::LOW)));

for (auto& sleeping_task : sleeping_task_low) {
env_->Schedule(&test::SleepingBackgroundTask::DoSleepTask, &sleeping_task,
Env::Priority::LOW);
}

port::Thread compact_thread1([&]() {
CompactRangeOptions cro;
Expand Down Expand Up @@ -8651,8 +8655,11 @@ TEST_F(DBCompactionTest, DisableMultiManualCompaction) {
compact_thread1.join();
compact_thread2.join();

sleeping_task_low.WakeUp();
sleeping_task_low.WaitUntilDone();
for (auto& sleeping_task : sleeping_task_low) {
sleeping_task.WakeUp();
sleeping_task.WaitUntilDone();
}

ASSERT_OK(dbfull()->TEST_WaitForCompact(true));
}

Expand Down
Loading