You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2023/01/04 16:44:16 UTC

[GitHub] [doris] platoneko opened a new pull request, #15633: [enhancement](compaction) Optimize calculating level size of input rowset in SizeBasedCumulativeCompactionPolicy

platoneko opened a new pull request, #15633:
URL: https://github.com/apache/doris/pull/15633

   # Proposed changes
   
   Issue Number: close #xxx
   
   ## Problem summary
   
   Describe your changes.
   
   ## Checklist(Required)
   
   1. Does it affect the original behavior: 
       - [ ] Yes
       - [ ] No
       - [ ] I don't know
   2. Has unit tests been added:
       - [ ] Yes
       - [ ] No
       - [ ] No Need
   3. Has document been added or modified:
       - [ ] Yes
       - [ ] No
       - [ ] No Need
   4. Does it need to update dependencies:
       - [ ] Yes
       - [ ] No
   5. Are there any changes that cannot be rolled back:
       - [ ] Yes (If Yes, please explain WHY)
       - [ ] No
   
   ## Further comments
   
   If this is a relatively large or complex change, kick off the discussion at [dev@doris.apache.org](mailto:dev@doris.apache.org) by explaining why you chose the solution you did and what alternatives you considered, etc...
   
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] platoneko commented on a diff in pull request #15633: [enhancement](compaction) Optimize calculating level size of input rowset in SizeBasedCumulativeCompactionPolicy

Posted by GitBox <gi...@apache.org>.
platoneko commented on code in PR #15633:
URL: https://github.com/apache/doris/pull/15633#discussion_r1081152084


##########
be/src/olap/cumulative_compaction_policy.cpp:
##########
@@ -335,13 +325,12 @@ int SizeBasedCumulativeCompactionPolicy::pick_input_rowsets(
     return transient_size;
 }
 
