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

zouxinyi 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 f87be09d69 [fix](load) Fix load channel mgr lock (#13960)
f87be09d69 is described below

commit f87be09d694b1947ccf615efa4fc4d2b12eddb58
Author: Xinyi Zou <zouxiny...@gmail.com>
AuthorDate: Sat Nov 5 00:48:30 2022 +0800

    [fix](load) Fix load channel mgr lock (#13960)
    
    hot fix load channel mgr lock
---
 be/src/olap/delta_writer.cpp             | 6 +++++-
 be/src/runtime/load_channel_mgr.h        | 1 +
 be/src/vec/exec/join/vhash_join_node.cpp | 2 +-
 3 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/be/src/olap/delta_writer.cpp b/be/src/olap/delta_writer.cpp
index a748f566c1..5ec23ea593 100644
--- a/be/src/olap/delta_writer.cpp
+++ b/be/src/olap/delta_writer.cpp
@@ -404,7 +404,11 @@ Status DeltaWriter::cancel() {
 void DeltaWriter::save_mem_consumption_snapshot() {
     std::lock_guard<std::mutex> l(_lock);
     _mem_consumption_snapshot = mem_consumption();
-    _memtable_consumption_snapshot = _mem_table->memory_usage();
+    if (_mem_table == nullptr) {
+        _memtable_consumption_snapshot = 0;
+    } else {
+        _memtable_consumption_snapshot = _mem_table->memory_usage();
+    }
 }
 
 int64_t DeltaWriter::get_memtable_consumption_inflush() const {
diff --git a/be/src/runtime/load_channel_mgr.h 
b/be/src/runtime/load_channel_mgr.h
index 4fd113cc77..b9182d8a00 100644
--- a/be/src/runtime/load_channel_mgr.h
+++ b/be/src/runtime/load_channel_mgr.h
@@ -61,6 +61,7 @@ public:
 
     void refresh_mem_tracker() {
         int64_t mem_usage = 0;
+        std::lock_guard<std::mutex> l(_lock);
         for (auto& kv : _load_channels) {
             mem_usage += kv.second->mem_consumption();
         }
diff --git a/be/src/vec/exec/join/vhash_join_node.cpp 
b/be/src/vec/exec/join/vhash_join_node.cpp
index a478df8744..0b326db114 100644
--- a/be/src/vec/exec/join/vhash_join_node.cpp
+++ b/be/src/vec/exec/join/vhash_join_node.cpp
@@ -999,7 +999,6 @@ Status HashJoinNode::prepare(RuntimeState* state) {
             "");
     _mem_tracker = std::make_unique<MemTracker>("ExecNode:" + 
_runtime_profile->name(),
                                                 _runtime_profile.get());
-    SCOPED_CONSUME_MEM_TRACKER(mem_tracker());
 
     if (_vconjunct_ctx_ptr) {
         RETURN_IF_ERROR((*_vconjunct_ctx_ptr)->prepare(state, 
_intermediate_row_desc));
@@ -1008,6 +1007,7 @@ Status HashJoinNode::prepare(RuntimeState* state) {
     for (int i = 0; i < _children.size(); ++i) {
         RETURN_IF_ERROR(_children[i]->prepare(state));
     }
+    SCOPED_CONSUME_MEM_TRACKER(mem_tracker());
 
     // Build phase
     auto build_phase_profile = runtime_profile()->create_child("BuildPhase", 
true, true);


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

Reply via email to