This is an automated email from the ASF dual-hosted git repository.

morningman pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new d5d3f7e0b7 [fix](memtracker) Fix thrift BackendService thread local is 
not initialized, memtracker init fail (#14589)
d5d3f7e0b7 is described below

commit d5d3f7e0b7c6b3e720538489191652da436a9d16
Author: Xinyi Zou <zouxiny...@gmail.com>
AuthorDate: Sat Nov 26 13:04:39 2022 +0800

    [fix](memtracker) Fix thrift BackendService thread local is not 
initialized, memtracker init fail (#14589)
---
 be/src/runtime/fragment_mgr.cpp       | 4 ++++
 be/src/runtime/memory/mem_tracker.cpp | 3 +--
 be/src/runtime/memory/mem_tracker.h   | 4 ++--
 3 files changed, 7 insertions(+), 4 deletions(-)

diff --git a/be/src/runtime/fragment_mgr.cpp b/be/src/runtime/fragment_mgr.cpp
index 09ccb4ef23..b4e0595451 100644
--- a/be/src/runtime/fragment_mgr.cpp
+++ b/be/src/runtime/fragment_mgr.cpp
@@ -659,6 +659,10 @@ Status FragmentMgr::exec_plan_fragment(const 
TExecPlanFragmentParams& params, Fi
             fragments_ctx->query_mem_tracker = 
std::make_shared<MemTrackerLimiter>(
                     MemTrackerLimiter::Type::LOAD,
                     fmt::format("Load#Id={}", 
print_id(fragments_ctx->query_id)), bytes_limit);
+        } else { // EXTERNAL
+            fragments_ctx->query_mem_tracker = 
std::make_shared<MemTrackerLimiter>(
+                    MemTrackerLimiter::Type::LOAD,
+                    fmt::format("External#Id={}", 
print_id(fragments_ctx->query_id)), bytes_limit);
         }
         if (params.query_options.__isset.is_report_success &&
             params.query_options.is_report_success) {
diff --git a/be/src/runtime/memory/mem_tracker.cpp 
b/be/src/runtime/memory/mem_tracker.cpp
index 4248ae99f2..34baeb9ff3 100644
--- a/be/src/runtime/memory/mem_tracker.cpp
+++ b/be/src/runtime/memory/mem_tracker.cpp
@@ -61,8 +61,7 @@ MemTracker::MemTracker(const std::string& label, 
RuntimeProfile* profile, MemTra
     if (parent) {
         _parent_label = parent->label();
         _parent_group_num = parent->group_num();
-    } else {
-        DCHECK(thread_context()->thread_mem_tracker_mgr->limiter_mem_tracker() 
!= nullptr);
+    } else if (thread_context_ptr.init) {
         _parent_label = thread_context()->thread_mem_tracker()->label();
         _parent_group_num = 
thread_context()->thread_mem_tracker()->group_num();
     }
diff --git a/be/src/runtime/memory/mem_tracker.h 
b/be/src/runtime/memory/mem_tracker.h
index 5ffcaa30a1..bf468043e1 100644
--- a/be/src/runtime/memory/mem_tracker.h
+++ b/be/src/runtime/memory/mem_tracker.h
@@ -94,8 +94,8 @@ protected:
     std::shared_ptr<RuntimeProfile::HighWaterMarkCounter> _consumption; // in 
bytes
 
     // Tracker is located in group num in mem_tracker_pool
-    int64_t _parent_group_num;
-    std::string _parent_label;
+    int64_t _parent_group_num = 0;
+    std::string _parent_label = "-";
 
     // Iterator into mem_tracker_pool for this object. Stored to have O(1) 
remove.
     std::list<MemTracker*>::iterator _tracker_group_it;


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

Reply via email to