You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by yi...@apache.org on 2022/05/07 00:46:40 UTC

[incubator-doris] branch master updated: [Improvement] [compaction]Enable vectorized compaction by default (#9383)

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

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


The following commit(s) were added to refs/heads/master by this push:
     new 22439cb6a6 [Improvement] [compaction]Enable vectorized compaction by default (#9383)
22439cb6a6 is described below

commit 22439cb6a65d316d605afc99f5c30bcac3ad6c2d
Author: Gabriel <ga...@gmail.com>
AuthorDate: Sat May 7 08:46:35 2022 +0800

    [Improvement] [compaction]Enable vectorized compaction by default (#9383)
---
 be/src/common/config.h                      |  2 +-
 be/src/olap/compaction.cpp                  | 15 +++++++++++++--
 be/src/olap/compaction.h                    |  3 +++
 docs/en/admin-manual/config/be-config.md    |  2 +-
 docs/zh-CN/admin-manual/config/be-config.md |  2 +-
 5 files changed, 19 insertions(+), 5 deletions(-)

diff --git a/be/src/common/config.h b/be/src/common/config.h
index ac8ddd8ff2..28714c6b24 100644
--- a/be/src/common/config.h
+++ b/be/src/common/config.h
@@ -241,7 +241,7 @@ CONF_Bool(enable_low_cardinality_optimize, "false");
 // whether disable automatic compaction task
 CONF_mBool(disable_auto_compaction, "false");
 // whether enable vectorized compaction
-CONF_Bool(enable_vectorized_compaction, "false");
+CONF_Bool(enable_vectorized_compaction, "true");
 // check the configuration of auto compaction in seconds when auto compaction disabled
 CONF_mInt32(check_auto_compaction_interval_seconds, "5");
 
diff --git a/be/src/olap/compaction.cpp b/be/src/olap/compaction.cpp
index a4eb59aaa7..b885162b76 100644
--- a/be/src/olap/compaction.cpp
+++ b/be/src/olap/compaction.cpp
@@ -87,14 +87,15 @@ Status Compaction::do_compaction_impl(int64_t permits) {
     // The test results show that merger is low-memory-footprint, there is no need to tracker its mem pool
     Merger::Statistics stats;
     Status res;
-    if (config::enable_vectorized_compaction) {
+    auto use_vectorized_compaction = _should_use_vectorized_compaction();
+    if (use_vectorized_compaction) {
         res = Merger::vmerge_rowsets(_tablet, compaction_type(), _input_rs_readers,
                                      _output_rs_writer.get(), &stats);
     } else {
         res = Merger::merge_rowsets(_tablet, compaction_type(), _input_rs_readers,
                                     _output_rs_writer.get(), &stats);
     }
-    string merge_type = config::enable_vectorized_compaction ? "v" : "";
+    string merge_type = use_vectorized_compaction ? "v" : "";
     if (!res.ok()) {
         LOG(WARNING) << "fail to do " << merge_type << compaction_name() << ". res=" << res
                      << ", tablet=" << _tablet->full_name()
@@ -291,6 +292,16 @@ int64_t Compaction::_get_input_num_rows_from_seg_grps() {
     return num_rows;
 }
 
+bool Compaction::_should_use_vectorized_compaction() {
+    auto cols = _tablet->tablet_schema().columns();
+    for (auto it = cols.begin(); it != cols.end(); it++) {
+        if ((*it).type() == FieldType::OLAP_FIELD_TYPE_STRING) {
+            return false;
+        }
+    }
+    return config::enable_vectorized_compaction;
+}
+
 int64_t Compaction::get_compaction_permits() {
     int64_t permits = 0;
     for (auto rowset : _input_rowsets) {
diff --git a/be/src/olap/compaction.h b/be/src/olap/compaction.h
index 240821b25f..27c33dcc5a 100644
--- a/be/src/olap/compaction.h
+++ b/be/src/olap/compaction.h
@@ -78,6 +78,9 @@ private:
     // return -1 if these are not alpha rowsets.
     int64_t _get_input_num_rows_from_seg_grps();
 
+    // check whether we should enable vectorized compaction.
+    bool _should_use_vectorized_compaction();
+
 protected:
     // the root tracker for this compaction
     std::shared_ptr<MemTracker> _mem_tracker;
diff --git a/docs/en/admin-manual/config/be-config.md b/docs/en/admin-manual/config/be-config.md
index cb5464f4c0..c8a2830d7b 100644
--- a/docs/en/admin-manual/config/be-config.md
+++ b/docs/en/admin-manual/config/be-config.md
@@ -113,7 +113,7 @@ Minimal interval (ms) to generate compaction tasks
 
 ### `enable_vectorized_compaction`
 
-Default: false
+Default: true
 
 Whether to enable vectorized compaction
 
diff --git a/docs/zh-CN/admin-manual/config/be-config.md b/docs/zh-CN/admin-manual/config/be-config.md
index 53adf6da18..2d187298fd 100644
--- a/docs/zh-CN/admin-manual/config/be-config.md
+++ b/docs/zh-CN/admin-manual/config/be-config.md
@@ -109,7 +109,7 @@ BE 的配置项有两种方式进行配置:
 
 ### `enable_vectorized_compaction`
 
-默认值:false
+默认值:true
 
 是否开启向量化compaction
 


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