yangzhg commented on a change in pull request #8605:
URL: https://github.com/apache/incubator-doris/pull/8605#discussion_r832908568



##########
File path: be/src/exec/except_node.cpp
##########
@@ -40,6 +41,7 @@ Status ExceptNode::init(const TPlanNode& tnode, RuntimeState* 
state) {
 
 Status ExceptNode::open(RuntimeState* state) {
     RETURN_IF_ERROR(SetOperationNode::open(state));
+    SCOPED_SWITCH_THREAD_LOCAL_MEM_TRACKER_AND_ERR_CB(mem_tracker(), "Except , 
while probing the hash table.");

Review comment:
       ```suggestion
       SCOPED_SWITCH_THREAD_LOCAL_MEM_TRACKER_AND_ERR_CB(mem_tracker(), "Except 
Node, while probing the hash table.");
   ```

##########
File path: be/src/runtime/thread_mem_tracker_mgr.h
##########
@@ -101,13 +93,36 @@ class ThreadMemTrackerMgr {
     // Thread update_tracker may be called very frequently, adding a memory 
copy will be slow.
     std::string update_tracker(const std::shared_ptr<MemTracker>& mem_tracker);
 
+    void update_tracker_id(const std::string& tracker_id) {
+        if (tracker_id != _tracker_id) {
+            _untracked_mems[_tracker_id] += _untracked_mem;
+            _untracked_mem = 0;
+            _tracker_id = tracker_id;
+        }
+    }
+
+    inline ConsumeErrCallBackInfo update_consume_err_cb(const std::string& 
cancel_msg,
+                                                        bool cancel_task, 
ERRCALLBACK cb_func) {
+        _temp_consume_err_cb = _consume_err_cb;
+        _consume_err_cb.cancel_msg = cancel_msg;
+        _consume_err_cb.cancel_task = cancel_task;
+        _consume_err_cb.cb_func = cb_func;
+        return _temp_consume_err_cb;
+    }
+
+    inline void update_consume_err_call_back(const ConsumeErrCallBackInfo& 
consume_err_cb) {
+        _consume_err_cb = consume_err_cb;
+    }
+
     // Note that, If call the memory allocation operation in TCMalloc 
new/delete Hook,
     // such as calling LOG/iostream/sstream/stringstream/etc. related methods,
     // must increase the control to avoid entering infinite recursion, 
otherwise it may cause crash or stuck,
     void cache_consume(int64_t size);
 
     void noncache_consume();
 
+    bool attach_task() { return _task_id != ""; }

Review comment:
       Rename this function

##########
File path: be/src/vec/exec/vcross_join_node.cpp
##########
@@ -53,6 +54,7 @@ Status VCrossJoinNode::close(RuntimeState* state) {
 Status VCrossJoinNode::construct_build_side(RuntimeState* state) {
     // Do a full scan of child(1) and store all build row batches.
     RETURN_IF_ERROR(child(1)->open(state));
+    SCOPED_SWITCH_THREAD_LOCAL_MEM_TRACKER_ERR_CB("Cross join, while getting 
next from the child 1");

Review comment:
       ```suggestion
       SCOPED_SWITCH_THREAD_LOCAL_MEM_TRACKER_ERR_CB("Vec Cross join, while 
getting next from child 1");
   ```

##########
File path: be/src/runtime/thread_mem_tracker_mgr.h
##########
@@ -80,7 +72,7 @@ class ThreadMemTrackerMgr {
     }
 
     void clear_untracked_mems() {
-        for(auto untracked_mem : _untracked_mems) {
+        for (auto untracked_mem : _untracked_mems) {

Review comment:
       ```suggestion
           for (const auto& untracked_mem : _untracked_mems) {
   ```

##########
File path: be/src/exec/intersect_node.cpp
##########
@@ -44,6 +45,7 @@ Status IntersectNode::init(const TPlanNode& tnode, 
RuntimeState* state) {
 // repeat [2] this for all the rest child
 Status IntersectNode::open(RuntimeState* state) {
     RETURN_IF_ERROR(SetOperationNode::open(state));
+    SCOPED_SWITCH_THREAD_LOCAL_MEM_TRACKER_AND_ERR_CB(mem_tracker(), 
"Intersect , while probing the hash table.");

Review comment:
       ```suggestion
       SCOPED_SWITCH_THREAD_LOCAL_MEM_TRACKER_AND_ERR_CB(mem_tracker(), 
"Intersect Node, while probing the hash table.");
   ```

##########
File path: be/src/runtime/thread_mem_tracker_mgr.cpp
##########
@@ -70,12 +72,12 @@ void ThreadMemTrackerMgr::exceeded_cancel_task(const 
std::string& cancel_details
 
 void ThreadMemTrackerMgr::exceeded(int64_t mem_usage, Status st) {
     auto rst = _mem_trackers[_tracker_id]->mem_limit_exceeded(
-            nullptr, "In TCMalloc Hook, " + 
_consume_err_call_back.action_type, mem_usage, st);
-    if (_consume_err_call_back.call_back_func != nullptr) {
-        _consume_err_call_back.call_back_func();
+            nullptr, "In TCMalloc Hook, " + _consume_err_cb.cancel_msg, 
mem_usage, st);

Review comment:
       ```suggestion
               nullptr, fmt::format("In TCMalloc Hook, {}", 
_consume_err_cb.cancel_msg), mem_usage, st);
   ```

##########
File path: be/src/vec/exec/vset_operation_node.cpp
##########
@@ -228,6 +229,8 @@ void VSetOperationNode::hash_table_init() {
 //build a hash table from child(0)
 Status VSetOperationNode::hash_table_build(RuntimeState* state) {
     RETURN_IF_ERROR(child(0)->open(state));
+    SCOPED_SWITCH_THREAD_LOCAL_MEM_TRACKER_ERR_CB(
+                "Set Operation Node, while constructing the hash table");

Review comment:
       ```suggestion
                   "Vec Set Operation Node, while constructing the hash table");
   ```




-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to