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

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


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new 9ccfff12ab7 [pick](branch-2.1) pick #46266 (#46840)
9ccfff12ab7 is described below

commit 9ccfff12ab7e57789d9b3410cce09458ae59698f
Author: Xinyi Zou <zouxi...@selectdb.com>
AuthorDate: Mon Jan 13 10:37:11 2025 +0800

    [pick](branch-2.1) pick #46266 (#46840)
    
    ### What problem does this PR solve?
    
    ```
    [fix](cancel) Fix BufferControlBlock cancel msg #46266
    ```
---
 be/src/runtime/buffer_control_block.cpp | 7 +++++--
 be/src/runtime/result_buffer_mgr.cpp    | 5 +++--
 2 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/be/src/runtime/buffer_control_block.cpp 
b/be/src/runtime/buffer_control_block.cpp
index f75b4601c77..af7ebf2ec64 100644
--- a/be/src/runtime/buffer_control_block.cpp
+++ b/be/src/runtime/buffer_control_block.cpp
@@ -172,7 +172,10 @@ BufferControlBlock::BufferControlBlock(const TUniqueId& 
id, int buffer_size, Run
 }
 
 BufferControlBlock::~BufferControlBlock() {
-    cancel(Status::Cancelled("Cancelled"));
+    cancel(Status::Cancelled(
+            "BufferControlBlock is destructed, this is not the expected path, 
the correct path is "
+            "ResultBufferMgr::cancel before the destructor, fragmentId: {}",
+            print_id(_fragment_id)));
 }
 
 Status BufferControlBlock::init() {
@@ -447,7 +450,7 @@ void BufferControlBlock::cancel(const Status& reason) {
     }
     _waiting_rpc.clear();
     for (auto& ctx : _waiting_arrow_result_batch_rpc) {
-        ctx->on_failure(Status::Cancelled("Cancelled"));
+        ctx->on_failure(reason);
     }
     _waiting_arrow_result_batch_rpc.clear();
     _arrow_flight_result_batch_queue.clear();
diff --git a/be/src/runtime/result_buffer_mgr.cpp 
b/be/src/runtime/result_buffer_mgr.cpp
index a15b3115d18..d1ef6711204 100644
--- a/be/src/runtime/result_buffer_mgr.cpp
+++ b/be/src/runtime/result_buffer_mgr.cpp
@@ -216,8 +216,9 @@ void ResultBufferMgr::cancel_thread() {
         }
 
         // cancel query
-        for (int i = 0; i < query_to_cancel.size(); ++i) {
-            cancel(query_to_cancel[i], Status::TimedOut("Query tiemout"));
+        for (const auto& id : query_to_cancel) {
+            cancel(id, Status::Cancelled("Clean up expired BufferControlBlock, 
queryId: {}",
+                                         print_id(id)));
         }
     } while 
(!_stop_background_threads_latch.wait_for(std::chrono::seconds(1)));
 


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to