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
17 changes: 17 additions & 0 deletions fe/fe-core/src/main/java/org/apache/doris/system/FQDNManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@
public class FQDNManager extends MasterDaemon {
private static final Logger LOG = LogManager.getLogger(FQDNManager.class);

public static final String UNKNOWN_HOST_IP = "unknown";

private SystemInfoService nodeMgr;

public FQDNManager(SystemInfoService nodeMgr) {
Expand Down Expand Up @@ -64,6 +66,13 @@ private void updateFeIp() {
}
} catch (UnknownHostException e) {
LOG.warn("unknown host name for fe, {}", fe.getHostName(), e);
// add fe alive check to make ip work when fe is still alive and dns has some problem.
if (!fe.isAlive() && !fe.getIp().equalsIgnoreCase(UNKNOWN_HOST_IP)) {
String ip = fe.getIp();
fe.setIp(UNKNOWN_HOST_IP);
Env.getCurrentEnv().getEditLog().logModifyFrontend(fe);
LOG.warn("ip for {} of fe has been changed from {} to {}", fe.getHostName(), ip, "unknown");
}
} catch (DdlException e) {
LOG.warn("fail to update ip for fe, {}", fe.getHostName(), e);
}
Expand All @@ -85,6 +94,14 @@ private void updateBeIp() {
}
} catch (UnknownHostException e) {
LOG.warn("unknown host name for be, {}", be.getHostName(), e);
// add be alive check to make ip work when be is still alive and dns has some problem.
if (!be.isAlive() && !be.getIp().equalsIgnoreCase(UNKNOWN_HOST_IP)) {
String ip = be.getIp();
ClientPool.backendPool.clearPool(new TNetworkAddress(ip, be.getBePort()));
be.setIp(UNKNOWN_HOST_IP);
Env.getCurrentEnv().getEditLog().logBackendStateChange(be);
LOG.warn("ip for {} of be has been changed from {} to {}", be.getHostName(), ip, "unknown");
}
}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,10 +192,6 @@ public void addBackends(List<HostInfo> hostInfos, boolean isFree)
public void addBackends(List<HostInfo> hostInfos, boolean isFree, String destCluster,
Map<String, String> tagMap) throws UserException {
for (HostInfo hostInfo : hostInfos) {
//if not enable_fqdn,ignore hostName
if (!Config.enable_fqdn_mode) {
hostInfo.setHostName(null);
}
if (Config.enable_fqdn_mode && StringUtils.isEmpty(hostInfo.getHostName())) {
throw new DdlException("backend's hostName should not be empty while enable_fqdn_mode is true");
}
Expand Down