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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,11 @@ public final class FeMetaVersion {
public static final int VERSION_116 = 116;
// add user and comment to load job
public static final int VERSION_117 = 117;
// note: when increment meta version, should assign the latest version to VERSION_CURRENT
// change frontend meta to json, add hostname to MasterInfo
public static final int VERSION_118 = 118;

public static final int VERSION_CURRENT = VERSION_117;
// note: when increment meta version, should assign the latest version to VERSION_CURRENT
public static final int VERSION_CURRENT = VERSION_118;

// all logs meta version should >= the minimum version, so that we could remove many if clause, for example
// if (FE_METAVERSION < VERSION_94) ...
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,16 +153,20 @@ public synchronized void process(List<AlterClause> alterClauses, String clusterN

} else if (alterClause instanceof AddObserverClause) {
AddObserverClause clause = (AddObserverClause) alterClause;
Env.getCurrentEnv().addFrontend(FrontendNodeType.OBSERVER, clause.getHost(), clause.getPort());
Env.getCurrentEnv().addFrontend(FrontendNodeType.OBSERVER, clause.getIp(), clause.getHostName(),
clause.getPort());
} else if (alterClause instanceof DropObserverClause) {
DropObserverClause clause = (DropObserverClause) alterClause;
Env.getCurrentEnv().dropFrontend(FrontendNodeType.OBSERVER, clause.getHost(), clause.getPort());
Env.getCurrentEnv().dropFrontend(FrontendNodeType.OBSERVER, clause.getIp(), clause.getHostName(),
clause.getPort());
} else if (alterClause instanceof AddFollowerClause) {
AddFollowerClause clause = (AddFollowerClause) alterClause;
Env.getCurrentEnv().addFrontend(FrontendNodeType.FOLLOWER, clause.getHost(), clause.getPort());
Env.getCurrentEnv().addFrontend(FrontendNodeType.FOLLOWER, clause.getIp(), clause.getHostName(),
clause.getPort());
} else if (alterClause instanceof DropFollowerClause) {
DropFollowerClause clause = (DropFollowerClause) alterClause;
Env.getCurrentEnv().dropFrontend(FrontendNodeType.FOLLOWER, clause.getHost(), clause.getPort());
Env.getCurrentEnv().dropFrontend(FrontendNodeType.FOLLOWER, clause.getIp(), clause.getHostName(),
clause.getPort());
} else if (alterClause instanceof ModifyBrokerClause) {
ModifyBrokerClause clause = (ModifyBrokerClause) alterClause;
Env.getCurrentEnv().getBrokerMgr().execute(clause);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,11 @@
import org.apache.doris.common.AnalysisException;
import org.apache.doris.common.ErrorCode;
import org.apache.doris.common.ErrorReport;
import org.apache.doris.common.Pair;
import org.apache.doris.ha.FrontendNodeType;
import org.apache.doris.mysql.privilege.PrivPredicate;
import org.apache.doris.qe.ConnectContext;
import org.apache.doris.system.SystemInfoService;
import org.apache.doris.system.SystemInfoService.HostInfo;

import com.google.common.base.Preconditions;
import com.google.common.base.Strings;
Expand All @@ -36,7 +36,8 @@

public class FrontendClause extends AlterClause {
protected String hostPort;
protected String host;
protected String ip;
protected String hostName;
protected int port;
protected FrontendNodeType role;

Expand All @@ -46,8 +47,12 @@ protected FrontendClause(String hostPort, FrontendNodeType role) {
this.role = role;
}

public String getHost() {
return host;
public String getIp() {
return ip;
}

public String getHostName() {
return hostName;
}

public int getPort() {
Expand All @@ -61,10 +66,11 @@ public void analyze(Analyzer analyzer) throws AnalysisException {
analyzer.getQualifiedUser());
}

Pair<String, Integer> pair = SystemInfoService.validateHostAndPort(hostPort);
this.host = pair.first;
this.port = pair.second;
Preconditions.checkState(!Strings.isNullOrEmpty(host));
HostInfo hostInfo = SystemInfoService.getIpHostAndPort(hostPort, true);
this.ip = hostInfo.getIp();
this.hostName = hostInfo.getHostName();
this.port = hostInfo.getPort();
Preconditions.checkState(!Strings.isNullOrEmpty(ip));
}

@Override
Expand Down
Loading