This is an automated email from the ASF dual-hosted git repository.

hellostephen pushed a commit to branch branch-3.0
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-3.0 by this push:
     new 643698bd01b [fix](beut) fix the unit test for calculating the 
compaction score (#48660)
643698bd01b is described below

commit 643698bd01bc2828a369d4469c400ea6eb8f6327
Author: Luwei <lu...@selectdb.com>
AuthorDate: Wed Mar 5 11:05:41 2025 +0800

    [fix](beut) fix the unit test for calculating the compaction score (#48660)
---
 be/test/olap/tablet_mgr_test.cpp | 20 ++++++++++++++++----
 1 file changed, 16 insertions(+), 4 deletions(-)

diff --git a/be/test/olap/tablet_mgr_test.cpp b/be/test/olap/tablet_mgr_test.cpp
index 02a197d43e0..7b940ffa0fa 100644
--- a/be/test/olap/tablet_mgr_test.cpp
+++ b/be/test/olap/tablet_mgr_test.cpp
@@ -482,7 +482,10 @@ TEST_F(TabletMgrTest, FindTabletWithCompact) {
         int index = 0;
         for (auto t : compact_tablets) {
             ASSERT_EQ(t->tablet_id(), 10100 - index);
-            ASSERT_EQ(t->calc_compaction_score(), 100 - index);
+            ASSERT_EQ(t->calc_compaction_score(
+                              CompactionType::CUMULATIVE_COMPACTION,
+                              
cumulative_compaction_policies[CUMULATIVE_SIZE_BASED_POLICY]),
+                      100 - index - 1);
             index++;
         }
         config::compaction_num_per_round = 1;
@@ -506,10 +509,16 @@ TEST_F(TabletMgrTest, FindTabletWithCompact) {
         ASSERT_EQ(compact_tablets.size(), 11);
         for (int i = 0; i < 10; ++i) {
             ASSERT_EQ(compact_tablets[i]->tablet_id(), 20100 - i);
-            ASSERT_EQ(compact_tablets[i]->calc_compaction_score(), 100 - i);
+            ASSERT_EQ(compact_tablets[i]->calc_compaction_score(
+                              CompactionType::CUMULATIVE_COMPACTION,
+                              
cumulative_compaction_policies[CUMULATIVE_SIZE_BASED_POLICY]),
+                      100 - i - 1);
         }
         ASSERT_EQ(compact_tablets[10]->tablet_id(), 20102);
-        ASSERT_EQ(compact_tablets[10]->calc_compaction_score(), 200);
+        ASSERT_EQ(compact_tablets[10]->calc_compaction_score(
+                          CompactionType::CUMULATIVE_COMPACTION,
+                          
cumulative_compaction_policies[CUMULATIVE_SIZE_BASED_POLICY]),
+                  200 - 1);
 
         config::compaction_num_per_round = 1;
         // drop all tablets
@@ -534,7 +543,10 @@ TEST_F(TabletMgrTest, FindTabletWithCompact) {
         ASSERT_EQ(compact_tablets.size(), 5);
         for (int i = 0; i < 5; ++i) {
             ASSERT_EQ(compact_tablets[i]->tablet_id(), 30000 + 5 - i);
-            ASSERT_EQ(compact_tablets[i]->calc_compaction_score(), 10 - i);
+            ASSERT_EQ(compact_tablets[i]->calc_compaction_score(
+                              CompactionType::CUMULATIVE_COMPACTION,
+                              
cumulative_compaction_policies[CUMULATIVE_SIZE_BASED_POLICY]),
+                      10 - i - 1);
         }
 
         config::compaction_num_per_round = 1;


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to