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

gabriellee 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 aafa227cf84 [fix](result sink) Fix empty sender if exists (#48614)
aafa227cf84 is described below

commit aafa227cf8497de5c93962088d6162a976d3a05a
Author: Gabriel <liwenqi...@selectdb.com>
AuthorDate: Tue Mar 4 17:51:42 2025 +0800

    [fix](result sink) Fix empty sender if exists (#48614)
    
    If a sender already exists, we should obtain the previous one when we
    create senders with the same query ID.
---
 be/src/runtime/result_buffer_mgr.cpp       | 1 +
 be/test/runtime/result_buffer_mgr_test.cpp | 5 +++++
 2 files changed, 6 insertions(+)

diff --git a/be/src/runtime/result_buffer_mgr.cpp 
b/be/src/runtime/result_buffer_mgr.cpp
index 38e33eb89ae..541e9c06955 100644
--- a/be/src/runtime/result_buffer_mgr.cpp
+++ b/be/src/runtime/result_buffer_mgr.cpp
@@ -79,6 +79,7 @@ Status ResultBufferMgr::create_sender(const TUniqueId& 
query_id, int buffer_size
 
         if (_buffer_map.end() != iter) {
             LOG(WARNING) << "already have buffer control block for this 
instance " << query_id;
+            *sender = iter->second;
             return Status::OK();
         }
     }
diff --git a/be/test/runtime/result_buffer_mgr_test.cpp 
b/be/test/runtime/result_buffer_mgr_test.cpp
index 831a0079da2..6983acd681f 100644
--- a/be/test/runtime/result_buffer_mgr_test.cpp
+++ b/be/test/runtime/result_buffer_mgr_test.cpp
@@ -46,6 +46,11 @@ TEST_F(ResultBufferMgrTest, create_normal) {
 
     std::shared_ptr<ResultBlockBufferBase> control_block1;
     EXPECT_TRUE(buffer_mgr.create_sender(query_id, 1024, &control_block1, 
&_state, false).ok());
+    EXPECT_NE(control_block1, nullptr);
+    control_block1.reset();
+
+    EXPECT_TRUE(buffer_mgr.create_sender(query_id, 1024, &control_block1, 
&_state, false).ok());
+    EXPECT_NE(control_block1, nullptr);
 }
 
 TEST_F(ResultBufferMgrTest, create_arrow) {


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

Reply via email to