From 607fc15d09b14313a3bdb11ed6b05e9dbecdca7c Mon Sep 17 00:00:00 2001 From: Kaijie Chen Date: Tue, 6 Aug 2024 17:39:33 +0800 Subject: [PATCH] [fix](move-memtable) close stream when cancel load stream stub (#38912) Fix load stream leak when sink v2 meet error. Tested by `check_before_quit.groovy`. --- be/src/vec/sink/load_stream_stub.cpp | 3 +++ 1 file changed, 3 insertions(+) diff --git a/be/src/vec/sink/load_stream_stub.cpp b/be/src/vec/sink/load_stream_stub.cpp index 93f3fd87a8571d..dc34b13e0ac155 100644 --- a/be/src/vec/sink/load_stream_stub.cpp +++ b/be/src/vec/sink/load_stream_stub.cpp @@ -338,6 +338,9 @@ Status LoadStreamStub::close_wait(RuntimeState* state, int64_t timeout_ms) { void LoadStreamStub::cancel(Status reason) { LOG(WARNING) << *this << " is cancelled because of " << reason; + if (_is_init.load()) { + brpc::StreamClose(_stream_id); + } { std::lock_guard lock(_cancel_mutex); _cancel_reason = reason;