-int SizeBasedCumulativeCompactionPolicy::_level_size(const int64_t size) {
-    for (auto& i : _levels) {
-        if (size >= i) {
-            return i;
-        }
-    }
-    return 0;
+int64_t SizeBasedCumulativeCompactionPolicy::_level_size(const int64_t size) {
+    if (size < 1024) return 0;
+    int64_t max_level = (int64_t)1

Review Comment:
   done



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] yixiutt commented on a diff in pull request #15633: [enhancement](compaction) Optimize calculating level size of input rowset in SizeBasedCumulativeCompactionPolicy

Posted by GitBox <gi...@apache.org>.
yixiutt commented on code in PR #15633:
URL: https://github.com/apache/doris/pull/15633#discussion_r1065464233


##########
be/src/olap/cumulative_compaction_policy.cpp:
##########
@@ -335,13 +325,12 @@ int SizeBasedCumulativeCompactionPolicy::pick_input_rowsets(
     return transient_size;
 }
 
-int SizeBasedCumulativeCompactionPolicy::_level_size(const int64_t size) {
-    for (auto& i : _levels) {
-        if (size >= i) {
-            return i;
-        }
-    }
-    return 0;
+int64_t SizeBasedCumulativeCompactionPolicy::_level_size(const int64_t size) {
+    if (size < 1024) return 0;
+    int64_t max_level = (int64_t)1

Review Comment:
   add some note here, it's hard to understand



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] github-actions[bot] commented on a diff in pull request #15633: [enhancement](compaction) Optimize calculating level size of input rowset in SizeBasedCumulativeCompactionPolicy

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on code in PR #15633:
URL: https://github.com/apache/doris/pull/15633#discussion_r1062077020


##########
be/test/olap/cumulative_compaction_policy_test.cpp:
##########
@@ -674,18 +674,18 @@
     for (auto& rowset : rs_metas) {
         _tablet_meta->add_rs_meta(rowset);
     }
-
+    config::compaction_promotion_size_mbytes = 1024;
     TabletSharedPtr _tablet(new Tablet(_tablet_meta, nullptr, CUMULATIVE_SIZE_BASED_POLICY));
     _tablet->init();
 
     SizeBasedCumulativeCompactionPolicy* policy =
             dynamic_cast<SizeBasedCumulativeCompactionPolicy*>(
                     _tablet->_cumulative_compaction_policy.get());
 
-    EXPECT_EQ(536870912, policy->_levels[0]);
-    EXPECT_EQ(268435456, policy->_levels[1]);
-    EXPECT_EQ(134217728, policy->_levels[2]);
-    EXPECT_EQ(67108864, policy->_levels[3]);
+    EXPECT_EQ(1 << 29, policy->_level_size(1 << 30));
+    EXPECT_EQ(0, policy->_level_size(1000));
+    EXPECT_EQ(1 << 20, policy->_level_size((1 << 20) + 100));
+    EXPECT_EQ(1 << 19, policy->_level_size((1 << 20) - 100));

Review Comment:
   warning: '_level_size' is a private member of 'doris::SizeBasedCumulativeCompactionPolicy' [clang-diagnostic-error]
   ```cpp
       EXPECT_EQ(1 << 19, policy->_level_size((1 << 20) - 100));
                                  ^
   ```
   **be/src/olap/cumulative_compaction_policy.h:167:** declared private here
   ```cpp
       int64_t _level_size(const int64_t size);
               ^
   ```
   



##########
be/test/olap/cumulative_compaction_policy_test.cpp:
##########
@@ -674,18 +674,18 @@
     for (auto& rowset : rs_metas) {
         _tablet_meta->add_rs_meta(rowset);
     }
-
+    config::compaction_promotion_size_mbytes = 1024;
     TabletSharedPtr _tablet(new Tablet(_tablet_meta, nullptr, CUMULATIVE_SIZE_BASED_POLICY));
     _tablet->init();
 
     SizeBasedCumulativeCompactionPolicy* policy =
             dynamic_cast<SizeBasedCumulativeCompactionPolicy*>(
                     _tablet->_cumulative_compaction_policy.get());
 
-    EXPECT_EQ(536870912, policy->_levels[0]);
-    EXPECT_EQ(268435456, policy->_levels[1]);
-    EXPECT_EQ(134217728, policy->_levels[2]);
-    EXPECT_EQ(67108864, policy->_levels[3]);
+    EXPECT_EQ(1 << 29, policy->_level_size(1 << 30));
+    EXPECT_EQ(0, policy->_level_size(1000));

Review Comment:
   warning: '_level_size' is a private member of 'doris::SizeBasedCumulativeCompactionPolicy' [clang-diagnostic-error]
   ```cpp
       EXPECT_EQ(0, policy->_level_size(1000));
                            ^
   ```
   **be/src/olap/cumulative_compaction_policy.h:167:** declared private here
   ```cpp
       int64_t _level_size(const int64_t size);
               ^
   ```
   



##########
be/test/olap/cumulative_compaction_policy_test.cpp:
##########
@@ -674,18 +674,18 @@
     for (auto& rowset : rs_metas) {
         _tablet_meta->add_rs_meta(rowset);
     }
-
+    config::compaction_promotion_size_mbytes = 1024;
     TabletSharedPtr _tablet(new Tablet(_tablet_meta, nullptr, CUMULATIVE_SIZE_BASED_POLICY));
     _tablet->init();
 
     SizeBasedCumulativeCompactionPolicy* policy =
             dynamic_cast<SizeBasedCumulativeCompactionPolicy*>(
                     _tablet->_cumulative_compaction_policy.get());
 
-    EXPECT_EQ(536870912, policy->_levels[0]);
-    EXPECT_EQ(268435456, policy->_levels[1]);
-    EXPECT_EQ(134217728, policy->_levels[2]);
-    EXPECT_EQ(67108864, policy->_levels[3]);
+    EXPECT_EQ(1 << 29, policy->_level_size(1 << 30));
+    EXPECT_EQ(0, policy->_level_size(1000));
+    EXPECT_EQ(1 << 20, policy->_level_size((1 << 20) + 100));

Review Comment:
   warning: '_level_size' is a private member of 'doris::SizeBasedCumulativeCompactionPolicy' [clang-diagnostic-error]
   ```cpp
       EXPECT_EQ(1 << 20, policy->_level_size((1 << 20) + 100));
                                  ^
   ```
   **be/src/olap/cumulative_compaction_policy.h:167:** declared private here
   ```cpp
       int64_t _level_size(const int64_t size);
               ^
   ```
   



##########
be/test/olap/cumulative_compaction_policy_test.cpp:
##########
@@ -674,18 +674,18 @@ TEST_F(TestSizeBasedCumulativeCompactionPolicy, _level_size) {
     for (auto& rowset : rs_metas) {
         _tablet_meta->add_rs_meta(rowset);
     }
-
+    config::compaction_promotion_size_mbytes = 1024;
     TabletSharedPtr _tablet(new Tablet(_tablet_meta, nullptr, CUMULATIVE_SIZE_BASED_POLICY));
     _tablet->init();
 
     SizeBasedCumulativeCompactionPolicy* policy =
             dynamic_cast<SizeBasedCumulativeCompactionPolicy*>(
                     _tablet->_cumulative_compaction_policy.get());

Review Comment:
   warning: '_cumulative_compaction_policy' is a private member of 'doris::Tablet' [clang-diagnostic-error]
   ```cpp
                       _tablet->_cumulative_compaction_policy.get());
                                ^
   ```
   **be/src/olap/tablet.h:438:** declared private here
   ```cpp
       std::shared_ptr<CumulativeCompactionPolicy> _cumulative_compaction_policy;
                                                   ^
   ```
   



##########
be/test/olap/cumulative_compaction_policy_test.cpp:
##########
@@ -674,18 +674,18 @@
     for (auto& rowset : rs_metas) {
         _tablet_meta->add_rs_meta(rowset);
     }
-
+    config::compaction_promotion_size_mbytes = 1024;
     TabletSharedPtr _tablet(new Tablet(_tablet_meta, nullptr, CUMULATIVE_SIZE_BASED_POLICY));
     _tablet->init();
 
     SizeBasedCumulativeCompactionPolicy* policy =
             dynamic_cast<SizeBasedCumulativeCompactionPolicy*>(
                     _tablet->_cumulative_compaction_policy.get());
 
-    EXPECT_EQ(536870912, policy->_levels[0]);
-    EXPECT_EQ(268435456, policy->_levels[1]);
-    EXPECT_EQ(134217728, policy->_levels[2]);
-    EXPECT_EQ(67108864, policy->_levels[3]);
+    EXPECT_EQ(1 << 29, policy->_level_size(1 << 30));

Review Comment:
   warning: '_level_size' is a private member of 'doris::SizeBasedCumulativeCompactionPolicy' [clang-diagnostic-error]
   ```cpp
       EXPECT_EQ(1 << 29, policy->_level_size(1 << 30));
                                  ^
   ```
   **be/src/olap/cumulative_compaction_policy.h:167:** declared private here
   ```cpp
       int64_t _level_size(const int64_t size);
               ^
   ```
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] github-actions[bot] commented on pull request #15633: [enhancement](compaction) Optimize calculating level size of input rowset in SizeBasedCumulativeCompactionPolicy

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #15633:
URL: https://github.com/apache/doris/pull/15633#issuecomment-1397978788

   PR approved by anyone and no changes requested.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] hello-stephen commented on pull request #15633: [enhancement](compaction) Optimize calculating level size of input rowset in SizeBasedCumulativeCompactionPolicy

Posted by GitBox <gi...@apache.org>.
hello-stephen commented on PR #15633:
URL: https://github.com/apache/doris/pull/15633#issuecomment-1371368191

   TeamCity pipeline, clickbench performance test result:
    the sum of best hot time: 36.8 seconds
    load time: 474 seconds
    storage size: 17122903688 Bytes
    https://doris-community-test-1308700295.cos.ap-hongkong.myqcloud.com/tmp/20230104200921_clickbench_pr_73810.html


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] github-actions[bot] commented on a diff in pull request #15633: [enhancement](compaction) Optimize calculating level size of input rowset in SizeBasedCumulativeCompactionPolicy

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on code in PR #15633:
URL: https://github.com/apache/doris/pull/15633#discussion_r1061684457


