Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
cbi42 committed Dec 27, 2024
1 parent 02b4197 commit 0963206
Showing 1 changed file with 14 additions and 4 deletions.
18 changes: 14 additions & 4 deletions db/db_compaction_test.cc
Original file line number Diff line number Diff line change
Expand Up @@ -6417,10 +6417,9 @@ TEST_P(RoundRobinSubcompactionsAgainstPressureToken, PressureTokenTest) {
options.level0_file_num_compaction_trigger = 4;
options.target_file_size_base = kKeysPerBuffer * 1024;
options.compaction_pri = CompactionPri::kRoundRobin;
// Target size is chosen so that filling the level with `kFilesPerLevel` files
// will make it oversized by `kNumSubcompactions` files.
options.max_bytes_for_level_base =
(kFilesPerLevel - kNumSubcompactions) * kKeysPerBuffer * 1024;
// Pick a small target level size to pick more files to compact
// and trigger subcompaction.
options.max_bytes_for_level_base = kKeysPerBuffer * 1024;
options.disable_auto_compactions = true;
// Setup `kNumSubcompactions` threads but limited subcompactions so
// that RoundRobin requires extra compactions from reserved threads
Expand All @@ -6446,6 +6445,17 @@ TEST_P(RoundRobinSubcompactionsAgainstPressureToken, PressureTokenTest) {
ASSERT_EQ(kFilesPerLevel, NumTableFilesAtLevel(lvl, 0));
}

bool compaction_num_verified = false;
SyncPoint::GetInstance()->SetCallBack(
"LevelCompactionPicker::PickCompaction:Return", [&](void* arg) {
if (!compaction_num_verified) {
Compaction* compaction = static_cast<Compaction*>(arg);
// In Round-Robin, # of subcompactions needed is the # of input files
ASSERT_GT(compaction->num_input_files(0), 1);
compaction_num_verified = true;
}
});

// This is a variable for making sure the following callback is called
// and the assertions in it are indeed excuted.
bool num_planned_subcompactions_verified = false;
Expand Down

0 comments on commit 0963206

Please sign in to comment.