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


##########
be/src/olap/cumulative_compaction_time_series_policy.cpp:
##########
@@ -164,7 +168,15 @@ int 
TimeSeriesCumulativeCompactionPolicy::pick_input_rowsets(
     input_rowsets->clear();
     int64_t total_size = 0;
 
-    for (auto& rowset : candidate_rowsets) {
+    std::vector<RowsetSharedPtr> filtered_rowsets;
+    // when single replica compaction is enabled and BE1 fetchs merged rowsets 
from BE2, and then BE2 goes offline.
+    // BE1 should performs compaction on its own, the time series compaction 
may re-compact previously fetched rowsets.
+    // time series compaction policy needs to skip over the fetched rowset
+    const auto& first_rowset_iter = std::find_if(
+            candidate_rowsets.begin(), candidate_rowsets.end(),
+            [](const RowsetSharedPtr& rs) { return rs->start_version() == 
rs->end_version(); });
+    filtered_rowsets.assign(first_rowset_iter, candidate_rowsets.end());
+    for (auto& rowset : filtered_rowsets) {

Review Comment:
   
   ```suggestion
       for (auto it = first_rowset_iter; it != candidate_rowsets.end(); ++it) {
   ```



-- 
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