[fix](compaction) fix repeatedly picking tablets with disable auto compaction (#35472) (#35505)

pick master #35472
This commit is contained in:
Luwei
2024-05-28 15:57:54 +08:00
committed by GitHub
parent 96a4159f73
commit 43890ffd3a
2 changed files with 10 additions and 10 deletions

View File

@ -898,17 +898,10 @@ std::vector<TabletSharedPtr> StorageEngine::_generate_compaction_tasks(
: copied_base_map[data_dir],
&disk_max_score, _cumulative_compaction_policies);
if (tablet != nullptr) {
if (!tablet->tablet_meta()->tablet_schema()->disable_auto_compaction()) {
if (need_pick_tablet) {
tablets_compaction.emplace_back(tablet);
}
max_compaction_score = std::max(max_compaction_score, disk_max_score);
} else {
LOG_EVERY_N(INFO, 500)
<< "Tablet " << tablet->tablet_id()
<< " will be ignored by automatic compaction tasks since it's "
<< "set to disabled automatic compaction.";
if (need_pick_tablet) {
tablets_compaction.emplace_back(tablet);
}
max_compaction_score = std::max(max_compaction_score, disk_max_score);
}
}
}

View File

@ -728,6 +728,13 @@ TabletSharedPtr TabletManager::find_best_tablet_to_compaction(
uint32_t compaction_score = 0;
TabletSharedPtr best_tablet;
auto handler = [&](const TabletSharedPtr& tablet_ptr) {
if (tablet_ptr->tablet_meta()->tablet_schema()->disable_auto_compaction()) {
LOG_EVERY_N(INFO, 500) << "Tablet " << tablet_ptr->tablet_id()
<< " will be ignored by automatic compaction tasks since it's "
<< "set to disabled automatic compaction.";
return;
}
if (config::enable_skip_tablet_compaction &&
tablet_ptr->should_skip_compaction(compaction_type, UnixSeconds())) {
return;