From 853902d4cdb79d1c73fdf9152fdea96adbf4b4d4 Mon Sep 17 00:00:00 2001 From: zhangqiang Date: Wed, 16 Oct 2024 15:54:12 +0800 Subject: [PATCH] [BugFix] Fix tablet not release if ingestion transaction is abort (#51932) ## Why I'm doing: We will back pressure OlapTableSink since there are too many memtables need to flush. However, if table is dropped by force and we will abort the running ingestion task and remove all the flush memtable task in the task queue. However, we do not clear the statistic, we will release tablet until the request time out which will result in delayed disk space reclamation. ## What I'm doing: Do not wait timeout if find the delta writer state is abort. Fixes https://github.com/StarRocks/StarRocksTest/issues/8666 Signed-off-by: sevev (cherry picked from commit 95f29c4ca62c8b9c8c9a1833fdf63077016b07c0) --- be/src/runtime/local_tablets_channel.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/be/src/runtime/local_tablets_channel.cpp b/be/src/runtime/local_tablets_channel.cpp index c2ed431e47764..4de7c18dd80b0 100644 --- a/be/src/runtime/local_tablets_channel.cpp +++ b/be/src/runtime/local_tablets_channel.cpp @@ -267,7 +267,8 @@ void LocalTabletsChannel::add_chunk(Chunk* chunk, const PTabletWriterAddChunkReq auto& delta_writer = it->second; // back pressure OlapTableSink since there are too many memtables need to flush - while (delta_writer->get_flush_stats().queueing_memtable_num >= config::max_queueing_memtable_per_tablet) { + while (delta_writer->get_state() != kAborted && + delta_writer->get_flush_stats().queueing_memtable_num >= config::max_queueing_memtable_per_tablet) { if (watch.elapsed_time() / 1000000 > request.timeout_ms()) { LOG(INFO) << "LocalTabletsChannel txn_id: " << _txn_id << " load_id: " << print_id(request.id()) << " wait tablet " << tablet_id << " flush memtable " << request.timeout_ms()