github-actions[bot] commented on code in PR #65470:
URL: https://github.com/apache/doris/pull/65470#discussion_r3679611746


##########
be/src/cloud/cloud_cumulative_compaction_policy.cpp:
##########
@@ -134,11 +135,19 @@ int64_t 
CloudSizeBasedCumulativeCompactionPolicy::pick_input_rowsets(
         // Keep at least 1 rowset to avoid removing the only rowset 
(consistent with fallback branch)
         while (input_rowsets->size() > 1 &&
                *compaction_score > static_cast<size_t>(max_compaction_score)) {
-            auto& last_rowset = input_rowsets->back();
-            *compaction_score -= 
last_rowset->rowset_meta()->get_compaction_score();
-            total_size -= last_rowset->rowset_meta()->total_disk_size();
+            last_popped = std::move(input_rowsets->back());
+            *compaction_score -= 
last_popped->rowset_meta()->get_compaction_score();
+            total_size -= last_popped->rowset_meta()->total_disk_size();
             input_rowsets->pop_back();
         }
+        // A single non-overlapping rowset cannot be compacted by itself. 
Restore the direct
+        // successor and accept a one-off max-score overshoot to keep the 
input mergeable.
+        if (input_rowsets->size() == 1 && last_popped != nullptr &&

Review Comment:
   [P1] Preserve mergeability after cloud transaction truncation
   
   `CloudCumulativeCompaction::pick_rowsets_to_compact()` validates this 
restored pair before calling `apply_txn_size_truncation_and_log()`. If the 
pair's serialized metadata exceeds `compaction_txn_max_size_bytes`, that later 
step keeps the first rowset and drops this successor, but still returns 
success. With the new test's empty `[13-56]` predecessor, compaction then 
recreates the same zero-byte version and `new_cumulative_point()` remains 13 
(including MoW, because the 43-version span is below the default promotion 
count), so the next run repeats while `[57-57]` stays unprocessed. Please 
preserve or revalidate the cumulative mergeability invariant after 
transaction-size limiting, and cover this at `CloudCumulativeCompaction` level 
with a forced-small transaction threshold.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to