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

commit c43bc8349fcd6f11a5a300c3b0e626b07cc93dfe
Author: Kaijie Chen <c...@apache.org>
AuthorDate: Tue Mar 5 19:06:00 2024 +0800

    [fix](move-memtable) free resources when fail to open stream (#31762)
---
 be/src/vec/sink/load_stream_stub.cpp | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/be/src/vec/sink/load_stream_stub.cpp 
b/be/src/vec/sink/load_stream_stub.cpp
index de1ade5aadb..bb12f4fdf0d 100644
--- a/be/src/vec/sink/load_stream_stub.cpp
+++ b/be/src/vec/sink/load_stream_stub.cpp
@@ -164,7 +164,8 @@ Status LoadStreamStub::open(std::shared_ptr<LoadStreamStub> 
self,
     opt.messages_in_batch = config::load_stream_messages_in_batch;
     opt.handler = new LoadStreamReplyHandler(_load_id, _dst_id, self);
     brpc::Controller cntl;
-    if (int ret = StreamCreate(&_stream_id, cntl, &opt)) {
+    if (int ret = brpc::StreamCreate(&_stream_id, cntl, &opt)) {
+        delete opt.handler;
         return Status::Error<true>(ret, "Failed to create stream");
     }
     cntl.set_timeout_ms(config::open_load_stream_timeout_ms);
@@ -192,6 +193,7 @@ Status LoadStreamStub::open(std::shared_ptr<LoadStreamStub> 
self,
                                               
resp.enable_unique_key_merge_on_write());
     }
     if (cntl.Failed()) {
+        brpc::StreamClose(_stream_id);
         return Status::InternalError("Failed to connect to backend {}: {}", 
_dst_id,
                                      cntl.ErrorText());
     }


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

Reply via email to