[Refactor] Refactors how host and port pairs are represented and handled throughout the codebase (#63695)
This commit is contained in:
parent
caface76d6
commit
e5bf03cda5
|
|
@ -33,6 +33,7 @@ fe_plugins/output
|
|||
fe/mocked
|
||||
fe/ut_ports
|
||||
fe/*/target
|
||||
fe/*/bin
|
||||
fe/plugin/*/target/
|
||||
fe/fe-core/gen
|
||||
fe/fe-grammar/gen
|
||||
|
|
|
|||
|
|
@ -46,6 +46,7 @@ import com.starrocks.catalog.TabletMeta;
|
|||
import com.starrocks.common.Config;
|
||||
import com.starrocks.common.DdlException;
|
||||
import com.starrocks.common.ErrorReport;
|
||||
import com.starrocks.common.Pair;
|
||||
import com.starrocks.common.StarRocksException;
|
||||
import com.starrocks.ha.FrontendNodeType;
|
||||
import com.starrocks.qe.ShowResultSet;
|
||||
|
|
@ -66,6 +67,7 @@ import com.starrocks.sql.ast.DropBackendClause;
|
|||
import com.starrocks.sql.ast.DropComputeNodeClause;
|
||||
import com.starrocks.sql.ast.DropFollowerClause;
|
||||
import com.starrocks.sql.ast.DropObserverClause;
|
||||
import com.starrocks.sql.ast.HostPort;
|
||||
import com.starrocks.sql.ast.ModifyBackendClause;
|
||||
import com.starrocks.sql.ast.ModifyBrokerClause;
|
||||
import com.starrocks.sql.ast.ModifyFrontendAddressClause;
|
||||
|
|
@ -76,6 +78,7 @@ import org.apache.commons.lang.NotImplementedException;
|
|||
import org.apache.logging.log4j.LogManager;
|
||||
import org.apache.logging.log4j.Logger;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
|
|
@ -196,10 +199,10 @@ public class SystemHandler extends AlterHandler {
|
|||
BrokerMgr brokerMgr = GlobalStateMgr.getCurrentState().getBrokerMgr();
|
||||
switch (clause.getOp()) {
|
||||
case OP_ADD:
|
||||
brokerMgr.addBrokers(clause.getBrokerName(), clause.getHostPortPairs());
|
||||
brokerMgr.addBrokers(clause.getBrokerName(), convertHostPortsToPairs(clause.getHostPortPairs()));
|
||||
break;
|
||||
case OP_DROP:
|
||||
brokerMgr.dropBrokers(clause.getBrokerName(), clause.getHostPortPairs());
|
||||
brokerMgr.dropBrokers(clause.getBrokerName(), convertHostPortsToPairs(clause.getHostPortPairs()));
|
||||
break;
|
||||
case OP_DROP_ALL:
|
||||
brokerMgr.dropAllBroker(clause.getBrokerName());
|
||||
|
|
@ -364,4 +367,10 @@ public class SystemHandler extends AlterHandler {
|
|||
public List<List<Comparable>> getAlterJobInfosByDb(Database db) {
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
private static Collection<Pair<String, Integer>> convertHostPortsToPairs(Collection<HostPort> hostPorts) {
|
||||
return hostPorts.stream()
|
||||
.map(hostPort -> new Pair<>(hostPort.getHost(), hostPort.getPort()))
|
||||
.collect(java.util.stream.Collectors.toList());
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,6 +49,7 @@ import com.starrocks.qe.ConnectContext;
|
|||
import com.starrocks.server.GlobalStateMgr;
|
||||
import com.starrocks.sql.analyzer.Authorizer;
|
||||
import com.starrocks.sql.ast.DecommissionBackendClause;
|
||||
import com.starrocks.sql.ast.HostPort;
|
||||
import com.starrocks.system.SystemInfoService;
|
||||
import io.netty.handler.codec.http.HttpMethod;
|
||||
|
||||
|
|
@ -91,8 +92,11 @@ public class CheckDecommissionAction extends RestBaseAction {
|
|||
|
||||
try {
|
||||
DecommissionBackendClause decommissionBackendClause = new DecommissionBackendClause(Lists.newArrayList(hostPortArr));
|
||||
List<Pair<String, Integer>> hostPortPairs = Arrays.stream(hostPortArr)
|
||||
.map(hostPort -> SystemInfoService.validateHostAndPort(hostPort, false)).collect(Collectors.toList());
|
||||
List<HostPort> hostPortPairs = Arrays.stream(hostPortArr)
|
||||
.map(hostPort -> {
|
||||
Pair<String, Integer> pair = SystemInfoService.validateHostAndPort(hostPort, false);
|
||||
return new HostPort(pair.first, pair.second);
|
||||
}).collect(Collectors.toList());
|
||||
decommissionBackendClause.setHostPortPairs(hostPortPairs);
|
||||
|
||||
GlobalStateMgr.getCurrentState().getAlterJobMgr().getClusterHandler().process(
|
||||
|
|
|
|||
|
|
@ -16,7 +16,6 @@ package com.starrocks.sql.analyzer;
|
|||
|
||||
import com.google.common.base.Preconditions;
|
||||
import com.google.common.base.Strings;
|
||||
import com.starrocks.common.AnalysisException;
|
||||
import com.starrocks.common.Pair;
|
||||
import com.starrocks.common.util.PropertyAnalyzer;
|
||||
import com.starrocks.qe.ConnectContext;
|
||||
|
|
@ -34,6 +33,7 @@ import com.starrocks.sql.ast.ComputeNodeClause;
|
|||
import com.starrocks.sql.ast.CreateImageClause;
|
||||
import com.starrocks.sql.ast.DdlStmt;
|
||||
import com.starrocks.sql.ast.FrontendClause;
|
||||
import com.starrocks.sql.ast.HostPort;
|
||||
import com.starrocks.sql.ast.ModifyBackendClause;
|
||||
import com.starrocks.sql.ast.ModifyBrokerClause;
|
||||
import com.starrocks.sql.ast.ModifyFrontendAddressClause;
|
||||
|
|
@ -64,7 +64,7 @@ public class AlterSystemStmtAnalyzer implements AstVisitorExtendInterface<Void,
|
|||
CancelAlterSystemStmt stmt = (CancelAlterSystemStmt) ddlStmt;
|
||||
for (String hostPort : stmt.getHostPorts()) {
|
||||
Pair<String, Integer> pair = SystemInfoService.validateHostAndPort(hostPort, false);
|
||||
stmt.getHostPortPairs().add(pair);
|
||||
stmt.getHostPortPairs().add(new HostPort(pair.first, pair.second));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -74,7 +74,7 @@ public class AlterSystemStmtAnalyzer implements AstVisitorExtendInterface<Void,
|
|||
for (String hostPort : computeNodeClause.getHostPorts()) {
|
||||
Pair<String, Integer> pair = SystemInfoService.validateHostAndPort(hostPort,
|
||||
computeNodeClause instanceof AddComputeNodeClause && !FrontendOptions.isUseFqdn());
|
||||
computeNodeClause.getHostPortPairs().add(pair);
|
||||
computeNodeClause.getHostPortPairs().add(new HostPort(pair.first, pair.second));
|
||||
}
|
||||
Preconditions.checkState(!computeNodeClause.getHostPortPairs().isEmpty());
|
||||
return null;
|
||||
|
|
@ -82,11 +82,11 @@ public class AlterSystemStmtAnalyzer implements AstVisitorExtendInterface<Void,
|
|||
|
||||
@Override
|
||||
public Void visitBackendClause(BackendClause backendClause, ConnectContext context) {
|
||||
List<Pair<String, Integer>> hostPortPairs = new ArrayList<>();
|
||||
List<HostPort> hostPortPairs = new ArrayList<>();
|
||||
for (String hostPort : backendClause.getHostPortsUnResolved()) {
|
||||
Pair<String, Integer> pair = SystemInfoService.validateHostAndPort(hostPort,
|
||||
backendClause instanceof AddBackendClause && !FrontendOptions.isUseFqdn());
|
||||
hostPortPairs.add(pair);
|
||||
hostPortPairs.add(new HostPort(pair.first, pair.second));
|
||||
}
|
||||
backendClause.setHostPortPairs(hostPortPairs);
|
||||
Preconditions.checkState(!hostPortPairs.isEmpty());
|
||||
|
|
@ -100,8 +100,7 @@ public class AlterSystemStmtAnalyzer implements AstVisitorExtendInterface<Void,
|
|||
(frontendClause instanceof AddFollowerClause
|
||||
|| frontendClause instanceof AddObserverClause)
|
||||
&& !FrontendOptions.isUseFqdn());
|
||||
frontendClause.setHost(pair.first);
|
||||
frontendClause.setPort(pair.second);
|
||||
frontendClause.setHostPortObj(new HostPort(pair.first, pair.second));
|
||||
Preconditions.checkState(!Strings.isNullOrEmpty(frontendClause.getHost()));
|
||||
return null;
|
||||
}
|
||||
|
|
@ -179,7 +178,7 @@ public class AlterSystemStmtAnalyzer implements AstVisitorExtendInterface<Void,
|
|||
if (clause.getOp() != ModifyBrokerClause.ModifyOp.OP_DROP_ALL) {
|
||||
for (String hostPort : clause.getHostPorts()) {
|
||||
Pair<String, Integer> pair = SystemInfoService.validateHostAndPort(hostPort, false);
|
||||
clause.getHostPortPairs().add(pair);
|
||||
clause.getHostPortPairs().add(new HostPort(pair.first, pair.second));
|
||||
}
|
||||
Preconditions.checkState(!clause.getHostPortPairs().isEmpty());
|
||||
}
|
||||
|
|
@ -187,10 +186,9 @@ public class AlterSystemStmtAnalyzer implements AstVisitorExtendInterface<Void,
|
|||
}
|
||||
|
||||
private void validateBrokerName(ModifyBrokerClause clause) {
|
||||
try {
|
||||
clause.validateBrokerName();
|
||||
} catch (AnalysisException e) {
|
||||
throw new SemanticException(e.getMessage());
|
||||
String brokerName = clause.getBrokerName();
|
||||
if (Strings.isNullOrEmpty(brokerName)) {
|
||||
throw new SemanticException("Broker's name can't be empty.");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -71,11 +71,6 @@ import com.starrocks.sql.ast.expression.UserVariableHint;
|
|||
import com.starrocks.sql.ast.expression.VarBinaryLiteral;
|
||||
import com.starrocks.sql.ast.expression.VariableExpr;
|
||||
import com.starrocks.sql.ast.feedback.AddPlanAdvisorStmt;
|
||||
import com.starrocks.sql.ast.feedback.ClearPlanAdvisorStmt;
|
||||
import com.starrocks.sql.ast.feedback.DelPlanAdvisorStmt;
|
||||
import com.starrocks.sql.ast.feedback.ShowPlanAdvisorStmt;
|
||||
import com.starrocks.sql.ast.group.CreateGroupProviderStmt;
|
||||
import com.starrocks.sql.ast.group.DropGroupProviderStmt;
|
||||
import com.starrocks.sql.ast.pipe.AlterPipeClause;
|
||||
import com.starrocks.sql.ast.pipe.AlterPipeStmt;
|
||||
import com.starrocks.sql.ast.pipe.CreatePipeStmt;
|
||||
|
|
@ -86,39 +81,8 @@ import com.starrocks.sql.ast.pipe.ShowPipeStmt;
|
|||
import com.starrocks.sql.ast.spm.CreateBaselinePlanStmt;
|
||||
import com.starrocks.sql.ast.spm.DropBaselinePlanStmt;
|
||||
import com.starrocks.sql.ast.spm.ShowBaselinePlanStmt;
|
||||
import com.starrocks.sql.ast.txn.BeginStmt;
|
||||
import com.starrocks.sql.ast.txn.CommitStmt;
|
||||
import com.starrocks.sql.ast.txn.RollbackStmt;
|
||||
import com.starrocks.sql.ast.warehouse.AlterWarehouseStmt;
|
||||
import com.starrocks.sql.ast.warehouse.CreateWarehouseStmt;
|
||||
import com.starrocks.sql.ast.warehouse.DropWarehouseStmt;
|
||||
import com.starrocks.sql.ast.warehouse.ResumeWarehouseStmt;
|
||||
import com.starrocks.sql.ast.warehouse.SetWarehouseStmt;
|
||||
import com.starrocks.sql.ast.warehouse.SuspendWarehouseStmt;
|
||||
import com.starrocks.sql.ast.warehouse.cngroup.AlterCnGroupStmt;
|
||||
import com.starrocks.sql.ast.warehouse.cngroup.CreateCnGroupStmt;
|
||||
import com.starrocks.sql.ast.warehouse.cngroup.EnableDisableCnGroupStmt;
|
||||
|
||||
public interface AstVisitorExtendInterface<R, C> extends AstVisitor<R, C> {
|
||||
default R visit(ParseNode node) {
|
||||
return visit(node, null);
|
||||
}
|
||||
|
||||
default R visit(ParseNode node, C context) {
|
||||
return node.accept(this, context);
|
||||
}
|
||||
|
||||
default R visitNode(ParseNode node, C context) {
|
||||
return null;
|
||||
}
|
||||
|
||||
default R visitStatement(StatementBase statement, C context) {
|
||||
return visitNode(statement, context);
|
||||
}
|
||||
|
||||
default R visitDDLStatement(DdlStmt statement, C context) {
|
||||
return visitStatement(statement, context);
|
||||
}
|
||||
|
||||
// ---------------------------------------- Query Statement --------------------------------------------------------------
|
||||
|
||||
|
|
@ -134,7 +98,6 @@ public interface AstVisitorExtendInterface<R, C> extends AstVisitor<R, C> {
|
|||
return visitStatement(statement, context);
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------- Database Statement -----------------------------------------------------
|
||||
|
||||
default R visitShowDatabasesStatement(ShowDbStmt statement, C context) {
|
||||
|
|
@ -157,7 +120,6 @@ public interface AstVisitorExtendInterface<R, C> extends AstVisitor<R, C> {
|
|||
return visitDDLStatement(statement, context);
|
||||
}
|
||||
|
||||
|
||||
default R visitShowDataDistributionStatement(ShowDataDistributionStmt statement, C context) {
|
||||
return visitShowStatement(statement, context);
|
||||
}
|
||||
|
|
@ -196,7 +158,6 @@ public interface AstVisitorExtendInterface<R, C> extends AstVisitor<R, C> {
|
|||
return visitDropTableStatement(statement, context);
|
||||
}
|
||||
|
||||
|
||||
default R visitRecoverTableStatement(RecoverTableStmt statement, C context) {
|
||||
return visitDDLStatement(statement, context);
|
||||
}
|
||||
|
|
@ -253,10 +214,6 @@ public interface AstVisitorExtendInterface<R, C> extends AstVisitor<R, C> {
|
|||
return visitDDLStatement(statement, context);
|
||||
}
|
||||
|
||||
default R visitDropTaskStmt(DropTaskStmt statement, C context) {
|
||||
return visitDDLStatement(statement, context);
|
||||
}
|
||||
|
||||
// ---------------------------------------- Partition Statement ----------------------------------------------------
|
||||
|
||||
default R visitRecoverPartitionStatement(RecoverPartitionStmt statement, C context) {
|
||||
|
|
@ -369,15 +326,10 @@ public interface AstVisitorExtendInterface<R, C> extends AstVisitor<R, C> {
|
|||
|
||||
// ------------------------------------------- Admin Statement -----------------------------------------------------
|
||||
|
||||
default R visitAdminSetConfigStatement(AdminSetConfigStmt statement, C context) {
|
||||
return visitDDLStatement(statement, context);
|
||||
}
|
||||
|
||||
default R visitAdminSetReplicaStatusStatement(AdminSetReplicaStatusStmt statement, C context) {
|
||||
return visitDDLStatement(statement, context);
|
||||
}
|
||||
|
||||
|
||||
default R visitAdminShowReplicaDistributionStatement(AdminShowReplicaDistributionStmt statement, C context) {
|
||||
return visitShowStatement(statement, context);
|
||||
}
|
||||
|
|
@ -394,35 +346,10 @@ public interface AstVisitorExtendInterface<R, C> extends AstVisitor<R, C> {
|
|||
return visitDDLStatement(statement, context);
|
||||
}
|
||||
|
||||
default R visitAdminCheckTabletsStatement(AdminCheckTabletsStmt statement, C context) {
|
||||
return visitDDLStatement(statement, context);
|
||||
}
|
||||
|
||||
|
||||
default R visitAdminSetPartitionVersionStmt(AdminSetPartitionVersionStmt statement, C context) {
|
||||
return visitDDLStatement(statement, context);
|
||||
}
|
||||
|
||||
|
||||
default R visitAdminSetAutomatedSnapshotOnStatement(AdminSetAutomatedSnapshotOnStmt clause, C context) {
|
||||
return visitDDLStatement(clause, context);
|
||||
}
|
||||
|
||||
default R visitAdminSetAutomatedSnapshotOffStatement(AdminSetAutomatedSnapshotOffStmt clause, C context) {
|
||||
return visitDDLStatement(clause, context);
|
||||
}
|
||||
|
||||
// ---------------------------------------- Cluster Management Statement -------------------------------------------
|
||||
|
||||
default R visitAlterSystemStatement(AlterSystemStmt statement, C context) {
|
||||
return visitDDLStatement(statement, context);
|
||||
}
|
||||
|
||||
default R visitCancelAlterSystemStatement(CancelAlterSystemStmt statement, C context) {
|
||||
return visitDDLStatement(statement, context);
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------- Analyze Statement ---------------------------------------------------
|
||||
|
||||
default R visitAnalyzeStatement(AnalyzeStmt statement, C context) {
|
||||
|
|
@ -461,14 +388,6 @@ public interface AstVisitorExtendInterface<R, C> extends AstVisitor<R, C> {
|
|||
return visitShowStatement(statement, context);
|
||||
}
|
||||
|
||||
|
||||
default R visitDropAnalyzeStatement(DropAnalyzeJobStmt statement, C context) {
|
||||
return visitDDLStatement(statement, context);
|
||||
}
|
||||
|
||||
// ---------------------------------------- Analyze Profile Statement ----------------------------------------------
|
||||
|
||||
|
||||
// ---------------------------------------- Resource Group Statement -----------------------------------------------
|
||||
|
||||
default R visitCreateResourceGroupStatement(CreateResourceGroupStmt statement, C context) {
|
||||
|
|
@ -483,19 +402,12 @@ public interface AstVisitorExtendInterface<R, C> extends AstVisitor<R, C> {
|
|||
return visitDDLStatement(statement, context);
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------- External Resource Statement---------------------------------------------
|
||||
|
||||
default R visitCreateResourceStatement(CreateResourceStmt statement, C context) {
|
||||
return visitDDLStatement(statement, context);
|
||||
}
|
||||
|
||||
|
||||
default R visitAlterResourceStatement(AlterResourceStmt statement, C context) {
|
||||
return visitDDLStatement(statement, context);
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------- UDF Statement-----------------------------------------------------------
|
||||
|
||||
default R visitShowFunctionsStatement(ShowFunctionsStmt statement, C context) {
|
||||
|
|
@ -534,9 +446,6 @@ public interface AstVisitorExtendInterface<R, C> extends AstVisitor<R, C> {
|
|||
|
||||
// ---------------------------------------- Show Statement ---------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
default R visitShowDeleteStatement(ShowDeleteStmt statement, C context) {
|
||||
return visitShowStatement(statement, context);
|
||||
}
|
||||
|
|
@ -545,13 +454,10 @@ public interface AstVisitorExtendInterface<R, C> extends AstVisitor<R, C> {
|
|||
return visitShowStatement(statement, context);
|
||||
}
|
||||
|
||||
|
||||
default R visitShowTransactionStatement(ShowTransactionStmt statement, C context) {
|
||||
return visitShowStatement(statement, context);
|
||||
}
|
||||
|
||||
|
||||
|
||||
default R visitShowWarningStatement(ShowWarningStmt statement, C context) {
|
||||
return visitShowStatement(statement, context);
|
||||
}
|
||||
|
|
@ -564,8 +470,6 @@ public interface AstVisitorExtendInterface<R, C> extends AstVisitor<R, C> {
|
|||
return visitShowStatement(statement, context);
|
||||
}
|
||||
|
||||
|
||||
|
||||
default R visitShowRunningQueriesStatement(ShowRunningQueriesStmt statement, C context) {
|
||||
return visitShowStatement(statement, context);
|
||||
}
|
||||
|
|
@ -594,12 +498,10 @@ public interface AstVisitorExtendInterface<R, C> extends AstVisitor<R, C> {
|
|||
return visitShowStatement(statement, context);
|
||||
}
|
||||
|
||||
|
||||
default R visitShowCollationStatement(ShowCollationStmt statement, C context) {
|
||||
return visitShowStatement(statement, context);
|
||||
}
|
||||
|
||||
|
||||
default R visitShowCharsetStatement(ShowCharsetStmt statement, C context) {
|
||||
return visitShowStatement(statement, context);
|
||||
}
|
||||
|
|
@ -608,8 +510,6 @@ public interface AstVisitorExtendInterface<R, C> extends AstVisitor<R, C> {
|
|||
return visitShowStatement(statement, context);
|
||||
}
|
||||
|
||||
|
||||
|
||||
default R visitShowProcedureStatement(ShowProcedureStmt statement, C context) {
|
||||
return visitShowStatement(statement, context);
|
||||
}
|
||||
|
|
@ -618,83 +518,12 @@ public interface AstVisitorExtendInterface<R, C> extends AstVisitor<R, C> {
|
|||
return visitShowStatement(statement, context);
|
||||
}
|
||||
|
||||
|
||||
// ---------------------------------------- Authz Statement ----------------------------------------------------
|
||||
|
||||
default R visitBaseCreateAlterUserStmt(BaseCreateAlterUserStmt statement, C context) {
|
||||
return visitDDLStatement(statement, context);
|
||||
}
|
||||
|
||||
default R visitCreateUserStatement(CreateUserStmt statement, C context) {
|
||||
return visitBaseCreateAlterUserStmt(statement, context);
|
||||
}
|
||||
|
||||
default R visitDropUserStatement(DropUserStmt statement, C context) {
|
||||
return visitDDLStatement(statement, context);
|
||||
}
|
||||
|
||||
default R visitAlterUserStatement(AlterUserStmt statement, C context) {
|
||||
return visitBaseCreateAlterUserStmt(statement, context);
|
||||
}
|
||||
|
||||
|
||||
|
||||
default R visitCreateRoleStatement(CreateRoleStmt statement, C context) {
|
||||
return visitDDLStatement(statement, context);
|
||||
}
|
||||
|
||||
default R visitAlterRoleStatement(AlterRoleStmt statement, C context) {
|
||||
return visitDDLStatement(statement, context);
|
||||
}
|
||||
|
||||
default R visitDropRoleStatement(DropRoleStmt statement, C context) {
|
||||
return visitDDLStatement(statement, context);
|
||||
}
|
||||
|
||||
|
||||
default R visitGrantRevokeRoleStatement(BaseGrantRevokeRoleStmt statement, C context) {
|
||||
return visitDDLStatement(statement, context);
|
||||
}
|
||||
|
||||
default R visitGrantRoleStatement(GrantRoleStmt statement, C context) {
|
||||
return visitGrantRevokeRoleStatement(statement, context);
|
||||
}
|
||||
|
||||
default R visitRevokeRoleStatement(RevokeRoleStmt statement, C context) {
|
||||
return visitGrantRevokeRoleStatement(statement, context);
|
||||
}
|
||||
|
||||
default R visitSetRoleStatement(SetRoleStmt statement, C context) {
|
||||
return visitStatement(statement, context);
|
||||
}
|
||||
|
||||
default R visitSetDefaultRoleStatement(SetDefaultRoleStmt statement, C context) {
|
||||
return visitStatement(statement, context);
|
||||
}
|
||||
|
||||
default R visitGrantRevokePrivilegeStatement(BaseGrantRevokePrivilegeStmt statement, C context) {
|
||||
return visitDDLStatement(statement, context);
|
||||
}
|
||||
|
||||
// ------------------------------------------- Security Integration Statement ----------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// ------------------------------------------- Group Provider Statement ----------------------------------------------------
|
||||
|
||||
default R visitCreateGroupProviderStatement(CreateGroupProviderStmt statement, C context) {
|
||||
return visitDDLStatement(statement, context);
|
||||
}
|
||||
|
||||
default R visitDropGroupProviderStatement(DropGroupProviderStmt statement, C context) {
|
||||
return visitDDLStatement(statement, context);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ---------------------------------------- Backup Restore Statement -----------------------------------------------
|
||||
|
||||
default R visitBackupStatement(BackupStmt statement, C context) {
|
||||
|
|
@ -725,49 +554,11 @@ public interface AstVisitorExtendInterface<R, C> extends AstVisitor<R, C> {
|
|||
return visitDDLStatement(statement, context);
|
||||
}
|
||||
|
||||
default R visitDropRepositoryStatement(DropRepositoryStmt statement, C context) {
|
||||
return visitDDLStatement(statement, context);
|
||||
}
|
||||
|
||||
// --------------------------------------- Sql BlackList And WhiteList Statement -----------------------------------
|
||||
|
||||
default R visitAddSqlBlackListStatement(AddSqlBlackListStmt statement, C context) {
|
||||
return visitStatement(statement, context);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// --------------------------------------- Backend BlackList -------------------------------------
|
||||
default R visitAddBackendBlackListStatement(AddBackendBlackListStmt statement, C context) {
|
||||
return visitStatement(statement, context);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// --------------------------------------- Compute Node BlackList -------------------------------------
|
||||
default R visitAddComputeNodeBlackListStatement(AddComputeNodeBlackListStmt statement, C context) {
|
||||
return visitStatement(statement, context);
|
||||
}
|
||||
|
||||
|
||||
|
||||
default R visitExecuteAsStatement(ExecuteAsStmt statement, C context) {
|
||||
return visitStatement(statement, context);
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------- DataCache Management Statement -------------------------------------------------
|
||||
default R visitCreateDataCacheRuleStatement(CreateDataCacheRuleStmt statement, C context) {
|
||||
return visitDDLStatement(statement, context);
|
||||
}
|
||||
|
||||
|
||||
default R visitDropDataCacheRuleStatement(DropDataCacheRuleStmt statement, C context) {
|
||||
return visitDDLStatement(statement, context);
|
||||
}
|
||||
|
||||
|
||||
default R visitDataCacheSelectStatement(DataCacheSelectStatement statement, C context) {
|
||||
return visitDDLStatement(statement, context);
|
||||
}
|
||||
|
|
@ -792,8 +583,6 @@ public interface AstVisitorExtendInterface<R, C> extends AstVisitor<R, C> {
|
|||
return visitDDLStatement(statement, context);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// --------------------------------------- File Statement ----------------------------------------------------------
|
||||
|
||||
default R visitCreateFileStatement(CreateFileStmt statement, C context) {
|
||||
|
|
@ -824,11 +613,6 @@ public interface AstVisitorExtendInterface<R, C> extends AstVisitor<R, C> {
|
|||
return visitShowStatement(statement, context);
|
||||
}
|
||||
|
||||
default R visitAlterStorageVolumeStatement(AlterStorageVolumeStmt statement, C context) {
|
||||
return visitDDLStatement(statement, context);
|
||||
}
|
||||
|
||||
|
||||
default R visitDescStorageVolumeStatement(DescStorageVolumeStmt statement, C context) {
|
||||
return visitShowStatement(statement, context);
|
||||
}
|
||||
|
|
@ -841,10 +625,6 @@ public interface AstVisitorExtendInterface<R, C> extends AstVisitor<R, C> {
|
|||
return visitNode(clause, context);
|
||||
}
|
||||
|
||||
default R visitAlterStorageVolumeCommentClause(AlterStorageVolumeCommentClause clause, C context) {
|
||||
return visitNode(clause, context);
|
||||
}
|
||||
|
||||
// -------------------------------------------- Pipe Statement -----------------------------------------------------
|
||||
default R visitPipeName(PipeName statement, C context) {
|
||||
return visitStatement(statement, context);
|
||||
|
|
@ -884,151 +664,12 @@ public interface AstVisitorExtendInterface<R, C> extends AstVisitor<R, C> {
|
|||
return visitDDLStatement(clause, context);
|
||||
}
|
||||
|
||||
default R visitDropDictionaryStatement(DropDictionaryStmt clause, C context) {
|
||||
return visitDDLStatement(clause, context);
|
||||
}
|
||||
|
||||
default R visitRefreshDictionaryStatement(RefreshDictionaryStmt clause, C context) {
|
||||
return visitDDLStatement(clause, context);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// ---------------------------------------- Warehouse Statement ----------------------------------------------------
|
||||
|
||||
|
||||
|
||||
default R visitCreateWarehouseStatement(CreateWarehouseStmt statement, C context) {
|
||||
return visitDDLStatement(statement, context);
|
||||
}
|
||||
|
||||
default R visitDropWarehouseStatement(DropWarehouseStmt statement, C context) {
|
||||
return visitDDLStatement(statement, context);
|
||||
}
|
||||
|
||||
default R visitSuspendWarehouseStatement(SuspendWarehouseStmt statement, C context) {
|
||||
return visitDDLStatement(statement, context);
|
||||
}
|
||||
|
||||
default R visitResumeWarehouseStatement(ResumeWarehouseStmt statement, C context) {
|
||||
return visitDDLStatement(statement, context);
|
||||
}
|
||||
|
||||
default R visitSetWarehouseStatement(SetWarehouseStmt statement, C context) {
|
||||
return visitStatement(statement, context);
|
||||
}
|
||||
|
||||
|
||||
default R visitAlterWarehouseStatement(AlterWarehouseStmt statement, C context) {
|
||||
return visitDDLStatement(statement, context);
|
||||
}
|
||||
|
||||
// ------------------------------------------- CNGroup statement ---------------------------------------------------
|
||||
default R visitCreateCNGroupStatement(CreateCnGroupStmt statement, C context) {
|
||||
return visitDDLStatement(statement, context);
|
||||
}
|
||||
|
||||
|
||||
default R visitEnableDisableCNGroupStatement(EnableDisableCnGroupStmt statement, C context) {
|
||||
return visitDDLStatement(statement, context);
|
||||
}
|
||||
|
||||
default R visitAlterCNGroupStatement(AlterCnGroupStmt statement, C context) {
|
||||
return visitDDLStatement(statement, context);
|
||||
}
|
||||
|
||||
// ------------------------------------------- Unsupported statement ---------------------------------------------------------
|
||||
|
||||
default R visitUnsupportedStatement(UnsupportedStmt statement, C context) {
|
||||
return visitStatement(statement, context);
|
||||
}
|
||||
|
||||
// ------------------------------------------- Alter Clause --------------------------------------------------------
|
||||
|
||||
//Alter system clause
|
||||
|
||||
default R visitFrontendClause(FrontendClause clause, C context) {
|
||||
return visitNode(clause, context);
|
||||
}
|
||||
|
||||
default R visitAddFollowerClause(AddFollowerClause clause, C context) {
|
||||
return visitFrontendClause(clause, context);
|
||||
}
|
||||
|
||||
default R visitDropFollowerClause(DropFollowerClause clause, C context) {
|
||||
return visitFrontendClause(clause, context);
|
||||
}
|
||||
|
||||
default R visitAddObserverClause(AddObserverClause clause, C context) {
|
||||
return visitFrontendClause(clause, context);
|
||||
}
|
||||
|
||||
default R visitDropObserverClause(DropObserverClause clause, C context) {
|
||||
return visitFrontendClause(clause, context);
|
||||
}
|
||||
|
||||
default R visitModifyFrontendHostClause(ModifyFrontendAddressClause clause, C context) {
|
||||
return visitNode(clause, context);
|
||||
}
|
||||
|
||||
default R visitBackendClause(BackendClause clause, C context) {
|
||||
return visitNode(clause, context);
|
||||
}
|
||||
|
||||
default R visitAddBackendClause(AddBackendClause clause, C context) {
|
||||
return visitBackendClause(clause, context);
|
||||
}
|
||||
|
||||
default R visitDropBackendClause(DropBackendClause clause, C context) {
|
||||
return visitBackendClause(clause, context);
|
||||
}
|
||||
|
||||
default R visitModifyBackendClause(ModifyBackendClause clause, C context) {
|
||||
return visitBackendClause(clause, context);
|
||||
}
|
||||
|
||||
default R visitDecommissionBackendClause(DecommissionBackendClause clause, C context) {
|
||||
return visitBackendClause(clause, context);
|
||||
}
|
||||
|
||||
default R visitModifyBrokerClause(ModifyBrokerClause clause, C context) {
|
||||
return visitNode(clause, context);
|
||||
}
|
||||
|
||||
default R visitComputeNodeClause(ComputeNodeClause clause, C context) {
|
||||
return visitNode(clause, context);
|
||||
}
|
||||
|
||||
default R visitAddComputeNodeClause(AddComputeNodeClause clause, C context) {
|
||||
return visitComputeNodeClause(clause, context);
|
||||
}
|
||||
|
||||
default R visitDropComputeNodeClause(DropComputeNodeClause clause, C context) {
|
||||
return visitComputeNodeClause(clause, context);
|
||||
}
|
||||
|
||||
default R visitCreateImageClause(CreateImageClause clause, C context) {
|
||||
return visitNode(clause, context);
|
||||
}
|
||||
|
||||
default R visitCleanTabletSchedQClause(CleanTabletSchedQClause clause, C context) {
|
||||
return visitNode(clause, context);
|
||||
}
|
||||
|
||||
//Alter table clause
|
||||
|
||||
default R visitCreateIndexClause(CreateIndexClause clause, C context) {
|
||||
return visitNode(clause, context);
|
||||
}
|
||||
|
||||
default R visitDropIndexClause(DropIndexClause clause, C context) {
|
||||
return visitNode(clause, context);
|
||||
}
|
||||
|
||||
default R visitDropPersistentIndexClause(DropPersistentIndexClause clause, C context) {
|
||||
return visitNode(clause, context);
|
||||
}
|
||||
|
||||
default R visitTableRenameClause(TableRenameClause clause, C context) {
|
||||
return visitNode(clause, context);
|
||||
}
|
||||
|
|
@ -1081,18 +722,6 @@ public interface AstVisitorExtendInterface<R, C> extends AstVisitor<R, C> {
|
|||
return visitNode(clause, context);
|
||||
}
|
||||
|
||||
default R visitAddRollupClause(AddRollupClause clause, C context) {
|
||||
return visitNode(clause, context);
|
||||
}
|
||||
|
||||
default R visitDropRollupClause(DropRollupClause clause, C context) {
|
||||
return visitNode(clause, context);
|
||||
}
|
||||
|
||||
default R visitRollupRenameClause(RollupRenameClause clause, C context) {
|
||||
return visitNode(clause, context);
|
||||
}
|
||||
|
||||
default R visitCompactionClause(CompactionClause clause, C context) {
|
||||
return visitNode(clause, context);
|
||||
}
|
||||
|
|
@ -1158,14 +787,6 @@ public interface AstVisitorExtendInterface<R, C> extends AstVisitor<R, C> {
|
|||
return visitNode(clause, context);
|
||||
}
|
||||
|
||||
default R visitDropBranchClause(DropBranchClause clause, C context) {
|
||||
return visitNode(clause, context);
|
||||
}
|
||||
|
||||
default R visitDropTagClause(DropTagClause clause, C context) {
|
||||
return visitNode(clause, context);
|
||||
}
|
||||
|
||||
// ------------------------------------------- Table Operation ----------------------------------==-----------------
|
||||
default R visitAlterTableOperationClause(AlterTableOperationClause clause, C context) {
|
||||
return visitNode(clause, context);
|
||||
|
|
@ -1471,32 +1092,6 @@ public interface AstVisitorExtendInterface<R, C> extends AstVisitor<R, C> {
|
|||
return visitStatement(statement, context);
|
||||
}
|
||||
|
||||
default R visitClearPlanAdvisorStatement(ClearPlanAdvisorStmt statement, C context) {
|
||||
return visitStatement(statement, context);
|
||||
}
|
||||
|
||||
default R visitDelPlanAdvisorStatement(DelPlanAdvisorStmt statement, C context) {
|
||||
return visitStatement(statement, context);
|
||||
}
|
||||
|
||||
default R visitShowPlanAdvisorStatement(ShowPlanAdvisorStmt statement, C context) {
|
||||
return visitStatement(statement, context);
|
||||
}
|
||||
|
||||
// ---------------------------------------- Transaction Statement --------------------------------------------------
|
||||
|
||||
default R visitBeginStatement(BeginStmt statement, C context) {
|
||||
return visitStatement(statement, context);
|
||||
}
|
||||
|
||||
default R visitCommitStatement(CommitStmt statement, C context) {
|
||||
return visitStatement(statement, context);
|
||||
}
|
||||
|
||||
default R visitRollbackStatement(RollbackStmt statement, C context) {
|
||||
return visitStatement(statement, context);
|
||||
}
|
||||
|
||||
// ---------------------------------------- Translate Statement --------------------------------------------------
|
||||
|
||||
// ------------------------------------------- AST -----------------------------------------------------------------
|
||||
|
|
@ -1538,7 +1133,6 @@ public interface AstVisitorExtendInterface<R, C> extends AstVisitor<R, C> {
|
|||
return visitShowStatement(statement, context);
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------- Procedure Statement -------------------------------------------------
|
||||
|
||||
default R visitCallProcedureStatement(CallProcedureStatement statement, C context) {
|
||||
|
|
|
|||
|
|
@ -2052,7 +2052,7 @@ public class AstBuilder extends com.starrocks.sql.parser.StarRocksBaseVisitor<Pa
|
|||
NodePosition pos = createPos(context);
|
||||
TaskName taskName;
|
||||
if (qualifiedName == null) {
|
||||
taskName = new TaskName(null, null, pos);
|
||||
taskName = new TaskName(null, null);
|
||||
} else {
|
||||
taskName = qualifiedNameToTaskName(qualifiedName);
|
||||
}
|
||||
|
|
@ -9141,9 +9141,9 @@ public class AstBuilder extends com.starrocks.sql.parser.StarRocksBaseVisitor<Pa
|
|||
// Hierarchy: database.table
|
||||
List<String> parts = qualifiedName.getParts();
|
||||
if (parts.size() == 2) {
|
||||
return new TaskName(parts.get(0), parts.get(1), qualifiedName.getPos());
|
||||
return new TaskName(normalizeName(parts.get(0)), normalizeName(parts.get(1)));
|
||||
} else if (parts.size() == 1) {
|
||||
return new TaskName(null, parts.get(0), qualifiedName.getPos());
|
||||
return new TaskName(null, normalizeName(parts.get(0)));
|
||||
} else {
|
||||
throw new ParsingException(PARSER_ERROR_MSG.invalidTaskFormat(qualifiedName.toString()),
|
||||
qualifiedName.getPos());
|
||||
|
|
|
|||
|
|
@ -88,6 +88,7 @@ import com.starrocks.sql.ast.CancelAlterSystemStmt;
|
|||
import com.starrocks.sql.ast.DecommissionBackendClause;
|
||||
import com.starrocks.sql.ast.DropBackendClause;
|
||||
import com.starrocks.sql.ast.DropComputeNodeClause;
|
||||
import com.starrocks.sql.ast.HostPort;
|
||||
import com.starrocks.sql.ast.ModifyBackendClause;
|
||||
import com.starrocks.system.Backend.BackendState;
|
||||
import com.starrocks.thrift.TNetworkAddress;
|
||||
|
|
@ -143,12 +144,13 @@ public class SystemInfoService implements GsonPostProcessable {
|
|||
|
||||
public void addComputeNodes(AddComputeNodeClause addComputeNodeClause)
|
||||
throws DdlException {
|
||||
for (Pair<String, Integer> pair : addComputeNodeClause.getHostPortPairs()) {
|
||||
checkSameNodeExist(pair.first, pair.second);
|
||||
for (HostPort hostPort : addComputeNodeClause.getHostPortPairs()) {
|
||||
checkSameNodeExist(hostPort.getHost(), hostPort.getPort());
|
||||
}
|
||||
|
||||
for (Pair<String, Integer> pair : addComputeNodeClause.getHostPortPairs()) {
|
||||
addComputeNode(pair.first, pair.second, addComputeNodeClause.getWarehouse(), addComputeNodeClause.getCNGroupName());
|
||||
for (HostPort hostPort : addComputeNodeClause.getHostPortPairs()) {
|
||||
addComputeNode(hostPort.getHost(), hostPort.getPort(), addComputeNodeClause.getWarehouse(),
|
||||
addComputeNodeClause.getCNGroupName());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -243,12 +245,13 @@ public class SystemInfoService implements GsonPostProcessable {
|
|||
}
|
||||
|
||||
public void addBackends(AddBackendClause addBackendClause) throws DdlException {
|
||||
for (Pair<String, Integer> pair : addBackendClause.getHostPortPairs()) {
|
||||
checkSameNodeExist(pair.first, pair.second);
|
||||
for (HostPort hostPort : addBackendClause.getHostPortPairs()) {
|
||||
checkSameNodeExist(hostPort.getHost(), hostPort.getPort());
|
||||
}
|
||||
|
||||
for (Pair<String, Integer> pair : addBackendClause.getHostPortPairs()) {
|
||||
addBackend(pair.first, pair.second, addBackendClause.getWarehouse(), addBackendClause.getCNGroupName());
|
||||
for (HostPort hostPort : addBackendClause.getHostPortPairs()) {
|
||||
addBackend(hostPort.getHost(), hostPort.getPort(), addBackendClause.getWarehouse(),
|
||||
addBackendClause.getCNGroupName());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -449,11 +452,11 @@ public class SystemInfoService implements GsonPostProcessable {
|
|||
long needCapacity = 0L;
|
||||
long releaseCapacity = 0L;
|
||||
// check if exist
|
||||
for (Pair<String, Integer> pair : decommissionBackendClause.getHostPortPairs()) {
|
||||
Backend backend = getBackendWithHeartbeatPort(pair.first, pair.second);
|
||||
for (HostPort hostPort : decommissionBackendClause.getHostPortPairs()) {
|
||||
Backend backend = getBackendWithHeartbeatPort(hostPort.getHost(), hostPort.getPort());
|
||||
if (backend == null) {
|
||||
throw new DdlException("Backend does not exist[" +
|
||||
NetUtils.getHostPortInAccessibleFormat(pair.first, pair.second) + "]");
|
||||
NetUtils.getHostPortInAccessibleFormat(hostPort.getHost(), hostPort.getPort()) + "]");
|
||||
}
|
||||
if (backend.isDecommissioned()) {
|
||||
// already under decommission, ignore it
|
||||
|
|
@ -534,18 +537,18 @@ public class SystemInfoService implements GsonPostProcessable {
|
|||
public void cancelDecommissionBackend(CancelAlterSystemStmt cancelAlterSystemStmt) throws DdlException {
|
||||
// check if backends is under decommission
|
||||
List<Backend> backends = Lists.newArrayList();
|
||||
List<Pair<String, Integer>> hostPortPairs = cancelAlterSystemStmt.getHostPortPairs();
|
||||
for (Pair<String, Integer> pair : hostPortPairs) {
|
||||
List<HostPort> hostPortPairs = cancelAlterSystemStmt.getHostPortPairs();
|
||||
for (HostPort hostPort : hostPortPairs) {
|
||||
// check if exist
|
||||
Backend backend = getBackendWithHeartbeatPort(pair.first, pair.second);
|
||||
Backend backend = getBackendWithHeartbeatPort(hostPort.getHost(), hostPort.getPort());
|
||||
if (backend == null) {
|
||||
throw new DdlException("Backend does not exist[" +
|
||||
NetUtils.getHostPortInAccessibleFormat(pair.first, pair.second) + "]");
|
||||
NetUtils.getHostPortInAccessibleFormat(hostPort.getHost(), hostPort.getPort()) + "]");
|
||||
}
|
||||
|
||||
if (!backend.isDecommissioned()) {
|
||||
// it's ok. just log
|
||||
LOG.info("backend is not decommissioned[{}]", pair.first);
|
||||
LOG.info("backend is not decommissioned[{}]", hostPort.getHost());
|
||||
continue;
|
||||
}
|
||||
|
||||
|
|
@ -578,14 +581,14 @@ public class SystemInfoService implements GsonPostProcessable {
|
|||
ErrorReport.reportDdlException(ErrorCode.ERR_UNKNOWN_WAREHOUSE, String.format("name: %s", warehouse));
|
||||
}
|
||||
|
||||
for (Pair<String, Integer> pair : dropComputeNodeClause.getHostPortPairs()) {
|
||||
dropComputeNode(pair.first, pair.second, warehouse, dropComputeNodeClause.getCNGroupName());
|
||||
for (HostPort hostPort : dropComputeNodeClause.getHostPortPairs()) {
|
||||
dropComputeNode(hostPort.getHost(), hostPort.getPort(), warehouse, dropComputeNodeClause.getCNGroupName());
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* The arg warehouse and cnGroupName can be null or empty,
|
||||
* which means ignore warehouse and cngroup when dropping compute node,
|
||||
* which means ignore warehouse and cngroup when dropping compute node,
|
||||
* otherwise they will be checked and an exception will be thrown if they are not matched.
|
||||
* If the warehouse is null or empty, the cnGroupName will be ignored.
|
||||
*/
|
||||
|
|
@ -625,7 +628,7 @@ public class SystemInfoService implements GsonPostProcessable {
|
|||
}
|
||||
|
||||
public void dropBackends(DropBackendClause dropBackendClause) throws DdlException {
|
||||
List<Pair<String, Integer>> hostPortPairs = dropBackendClause.getHostPortPairs();
|
||||
List<HostPort> hostPortPairs = dropBackendClause.getHostPortPairs();
|
||||
boolean needCheckWithoutForce = !dropBackendClause.isForce();
|
||||
|
||||
String warehouse = dropBackendClause.getWarehouse();
|
||||
|
|
@ -634,8 +637,8 @@ public class SystemInfoService implements GsonPostProcessable {
|
|||
ErrorReport.reportDdlException(ErrorCode.ERR_UNKNOWN_WAREHOUSE, String.format("name: %s", warehouse));
|
||||
}
|
||||
|
||||
for (Pair<String, Integer> pair : hostPortPairs) {
|
||||
dropBackend(pair.first, pair.second, warehouse, dropBackendClause.cngroupName, needCheckWithoutForce);
|
||||
for (HostPort hostPort : hostPortPairs) {
|
||||
dropBackend(hostPort.getHost(), hostPort.getPort(), warehouse, dropBackendClause.cngroupName, needCheckWithoutForce);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -691,7 +694,7 @@ public class SystemInfoService implements GsonPostProcessable {
|
|||
/*
|
||||
* Final entry of dropping backend.
|
||||
* The arg warehouse and cnGroupName can be null or empty,
|
||||
* which means ignore warehouse and cngroup when dropping compute node,
|
||||
* which means ignore warehouse and cngroup when dropping compute node,
|
||||
* otherwise they will be checked and an exception will be thrown if they are not matched.
|
||||
* If the warehouse is null or empty, the cnGroupName will be ignored.
|
||||
*/
|
||||
|
|
|
|||
|
|
@ -16,10 +16,10 @@ package com.starrocks.analysis;
|
|||
|
||||
import com.google.common.collect.ImmutableSet;
|
||||
import com.starrocks.alter.AlterOpType;
|
||||
import com.starrocks.common.Pair;
|
||||
import com.starrocks.qe.ConnectContext;
|
||||
import com.starrocks.sql.analyzer.AnalyzeTestUtil;
|
||||
import com.starrocks.sql.ast.AlterSystemStmt;
|
||||
import com.starrocks.sql.ast.HostPort;
|
||||
import com.starrocks.sql.ast.ModifyBrokerClause;
|
||||
import com.starrocks.utframe.UtFrameUtils;
|
||||
import org.junit.jupiter.api.Assertions;
|
||||
|
|
@ -42,12 +42,12 @@ public class ModifyBrokerClauseTest {
|
|||
String brokerName = "broker1";
|
||||
String hostPort = "127.0.0.1:8000";
|
||||
String stmt = String.format("ALTER SYSTEM ADD BROKER %s \"%s\"", brokerName, hostPort);
|
||||
ModifyBrokerClause clause = (ModifyBrokerClause)(
|
||||
(AlterSystemStmt)UtFrameUtils.parseStmtWithNewParser(stmt, connectContext)).getAlterClause();
|
||||
ModifyBrokerClause clause = (ModifyBrokerClause) (
|
||||
(AlterSystemStmt) UtFrameUtils.parseStmtWithNewParser(stmt, connectContext)).getAlterClause();
|
||||
Assertions.assertEquals(ModifyBrokerClause.ModifyOp.OP_ADD, clause.getOp());
|
||||
Assertions.assertEquals(AlterOpType.ALTER_OTHER, AlterOpType.getOpType(clause));
|
||||
Assertions.assertEquals(brokerName, clause.getBrokerName());
|
||||
Assertions.assertEquals(ImmutableSet.of(Pair.create("127.0.0.1", 8000)), clause.getHostPortPairs());
|
||||
Assertions.assertEquals(ImmutableSet.of(new HostPort("127.0.0.1", 8000)), clause.getHostPortPairs());
|
||||
}
|
||||
|
||||
@Test
|
||||
|
|
@ -56,20 +56,21 @@ public class ModifyBrokerClauseTest {
|
|||
String hostPort1 = "127.0.0.1:8000";
|
||||
String hostPort2 = "127.0.0.1:8001";
|
||||
String stmt = String.format("ALTER SYSTEM DROP BROKER %s \"%s\", \"%s\"", brokerName, hostPort1, hostPort2);
|
||||
ModifyBrokerClause clause = (ModifyBrokerClause)(
|
||||
(AlterSystemStmt)UtFrameUtils.parseStmtWithNewParser(stmt, connectContext)).getAlterClause();
|
||||
ModifyBrokerClause clause = (ModifyBrokerClause) (
|
||||
(AlterSystemStmt) UtFrameUtils.parseStmtWithNewParser(stmt, connectContext)).getAlterClause();
|
||||
Assertions.assertEquals(ModifyBrokerClause.ModifyOp.OP_DROP, clause.getOp());
|
||||
Assertions.assertEquals(AlterOpType.ALTER_OTHER, AlterOpType.getOpType(clause));
|
||||
Assertions.assertEquals(brokerName, clause.getBrokerName());
|
||||
Assertions.assertEquals(ImmutableSet.of(Pair.create("127.0.0.1", 8000), Pair.create("127.0.0.1", 8001)), clause.getHostPortPairs());
|
||||
Assertions.assertEquals(ImmutableSet.of(new HostPort("127.0.0.1", 8000), new HostPort("127.0.0.1", 8001)),
|
||||
clause.getHostPortPairs());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDropAllBrokerCluase() throws Exception {
|
||||
String brokerName = "broker1";
|
||||
String stmt = String.format("ALTER SYSTEM DROP ALL BROKER %s", brokerName);
|
||||
ModifyBrokerClause clause = (ModifyBrokerClause)(
|
||||
(AlterSystemStmt)UtFrameUtils.parseStmtWithNewParser(stmt, connectContext)).getAlterClause();
|
||||
ModifyBrokerClause clause = (ModifyBrokerClause) (
|
||||
(AlterSystemStmt) UtFrameUtils.parseStmtWithNewParser(stmt, connectContext)).getAlterClause();
|
||||
Assertions.assertEquals(ModifyBrokerClause.ModifyOp.OP_DROP_ALL, clause.getOp());
|
||||
Assertions.assertEquals(AlterOpType.ALTER_OTHER, AlterOpType.getOpType(clause));
|
||||
Assertions.assertEquals(brokerName, clause.getBrokerName());
|
||||
|
|
|
|||
|
|
@ -38,7 +38,6 @@ import com.google.common.collect.Lists;
|
|||
import com.starrocks.catalog.Database;
|
||||
import com.starrocks.common.AnalysisException;
|
||||
import com.starrocks.common.DdlException;
|
||||
import com.starrocks.common.Pair;
|
||||
import com.starrocks.common.StarRocksException;
|
||||
import com.starrocks.lake.StarOSAgent;
|
||||
import com.starrocks.server.GlobalStateMgr;
|
||||
|
|
@ -49,6 +48,7 @@ import com.starrocks.sql.analyzer.SemanticException;
|
|||
import com.starrocks.sql.ast.AddBackendClause;
|
||||
import com.starrocks.sql.ast.AddComputeNodeClause;
|
||||
import com.starrocks.sql.ast.DropBackendClause;
|
||||
import com.starrocks.sql.ast.HostPort;
|
||||
import com.starrocks.sql.parser.NodePosition;
|
||||
import com.starrocks.system.Backend;
|
||||
import com.starrocks.system.ComputeNode;
|
||||
|
|
@ -141,7 +141,7 @@ public class SystemInfoServiceTest {
|
|||
clearAllBackend();
|
||||
AddBackendClause stmt = new AddBackendClause(Lists.newArrayList("192.168.0.1:1234"),
|
||||
WarehouseManager.DEFAULT_WAREHOUSE_NAME);
|
||||
stmt.getHostPortPairs().add(Pair.create("192.168.0.1", 1234));
|
||||
stmt.getHostPortPairs().add(new HostPort("192.168.0.1", 1234));
|
||||
try {
|
||||
systemInfoService.addBackends(stmt);
|
||||
} catch (DdlException e) {
|
||||
|
|
@ -176,7 +176,7 @@ public class SystemInfoServiceTest {
|
|||
AddComputeNodeClause stmt = new AddComputeNodeClause(Lists.newArrayList("192.168.0.1:1234"),
|
||||
WarehouseManager.DEFAULT_WAREHOUSE_NAME, "", NodePosition.ZERO);
|
||||
|
||||
stmt.getHostPortPairs().add(Pair.create("192.168.0.1", 1234));
|
||||
stmt.getHostPortPairs().add(new HostPort("192.168.0.1", 1234));
|
||||
|
||||
try {
|
||||
systemInfoService.addComputeNodes(stmt);
|
||||
|
|
@ -198,7 +198,7 @@ public class SystemInfoServiceTest {
|
|||
clearAllBackend();
|
||||
AddBackendClause stmt = new AddBackendClause(Lists.newArrayList("192.168.0.1:1234"),
|
||||
WarehouseManager.DEFAULT_WAREHOUSE_NAME);
|
||||
stmt.getHostPortPairs().add(Pair.create("192.168.0.1", 1234));
|
||||
stmt.getHostPortPairs().add(new HostPort("192.168.0.1", 1234));
|
||||
try {
|
||||
systemInfoService.addBackends(stmt);
|
||||
} catch (DdlException e) {
|
||||
|
|
@ -207,7 +207,7 @@ public class SystemInfoServiceTest {
|
|||
|
||||
DropBackendClause dropStmt =
|
||||
new DropBackendClause(Lists.newArrayList("192.168.0.1:1234"), true, WarehouseManager.DEFAULT_WAREHOUSE_NAME);
|
||||
dropStmt.getHostPortPairs().add(Pair.create("192.168.0.1", 1234));
|
||||
dropStmt.getHostPortPairs().add(new HostPort("192.168.0.1", 1234));
|
||||
try {
|
||||
systemInfoService.dropBackends(dropStmt);
|
||||
} catch (DdlException e) {
|
||||
|
|
@ -250,7 +250,7 @@ public class SystemInfoServiceTest {
|
|||
|
||||
AddBackendClause stmt2 = new AddBackendClause(Lists.newArrayList("192.168.0.1:1235"),
|
||||
WarehouseManager.DEFAULT_WAREHOUSE_NAME);
|
||||
stmt2.getHostPortPairs().add(Pair.create("192.168.0.1", 1235));
|
||||
stmt2.getHostPortPairs().add(new HostPort("192.168.0.1", 1235));
|
||||
|
||||
try {
|
||||
systemInfoService.addBackends(stmt2);
|
||||
|
|
@ -260,7 +260,7 @@ public class SystemInfoServiceTest {
|
|||
|
||||
DropBackendClause dropStmt2 =
|
||||
new DropBackendClause(Lists.newArrayList("192.168.0.1:1235"), true, WarehouseManager.DEFAULT_WAREHOUSE_NAME);
|
||||
dropStmt2.getHostPortPairs().add(Pair.create("192.168.0.1", 1235));
|
||||
dropStmt2.getHostPortPairs().add(new HostPort("192.168.0.1", 1235));
|
||||
|
||||
try {
|
||||
systemInfoService.dropBackends(dropStmt2);
|
||||
|
|
@ -282,7 +282,7 @@ public class SystemInfoServiceTest {
|
|||
clearAllBackend();
|
||||
AddComputeNodeClause stmt = new AddComputeNodeClause(Lists.newArrayList("192.168.0.1:1234"),
|
||||
WarehouseManager.DEFAULT_WAREHOUSE_NAME, "", NodePosition.ZERO);
|
||||
stmt.getHostPortPairs().add(Pair.create("192.168.0.1", 1234));
|
||||
stmt.getHostPortPairs().add(new HostPort("192.168.0.1", 1234));
|
||||
|
||||
try {
|
||||
systemInfoService.addComputeNodes(stmt);
|
||||
|
|
|
|||
|
|
@ -938,7 +938,7 @@ public class RedirectStatusTest {
|
|||
QueryStatement queryStatement = new QueryStatement(selectRelation);
|
||||
|
||||
InsertStmt insertStmt = new InsertStmt(new TableName(), queryStatement);
|
||||
SubmitTaskStmt stmt = new SubmitTaskStmt(new TaskName("", "", NodePosition.ZERO), 0, insertStmt, NodePosition.ZERO);
|
||||
SubmitTaskStmt stmt = new SubmitTaskStmt(new TaskName("", ""), 0, insertStmt, NodePosition.ZERO);
|
||||
Assertions.assertEquals(RedirectStatus.FORWARD_WITH_SYNC, RedirectStatus.getRedirectStatus(stmt));
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -17,7 +17,6 @@ package com.starrocks.system;
|
|||
import com.google.common.collect.ImmutableMap;
|
||||
import com.starrocks.catalog.DiskInfo;
|
||||
import com.starrocks.common.DdlException;
|
||||
import com.starrocks.common.Pair;
|
||||
import com.starrocks.leader.CheckpointController;
|
||||
import com.starrocks.persist.CancelDecommissionDiskInfo;
|
||||
import com.starrocks.persist.DecommissionDiskInfo;
|
||||
|
|
@ -37,6 +36,7 @@ import com.starrocks.sql.ast.CancelAlterSystemStmt;
|
|||
import com.starrocks.sql.ast.DecommissionBackendClause;
|
||||
import com.starrocks.sql.ast.DropBackendClause;
|
||||
import com.starrocks.sql.ast.DropComputeNodeClause;
|
||||
import com.starrocks.sql.ast.HostPort;
|
||||
import com.starrocks.sql.ast.ModifyBackendClause;
|
||||
import com.starrocks.thrift.TDisk;
|
||||
import com.starrocks.thrift.TStorageMedium;
|
||||
|
|
@ -89,8 +89,8 @@ public class SystemInfoServiceEditLogTest {
|
|||
List<String> hostPorts = Arrays.asList("192.168.1.100:9050", "192.168.1.101:9051");
|
||||
|
||||
AddComputeNodeClause addComputeNodeClause = new AddComputeNodeClause(hostPorts, warehouse, cnGroupName, null);
|
||||
addComputeNodeClause.getHostPortPairs().add(Pair.create("192.168.1.100", 9050));
|
||||
addComputeNodeClause.getHostPortPairs().add(Pair.create("192.168.1.101", 9051));
|
||||
addComputeNodeClause.getHostPortPairs().add(new HostPort("192.168.1.100", 9050));
|
||||
addComputeNodeClause.getHostPortPairs().add(new HostPort("192.168.1.101", 9051));
|
||||
|
||||
// 2. Verify initial state
|
||||
Assertions.assertEquals(0, masterSystemInfoService.getComputeNodes().size());
|
||||
|
|
@ -157,7 +157,7 @@ public class SystemInfoServiceEditLogTest {
|
|||
List<String> hostPorts = List.of("192.168.1.200:9050");
|
||||
|
||||
AddComputeNodeClause addComputeNodeClause = new AddComputeNodeClause(hostPorts, warehouse, cnGroupName, null);
|
||||
addComputeNodeClause.getHostPortPairs().add(Pair.create("192.168.1.200", 9050));
|
||||
addComputeNodeClause.getHostPortPairs().add(new HostPort("192.168.1.200", 9050));
|
||||
|
||||
// 2. Create a separate SystemInfoService for exception testing
|
||||
SystemInfoService exceptionSystemInfoService = new SystemInfoService();
|
||||
|
|
@ -193,9 +193,9 @@ public class SystemInfoServiceEditLogTest {
|
|||
List<String> hostPorts = Arrays.asList("192.168.1.100:9050", "192.168.1.101:9051", "192.168.1.102:9052");
|
||||
|
||||
AddComputeNodeClause addComputeNodeClause = new AddComputeNodeClause(hostPorts, warehouse, cnGroupName, null);
|
||||
addComputeNodeClause.getHostPortPairs().add(Pair.create("192.168.1.100", 9050));
|
||||
addComputeNodeClause.getHostPortPairs().add(Pair.create("192.168.1.101", 9051));
|
||||
addComputeNodeClause.getHostPortPairs().add(Pair.create("192.168.1.102", 9052));
|
||||
addComputeNodeClause.getHostPortPairs().add(new HostPort("192.168.1.100", 9050));
|
||||
addComputeNodeClause.getHostPortPairs().add(new HostPort("192.168.1.101", 9051));
|
||||
addComputeNodeClause.getHostPortPairs().add(new HostPort("192.168.1.102", 9052));
|
||||
masterSystemInfoService.addComputeNodes(addComputeNodeClause);
|
||||
|
||||
// 2. Verify all compute nodes are added
|
||||
|
|
@ -218,9 +218,9 @@ public class SystemInfoServiceEditLogTest {
|
|||
List<String> hostPorts = Arrays.asList("192.168.1.100:9050", "192.168.1.101:9051", "192.168.1.102:9052");
|
||||
|
||||
AddComputeNodeClause addComputeNodeClause = new AddComputeNodeClause(hostPorts, warehouse, cnGroupName, null);
|
||||
addComputeNodeClause.getHostPortPairs().add(Pair.create("192.168.1.100", 9050));
|
||||
addComputeNodeClause.getHostPortPairs().add(Pair.create("192.168.1.101", 9051));
|
||||
addComputeNodeClause.getHostPortPairs().add(Pair.create("192.168.1.102", 9052));
|
||||
addComputeNodeClause.getHostPortPairs().add(new HostPort("192.168.1.100", 9050));
|
||||
addComputeNodeClause.getHostPortPairs().add(new HostPort("192.168.1.101", 9051));
|
||||
addComputeNodeClause.getHostPortPairs().add(new HostPort("192.168.1.102", 9052));
|
||||
masterSystemInfoService.addComputeNodes(addComputeNodeClause);
|
||||
|
||||
// 2. Verify follower initial state
|
||||
|
|
@ -260,8 +260,8 @@ public class SystemInfoServiceEditLogTest {
|
|||
String cnGroupName = "";
|
||||
|
||||
AddBackendClause addBackendClause = new AddBackendClause(hostPorts, warehouse, cnGroupName, null);
|
||||
addBackendClause.getHostPortPairs().add(Pair.create("192.168.1.100", 9060));
|
||||
addBackendClause.getHostPortPairs().add(Pair.create("192.168.1.101", 9061));
|
||||
addBackendClause.getHostPortPairs().add(new HostPort("192.168.1.100", 9060));
|
||||
addBackendClause.getHostPortPairs().add(new HostPort("192.168.1.101", 9061));
|
||||
|
||||
// 2. Verify initial state
|
||||
Assertions.assertEquals(0, masterSystemInfoService.getBackends().size());
|
||||
|
|
@ -334,7 +334,7 @@ public class SystemInfoServiceEditLogTest {
|
|||
String cnGroupName = "";
|
||||
|
||||
AddBackendClause addBackendClause = new AddBackendClause(hostPorts, warehouse, cnGroupName, null);
|
||||
addBackendClause.getHostPortPairs().add(Pair.create("192.168.1.200", 9060));
|
||||
addBackendClause.getHostPortPairs().add(new HostPort("192.168.1.200", 9060));
|
||||
|
||||
// 2. Create a separate SystemInfoService for exception testing
|
||||
SystemInfoService exceptionSystemInfoService = new SystemInfoService();
|
||||
|
|
@ -372,9 +372,9 @@ public class SystemInfoServiceEditLogTest {
|
|||
String cnGroupName = "";
|
||||
|
||||
AddBackendClause addBackendClause = new AddBackendClause(hostPorts, warehouse, cnGroupName, null);
|
||||
addBackendClause.getHostPortPairs().add(Pair.create("192.168.1.100", 9060));
|
||||
addBackendClause.getHostPortPairs().add(Pair.create("192.168.1.101", 9061));
|
||||
addBackendClause.getHostPortPairs().add(Pair.create("192.168.1.102", 9062));
|
||||
addBackendClause.getHostPortPairs().add(new HostPort("192.168.1.100", 9060));
|
||||
addBackendClause.getHostPortPairs().add(new HostPort("192.168.1.101", 9061));
|
||||
addBackendClause.getHostPortPairs().add(new HostPort("192.168.1.102", 9062));
|
||||
masterSystemInfoService.addBackends(addBackendClause);
|
||||
|
||||
// 2. Verify all backends are added
|
||||
|
|
@ -400,9 +400,9 @@ public class SystemInfoServiceEditLogTest {
|
|||
String cnGroupName = "";
|
||||
|
||||
AddBackendClause addBackendClause = new AddBackendClause(hostPorts, warehouse, cnGroupName, null);
|
||||
addBackendClause.getHostPortPairs().add(Pair.create("192.168.1.100", 9060));
|
||||
addBackendClause.getHostPortPairs().add(Pair.create("192.168.1.101", 9061));
|
||||
addBackendClause.getHostPortPairs().add(Pair.create("192.168.1.102", 9062));
|
||||
addBackendClause.getHostPortPairs().add(new HostPort("192.168.1.100", 9060));
|
||||
addBackendClause.getHostPortPairs().add(new HostPort("192.168.1.101", 9061));
|
||||
addBackendClause.getHostPortPairs().add(new HostPort("192.168.1.102", 9062));
|
||||
masterSystemInfoService.addBackends(addBackendClause);
|
||||
|
||||
// 2. Verify follower initial state
|
||||
|
|
@ -443,8 +443,8 @@ public class SystemInfoServiceEditLogTest {
|
|||
String cnGroupName = "";
|
||||
|
||||
AddBackendClause addBackendClause = new AddBackendClause(hostPorts, warehouse, cnGroupName, null);
|
||||
addBackendClause.getHostPortPairs().add(Pair.create("192.168.1.200", 9060));
|
||||
addBackendClause.getHostPortPairs().add(Pair.create("192.168.1.201", 9061));
|
||||
addBackendClause.getHostPortPairs().add(new HostPort("192.168.1.200", 9060));
|
||||
addBackendClause.getHostPortPairs().add(new HostPort("192.168.1.201", 9061));
|
||||
masterSystemInfoService.addBackends(addBackendClause);
|
||||
Assertions.assertEquals(2, masterSystemInfoService.getBackends().size());
|
||||
|
||||
|
|
@ -460,7 +460,7 @@ public class SystemInfoServiceEditLogTest {
|
|||
// 3. Execute dropBackends operation (master side)
|
||||
List<String> dropHostPorts = Arrays.asList("192.168.1.200:9060");
|
||||
DropBackendClause dropBackendClause = new DropBackendClause(dropHostPorts, false, warehouse, cnGroupName, null);
|
||||
dropBackendClause.getHostPortPairs().add(Pair.create("192.168.1.200", 9060));
|
||||
dropBackendClause.getHostPortPairs().add(new HostPort("192.168.1.200", 9060));
|
||||
masterSystemInfoService.dropBackends(dropBackendClause);
|
||||
|
||||
// 4. Verify master state after dropping
|
||||
|
|
@ -505,7 +505,7 @@ public class SystemInfoServiceEditLogTest {
|
|||
String cnGroupName = "";
|
||||
|
||||
AddBackendClause addBackendClause = new AddBackendClause(hostPorts, warehouse, cnGroupName, null);
|
||||
addBackendClause.getHostPortPairs().add(Pair.create("192.168.1.300", 9060));
|
||||
addBackendClause.getHostPortPairs().add(new HostPort("192.168.1.300", 9060));
|
||||
|
||||
// 2. Create a separate SystemInfoService for exception testing
|
||||
SystemInfoService exceptionSystemInfoService = new SystemInfoService();
|
||||
|
|
@ -523,7 +523,7 @@ public class SystemInfoServiceEditLogTest {
|
|||
// 3. Execute dropBackends operation and expect exception
|
||||
List<String> dropHostPorts = Arrays.asList("192.168.1.300:9060");
|
||||
DropBackendClause dropBackendClause = new DropBackendClause(dropHostPorts, false, warehouse, cnGroupName, null);
|
||||
dropBackendClause.getHostPortPairs().add(Pair.create("192.168.1.300", 9060));
|
||||
dropBackendClause.getHostPortPairs().add(new HostPort("192.168.1.300", 9060));
|
||||
RuntimeException exception = Assertions.assertThrows(RuntimeException.class, () -> {
|
||||
exceptionSystemInfoService.dropBackends(dropBackendClause);
|
||||
});
|
||||
|
|
@ -551,7 +551,7 @@ public class SystemInfoServiceEditLogTest {
|
|||
|
||||
// 3. Execute dropBackends operation and expect DdlException
|
||||
DropBackendClause dropBackendClause = new DropBackendClause(dropHostPorts, false, warehouse, cnGroupName, null);
|
||||
dropBackendClause.getHostPortPairs().add(Pair.create("192.168.1.400", 9060));
|
||||
dropBackendClause.getHostPortPairs().add(new HostPort("192.168.1.400", 9060));
|
||||
DdlException exception = Assertions.assertThrows(DdlException.class, () -> {
|
||||
masterSystemInfoService.dropBackends(dropBackendClause);
|
||||
});
|
||||
|
|
@ -569,7 +569,7 @@ public class SystemInfoServiceEditLogTest {
|
|||
String cnGroupName = "";
|
||||
|
||||
AddBackendClause addBackendClause = new AddBackendClause(hostPorts, warehouse, cnGroupName, null);
|
||||
addBackendClause.getHostPortPairs().add(Pair.create("192.168.1.500", 9060));
|
||||
addBackendClause.getHostPortPairs().add(new HostPort("192.168.1.500", 9060));
|
||||
masterSystemInfoService.addBackends(addBackendClause);
|
||||
Assertions.assertEquals(1, masterSystemInfoService.getBackends().size());
|
||||
|
||||
|
|
@ -577,7 +577,7 @@ public class SystemInfoServiceEditLogTest {
|
|||
String wrongWarehouse = "wrong_warehouse";
|
||||
List<String> dropHostPorts = Arrays.asList("192.168.1.500:9060");
|
||||
DropBackendClause dropBackendClause = new DropBackendClause(dropHostPorts, false, wrongWarehouse, cnGroupName, null);
|
||||
dropBackendClause.getHostPortPairs().add(Pair.create("192.168.1.500", 9060));
|
||||
dropBackendClause.getHostPortPairs().add(new HostPort("192.168.1.500", 9060));
|
||||
|
||||
// 3. Expect DdlException to be thrown
|
||||
Assertions.assertThrows(DdlException.class, () -> {
|
||||
|
|
@ -599,16 +599,16 @@ public class SystemInfoServiceEditLogTest {
|
|||
String cnGroupName = "";
|
||||
|
||||
AddBackendClause addBackendClause = new AddBackendClause(hostPorts, warehouse, cnGroupName, null);
|
||||
addBackendClause.getHostPortPairs().add(Pair.create("192.168.1.100", 9060));
|
||||
addBackendClause.getHostPortPairs().add(Pair.create("192.168.1.101", 9061));
|
||||
addBackendClause.getHostPortPairs().add(Pair.create("192.168.1.102", 9062));
|
||||
addBackendClause.getHostPortPairs().add(new HostPort("192.168.1.100", 9060));
|
||||
addBackendClause.getHostPortPairs().add(new HostPort("192.168.1.101", 9061));
|
||||
addBackendClause.getHostPortPairs().add(new HostPort("192.168.1.102", 9062));
|
||||
masterSystemInfoService.addBackends(addBackendClause);
|
||||
Assertions.assertEquals(3, masterSystemInfoService.getBackends().size());
|
||||
|
||||
// 2. Drop one backend
|
||||
List<String> dropHostPorts = Arrays.asList("192.168.1.100:9060");
|
||||
DropBackendClause dropBackendClause = new DropBackendClause(dropHostPorts, false, warehouse, cnGroupName, null);
|
||||
dropBackendClause.getHostPortPairs().add(Pair.create("192.168.1.100", 9060));
|
||||
dropBackendClause.getHostPortPairs().add(new HostPort("192.168.1.100", 9060));
|
||||
masterSystemInfoService.dropBackends(dropBackendClause);
|
||||
Assertions.assertEquals(2, masterSystemInfoService.getBackends().size());
|
||||
|
||||
|
|
@ -639,16 +639,16 @@ public class SystemInfoServiceEditLogTest {
|
|||
String cnGroupName = "";
|
||||
|
||||
AddBackendClause addBackendClause = new AddBackendClause(hostPorts, warehouse, cnGroupName, null);
|
||||
addBackendClause.getHostPortPairs().add(Pair.create("192.168.1.100", 9060));
|
||||
addBackendClause.getHostPortPairs().add(Pair.create("192.168.1.101", 9061));
|
||||
addBackendClause.getHostPortPairs().add(Pair.create("192.168.1.102", 9062));
|
||||
addBackendClause.getHostPortPairs().add(new HostPort("192.168.1.100", 9060));
|
||||
addBackendClause.getHostPortPairs().add(new HostPort("192.168.1.101", 9061));
|
||||
addBackendClause.getHostPortPairs().add(new HostPort("192.168.1.102", 9062));
|
||||
masterSystemInfoService.addBackends(addBackendClause);
|
||||
Assertions.assertEquals(3, masterSystemInfoService.getBackends().size());
|
||||
|
||||
// 2. Drop one backend
|
||||
List<String> dropHostPorts = Arrays.asList("192.168.1.100:9060");
|
||||
DropBackendClause dropBackendClause = new DropBackendClause(dropHostPorts, false, warehouse, cnGroupName, null);
|
||||
dropBackendClause.getHostPortPairs().add(Pair.create("192.168.1.100", 9060));
|
||||
dropBackendClause.getHostPortPairs().add(new HostPort("192.168.1.100", 9060));
|
||||
masterSystemInfoService.dropBackends(dropBackendClause);
|
||||
Assertions.assertEquals(2, masterSystemInfoService.getBackends().size());
|
||||
|
||||
|
|
@ -699,8 +699,8 @@ public class SystemInfoServiceEditLogTest {
|
|||
// 2. Add some compute nodes first
|
||||
List<String> hostPorts = Arrays.asList("192.168.1.100:9050", "192.168.1.101:9051");
|
||||
AddComputeNodeClause addComputeNodeClause = new AddComputeNodeClause(hostPorts, warehouse, cnGroupName, null);
|
||||
addComputeNodeClause.getHostPortPairs().add(Pair.create("192.168.1.100", 9050));
|
||||
addComputeNodeClause.getHostPortPairs().add(Pair.create("192.168.1.101", 9051));
|
||||
addComputeNodeClause.getHostPortPairs().add(new HostPort("192.168.1.100", 9050));
|
||||
addComputeNodeClause.getHostPortPairs().add(new HostPort("192.168.1.101", 9051));
|
||||
masterSystemInfoService.addComputeNodes(addComputeNodeClause);
|
||||
Assertions.assertEquals(2, masterSystemInfoService.getComputeNodes().size());
|
||||
|
||||
|
|
@ -745,7 +745,7 @@ public class SystemInfoServiceEditLogTest {
|
|||
// 2. Add some compute nodes first
|
||||
List<String> hostPorts = Arrays.asList("192.168.1.200:9050");
|
||||
AddComputeNodeClause addComputeNodeClause = new AddComputeNodeClause(hostPorts, warehouse, cnGroupName, null);
|
||||
addComputeNodeClause.getHostPortPairs().add(Pair.create("192.168.1.200", 9050));
|
||||
addComputeNodeClause.getHostPortPairs().add(new HostPort("192.168.1.200", 9050));
|
||||
|
||||
// 3. Create a separate SystemInfoService for exception testing
|
||||
SystemInfoService exceptionSystemInfoService = new SystemInfoService();
|
||||
|
|
@ -810,8 +810,8 @@ public class SystemInfoServiceEditLogTest {
|
|||
// 2. Add some backends first
|
||||
List<String> hostPorts = Arrays.asList("192.168.1.100:9060", "192.168.1.101:9061");
|
||||
AddBackendClause addBackendClause = new AddBackendClause(hostPorts, warehouse, cnGroupName, null);
|
||||
addBackendClause.getHostPortPairs().add(Pair.create("192.168.1.100", 9060));
|
||||
addBackendClause.getHostPortPairs().add(Pair.create("192.168.1.101", 9061));
|
||||
addBackendClause.getHostPortPairs().add(new HostPort("192.168.1.100", 9060));
|
||||
addBackendClause.getHostPortPairs().add(new HostPort("192.168.1.101", 9061));
|
||||
masterSystemInfoService.addBackends(addBackendClause);
|
||||
Assertions.assertEquals(2, masterSystemInfoService.getBackends().size());
|
||||
|
||||
|
|
@ -854,7 +854,7 @@ public class SystemInfoServiceEditLogTest {
|
|||
// 2. Add some backends first
|
||||
List<String> hostPorts = Arrays.asList("192.168.1.200:9060");
|
||||
AddBackendClause addBackendClause = new AddBackendClause(hostPorts, warehouse, cnGroupName, null);
|
||||
addBackendClause.getHostPortPairs().add(Pair.create("192.168.1.200", 9060));
|
||||
addBackendClause.getHostPortPairs().add(new HostPort("192.168.1.200", 9060));
|
||||
|
||||
// 3. Create a separate SystemInfoService for exception testing
|
||||
SystemInfoService exceptionSystemInfoService = new SystemInfoService();
|
||||
|
|
@ -920,12 +920,12 @@ public class SystemInfoServiceEditLogTest {
|
|||
// 2. Add compute nodes and backends
|
||||
List<String> computeHostPorts = Arrays.asList("192.168.1.100:9050");
|
||||
AddComputeNodeClause addComputeNodeClause = new AddComputeNodeClause(computeHostPorts, warehouse, cnGroupName, null);
|
||||
addComputeNodeClause.getHostPortPairs().add(Pair.create("192.168.1.100", 9050));
|
||||
addComputeNodeClause.getHostPortPairs().add(new HostPort("192.168.1.100", 9050));
|
||||
masterSystemInfoService.addComputeNodes(addComputeNodeClause);
|
||||
|
||||
List<String> backendHostPorts = Arrays.asList("192.168.1.200:9060");
|
||||
AddBackendClause addBackendClause = new AddBackendClause(backendHostPorts, warehouse, cnGroupName, null);
|
||||
addBackendClause.getHostPortPairs().add(Pair.create("192.168.1.200", 9060));
|
||||
addBackendClause.getHostPortPairs().add(new HostPort("192.168.1.200", 9060));
|
||||
masterSystemInfoService.addBackends(addBackendClause);
|
||||
|
||||
// 3. Execute multiple historical node updates
|
||||
|
|
@ -980,7 +980,7 @@ public class SystemInfoServiceEditLogTest {
|
|||
|
||||
List<String> hostPorts = Arrays.asList(originalHost + ":" + heartbeatPort);
|
||||
AddBackendClause addBackendClause = new AddBackendClause(hostPorts, warehouse, cnGroupName, null);
|
||||
addBackendClause.getHostPortPairs().add(Pair.create(originalHost, heartbeatPort));
|
||||
addBackendClause.getHostPortPairs().add(new HostPort(originalHost, heartbeatPort));
|
||||
masterSystemInfoService.addBackends(addBackendClause);
|
||||
Assertions.assertEquals(1, masterSystemInfoService.getBackends().size());
|
||||
|
||||
|
|
@ -1033,7 +1033,7 @@ public class SystemInfoServiceEditLogTest {
|
|||
|
||||
List<String> hostPorts = Arrays.asList(originalHost + ":" + heartbeatPort);
|
||||
AddBackendClause addBackendClause = new AddBackendClause(hostPorts, warehouse, cnGroupName, null);
|
||||
addBackendClause.getHostPortPairs().add(Pair.create(originalHost, heartbeatPort));
|
||||
addBackendClause.getHostPortPairs().add(new HostPort(originalHost, heartbeatPort));
|
||||
|
||||
// 2. Create a separate SystemInfoService for exception testing
|
||||
SystemInfoService exceptionSystemInfoService = new SystemInfoService();
|
||||
|
|
@ -1070,7 +1070,7 @@ public class SystemInfoServiceEditLogTest {
|
|||
|
||||
List<String> hostPorts = Arrays.asList(host + ":" + heartbeatPort);
|
||||
AddBackendClause addBackendClause = new AddBackendClause(hostPorts, warehouse, cnGroupName, null);
|
||||
addBackendClause.getHostPortPairs().add(Pair.create(host, heartbeatPort));
|
||||
addBackendClause.getHostPortPairs().add(new HostPort(host, heartbeatPort));
|
||||
masterSystemInfoService.addBackends(addBackendClause);
|
||||
Assertions.assertEquals(1, masterSystemInfoService.getBackends().size());
|
||||
|
||||
|
|
@ -1129,7 +1129,7 @@ public class SystemInfoServiceEditLogTest {
|
|||
|
||||
List<String> hostPorts = Arrays.asList(host + ":" + heartbeatPort);
|
||||
AddBackendClause addBackendClause = new AddBackendClause(hostPorts, warehouse, cnGroupName, null);
|
||||
addBackendClause.getHostPortPairs().add(Pair.create(host, heartbeatPort));
|
||||
addBackendClause.getHostPortPairs().add(new HostPort(host, heartbeatPort));
|
||||
|
||||
// 2. Create a separate SystemInfoService for exception testing
|
||||
SystemInfoService exceptionSystemInfoService = new SystemInfoService();
|
||||
|
|
@ -1171,7 +1171,7 @@ public class SystemInfoServiceEditLogTest {
|
|||
|
||||
List<String> hostPorts = Arrays.asList(host + ":" + heartbeatPort);
|
||||
AddBackendClause addBackendClause = new AddBackendClause(hostPorts, warehouse, cnGroupName, null);
|
||||
addBackendClause.getHostPortPairs().add(Pair.create(host, heartbeatPort));
|
||||
addBackendClause.getHostPortPairs().add(new HostPort(host, heartbeatPort));
|
||||
masterSystemInfoService.addBackends(addBackendClause);
|
||||
Assertions.assertEquals(1, masterSystemInfoService.getBackends().size());
|
||||
|
||||
|
|
@ -1185,7 +1185,7 @@ public class SystemInfoServiceEditLogTest {
|
|||
// 3. Execute decommissionBackend operation (master side)
|
||||
List<String> decommissionHostPorts = Arrays.asList(host + ":" + heartbeatPort);
|
||||
DecommissionBackendClause decommissionBackendClause = new DecommissionBackendClause(decommissionHostPorts);
|
||||
decommissionBackendClause.getHostPortPairs().add(Pair.create(host, heartbeatPort));
|
||||
decommissionBackendClause.getHostPortPairs().add(new HostPort(host, heartbeatPort));
|
||||
masterSystemInfoService.decommissionBackend(decommissionBackendClause);
|
||||
|
||||
// 4. Verify master state after decommission
|
||||
|
|
@ -1228,7 +1228,7 @@ public class SystemInfoServiceEditLogTest {
|
|||
|
||||
List<String> hostPorts = Arrays.asList(host + ":" + heartbeatPort);
|
||||
AddBackendClause addBackendClause = new AddBackendClause(hostPorts, warehouse, cnGroupName, null);
|
||||
addBackendClause.getHostPortPairs().add(Pair.create(host, heartbeatPort));
|
||||
addBackendClause.getHostPortPairs().add(new HostPort(host, heartbeatPort));
|
||||
|
||||
// 2. Create a separate SystemInfoService for exception testing
|
||||
SystemInfoService exceptionSystemInfoService = new SystemInfoService();
|
||||
|
|
@ -1246,7 +1246,7 @@ public class SystemInfoServiceEditLogTest {
|
|||
// 3. Execute decommissionBackend operation and expect exception
|
||||
List<String> decommissionHostPorts = Arrays.asList(host + ":" + heartbeatPort);
|
||||
DecommissionBackendClause decommissionBackendClause = new DecommissionBackendClause(decommissionHostPorts);
|
||||
decommissionBackendClause.getHostPortPairs().add(Pair.create(host, heartbeatPort));
|
||||
decommissionBackendClause.getHostPortPairs().add(new HostPort(host, heartbeatPort));
|
||||
RuntimeException exception = Assertions.assertThrows(RuntimeException.class, () -> {
|
||||
exceptionSystemInfoService.decommissionBackend(decommissionBackendClause);
|
||||
});
|
||||
|
|
@ -1268,7 +1268,7 @@ public class SystemInfoServiceEditLogTest {
|
|||
|
||||
List<String> hostPorts = Arrays.asList(host + ":" + heartbeatPort);
|
||||
AddBackendClause addBackendClause = new AddBackendClause(hostPorts, warehouse, cnGroupName, null);
|
||||
addBackendClause.getHostPortPairs().add(Pair.create(host, heartbeatPort));
|
||||
addBackendClause.getHostPortPairs().add(new HostPort(host, heartbeatPort));
|
||||
masterSystemInfoService.addBackends(addBackendClause);
|
||||
Assertions.assertEquals(1, masterSystemInfoService.getBackends().size());
|
||||
|
||||
|
|
@ -1280,7 +1280,7 @@ public class SystemInfoServiceEditLogTest {
|
|||
// 3. Execute cancelDecommissionBackend operation (master side)
|
||||
List<String> cancelHostPorts = Arrays.asList(host + ":" + heartbeatPort);
|
||||
CancelAlterSystemStmt cancelAlterSystemStmt = new CancelAlterSystemStmt(cancelHostPorts);
|
||||
cancelAlterSystemStmt.getHostPortPairs().add(Pair.create(host, heartbeatPort));
|
||||
cancelAlterSystemStmt.getHostPortPairs().add(new HostPort(host, heartbeatPort));
|
||||
masterSystemInfoService.cancelDecommissionBackend(cancelAlterSystemStmt);
|
||||
|
||||
// 4. Verify master state after cancel decommission
|
||||
|
|
@ -1323,12 +1323,12 @@ public class SystemInfoServiceEditLogTest {
|
|||
|
||||
List<String> hostPorts = Arrays.asList(host + ":" + heartbeatPort);
|
||||
AddBackendClause addBackendClause = new AddBackendClause(hostPorts, warehouse, cnGroupName, null);
|
||||
addBackendClause.getHostPortPairs().add(Pair.create(host, heartbeatPort));
|
||||
addBackendClause.getHostPortPairs().add(new HostPort(host, heartbeatPort));
|
||||
|
||||
// 2. Decommission the backend first
|
||||
List<String> decommissionHostPorts = Arrays.asList(host + ":" + heartbeatPort);
|
||||
DecommissionBackendClause decommissionBackendClause = new DecommissionBackendClause(decommissionHostPorts);
|
||||
decommissionBackendClause.getHostPortPairs().add(Pair.create(host, heartbeatPort));
|
||||
decommissionBackendClause.getHostPortPairs().add(new HostPort(host, heartbeatPort));
|
||||
|
||||
// 3. Create a separate SystemInfoService for exception testing
|
||||
SystemInfoService exceptionSystemInfoService = new SystemInfoService();
|
||||
|
|
@ -1347,7 +1347,7 @@ public class SystemInfoServiceEditLogTest {
|
|||
// 4. Execute cancelDecommissionBackend operation and expect exception
|
||||
List<String> cancelHostPorts = Arrays.asList(host + ":" + heartbeatPort);
|
||||
CancelAlterSystemStmt cancelAlterSystemStmt = new CancelAlterSystemStmt(cancelHostPorts);
|
||||
cancelAlterSystemStmt.getHostPortPairs().add(Pair.create(host, heartbeatPort));
|
||||
cancelAlterSystemStmt.getHostPortPairs().add(new HostPort(host, heartbeatPort));
|
||||
RuntimeException exception = Assertions.assertThrows(RuntimeException.class, () -> {
|
||||
exceptionSystemInfoService.cancelDecommissionBackend(cancelAlterSystemStmt);
|
||||
});
|
||||
|
|
@ -1369,7 +1369,7 @@ public class SystemInfoServiceEditLogTest {
|
|||
List<String> hostPorts = Arrays.asList("192.168.1.200:9050");
|
||||
|
||||
AddComputeNodeClause addComputeNodeClause = new AddComputeNodeClause(hostPorts, warehouse, cnGroupName, null);
|
||||
addComputeNodeClause.getHostPortPairs().add(Pair.create("192.168.1.200", 9050));
|
||||
addComputeNodeClause.getHostPortPairs().add(new HostPort("192.168.1.200", 9050));
|
||||
masterSystemInfoService.addComputeNodes(addComputeNodeClause);
|
||||
Assertions.assertEquals(1, masterSystemInfoService.getComputeNodes().size());
|
||||
|
||||
|
|
@ -1381,7 +1381,7 @@ public class SystemInfoServiceEditLogTest {
|
|||
|
||||
// 3. Execute dropComputeNodes operation (master side)
|
||||
DropComputeNodeClause dropComputeNodeClause = new DropComputeNodeClause(hostPorts, warehouse, cnGroupName, null);
|
||||
dropComputeNodeClause.getHostPortPairs().add(Pair.create("192.168.1.200", 9050));
|
||||
dropComputeNodeClause.getHostPortPairs().add(new HostPort("192.168.1.200", 9050));
|
||||
masterSystemInfoService.dropComputeNodes(dropComputeNodeClause);
|
||||
|
||||
// 4. Verify master state after dropping
|
||||
|
|
@ -1415,7 +1415,7 @@ public class SystemInfoServiceEditLogTest {
|
|||
List<String> hostPorts = Arrays.asList("192.168.1.300:9050");
|
||||
|
||||
AddComputeNodeClause addComputeNodeClause = new AddComputeNodeClause(hostPorts, warehouse, cnGroupName, null);
|
||||
addComputeNodeClause.getHostPortPairs().add(Pair.create("192.168.1.300", 9050));
|
||||
addComputeNodeClause.getHostPortPairs().add(new HostPort("192.168.1.300", 9050));
|
||||
masterSystemInfoService.addComputeNodes(addComputeNodeClause);
|
||||
Assertions.assertEquals(1, masterSystemInfoService.getComputeNodes().size());
|
||||
|
||||
|
|
@ -1434,7 +1434,7 @@ public class SystemInfoServiceEditLogTest {
|
|||
|
||||
// 3. Execute dropComputeNodes operation and expect exception
|
||||
DropComputeNodeClause dropComputeNodeClause = new DropComputeNodeClause(hostPorts, warehouse, cnGroupName, null);
|
||||
dropComputeNodeClause.getHostPortPairs().add(Pair.create("192.168.1.300", 9050));
|
||||
dropComputeNodeClause.getHostPortPairs().add(new HostPort("192.168.1.300", 9050));
|
||||
RuntimeException exception = Assertions.assertThrows(RuntimeException.class, () -> {
|
||||
exceptionSystemInfoService.dropComputeNodes(dropComputeNodeClause);
|
||||
});
|
||||
|
|
@ -1460,7 +1460,7 @@ public class SystemInfoServiceEditLogTest {
|
|||
|
||||
// 3. Execute dropComputeNodes operation and expect DdlException
|
||||
DropComputeNodeClause dropComputeNodeClause = new DropComputeNodeClause(hostPorts, warehouse, cnGroupName, null);
|
||||
dropComputeNodeClause.getHostPortPairs().add(Pair.create("192.168.1.400", 9050));
|
||||
dropComputeNodeClause.getHostPortPairs().add(new HostPort("192.168.1.400", 9050));
|
||||
DdlException exception = Assertions.assertThrows(DdlException.class, () -> {
|
||||
masterSystemInfoService.dropComputeNodes(dropComputeNodeClause);
|
||||
});
|
||||
|
|
@ -1476,14 +1476,14 @@ public class SystemInfoServiceEditLogTest {
|
|||
List<String> hostPorts = Arrays.asList("192.168.1.500:9050");
|
||||
|
||||
AddComputeNodeClause addComputeNodeClause = new AddComputeNodeClause(hostPorts, warehouse, cnGroupName, null);
|
||||
addComputeNodeClause.getHostPortPairs().add(Pair.create("192.168.1.500", 9050));
|
||||
addComputeNodeClause.getHostPortPairs().add(new HostPort("192.168.1.500", 9050));
|
||||
masterSystemInfoService.addComputeNodes(addComputeNodeClause);
|
||||
Assertions.assertEquals(1, masterSystemInfoService.getComputeNodes().size());
|
||||
|
||||
// 2. Try to drop with wrong warehouse
|
||||
String wrongWarehouse = "wrong_warehouse";
|
||||
DropComputeNodeClause dropComputeNodeClause = new DropComputeNodeClause(hostPorts, wrongWarehouse, cnGroupName, null);
|
||||
dropComputeNodeClause.getHostPortPairs().add(Pair.create("192.168.1.500", 9050));
|
||||
dropComputeNodeClause.getHostPortPairs().add(new HostPort("192.168.1.500", 9050));
|
||||
|
||||
// 3. Expect DdlException to be thrown
|
||||
DdlException exception = Assertions.assertThrows(DdlException.class, () -> {
|
||||
|
|
@ -1503,16 +1503,16 @@ public class SystemInfoServiceEditLogTest {
|
|||
List<String> hostPorts = Arrays.asList("192.168.1.100:9050", "192.168.1.101:9051", "192.168.1.102:9052");
|
||||
|
||||
AddComputeNodeClause addComputeNodeClause = new AddComputeNodeClause(hostPorts, warehouse, cnGroupName, null);
|
||||
addComputeNodeClause.getHostPortPairs().add(Pair.create("192.168.1.100", 9050));
|
||||
addComputeNodeClause.getHostPortPairs().add(Pair.create("192.168.1.101", 9051));
|
||||
addComputeNodeClause.getHostPortPairs().add(Pair.create("192.168.1.102", 9052));
|
||||
addComputeNodeClause.getHostPortPairs().add(new HostPort("192.168.1.100", 9050));
|
||||
addComputeNodeClause.getHostPortPairs().add(new HostPort("192.168.1.101", 9051));
|
||||
addComputeNodeClause.getHostPortPairs().add(new HostPort("192.168.1.102", 9052));
|
||||
masterSystemInfoService.addComputeNodes(addComputeNodeClause);
|
||||
Assertions.assertEquals(3, masterSystemInfoService.getComputeNodes().size());
|
||||
|
||||
// 2. Drop one compute node
|
||||
List<String> dropHostPorts = Arrays.asList("192.168.1.100:9050");
|
||||
DropComputeNodeClause dropComputeNodeClause = new DropComputeNodeClause(dropHostPorts, warehouse, cnGroupName, null);
|
||||
dropComputeNodeClause.getHostPortPairs().add(Pair.create("192.168.1.100", 9050));
|
||||
dropComputeNodeClause.getHostPortPairs().add(new HostPort("192.168.1.100", 9050));
|
||||
masterSystemInfoService.dropComputeNodes(dropComputeNodeClause);
|
||||
Assertions.assertEquals(2, masterSystemInfoService.getComputeNodes().size());
|
||||
|
||||
|
|
@ -1540,16 +1540,16 @@ public class SystemInfoServiceEditLogTest {
|
|||
// 1. Add multiple compute nodes to master
|
||||
List<String> hostPorts = Arrays.asList("192.168.1.100:9050", "192.168.1.101:9051", "192.168.1.102:9052");
|
||||
AddComputeNodeClause addComputeNodeClause = new AddComputeNodeClause(hostPorts, warehouse, cnGroupName, null);
|
||||
addComputeNodeClause.getHostPortPairs().add(Pair.create("192.168.1.100", 9050));
|
||||
addComputeNodeClause.getHostPortPairs().add(Pair.create("192.168.1.101", 9051));
|
||||
addComputeNodeClause.getHostPortPairs().add(Pair.create("192.168.1.102", 9052));
|
||||
addComputeNodeClause.getHostPortPairs().add(new HostPort("192.168.1.100", 9050));
|
||||
addComputeNodeClause.getHostPortPairs().add(new HostPort("192.168.1.101", 9051));
|
||||
addComputeNodeClause.getHostPortPairs().add(new HostPort("192.168.1.102", 9052));
|
||||
masterSystemInfoService.addComputeNodes(addComputeNodeClause);
|
||||
Assertions.assertEquals(3, masterSystemInfoService.getComputeNodes().size());
|
||||
|
||||
// 2. Drop one compute node
|
||||
List<String> dropHostPorts = Arrays.asList("192.168.1.100:9050");
|
||||
DropComputeNodeClause dropComputeNodeClause = new DropComputeNodeClause(dropHostPorts, warehouse, cnGroupName, null);
|
||||
dropComputeNodeClause.getHostPortPairs().add(Pair.create("192.168.1.100", 9050));
|
||||
dropComputeNodeClause.getHostPortPairs().add(new HostPort("192.168.1.100", 9050));
|
||||
masterSystemInfoService.dropComputeNodes(dropComputeNodeClause);
|
||||
Assertions.assertEquals(2, masterSystemInfoService.getComputeNodes().size());
|
||||
|
||||
|
|
@ -1599,7 +1599,7 @@ public class SystemInfoServiceEditLogTest {
|
|||
|
||||
List<String> hostPorts = Arrays.asList(beHostPort);
|
||||
AddBackendClause addBackendClause = new AddBackendClause(hostPorts, warehouse, cnGroupName, null);
|
||||
addBackendClause.getHostPortPairs().add(Pair.create(host, heartbeatPort));
|
||||
addBackendClause.getHostPortPairs().add(new HostPort(host, heartbeatPort));
|
||||
masterSystemInfoService.addBackends(addBackendClause);
|
||||
Assertions.assertEquals(1, masterSystemInfoService.getBackends().size());
|
||||
|
||||
|
|
@ -1645,7 +1645,7 @@ public class SystemInfoServiceEditLogTest {
|
|||
|
||||
List<String> hostPorts = Arrays.asList(beHostPort);
|
||||
AddBackendClause addBackendClause = new AddBackendClause(hostPorts, warehouse, cnGroupName, null);
|
||||
addBackendClause.getHostPortPairs().add(Pair.create(host, heartbeatPort));
|
||||
addBackendClause.getHostPortPairs().add(new HostPort(host, heartbeatPort));
|
||||
|
||||
// 2. Create a separate SystemInfoService for exception testing
|
||||
SystemInfoService exceptionSystemInfoService = new SystemInfoService();
|
||||
|
|
@ -1686,7 +1686,7 @@ public class SystemInfoServiceEditLogTest {
|
|||
|
||||
List<String> hostPorts = Arrays.asList(beHostPort);
|
||||
AddBackendClause addBackendClause = new AddBackendClause(hostPorts, warehouse, cnGroupName, null);
|
||||
addBackendClause.getHostPortPairs().add(Pair.create(host, heartbeatPort));
|
||||
addBackendClause.getHostPortPairs().add(new HostPort(host, heartbeatPort));
|
||||
masterSystemInfoService.addBackends(addBackendClause);
|
||||
Assertions.assertEquals(1, masterSystemInfoService.getBackends().size());
|
||||
|
||||
|
|
@ -1734,7 +1734,7 @@ public class SystemInfoServiceEditLogTest {
|
|||
|
||||
List<String> hostPorts = Arrays.asList(beHostPort);
|
||||
AddBackendClause addBackendClause = new AddBackendClause(hostPorts, warehouse, cnGroupName, null);
|
||||
addBackendClause.getHostPortPairs().add(Pair.create(host, heartbeatPort));
|
||||
addBackendClause.getHostPortPairs().add(new HostPort(host, heartbeatPort));
|
||||
|
||||
// 2. Create a separate SystemInfoService for exception testing
|
||||
SystemInfoService exceptionSystemInfoService = new SystemInfoService();
|
||||
|
|
@ -1776,7 +1776,7 @@ public class SystemInfoServiceEditLogTest {
|
|||
|
||||
List<String> hostPorts = Arrays.asList(beHostPort);
|
||||
AddBackendClause addBackendClause = new AddBackendClause(hostPorts, warehouse, cnGroupName, null);
|
||||
addBackendClause.getHostPortPairs().add(Pair.create(host, heartbeatPort));
|
||||
addBackendClause.getHostPortPairs().add(new HostPort(host, heartbeatPort));
|
||||
masterSystemInfoService.addBackends(addBackendClause);
|
||||
Assertions.assertEquals(1, masterSystemInfoService.getBackends().size());
|
||||
|
||||
|
|
@ -1823,7 +1823,7 @@ public class SystemInfoServiceEditLogTest {
|
|||
|
||||
List<String> hostPorts = Arrays.asList(beHostPort);
|
||||
AddBackendClause addBackendClause = new AddBackendClause(hostPorts, warehouse, cnGroupName, null);
|
||||
addBackendClause.getHostPortPairs().add(Pair.create(host, heartbeatPort));
|
||||
addBackendClause.getHostPortPairs().add(new HostPort(host, heartbeatPort));
|
||||
|
||||
// 2. Create a separate SystemInfoService for exception testing
|
||||
SystemInfoService exceptionSystemInfoService = new SystemInfoService();
|
||||
|
|
@ -1866,7 +1866,7 @@ public class SystemInfoServiceEditLogTest {
|
|||
|
||||
List<String> hostPorts = Arrays.asList(beHostPort);
|
||||
AddBackendClause addBackendClause = new AddBackendClause(hostPorts, warehouse, cnGroupName, null);
|
||||
addBackendClause.getHostPortPairs().add(Pair.create(host, heartbeatPort));
|
||||
addBackendClause.getHostPortPairs().add(new HostPort(host, heartbeatPort));
|
||||
masterSystemInfoService.addBackends(addBackendClause);
|
||||
Assertions.assertEquals(1, masterSystemInfoService.getBackends().size());
|
||||
|
||||
|
|
@ -1961,7 +1961,7 @@ public class SystemInfoServiceEditLogTest {
|
|||
|
||||
List<String> hostPorts = Arrays.asList(beHostPort);
|
||||
AddBackendClause addBackendClause = new AddBackendClause(hostPorts, warehouse, cnGroupName, null);
|
||||
addBackendClause.getHostPortPairs().add(Pair.create(host, heartbeatPort));
|
||||
addBackendClause.getHostPortPairs().add(new HostPort(host, heartbeatPort));
|
||||
|
||||
// 2. Create a separate SystemInfoService for exception testing
|
||||
SystemInfoService exceptionSystemInfoService = new SystemInfoService();
|
||||
|
|
@ -2014,7 +2014,7 @@ public class SystemInfoServiceEditLogTest {
|
|||
|
||||
List<String> hostPorts = Arrays.asList(beHostPort);
|
||||
AddBackendClause addBackendClause = new AddBackendClause(hostPorts, warehouse, cnGroupName, null);
|
||||
addBackendClause.getHostPortPairs().add(Pair.create(host, heartbeatPort));
|
||||
addBackendClause.getHostPortPairs().add(new HostPort(host, heartbeatPort));
|
||||
masterSystemInfoService.addBackends(addBackendClause);
|
||||
Assertions.assertEquals(1, masterSystemInfoService.getBackends().size());
|
||||
|
||||
|
|
@ -2094,7 +2094,7 @@ public class SystemInfoServiceEditLogTest {
|
|||
|
||||
List<String> hostPorts = Arrays.asList(beHostPort);
|
||||
AddBackendClause addBackendClause = new AddBackendClause(hostPorts, warehouse, cnGroupName, null);
|
||||
addBackendClause.getHostPortPairs().add(Pair.create(host, heartbeatPort));
|
||||
addBackendClause.getHostPortPairs().add(new HostPort(host, heartbeatPort));
|
||||
masterSystemInfoService.addBackends(addBackendClause);
|
||||
Assertions.assertEquals(1, masterSystemInfoService.getBackends().size());
|
||||
|
||||
|
|
@ -2175,7 +2175,7 @@ public class SystemInfoServiceEditLogTest {
|
|||
|
||||
List<String> hostPorts = Arrays.asList(beHostPort);
|
||||
AddBackendClause addBackendClause = new AddBackendClause(hostPorts, warehouse, cnGroupName, null);
|
||||
addBackendClause.getHostPortPairs().add(Pair.create(host, heartbeatPort));
|
||||
addBackendClause.getHostPortPairs().add(new HostPort(host, heartbeatPort));
|
||||
masterSystemInfoService.addBackends(addBackendClause);
|
||||
Assertions.assertEquals(1, masterSystemInfoService.getBackends().size());
|
||||
|
||||
|
|
|
|||
|
|
@ -44,6 +44,6 @@ public class AddBackendClause extends BackendClause {
|
|||
|
||||
@Override
|
||||
public <R, C> R accept(AstVisitor<R, C> visitor, C context) {
|
||||
return ((AstVisitorExtendInterface<R, C>) visitor).visitAddBackendClause(this, context);
|
||||
return visitor.visitAddBackendClause(this, context);
|
||||
}
|
||||
}
|
||||
|
|
@ -38,6 +38,6 @@ public class AddComputeNodeClause extends ComputeNodeClause {
|
|||
|
||||
@Override
|
||||
public <R, C> R accept(AstVisitor<R, C> visitor, C context) {
|
||||
return ((AstVisitorExtendInterface<R, C>) visitor).visitAddComputeNodeClause(this, context);
|
||||
return visitor.visitAddComputeNodeClause(this, context);
|
||||
}
|
||||
}
|
||||
|
|
@ -12,7 +12,6 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
|
||||
package com.starrocks.sql.ast;
|
||||
|
||||
import com.starrocks.sql.parser.NodePosition;
|
||||
|
|
@ -20,14 +19,12 @@ import com.starrocks.sql.parser.NodePosition;
|
|||
// Alter clause.
|
||||
public abstract class AlterClause implements ParseNode {
|
||||
|
||||
|
||||
protected final NodePosition pos;
|
||||
|
||||
protected AlterClause(NodePosition pos) {
|
||||
this.pos = pos;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public NodePosition getPos() {
|
||||
return pos;
|
||||
|
|
|
|||
|
|
@ -111,6 +111,10 @@ public interface AstVisitor<R, C> {
|
|||
return visitDDLStatement(statement, context);
|
||||
}
|
||||
|
||||
default R visitDropTaskStmt(DropTaskStmt statement, C context) {
|
||||
return visitDDLStatement(statement, context);
|
||||
}
|
||||
|
||||
default R visitAdminShowConfigStatement(AdminShowConfigStmt statement, C context) {
|
||||
return visitShowStatement(statement, context);
|
||||
}
|
||||
|
|
@ -266,21 +270,66 @@ public interface AstVisitor<R, C> {
|
|||
}
|
||||
|
||||
default R visitAddFollowerClause(AddFollowerClause clause, C context) {
|
||||
return visitNode(clause, context);
|
||||
return visitFrontendClause(clause, context);
|
||||
}
|
||||
|
||||
default R visitDropFollowerClause(DropFollowerClause clause, C context) {
|
||||
return visitNode(clause, context);
|
||||
return visitFrontendClause(clause, context);
|
||||
}
|
||||
|
||||
default R visitAddObserverClause(AddObserverClause clause, C context) {
|
||||
return visitNode(clause, context);
|
||||
return visitFrontendClause(clause, context);
|
||||
}
|
||||
|
||||
default R visitDropObserverClause(DropObserverClause clause, C context) {
|
||||
return visitFrontendClause(clause, context);
|
||||
}
|
||||
|
||||
default R visitModifyFrontendHostClause(ModifyFrontendAddressClause clause, C context) {
|
||||
return visitFrontendClause(clause, context);
|
||||
}
|
||||
|
||||
default R visitModifyBrokerClause(ModifyBrokerClause clause, C context) {
|
||||
return visitNode(clause, context);
|
||||
}
|
||||
|
||||
default R visitCancelAlterSystemStatement(CancelAlterSystemStmt statement, C context) {
|
||||
return visitDDLStatement(statement, context);
|
||||
}
|
||||
|
||||
default R visitBackendClause(BackendClause clause, C context) {
|
||||
return visitNode(clause, context);
|
||||
}
|
||||
|
||||
default R visitAddBackendClause(AddBackendClause clause, C context) {
|
||||
return visitBackendClause(clause, context);
|
||||
}
|
||||
|
||||
default R visitDropBackendClause(DropBackendClause clause, C context) {
|
||||
return visitBackendClause(clause, context);
|
||||
}
|
||||
|
||||
default R visitModifyBackendClause(ModifyBackendClause clause, C context) {
|
||||
return visitBackendClause(clause, context);
|
||||
}
|
||||
|
||||
default R visitDecommissionBackendClause(DecommissionBackendClause clause, C context) {
|
||||
return visitBackendClause(clause, context);
|
||||
}
|
||||
|
||||
default R visitComputeNodeClause(ComputeNodeClause clause, C context) {
|
||||
return visitNode(clause, context);
|
||||
}
|
||||
|
||||
default R visitAddComputeNodeClause(AddComputeNodeClause clause, C context) {
|
||||
return visitComputeNodeClause(clause, context);
|
||||
}
|
||||
|
||||
default R visitDropComputeNodeClause(DropComputeNodeClause clause, C context) {
|
||||
return visitComputeNodeClause(clause, context);
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------- Basic Node Types ----------------------------------------------------
|
||||
|
||||
default R visitIdentifier(Identifier identifier, C context) {
|
||||
|
|
@ -398,6 +447,10 @@ public interface AstVisitor<R, C> {
|
|||
return visitNode(clause, context);
|
||||
}
|
||||
|
||||
default R visitDropTagClause(DropTagClause clause, C context) {
|
||||
return visitNode(clause, context);
|
||||
}
|
||||
|
||||
default R visitDropPersistentIndexClause(DropPersistentIndexClause clause, C context) {
|
||||
return visitNode(clause, context);
|
||||
}
|
||||
|
|
@ -460,6 +513,7 @@ public interface AstVisitor<R, C> {
|
|||
return visitDDLStatement(statement, context);
|
||||
}
|
||||
|
||||
|
||||
// ------------------------------------------- User Statement ----------------------------------------------------
|
||||
|
||||
default R visitBaseCreateAlterUserStmt(BaseCreateAlterUserStmt statement, C context) {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@
|
|||
|
||||
package com.starrocks.sql.ast;
|
||||
|
||||
import com.starrocks.common.Pair;
|
||||
import com.starrocks.sql.parser.NodePosition;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
|
@ -23,7 +22,7 @@ import java.util.List;
|
|||
|
||||
public class BackendClause extends AlterClause {
|
||||
protected List<String> hostPortsUnResolved;
|
||||
protected List<Pair<String, Integer>> hostPortPairs;
|
||||
protected List<HostPort> hostPortPairs;
|
||||
|
||||
protected BackendClause(List<String> hostPortsUnResolved, NodePosition pos) {
|
||||
super(pos);
|
||||
|
|
@ -31,11 +30,11 @@ public class BackendClause extends AlterClause {
|
|||
this.hostPortPairs = new LinkedList<>();
|
||||
}
|
||||
|
||||
public List<Pair<String, Integer>> getHostPortPairs() {
|
||||
public List<HostPort> getHostPortPairs() {
|
||||
return hostPortPairs;
|
||||
}
|
||||
|
||||
public void setHostPortPairs(List<Pair<String, Integer>> hostPortPairs) {
|
||||
public void setHostPortPairs(List<HostPort> hostPortPairs) {
|
||||
this.hostPortPairs = hostPortPairs;
|
||||
}
|
||||
|
||||
|
|
@ -45,6 +44,6 @@ public class BackendClause extends AlterClause {
|
|||
|
||||
@Override
|
||||
public <R, C> R accept(AstVisitor<R, C> visitor, C context) {
|
||||
return ((AstVisitorExtendInterface<R, C>) visitor).visitBackendClause(this, context);
|
||||
return visitor.visitBackendClause(this, context);
|
||||
}
|
||||
}
|
||||
|
|
@ -15,7 +15,6 @@
|
|||
|
||||
package com.starrocks.sql.ast;
|
||||
|
||||
import com.starrocks.common.Pair;
|
||||
import com.starrocks.sql.parser.NodePosition;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
|
@ -24,7 +23,7 @@ import java.util.List;
|
|||
public class CancelAlterSystemStmt extends CancelStmt {
|
||||
|
||||
protected List<String> hostPorts;
|
||||
private final List<Pair<String, Integer>> hostPortPairs;
|
||||
private final List<HostPort> hostPortPairs;
|
||||
|
||||
public CancelAlterSystemStmt(List<String> hostPorts) {
|
||||
this(hostPorts, NodePosition.ZERO);
|
||||
|
|
@ -40,12 +39,12 @@ public class CancelAlterSystemStmt extends CancelStmt {
|
|||
return hostPorts;
|
||||
}
|
||||
|
||||
public List<Pair<String, Integer>> getHostPortPairs() {
|
||||
public List<HostPort> getHostPortPairs() {
|
||||
return hostPortPairs;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, C> R accept(AstVisitor<R, C> visitor, C context) {
|
||||
return ((AstVisitorExtendInterface<R, C>) visitor).visitCancelAlterSystemStatement(this, context);
|
||||
return visitor.visitCancelAlterSystemStatement(this, context);
|
||||
}
|
||||
}
|
||||
|
|
@ -15,7 +15,6 @@
|
|||
|
||||
package com.starrocks.sql.ast;
|
||||
|
||||
import com.starrocks.common.Pair;
|
||||
import com.starrocks.sql.parser.NodePosition;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
|
@ -24,7 +23,7 @@ import java.util.List;
|
|||
public class ComputeNodeClause extends AlterClause {
|
||||
|
||||
protected List<String> hostPorts;
|
||||
private final List<Pair<String, Integer>> hostPortPairs;
|
||||
private final List<HostPort> hostPortPairs;
|
||||
|
||||
public ComputeNodeClause(List<String> hostPorts, NodePosition pos) {
|
||||
super(pos);
|
||||
|
|
@ -32,7 +31,7 @@ public class ComputeNodeClause extends AlterClause {
|
|||
this.hostPortPairs = new LinkedList<>();
|
||||
}
|
||||
|
||||
public List<Pair<String, Integer>> getHostPortPairs() {
|
||||
public List<HostPort> getHostPortPairs() {
|
||||
return hostPortPairs;
|
||||
}
|
||||
|
||||
|
|
@ -42,6 +41,6 @@ public class ComputeNodeClause extends AlterClause {
|
|||
|
||||
@Override
|
||||
public <R, C> R accept(AstVisitor<R, C> visitor, C context) {
|
||||
return ((AstVisitorExtendInterface<R, C>) visitor).visitComputeNodeClause(this, context);
|
||||
return visitor.visitComputeNodeClause(this, context);
|
||||
}
|
||||
}
|
||||
|
|
@ -15,30 +15,22 @@
|
|||
|
||||
package com.starrocks.sql.ast;
|
||||
|
||||
import com.starrocks.alter.DecommissionType;
|
||||
import com.starrocks.sql.parser.NodePosition;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class DecommissionBackendClause extends BackendClause {
|
||||
|
||||
private DecommissionType type;
|
||||
|
||||
public DecommissionBackendClause(List<String> hostPorts) {
|
||||
this(hostPorts, NodePosition.ZERO);
|
||||
}
|
||||
|
||||
public DecommissionBackendClause(List<String> hostPorts, NodePosition pos) {
|
||||
super(hostPorts, pos);
|
||||
type = DecommissionType.SystemDecommission;
|
||||
}
|
||||
|
||||
public void setType(DecommissionType type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, C> R accept(AstVisitor<R, C> visitor, C context) {
|
||||
return ((AstVisitorExtendInterface<R, C>) visitor).visitDecommissionBackendClause(this, context);
|
||||
return visitor.visitDecommissionBackendClause(this, context);
|
||||
}
|
||||
}
|
||||
|
|
@ -48,6 +48,6 @@ public class DropBackendClause extends BackendClause {
|
|||
|
||||
@Override
|
||||
public <R, C> R accept(AstVisitor<R, C> visitor, C context) {
|
||||
return ((AstVisitorExtendInterface<R, C>) visitor).visitDropBackendClause(this, context);
|
||||
return visitor.visitDropBackendClause(this, context);
|
||||
}
|
||||
}
|
||||
|
|
@ -42,6 +42,6 @@ public class DropComputeNodeClause extends ComputeNodeClause {
|
|||
|
||||
@Override
|
||||
public <R, C> R accept(AstVisitor<R, C> visitor, C context) {
|
||||
return ((AstVisitorExtendInterface<R, C>) visitor).visitDropComputeNodeClause(this, context);
|
||||
return visitor.visitDropComputeNodeClause(this, context);
|
||||
}
|
||||
}
|
||||
|
|
@ -37,6 +37,6 @@ public class DropTagClause extends AlterTableClause {
|
|||
|
||||
@Override
|
||||
public <R, C> R accept(AstVisitor<R, C> visitor, C context) {
|
||||
return ((AstVisitorExtendInterface<R, C>) visitor).visitDropTagClause(this, context);
|
||||
return visitor.visitDropTagClause(this, context);
|
||||
}
|
||||
}
|
||||
|
|
@ -43,7 +43,7 @@ public class DropTaskStmt extends DdlStmt {
|
|||
|
||||
@Override
|
||||
public <R, C> R accept(AstVisitor<R, C> visitor, C context) {
|
||||
return ((AstVisitorExtendInterface<R, C>) visitor).visitDropTaskStmt(this, context);
|
||||
return visitor.visitDropTaskStmt(this, context);
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -12,15 +12,13 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
|
||||
package com.starrocks.sql.ast;
|
||||
|
||||
import com.starrocks.sql.parser.NodePosition;
|
||||
|
||||
public class FrontendClause extends AlterClause {
|
||||
protected String hostPort;
|
||||
protected String host;
|
||||
protected int port;
|
||||
protected HostPort hostPortObj;
|
||||
|
||||
protected FrontendClause(String hostPort, NodePosition pos) {
|
||||
super(pos);
|
||||
|
|
@ -28,23 +26,19 @@ public class FrontendClause extends AlterClause {
|
|||
}
|
||||
|
||||
public String getHost() {
|
||||
return host;
|
||||
return hostPortObj != null ? hostPortObj.getHost() : null;
|
||||
}
|
||||
|
||||
public int getPort() {
|
||||
return port;
|
||||
return hostPortObj != null ? hostPortObj.getPort() : 0;
|
||||
}
|
||||
|
||||
public String getHostPort() {
|
||||
return hostPort;
|
||||
}
|
||||
|
||||
public void setHost(String host) {
|
||||
this.host = host;
|
||||
}
|
||||
|
||||
public void setPort(int port) {
|
||||
this.port = port;
|
||||
public void setHostPortObj(HostPort hostPortObj) {
|
||||
this.hostPortObj = hostPortObj;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
|||
|
|
@ -0,0 +1,68 @@
|
|||
// Copyright 2021-present StarRocks, Inc. All rights reserved.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// https://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
package com.starrocks.sql.ast;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Represents a host and port pair for network connections.
|
||||
*/
|
||||
public class HostPort {
|
||||
|
||||
private final String host;
|
||||
private final int port;
|
||||
|
||||
public HostPort(String host, int port) {
|
||||
this.host = host;
|
||||
this.port = port;
|
||||
}
|
||||
|
||||
public String getHost() {
|
||||
return host;
|
||||
}
|
||||
|
||||
public int getPort() {
|
||||
return port;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (o == null || getClass() != o.getClass()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
HostPort hostPort = (HostPort) o;
|
||||
|
||||
if (port != hostPort.port) {
|
||||
return false;
|
||||
}
|
||||
return Objects.equals(host, hostPort.host);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = host != null ? host.hashCode() : 0;
|
||||
result = 31 * result + port;
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return host + ":" + port;
|
||||
}
|
||||
}
|
||||
|
|
@ -76,6 +76,6 @@ public class ModifyBackendClause extends BackendClause {
|
|||
|
||||
@Override
|
||||
public <R, C> R accept(AstVisitor<R, C> visitor, C context) {
|
||||
return ((AstVisitorExtendInterface<R, C>) visitor).visitModifyBackendClause(this, context);
|
||||
return visitor.visitModifyBackendClause(this, context);
|
||||
}
|
||||
}
|
||||
|
|
@ -15,9 +15,6 @@
|
|||
|
||||
package com.starrocks.sql.ast;
|
||||
|
||||
import com.google.common.base.Strings;
|
||||
import com.starrocks.common.AnalysisException;
|
||||
import com.starrocks.common.Pair;
|
||||
import com.starrocks.sql.parser.NodePosition;
|
||||
|
||||
import java.util.HashSet;
|
||||
|
|
@ -35,7 +32,7 @@ public class ModifyBrokerClause extends AlterClause {
|
|||
private final String brokerName;
|
||||
private final List<String> hostPorts;
|
||||
|
||||
protected Set<Pair<String, Integer>> hostPortPairs;
|
||||
protected Set<HostPort> hostPortPairs;
|
||||
|
||||
public ModifyBrokerClause(ModifyOp op, String brokerName, List<String> hostPorts, NodePosition pos) {
|
||||
super(pos);
|
||||
|
|
@ -70,18 +67,12 @@ public class ModifyBrokerClause extends AlterClause {
|
|||
return hostPorts;
|
||||
}
|
||||
|
||||
public Set<Pair<String, Integer>> getHostPortPairs() {
|
||||
public Set<HostPort> getHostPortPairs() {
|
||||
return hostPortPairs;
|
||||
}
|
||||
|
||||
public void validateBrokerName() throws AnalysisException {
|
||||
if (Strings.isNullOrEmpty(brokerName)) {
|
||||
throw new AnalysisException("Broker's name can't be empty.");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R, C> R accept(AstVisitor<R, C> visitor, C context) {
|
||||
return ((AstVisitorExtendInterface<R, C>) visitor).visitModifyBrokerClause(this, context);
|
||||
return visitor.visitModifyBrokerClause(this, context);
|
||||
}
|
||||
}
|
||||
|
|
@ -42,6 +42,6 @@ public class ModifyFrontendAddressClause extends FrontendClause {
|
|||
|
||||
@Override
|
||||
public <R, C> R accept(AstVisitor<R, C> visitor, C context) {
|
||||
return ((AstVisitorExtendInterface<R, C>) visitor).visitModifyFrontendHostClause(this, context);
|
||||
return visitor.visitModifyFrontendHostClause(this, context);
|
||||
}
|
||||
}
|
||||
|
|
@ -12,25 +12,15 @@
|
|||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
|
||||
package com.starrocks.sql.ast;
|
||||
|
||||
import com.starrocks.sql.parser.NodePosition;
|
||||
|
||||
import static com.starrocks.common.util.Util.normalizeName;
|
||||
|
||||
public class TaskName {
|
||||
private final String dbName;
|
||||
private final String name;
|
||||
|
||||
private String dbName;
|
||||
|
||||
private String name;
|
||||
|
||||
private final NodePosition pos;
|
||||
|
||||
public TaskName(String dbName, String name, NodePosition pos) {
|
||||
this.dbName = normalizeName(dbName);
|
||||
public TaskName(String dbName, String name) {
|
||||
this.dbName = dbName;
|
||||
this.name = name;
|
||||
this.pos = pos;
|
||||
}
|
||||
|
||||
public String getDbName() {
|
||||
|
|
@ -40,8 +30,4 @@ public class TaskName {
|
|||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
}
|
||||
Loading…
Reference in New Issue