From ed5c6df4712f9ba2a35b8939c6b3d2b93792dcdc Mon Sep 17 00:00:00 2001 From: deardeng Date: Wed, 25 Jun 2025 20:13:52 +0800 Subject: [PATCH] [fix](cloud)Fix auto start affected by daemon jobs (#51729) --- .../src/main/java/org/apache/doris/common/Config.java | 9 +++++++++ .../doris/cloud/system/CloudSystemInfoService.java | 9 ++++++--- 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/fe/fe-common/src/main/java/org/apache/doris/common/Config.java b/fe/fe-common/src/main/java/org/apache/doris/common/Config.java index 23da54f52a0281..6ee7553ed77c78 100644 --- a/fe/fe-common/src/main/java/org/apache/doris/common/Config.java +++ b/fe/fe-common/src/main/java/org/apache/doris/common/Config.java @@ -3330,6 +3330,15 @@ public static int metaServiceRpcRetryTimes() { "In cloud mode, the retry number when the FE requests the meta service times out is 1 by default"}) public static int meta_service_rpc_timeout_retry_times = 1; + @ConfField(mutable = true, description = {"存算分离模式下自动启停功能,对于该配置中的数据库名不进行唤醒操作," + + "用于内部作业的数据库,例如统计信息用到的数据库," + + "举例: auto_start_ignore_db_names=__internal_schema, information_schema", + "In the cloud mode, the automatic start and stop ignores the DB name of the internal job," + + "used for databases involved in internal jobs, such as those used for statistics, " + + "For example: auto_start_ignore_db_names=__internal_schema, information_schema" + }) + public static String[] auto_start_ignore_resume_db_names = {"__internal_schema", "information_schema"}; + // ATTN: DONOT add any config not related to cloud mode here // ATTN: DONOT add any config not related to cloud mode here // ATTN: DONOT add any config not related to cloud mode here diff --git a/fe/fe-core/src/main/java/org/apache/doris/cloud/system/CloudSystemInfoService.java b/fe/fe-core/src/main/java/org/apache/doris/cloud/system/CloudSystemInfoService.java index 6603c29b1e4198..f3583fa54877cb 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/cloud/system/CloudSystemInfoService.java +++ b/fe/fe-core/src/main/java/org/apache/doris/cloud/system/CloudSystemInfoService.java @@ -56,6 +56,7 @@ import java.io.IOException; import java.util.ArrayList; +import java.util.Arrays; import java.util.Collections; import java.util.Comparator; import java.util.HashSet; @@ -1024,9 +1025,11 @@ public String waitForAutoStart(String clusterName) throws DdlException { LOG.debug("auto start wait cluster {} status {}", clusterName, clusterStatus); if (Cloud.ClusterStatus.valueOf(clusterStatus) != Cloud.ClusterStatus.NORMAL) { // ATTN: prevent `Automatic Analyzer` daemon threads from pulling up clusters - // root ? see StatisticsUtil.buildConnectContext - if (ConnectContext.get() != null && ConnectContext.get().getUserIdentity().isRootUser()) { - LOG.warn("auto start daemon thread run in root, not resume cluster {}-{}", clusterName, clusterStatus); + // FeConstants.INTERNAL_DB_NAME ? see StatisticsUtil.buildConnectContext + List ignoreDbNameList = Arrays.asList(Config.auto_start_ignore_resume_db_names); + if (ConnectContext.get() != null && ignoreDbNameList.contains(ConnectContext.get().getDatabase())) { + LOG.warn("auto start daemon thread db {}, not resume cluster {}-{}", + ConnectContext.get().getDatabase(), clusterName, clusterStatus); return null; } Cloud.AlterClusterRequest.Builder builder = Cloud.AlterClusterRequest.newBuilder();