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


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new 76c7bf0785a [bugfix](loadmem) load memory is too small because flush 
memory is not right (#40696) (#40884)
76c7bf0785a is described below

commit 76c7bf0785a96902924d2f8b58c60e77d4ac38c7
Author: yiguolei <676222...@qq.com>
AuthorDate: Mon Sep 16 12:25:30 2024 +0800

    [bugfix](loadmem) load memory is too small because flush memory is not 
right (#40696) (#40884)
---
 be/src/olap/memtable_flush_executor.cpp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/be/src/olap/memtable_flush_executor.cpp 
b/be/src/olap/memtable_flush_executor.cpp
index cf96d5f46a5..704e8b280bc 100644
--- a/be/src/olap/memtable_flush_executor.cpp
+++ b/be/src/olap/memtable_flush_executor.cpp
@@ -142,9 +142,12 @@ Status FlushToken::_do_flush_memtable(MemTable* memtable, 
int32_t segment_id, in
     signal::set_signal_task_id(_rowset_writer->load_id());
     signal::tablet_id = memtable->tablet_id();
     {
-        SCOPED_CONSUME_MEM_TRACKER(memtable->flush_mem_tracker());
         std::unique_ptr<vectorized::Block> block;
+        // During to block method, it will release old memory and create new 
block, so that
+        // we could not scoped it.
         RETURN_IF_ERROR(memtable->to_block(&block));
+        memtable->flush_mem_tracker()->consume(block->allocated_bytes());
+        SCOPED_CONSUME_MEM_TRACKER(memtable->flush_mem_tracker());
         RETURN_IF_ERROR(_rowset_writer->flush_memtable(block.get(), 
segment_id, flush_size));
     }
     _memtable_stat += memtable->stat();


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

Reply via email to