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

morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new aab2f22f071 [fix](binlog compaction): cumu policy may be null (#65032)
aab2f22f071 is described below

commit aab2f22f071b09434a0909b21cc5536041e339d1
Author: Userwhite <[email protected]>
AuthorDate: Wed Jul 1 11:20:24 2026 +0800

    [fix](binlog compaction): cumu policy may be null (#65032)
    
    ### What problem does this PR solve?
    
    ensure cumu policy is not null if do binlog compaction first.
---
 be/src/storage/tablet/tablet.cpp         | 3 ++-
 be/src/storage/tablet/tablet_manager.cpp | 7 ++-----
 2 files changed, 4 insertions(+), 6 deletions(-)

diff --git a/be/src/storage/tablet/tablet.cpp b/be/src/storage/tablet/tablet.cpp
index 84b083d112b..25189c32921 100644
--- a/be/src/storage/tablet/tablet.cpp
+++ b/be/src/storage/tablet/tablet.cpp
@@ -1209,7 +1209,8 @@ bool Tablet::suitable_for_compaction(
         CompactionType compaction_type,
         std::shared_ptr<CumulativeCompactionPolicy> 
cumulative_compaction_policy) {
 #ifndef BE_TEST
-    if (compaction_type == CompactionType::CUMULATIVE_COMPACTION &&
+    if ((compaction_type == CompactionType::CUMULATIVE_COMPACTION ||
+         compaction_type == CompactionType::BINLOG_COMPACTION) &&
         cumulative_compaction_policy != nullptr) {
         std::lock_guard wrlock(_meta_lock);
         if (_cumulative_compaction_policy == nullptr ||
diff --git a/be/src/storage/tablet/tablet_manager.cpp 
b/be/src/storage/tablet/tablet_manager.cpp
index f53ff7a9017..c27215d3b91 100644
--- a/be/src/storage/tablet/tablet_manager.cpp
+++ b/be/src/storage/tablet/tablet_manager.cpp
@@ -814,11 +814,8 @@ std::vector<TabletCompactionContext> 
TabletManager::find_best_tablets_to_compact
                 return;
             }
         }
-        std::shared_ptr<CumulativeCompactionPolicy> 
cumulative_compaction_policy;
-        if (compaction_type != CompactionType::BINLOG_COMPACTION) {
-            cumulative_compaction_policy = 
all_cumulative_compaction_policies.at(
-                    tablet_ptr->tablet_meta()->compaction_policy());
-        }
+        auto cumulative_compaction_policy = 
all_cumulative_compaction_policies.at(
+                tablet_ptr->tablet_meta()->compaction_policy());
         int8_t prefer_compaction_level = -1;
         uint32_t current_compaction_score =
                 tablet_ptr->calc_compaction_score(compaction_type, 
&prefer_compaction_level);


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

Reply via email to