Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -96,14 +96,26 @@ public void finalize(Analyzer analyzer) throws UserException {
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) {
Expand Down
12 changes: 12 additions & 0 deletions fe/fe-core/src/main/java/org/apache/doris/qe/SessionVariable.java
Original file line number Diff line number Diff line change
Expand Up @@ -737,6 +737,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";
Expand Down Expand Up @@ -2600,6 +2602,16 @@ public void setDetailShapePlanNodes(String detailShapePlanNodes) {
})
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 语句中显示列注释",
Expand Down
Loading