This is an automated email from the ASF dual-hosted git repository.

yiguolei pushed a commit to branch branch-4.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-4.1 by this push:
     new eec1af92448 branch-4.1: [improvement](nereids) improve show frontends 
so slow issue when we don't enable fqdn mode in fe.conf because of using dns 
resolve firstly but not ip directly #62139 (#64067)
eec1af92448 is described below

commit eec1af924487332f3768ff1fd22e346c22ade27f
Author: github-actions[bot] 
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Sat Jul 4 12:33:39 2026 +0800

    branch-4.1: [improvement](nereids) improve show frontends so slow issue 
when we don't enable fqdn mode in fe.conf because of using dns resolve firstly 
but not ip directly #62139 (#64067)
    
    Cherry-picked from #62139
    
    Co-authored-by: heguanhui <[email protected]>
---
 .../doris/common/proc/FrontendsProcNode.java       | 50 +++++++++++-----------
 1 file changed, 26 insertions(+), 24 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/org/apache/doris/common/proc/FrontendsProcNode.java 
b/fe/fe-core/src/main/java/org/apache/doris/common/proc/FrontendsProcNode.java
index 27723196728..4b7adbf9638 100644
--- 
a/fe/fe-core/src/main/java/org/apache/doris/common/proc/FrontendsProcNode.java
+++ 
b/fe/fe-core/src/main/java/org/apache/doris/common/proc/FrontendsProcNode.java
@@ -204,35 +204,37 @@ public class FrontendsProcNode implements 
ProcNodeInterface {
     }
 
     private static boolean isJoin(List<InetSocketAddress> allFeHosts, Frontend 
fe) {
+        String feHost = fe.getHost();
+        int fePort = fe.getEditLogPort();
         for (InetSocketAddress addr : allFeHosts) {
-            if (fe.getEditLogPort() != addr.getPort()) {
+            if (fePort != addr.getPort()) {
                 continue;
             }
-            // if hostname of InetSocketAddress is ip, addr.getHostName() may 
be not equal to fe.getIp()
-            // so we need to compare fe.getIp() with address.getHostAddress()
-            InetAddress address = addr.getAddress();
-            if (null == address) {
-                LOG.warn("Failed to get InetAddress {}", addr);
-                continue;
-            }
-            if (fe.getHost().equals(address.getHostAddress())) {
-                return true;
-            }
-        }
-
-        // Avoid calling getHostName multiple times, don't remove it
-        for (InetSocketAddress addr : allFeHosts) {
-            // Avoid calling getHostName multiple times, don't remove it
-            if (fe.getEditLogPort() != addr.getPort()) {
-                continue;
-            }
-            // 
https://bugs.openjdk.org/browse/JDK-8143378#:~:text=getHostName()%3B%20takes%20about%205,millisecond%20on%20JDK%20update%2051
-            // getHostName sometime has bug, take 5s
-            String host = addr.getHostName();
-            if (!Strings.isNullOrEmpty(host)) {
-                if (host.equals(fe.getHost())) {
+            if (Config.enable_fqdn_mode) {
+                String hostName = addr.getHostName();
+                if (!Strings.isNullOrEmpty(hostName) && 
hostName.equals(feHost)) {
+                    return true;
+                }
+                InetAddress address = addr.getAddress();
+                if (address != null && 
feHost.equals(address.getHostAddress())) {
                     return true;
                 }
+                if (address == null && !Strings.isNullOrEmpty(hostName) && 
hostName.equals(feHost)) {
+                    return true;
+                }
+            } else {
+                InetAddress address = addr.getAddress();
+                if (address != null) {
+                    String addrIp = address.getHostAddress();
+                    if (feHost.equals(addrIp)) {
+                        return true;
+                    }
+                } else {
+                    String hostName = addr.getHostName();
+                    if (!Strings.isNullOrEmpty(hostName) && 
hostName.equals(feHost)) {
+                        return true;
+                    }
+                }
             }
         }
         return false;


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to