[fix] (compaction) fix time series compaction policy (#38220) (#38917)

## Proposed changes

pick from #38220
This commit is contained in:
Sun Chenyang
2024-08-06 14:26:42 +08:00
committed by GitHub
parent fcb4483ed1
commit 8ce30963cd
2 changed files with 9 additions and 4 deletions

View File

@ -82,8 +82,10 @@ Status CumulativeCompaction::execute_compact_impl() {
_state = CompactionState::SUCCESS;
// 5. set cumulative level
_tablet->cumulative_compaction_policy()->update_compaction_level(_tablet.get(), _input_rowsets,
_output_rowset);
if (_tablet->tablet_meta()->time_series_compaction_level_threshold() >= 2) {
_tablet->cumulative_compaction_policy()->update_compaction_level(
_tablet.get(), _input_rowsets, _output_rowset);
}
// 6. set cumulative point
_tablet->cumulative_compaction_policy()->update_cumulative_point(

View File

@ -1997,8 +1997,11 @@ Status Tablet::prepare_compaction_and_calculate_permits(CompactionType compactio
}
permits = 0;
for (auto&& rowset : compaction->input_rowsets()) {
permits += rowset->rowset_meta()->get_compaction_score();
// Time series policy does not rely on permits, it uses goal size to control memory
if (tablet->tablet_meta()->compaction_policy() != CUMULATIVE_TIME_SERIES_POLICY) {
for (auto&& rowset : compaction->input_rowsets()) {
permits += rowset->rowset_meta()->get_compaction_score();
}
}
return Status::OK();
}