platoneko commented on code in PR #10280:
URL: https://github.com/apache/doris/pull/10280#discussion_r911967400


##########
be/src/olap/base_compaction.cpp:
##########
@@ -106,14 +106,11 @@ Status BaseCompaction::pick_rowsets_to_compact() {
     }
 
     // 2. the ratio between base rowset and all input cumulative rowsets 
reaches the threshold
-    int64_t base_size = 0;
+    // `_input_rowsets` has been sorted by end version, so we consider 
`_input_rowsets[0]` is the base rowset.
+    int64_t base_size = _input_rowsets.front()->data_disk_size();
     int64_t cumulative_total_size = 0;
-    for (auto& rowset : _input_rowsets) {
-        if (rowset->start_version() != 0) {
-            cumulative_total_size += rowset->data_disk_size();
-        } else {
-            base_size = rowset->data_disk_size();
-        }
+    for (auto it = _input_rowsets.begin() + 1; it != _input_rowsets.end(); 
++it) {

Review Comment:
   _input_rowsets has been sorted at line 89, and _check_rowset_overlapping at 
line 91. So i think it has been in order.



-- 
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-unsubscr...@doris.apache.org

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


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

Reply via email to