##########
be/src/olap/cumulative_compaction_policy.cpp:
##########
@@ -335,13 +327,12 @@
     return transient_size;
 }
 
-int SizeBasedCumulativeCompactionPolicy::_level_size(const int64_t size) {
-    for (auto& i : _levels) {
-        if (size >= i) {
-            return i;
-        }
-    }
-    return 0;
+int64_t SizeBasedCumulativeCompactionPolicy::_level_size(const int64_t size) {
+    if (size < 1024) return 0;
+    int64_t max_level = (int64_t)1
+                        << (sizeof(_promotion_size) * 8 - 1 - __builtin_clzl(_promotion_size / 2));
+    if (size >= max_level) return max_level;

Review Comment:
   warning: statement should be inside braces [readability-braces-around-statements]
   
   ```suggestion
       if (size >= max_level) { return max_level;
   }
   ```
   



##########
be/src/olap/cumulative_compaction_policy.cpp:
##########
@@ -335,13 +327,12 @@ int SizeBasedCumulativeCompactionPolicy::pick_input_rowsets(
     return transient_size;
 }
 
-int SizeBasedCumulativeCompactionPolicy::_level_size(const int64_t size) {
-    for (auto& i : _levels) {
-        if (size >= i) {
-            return i;
-        }
-    }
-    return 0;
+int64_t SizeBasedCumulativeCompactionPolicy::_level_size(const int64_t size) {
+    if (size < 1024) return 0;

Review Comment:
   warning: statement should be inside braces [readability-braces-around-statements]
   
   ```suggestion
       if (size < 1024) { return 0;
   }
   ```
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] dataroaring merged pull request #15633: [enhancement](compaction) Optimize calculating level size of input rowset in SizeBasedCumulativeCompactionPolicy

Posted by "dataroaring (via GitHub)" <gi...@apache.org>.
dataroaring merged PR #15633:
URL: https://github.com/apache/doris/pull/15633


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] platoneko commented on a diff in pull request #15633: [enhancement](compaction) Optimize calculating level size of input rowset in SizeBasedCumulativeCompactionPolicy

Posted by GitBox <gi...@apache.org>.
platoneko commented on code in PR #15633:
URL: https://github.com/apache/doris/pull/15633#discussion_r1067854490


##########
be/src/olap/cumulative_compaction_policy.cpp:
##########
@@ -335,13 +325,12 @@ int SizeBasedCumulativeCompactionPolicy::pick_input_rowsets(
     return transient_size;
 }
 
-int SizeBasedCumulativeCompactionPolicy::_level_size(const int64_t size) {
-    for (auto& i : _levels) {
-        if (size >= i) {
-            return i;
-        }
-    }
-    return 0;
+int64_t SizeBasedCumulativeCompactionPolicy::_level_size(const int64_t size) {
+    if (size < 1024) return 0;
+    int64_t max_level = (int64_t)1

Review Comment:
   Calculate the first 2 power number <= the given size.



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] github-actions[bot] commented on pull request #15633: [enhancement](compaction) Optimize calculating level size of input rowset in SizeBasedCumulativeCompactionPolicy

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on PR #15633:
URL: https://github.com/apache/doris/pull/15633#issuecomment-1397978753

   PR approved by at least one committer and no changes requested.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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


[GitHub] [doris] github-actions[bot] commented on a diff in pull request #15633: [enhancement](compaction) Optimize calculating level size of input rowset in SizeBasedCumulativeCompactionPolicy

Posted by GitBox <gi...@apache.org>.
github-actions[bot] commented on code in PR #15633:
URL: https://github.com/apache/doris/pull/15633#discussion_r1082186196


##########
be/test/olap/cumulative_compaction_policy_test.cpp:
##########
@@ -647,18 +647,18 @@ TEST_F(TestSizeBasedCumulativeCompactionPolicy, _level_size) {
     for (auto& rowset : rs_metas) {
         _tablet_meta->add_rs_meta(rowset);
     }
-
+    config::compaction_promotion_size_mbytes = 1024;
     TabletSharedPtr _tablet(new Tablet(_tablet_meta, nullptr, CUMULATIVE_SIZE_BASED_POLICY));
     _tablet->init();
 
     SizeBasedCumulativeCompactionPolicy* policy =
             dynamic_cast<SizeBasedCumulativeCompactionPolicy*>(
                     _tablet->_cumulative_compaction_policy.get());

Review Comment:
   warning: '_cumulative_compaction_policy' is a private member of 'doris::Tablet' [clang-diagnostic-error]
   ```cpp
                       _tablet->_cumulative_compaction_policy.get());
                                ^
   ```
   **be/src/olap/tablet.h:440:** declared private here
   ```cpp
       std::shared_ptr<CumulativeCompactionPolicy> _cumulative_compaction_policy;
                                                   ^
   ```
   



##########
be/test/olap/cumulative_compaction_policy_test.cpp:
##########
@@ -647,18 +647,18 @@
     for (auto& rowset : rs_metas) {
         _tablet_meta->add_rs_meta(rowset);
     }
-
+    config::compaction_promotion_size_mbytes = 1024;
     TabletSharedPtr _tablet(new Tablet(_tablet_meta, nullptr, CUMULATIVE_SIZE_BASED_POLICY));
     _tablet->init();
 
     SizeBasedCumulativeCompactionPolicy* policy =
             dynamic_cast<SizeBasedCumulativeCompactionPolicy*>(
                     _tablet->_cumulative_compaction_policy.get());
 
-    EXPECT_EQ(536870912, policy->_levels[0]);
-    EXPECT_EQ(268435456, policy->_levels[1]);
-    EXPECT_EQ(134217728, policy->_levels[2]);
-    EXPECT_EQ(67108864, policy->_levels[3]);
+    EXPECT_EQ(1 << 29, policy->_level_size(1 << 30));

Review Comment:
   warning: '_level_size' is a private member of 'doris::SizeBasedCumulativeCompactionPolicy' [clang-diagnostic-error]
   ```cpp
       EXPECT_EQ(1 << 29, policy->_level_size(1 << 30));
                                  ^
   ```
   **be/src/olap/cumulative_compaction_policy.h:158:** declared private here
   ```cpp
       int64_t _level_size(const int64_t size);
               ^
   ```
   



##########
be/test/olap/cumulative_compaction_policy_test.cpp:
##########
@@ -647,18 +647,18 @@
     for (auto& rowset : rs_metas) {
         _tablet_meta->add_rs_meta(rowset);
     }
-
+    config::compaction_promotion_size_mbytes = 1024;
     TabletSharedPtr _tablet(new Tablet(_tablet_meta, nullptr, CUMULATIVE_SIZE_BASED_POLICY));
     _tablet->init();
 
     SizeBasedCumulativeCompactionPolicy* policy =
             dynamic_cast<SizeBasedCumulativeCompactionPolicy*>(
                     _tablet->_cumulative_compaction_policy.get());
 
-    EXPECT_EQ(536870912, policy->_levels[0]);
-    EXPECT_EQ(268435456, policy->_levels[1]);
-    EXPECT_EQ(134217728, policy->_levels[2]);
-    EXPECT_EQ(67108864, policy->_levels[3]);
+    EXPECT_EQ(1 << 29, policy->_level_size(1 << 30));
+    EXPECT_EQ(0, policy->_level_size(1000));

Review Comment:
   warning: '_level_size' is a private member of 'doris::SizeBasedCumulativeCompactionPolicy' [clang-diagnostic-error]
   ```cpp
       EXPECT_EQ(0, policy->_level_size(1000));
                            ^
   ```
   **be/src/olap/cumulative_compaction_policy.h:158:** declared private here
   ```cpp
       int64_t _level_size(const int64_t size);
               ^
   ```
   



##########
be/test/olap/cumulative_compaction_policy_test.cpp:
##########
@@ -647,18 +647,18 @@
     for (auto& rowset : rs_metas) {
         _tablet_meta->add_rs_meta(rowset);
     }
-
+    config::compaction_promotion_size_mbytes = 1024;
     TabletSharedPtr _tablet(new Tablet(_tablet_meta, nullptr, CUMULATIVE_SIZE_BASED_POLICY));
     _tablet->init();
 
     SizeBasedCumulativeCompactionPolicy* policy =
             dynamic_cast<SizeBasedCumulativeCompactionPolicy*>(
                     _tablet->_cumulative_compaction_policy.get());
 
-    EXPECT_EQ(536870912, policy->_levels[0]);
-    EXPECT_EQ(268435456, policy->_levels[1]);
-    EXPECT_EQ(134217728, policy->_levels[2]);
-    EXPECT_EQ(67108864, policy->_levels[3]);
+    EXPECT_EQ(1 << 29, policy->_level_size(1 << 30));
+    EXPECT_EQ(0, policy->_level_size(1000));
+    EXPECT_EQ(1 << 20, policy->_level_size((1 << 20) + 100));
+    EXPECT_EQ(1 << 19, policy->_level_size((1 << 20) - 100));

Review Comment:
   warning: '_level_size' is a private member of 'doris::SizeBasedCumulativeCompactionPolicy' [clang-diagnostic-error]
   ```cpp
       EXPECT_EQ(1 << 19, policy->_level_size((1 << 20) - 100));
                                  ^
   ```
   **be/src/olap/cumulative_compaction_policy.h:158:** declared private here
   ```cpp
       int64_t _level_size(const int64_t size);
               ^
   ```
   



##########
be/test/olap/cumulative_compaction_policy_test.cpp:
##########
@@ -647,18 +647,18 @@
     for (auto& rowset : rs_metas) {
         _tablet_meta->add_rs_meta(rowset);
     }
-
+    config::compaction_promotion_size_mbytes = 1024;
     TabletSharedPtr _tablet(new Tablet(_tablet_meta, nullptr, CUMULATIVE_SIZE_BASED_POLICY));
     _tablet->init();
 
     SizeBasedCumulativeCompactionPolicy* policy =
             dynamic_cast<SizeBasedCumulativeCompactionPolicy*>(
                     _tablet->_cumulative_compaction_policy.get());
 
-    EXPECT_EQ(536870912, policy->_levels[0]);
-    EXPECT_EQ(268435456, policy->_levels[1]);
-    EXPECT_EQ(134217728, policy->_levels[2]);
-    EXPECT_EQ(67108864, policy->_levels[3]);
+    EXPECT_EQ(1 << 29, policy->_level_size(1 << 30));
+    EXPECT_EQ(0, policy->_level_size(1000));
+    EXPECT_EQ(1 << 20, policy->_level_size((1 << 20) + 100));

Review Comment:
   warning: '_level_size' is a private member of 'doris::SizeBasedCumulativeCompactionPolicy' [clang-diagnostic-error]
   ```cpp
       EXPECT_EQ(1 << 20, policy->_level_size((1 << 20) + 100));
                                  ^
   ```
   **be/src/olap/cumulative_compaction_policy.h:158:** declared private here
   ```cpp
       int64_t _level_size(const int64_t size);
               ^
   ```
   



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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