From 8ce30963cd5c4e593e6aca5bb398be99bdbfbb58 Mon Sep 17 00:00:00 2001 From: Sun Chenyang Date: Tue, 6 Aug 2024 14:26:42 +0800 Subject: [PATCH] [fix] (compaction) fix time series compaction policy (#38220) (#38917) ## Proposed changes pick from #38220 --- be/src/olap/cumulative_compaction.cpp | 6 ++++-- be/src/olap/tablet.cpp | 7 +++++-- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/be/src/olap/cumulative_compaction.cpp b/be/src/olap/cumulative_compaction.cpp index f461de3a5e..04504432f1 100644 --- a/be/src/olap/cumulative_compaction.cpp +++ b/be/src/olap/cumulative_compaction.cpp @@ -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( diff --git a/be/src/olap/tablet.cpp b/be/src/olap/tablet.cpp index 11cb7055c7..1121e61451 100644 --- a/be/src/olap/tablet.cpp +++ b/be/src/olap/tablet.cpp @@ -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(); }