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

yiguolei pushed a commit to branch branch-4.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-4.1 by this push:
     new 3fadbb635b8 branch-4.1: [fix](cloud) Guard sync rowset statistics with 
task context #67942 (#67964)
3fadbb635b8 is described below

commit 3fadbb635b8fa36345b8b0c384d5da603630137d
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Tue Sep 15 11:59:18 2026 +0800

    branch-4.1: [fix](cloud) Guard sync rowset statistics with task context 
#67942 (#67964)
    
    Cherry-picked from #67942
    
    Co-authored-by: bobhan1 <[email protected]>
---
 be/src/exec/operator/olap_scan_operator.cpp | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/be/src/exec/operator/olap_scan_operator.cpp 
b/be/src/exec/operator/olap_scan_operator.cpp
index 5a09111d94b..051a8b5348a 100644
--- a/be/src/exec/operator/olap_scan_operator.cpp
+++ b/be/src/exec/operator/olap_scan_operator.cpp
@@ -670,16 +670,17 @@ Status 
OlapScanLocalState::_sync_cloud_tablets(RuntimeState* state) {
                 tasks.emplace_back([this, sync_stats, version, i, task_ctx, 
task_create_time]() {
                     // Record bthread scheduling delay
                     auto task_start_time = std::chrono::steady_clock::now();
+                    auto task_lock = task_ctx.lock();
+                    if (task_lock == nullptr) {
+                        return Status::OK();
+                    }
+                    // The local state owns sync_stats, so keep its context 
alive before access.
                     if (sync_stats) {
                         sync_stats->bthread_schedule_delay_ns +=
                                 
std::chrono::duration_cast<std::chrono::nanoseconds>(
                                         task_start_time - task_create_time)
                                         .count();
                     }
-                    auto task_lock = task_ctx.lock();
-                    if (task_lock == nullptr) {
-                        return Status::OK();
-                    }
                     Defer defer([&] {
                         if (_pending_tablets_num.fetch_sub(1) == 1) {
                             _cloud_tablet_dependency->set_ready();


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

Reply via email to