You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by mo...@apache.org on 2022/04/06 02:44:56 UTC

[incubator-doris] 10/19: [Improvement][fix](compaction) Change min_compaction_failure_interval_sec to 5 and fix a bug of log (#8781)

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

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

commit 1dcd992828c7bffc6f3c51371e50f415f2aa5053
Author: zhannngchen <48...@users.noreply.github.com>
AuthorDate: Sat Apr 2 13:00:56 2022 +0800

    [Improvement][fix](compaction) Change min_compaction_failure_interval_sec to 5 and fix a bug of log (#8781)
    
    see issue #8767
---
 be/src/common/config.h                             |  2 +-
 be/src/http/action/compaction_action.cpp           | 28 +++++++++++++++-------
 be/src/olap/olap_server.cpp                        |  5 ++--
 docs/en/administrator-guide/config/be_config.md    |  2 +-
 docs/zh-CN/administrator-guide/config/be_config.md |  2 +-
 5 files changed, 25 insertions(+), 14 deletions(-)

diff --git a/be/src/common/config.h b/be/src/common/config.h
index 91f8dff56f..2a5f03de8e 100644
--- a/be/src/common/config.h
+++ b/be/src/common/config.h
@@ -284,7 +284,7 @@ CONF_mInt32(cumulative_compaction_skip_window_seconds, "30");
 
 // if compaction of a tablet failed, this tablet should not be chosen to
 // compaction until this interval passes.
-CONF_mInt64(min_compaction_failure_interval_sec, "600"); // 10 min
+CONF_mInt64(min_compaction_failure_interval_sec, "5"); // 5 seconds
 
 // This config can be set to limit thread number in compaction thread pool.
 CONF_mInt32(max_compaction_threads, "10");
diff --git a/be/src/http/action/compaction_action.cpp b/be/src/http/action/compaction_action.cpp
index 64f104210c..6f6372b96d 100644
--- a/be/src/http/action/compaction_action.cpp
+++ b/be/src/http/action/compaction_action.cpp
@@ -228,20 +228,32 @@ OLAPStatus CompactionAction::_execute_compaction_callback(TabletSharedPtr tablet
         std::string tracker_label = "CompactionAction:BaseCompaction:" + std::to_string(syscall(__NR_gettid));
         BaseCompaction base_compaction(tablet, tracker_label, _compaction_mem_tracker);
         OLAPStatus res = base_compaction.compact();
-        if (res != OLAP_SUCCESS && res != OLAP_ERR_BE_NO_SUITABLE_VERSION) {
-            DorisMetrics::instance()->base_compaction_request_failed->increment(1);
-            LOG(WARNING) << "failed to init base compaction. res=" << res
-                         << ", table=" << tablet->full_name();
+        if (res != OLAP_SUCCESS) {
+            if (res == OLAP_ERR_BE_NO_SUITABLE_VERSION) {
+                // Ignore this error code.
+                VLOG_NOTICE << "failed to init base compaction due to no suitable version, tablet="
+                            << tablet->full_name();
+            } else {
+                DorisMetrics::instance()->base_compaction_request_failed->increment(1);
+                LOG(WARNING) << "failed to init base compaction. res=" << res
+                             << ", tablet=" << tablet->full_name();
+            }
         }
         status = res;
     } else if (compaction_type == PARAM_COMPACTION_CUMULATIVE) {
         std::string tracker_label = "CompactionAction:CumulativeCompaction:" + std::to_string(syscall(__NR_gettid));
         CumulativeCompaction cumulative_compaction(tablet, tracker_label, _compaction_mem_tracker);
         OLAPStatus res = cumulative_compaction.compact();
-        if (res != OLAP_SUCCESS && res != OLAP_ERR_CUMULATIVE_NO_SUITABLE_VERSION) {
-            DorisMetrics::instance()->cumulative_compaction_request_failed->increment(1);
-            LOG(WARNING) << "failed to do cumulative compaction. res=" << res
-                         << ", table=" << tablet->full_name();
+        if (res != OLAP_SUCCESS) {
+            if (res == OLAP_ERR_CUMULATIVE_NO_SUITABLE_VERSION) {
+                // Ignore this error code.
+                VLOG_NOTICE << "failed to init cumulative compaction due to no suitable version,"
+                            << "tablet=" << tablet->full_name();
+            } else {
+                DorisMetrics::instance()->cumulative_compaction_request_failed->increment(1);
+                LOG(WARNING) << "failed to do cumulative compaction. res=" << res
+                             << ", table=" << tablet->full_name();
+            }
         }
         status = res;
     }
diff --git a/be/src/olap/olap_server.cpp b/be/src/olap/olap_server.cpp
index 05a5e69af4..196580ed72 100644
--- a/be/src/olap/olap_server.cpp
+++ b/be/src/olap/olap_server.cpp
@@ -578,14 +578,13 @@ Status StorageEngine::_submit_compaction_task(TabletSharedPtr tablet, Compaction
         // reset compaction
         tablet->reset_compaction(compaction_type);
         _pop_tablet_from_submitted_compaction(tablet, compaction_type);
-        if (st != OLAP_SUCCESS) {
+        if (!st.ok()) {
             return Status::InternalError(strings::Substitute(
                         "failed to prepare compaction task and calculate permits, tablet_id=$0, compaction_type=$1, "
                         "permit=$2, current_permit=$3, status=$4",
                         tablet->tablet_id(), compaction_type, permits, _permit_limiter.usage(), st.get_error_msg()));
-        } else {
-            return Status::OK();
         }
+        return st;
     }
 }
 
diff --git a/docs/en/administrator-guide/config/be_config.md b/docs/en/administrator-guide/config/be_config.md
index 0f8bfaaca2..b1d9f9c5eb 100644
--- a/docs/en/administrator-guide/config/be_config.md
+++ b/docs/en/administrator-guide/config/be_config.md
@@ -862,7 +862,7 @@ Minimum read buffer size (in bytes)
 
 * Type: int32
 * Description: During the cumulative compaction process, when the selected tablet fails to be merged successfully, it will wait for a period of time before it may be selected again. The waiting period is the value of this configuration.
-* Default value: 600
+* Default value: 5
 * Unit: seconds
 
 ### `min_compaction_threads`
diff --git a/docs/zh-CN/administrator-guide/config/be_config.md b/docs/zh-CN/administrator-guide/config/be_config.md
index 2b86af5dbf..1dd7e7a015 100644
--- a/docs/zh-CN/administrator-guide/config/be_config.md
+++ b/docs/zh-CN/administrator-guide/config/be_config.md
@@ -863,7 +863,7 @@ txn 管理器中每个 txn_partition_map 的最大 txns 数,这是一种自我
 
 * 类型:int32
 * 描述:在 cumulative compaction 过程中,当选中的 tablet 没能成功的进行版本合并,则会等待一段时间后才会再次有可能被选中。等待的这段时间就是这个配置的值。
-* 默认值:600
+* 默认值:5
 * 单位:秒
 
 ### `min_compaction_threads`


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