This is an automated email from the ASF dual-hosted git repository. liaoxin 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 9cf359a3dc8 [opt](query) accelerate query information_schema.tables from follower node in cloud mode (#51240) 9cf359a3dc8 is described below commit 9cf359a3dc851b39f1625da4042ec6fefa8dfd6f Author: hui lai <lai...@selectdb.com> AuthorDate: Thu May 29 09:27:28 2025 +0800 [opt](query) accelerate query information_schema.tables from follower node in cloud mode (#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 08a98fddbec..b58b95e91e2 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 @@ -96,14 +96,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 4238f074fa8..295db5fc053 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 @@ -738,6 +738,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 SHOW_COLUMN_COMMENT_IN_DESCRIBE = "show_column_comment_in_describe"; public static final String SQL_CONVERTOR_CONFIG = "sql_convertor_config"; @@ -2605,6 +2607,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 = SHOW_COLUMN_COMMENT_IN_DESCRIBE, needForward = true, description = { "是否在 DESCRIBE TABLE 语句中显示列注释", --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org