This is an automated email from the ASF dual-hosted git repository. dataroaring pushed a commit to branch branch-3.0.6 in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-3.0.6 by this push: new 95143b4988f [opt](query) accelerate query information_schema.tables from follower node in cloud mode (#51240) (#51405) 95143b4988f is described below commit 95143b4988f3f7f1e6e476b2a15b62bda557eccc Author: hui lai <lai...@selectdb.com> AuthorDate: Wed Jun 11 10:15:25 2025 +0800 [opt](query) accelerate query information_schema.tables from follower node in cloud mode (#51240) (#51405) pick #51240 Accelerate query information_schema.tables by scanning table information from FE master when sending query request from follower node. It can reduces rpc call from follower to meta service to improve query performance for master getting version is memory operation, but it will slightly increase the pressure on the FE master. --- .../org/apache/doris/planner/SchemaScanNode.java | 20 ++++++++++++++++---- .../java/org/apache/doris/qe/SessionVariable.java | 12 ++++++++++++ 2 files changed, 28 insertions(+), 4 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/planner/SchemaScanNode.java b/fe/fe-core/src/main/java/org/apache/doris/planner/SchemaScanNode.java index 5ea6492f1ec..eaf9a6c7838 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/planner/SchemaScanNode.java +++ b/fe/fe-core/src/main/java/org/apache/doris/planner/SchemaScanNode.java @@ -94,14 +94,26 @@ public class SchemaScanNode extends ScanNode { schemaCatalog = analyzer.getSchemaCatalog(); schemaDb = analyzer.getSchemaDb(); schemaTable = analyzer.getSchemaTable(); - frontendIP = FrontendOptions.getLocalHostAddress(); - frontendPort = Config.rpc_port; + if (ConnectContext.get().getSessionVariable().enableSchemaScanFromMasterFe + && tableName.equalsIgnoreCase("tables")) { + frontendIP = Env.getCurrentEnv().getMasterHost(); + frontendPort = Env.getCurrentEnv().getMasterRpcPort(); + } else { + frontendIP = FrontendOptions.getLocalHostAddress(); + frontendPort = Config.rpc_port; + } } @Override public void finalizeForNereids() throws UserException { - frontendIP = FrontendOptions.getLocalHostAddress(); - frontendPort = Config.rpc_port; + if (ConnectContext.get().getSessionVariable().enableSchemaScanFromMasterFe + && tableName.equalsIgnoreCase("tables")) { + frontendIP = Env.getCurrentEnv().getMasterHost(); + frontendPort = Env.getCurrentEnv().getMasterRpcPort(); + } else { + frontendIP = FrontendOptions.getLocalHostAddress(); + frontendPort = Config.rpc_port; + } } private void setFeAddrList(TPlanNode msg) { diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java b/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java index 9391e5c76d2..cfbdbdfd436 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java @@ -712,6 +712,8 @@ public class SessionVariable implements Serializable, Writable { public static final String ENABLE_SQL_CONVERTOR_FEATURES = "enable_sql_convertor_features"; + public static final String ENABLE_SCHEMA_SCAN_FROM_MASTER_FE = "enable_schema_scan_from_master_fe"; + public static final String SQL_CONVERTOR_CONFIG = "sql_convertor_config"; /** @@ -2431,6 +2433,16 @@ public class SessionVariable implements Serializable, Writable { }) public String enableSqlConvertorFeatures = ""; + // The default value is true, + // which throughs reducing rpc call from follower node to meta service to improve query performance + // for getting version is memory operation in master node, + // but it will slightly increase the pressure on the FE master. + @VariableMgr.VarAttr(name = ENABLE_SCHEMA_SCAN_FROM_MASTER_FE, description = { + "在follower节点查询时, 是否允许从master节点扫描information_schema.tables的结果", + "Whether to allow scanning information_schema.tables from the master node" + }) + public boolean enableSchemaScanFromMasterFe = true; + @VariableMgr.VarAttr(name = SQL_CONVERTOR_CONFIG, needForward = true, description = { "SQL 转换器的相关配置,使用 Json 格式。以 {} 为根元素。", --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org