This is an automated email from the ASF dual-hosted git repository.
caiconghui pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/master by this push:
new a651926ba9 [fix](fqdn) Add UnknownHostException handle logic in
FQDNManager to avoid that active ip could be incorrectly assigned to dead be or
dead fe (#17689)
a651926ba9 is described below
commit a651926ba9fe2fb68b639ef5f85eee3fe97e7467
Author: caiconghui <[email protected]>
AuthorDate: Sun Mar 12 21:12:33 2023 +0800
[fix](fqdn) Add UnknownHostException handle logic in FQDNManager to avoid
that active ip could be incorrectly assigned to dead be or dead fe (#17689)
1.if be is dead and be ip not changed by FQDNManager,A situation may occur
that after a while the old ip is used by other new alive pod,this may cause two
be share same ip which is unexpected.
2.when enable_fqdn is false, user can still set hostname in be when add
backend
Co-authored-by: caiconghui1 <[email protected]>
---
.../main/java/org/apache/doris/system/FQDNManager.java | 17 +++++++++++++++++
.../java/org/apache/doris/system/SystemInfoService.java | 4 ----
2 files changed, 17 insertions(+), 4 deletions(-)
diff --git a/fe/fe-core/src/main/java/org/apache/doris/system/FQDNManager.java
b/fe/fe-core/src/main/java/org/apache/doris/system/FQDNManager.java
index 2f60d3b2b5..e86e2b76a4 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/system/FQDNManager.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/system/FQDNManager.java
@@ -34,6 +34,8 @@ import java.net.UnknownHostException;
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) {
@@ -64,6 +66,13 @@ public class FQDNManager extends MasterDaemon {
}
} 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);
}
@@ -85,6 +94,14 @@ public class FQDNManager extends MasterDaemon {
}
} 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");
+ }
}
}
}
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/system/SystemInfoService.java
b/fe/fe-core/src/main/java/org/apache/doris/system/SystemInfoService.java
index abb08dcb96..1b10fd2833 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/system/SystemInfoService.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/system/SystemInfoService.java
@@ -192,10 +192,6 @@ public class SystemInfoService {
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");
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]