From dedb57f87e31305db3e2a13e374ba4fd58043fca Mon Sep 17 00:00:00 2001 From: weizuo93 Date: Fri, 27 Aug 2021 11:10:41 +0800 Subject: [PATCH] [Enhancement] Modify the method of calculating compaction score (#6252) * optimize calculation method of compaction score to lower the priority of rowset with 0 segments Co-authored-by: weizuo --- be/src/olap/rowset/rowset_meta.h | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/be/src/olap/rowset/rowset_meta.h b/be/src/olap/rowset/rowset_meta.h index a31f14e2ef..2c9fcfbc29 100644 --- a/be/src/olap/rowset/rowset_meta.h +++ b/be/src/olap/rowset/rowset_meta.h @@ -265,15 +265,14 @@ public: } // get the compaction score of this rowset. - // if segments are overlapping, the score equals to the number of segments, + // if segments are overlapping or the number of segments is 0, the score equals to the number of segments, // otherwise, score is 1. uint32_t get_compaction_score() const { uint32_t score = 0; - if (!is_segments_overlapping()) { + if ((num_segments() > 0 && !is_segments_overlapping()) || has_delete_predicate()) { score = 1; } else { score = num_segments(); - CHECK(score > 0); } return score; }