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 d6f4db41700 [fix](load) fix metrics memtable_flush_duration_us 
(#47607) (#48213)
d6f4db41700 is described below

commit d6f4db41700fcc7106f203f4d1f75a423432d9d3
Author: Kaijie Chen <chenkai...@selectdb.com>
AuthorDate: Tue Feb 25 21:13:03 2025 +0800

    [fix](load) fix metrics memtable_flush_duration_us (#47607) (#48213)
    
    backport #47607
---
 be/src/olap/memtable_flush_executor.cpp | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/be/src/olap/memtable_flush_executor.cpp 
b/be/src/olap/memtable_flush_executor.cpp
index 30d06f70126..6200bf16566 100644
--- a/be/src/olap/memtable_flush_executor.cpp
+++ b/be/src/olap/memtable_flush_executor.cpp
@@ -145,12 +145,10 @@ Status FlushToken::_do_flush_memtable(MemTable* memtable, 
int32_t segment_id, in
     VLOG_CRITICAL << "begin to flush memtable for tablet: " << 
memtable->tablet_id()
                   << ", memsize: " << memtable->memory_usage()
                   << ", rows: " << memtable->stat().raw_rows;
-    int64_t duration_ns;
-    SCOPED_RAW_TIMER(&duration_ns);
-    SCOPED_ATTACH_TASK(memtable->query_thread_context());
-    signal::set_signal_task_id(_rowset_writer->load_id());
-    signal::tablet_id = memtable->tablet_id();
+    int64_t duration_ns = 0;
     {
+        SCOPED_RAW_TIMER(&duration_ns);
+        SCOPED_ATTACH_TASK(memtable->query_thread_context());
         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.
@@ -169,6 +167,8 @@ Status FlushToken::_do_flush_memtable(MemTable* memtable, 
int32_t segment_id, in
 
 void FlushToken::_flush_memtable(std::unique_ptr<MemTable> memtable_ptr, 
int32_t segment_id,
                                  int64_t submit_task_time) {
+    signal::set_signal_task_id(_rowset_writer->load_id());
+    signal::tablet_id = memtable_ptr->tablet_id();
     Defer defer {[&]() {
         std::lock_guard<std::mutex> lock(_mutex);
         _stats.flush_running_count--;


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

Reply via email to