You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by da...@apache.org on 2022/07/16 07:32:59 UTC

[doris] branch master updated: release memory allocated in agg function in vec stream load (#10739)

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

dataroaring 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 f78db1d773 release memory allocated in agg function in vec stream load  (#10739)
f78db1d773 is described below

commit f78db1d77389c1152ada2091c7cc07fc828b87fb
Author: Yongqiang YANG <98...@users.noreply.github.com>
AuthorDate: Sat Jul 16 15:32:53 2022 +0800

    release memory allocated in agg function in vec stream load  (#10739)
    
    release memory allocated in agg function in vec stream load
    
    When a load is cancelled, memory allocated by agg functions should
    be freeed.
---
 be/src/olap/memtable.cpp | 17 +++++++++++++++++
 bin/stop_be.sh           |  2 +-
 2 files changed, 18 insertions(+), 1 deletion(-)

diff --git a/be/src/olap/memtable.cpp b/be/src/olap/memtable.cpp
index 61035f13db..2332b8e2dd 100644
--- a/be/src/olap/memtable.cpp
+++ b/be/src/olap/memtable.cpp
@@ -118,6 +118,19 @@ void MemTable::_init_agg_functions(const vectorized::Block* block) {
 }
 
 MemTable::~MemTable() {
+    if (_vec_skip_list != nullptr && _keys_type != KeysType::DUP_KEYS) {
+        VecTable::Iterator it(_vec_skip_list.get());
+        for (it.SeekToFirst(); it.Valid(); it.Next()) {
+            // We should release agg_places here, because they are not relesed when a
+            // load is canceled.
+            for (size_t i = _schema->num_key_columns(); i < _schema->num_columns(); ++i) {
+                auto function = _agg_functions[i];
+                DCHECK(function != nullptr);
+                DCHECK(it.key()->agg_places(i) != nullptr);
+                function->destroy(it.key()->agg_places(i));
+            }
+        }
+    }
     std::for_each(_row_in_blocks.begin(), _row_in_blocks.end(), std::default_delete<RowInBlock>());
     _mem_tracker->release(_mem_usage);
     _buffer_mem_pool->free_all();
@@ -322,6 +335,10 @@ void MemTable::_collect_vskiplist_results() {
             _output_mutable_block.clear_column_data();
         }
     }
+
+    if (is_final) {
+        _vec_skip_list.reset();
+    }
 }
 
 void MemTable::shrink_memtable_by_agg() {
diff --git a/bin/stop_be.sh b/bin/stop_be.sh
index e189f91112..0ce5124934 100755
--- a/bin/stop_be.sh
+++ b/bin/stop_be.sh
@@ -23,7 +23,7 @@ export DORIS_HOME=`cd "$curdir/.."; pwd`
 export PID_DIR=`cd "$curdir"; pwd`
 
 signum=9
-if [[ $1 = "--grace" ]]; then
+if [ "x"$1 = "x--grace" ]; then
     signum=15
 fi
 


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