Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions be/src/vec/sink/writer/vtablet_writer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -357,18 +357,20 @@ Status VNodeChannel::init(RuntimeState* state) {
_cur_add_block_request->set_eos(false);

// add block closure
// Has to using value to capture _task_exec_ctx because tablet writer may destroyed during callback.
_send_block_callback = WriteBlockCallback<PTabletWriterAddBlockResult>::create_shared();
_send_block_callback->addFailedHandler([this](bool is_last_rpc) {
auto ctx_lock = _task_exec_ctx.lock();
_send_block_callback->addFailedHandler([&, task_exec_ctx = _task_exec_ctx](bool is_last_rpc) {
auto ctx_lock = task_exec_ctx.lock();
if (ctx_lock == nullptr) {
return;
}
_add_block_failed_callback(is_last_rpc);
});

_send_block_callback->addSuccessHandler(
[this](const PTabletWriterAddBlockResult& result, bool is_last_rpc) {
auto ctx_lock = _task_exec_ctx.lock();
[&, task_exec_ctx = _task_exec_ctx](const PTabletWriterAddBlockResult& result,
bool is_last_rpc) {
auto ctx_lock = task_exec_ctx.lock();
if (ctx_lock == nullptr) {
return;
}
Expand Down