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 @@ -94,14 +94,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
Original file line number Diff line number Diff line change
Expand Up @@ -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";

/**
Expand Down Expand Up @@ -2431,6 +2433,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 = SQL_CONVERTOR_CONFIG, needForward = true,
description = {
"SQL 转换器的相关配置,使用 Json 格式。以 {} 为根元素。",
Expand Down