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

hello-stephen 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 c88de29df7d [fix](core): fix cumu policy npe when do binlog schedule 
(#64249)
c88de29df7d is described below

commit c88de29df7d3119b93d27e1986aa4054fa05e1c7
Author: Userwhite <[email protected]>
AuthorDate: Wed Jun 10 10:25:05 2026 +0800

    [fix](core): fix cumu policy npe when do binlog schedule (#64249)
---
 be/src/storage/tablet/tablet.cpp | 17 +++++++++++------
 1 file changed, 11 insertions(+), 6 deletions(-)

diff --git a/be/src/storage/tablet/tablet.cpp b/be/src/storage/tablet/tablet.cpp
index ef745fb56fe..d782574638b 100644
--- a/be/src/storage/tablet/tablet.cpp
+++ b/be/src/storage/tablet/tablet.cpp
@@ -1205,6 +1205,17 @@ uint32_t Tablet::calc_compaction_score(CompactionType 
compaction_type,
 bool Tablet::suitable_for_compaction(
         CompactionType compaction_type,
         std::shared_ptr<CumulativeCompactionPolicy> 
cumulative_compaction_policy) {
+#ifndef BE_TEST
+    if (compaction_type == CompactionType::CUMULATIVE_COMPACTION &&
+        cumulative_compaction_policy != nullptr) {
+        std::lock_guard<std::shared_mutex> wrlock(_meta_lock);
+        if (_cumulative_compaction_policy == nullptr ||
+            _cumulative_compaction_policy->name() != 
cumulative_compaction_policy->name()) {
+            _cumulative_compaction_policy = cumulative_compaction_policy;
+        }
+    }
+#endif
+
     // Need meta lock, because it will iterator "all_rs_metas" of tablet meta.
     std::shared_lock rdlock(_meta_lock);
     int32_t score = -1;
@@ -1252,12 +1263,6 @@ uint32_t Tablet::_calc_cumulative_compaction_score(
     if (cumulative_compaction_policy == nullptr) [[unlikely]] {
         return 0;
     }
-#ifndef BE_TEST
-    if (_cumulative_compaction_policy == nullptr ||
-        _cumulative_compaction_policy->name() != 
cumulative_compaction_policy->name()) {
-        _cumulative_compaction_policy = cumulative_compaction_policy;
-    }
-#endif
     DBUG_EXECUTE_IF("Tablet._calc_cumulative_compaction_score.return", {
         LOG_WARNING("Tablet._calc_cumulative_compaction_score.return")
                 .tag("tablet id", tablet_id());


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

Reply via email to