github-actions[bot] commented on code in PR #60209:
URL: https://github.com/apache/doris/pull/60209#discussion_r3556177781
##########
fe/fe-core/src/main/java/org/apache/doris/common/proc/BackendsProcDir.java:
##########
@@ -167,6 +169,10 @@ public static List<List<String>> getBackendInfos() {
// node role, show the value only when backend is alive.
backendInfo.add(backend.isAlive() ? backend.getNodeRoleTag().value
: "");
+ // ip
+ if (Config.enable_fqdn_mode) {
Review Comment:
This adds the resolved `Ip` for the SHOW/PROC/TVF backend paths, but the
connector-facing REST endpoint is still a parallel path: `/api/backends` in
`BackendsAction` returns `backendRow.ip = be.getHost()`. In FQDN mode
`Backend.getHost()` is the stable hostname, so callers of that REST API still
get a hostname in the JSON `ip` field instead of the resolved address this PR
is adding elsewhere. Since that endpoint is documented as being used by
flink/spark connectors for stream-load backend discovery, please update it to
use the same FQDN-mode resolution or add a separate resolved-IP field so the
REST API behavior matches `SHOW BACKENDS`.
##########
fe/fe-core/src/main/java/org/apache/doris/common/util/HostUtils.java:
##########
@@ -0,0 +1,58 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you 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
+//
+// http://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 org.apache.doris.common.util;
+
+import com.github.benmanes.caffeine.cache.CacheLoader;
+import com.github.benmanes.caffeine.cache.Caffeine;
+import com.github.benmanes.caffeine.cache.LoadingCache;
+import org.apache.logging.log4j.LogManager;
+import org.apache.logging.log4j.Logger;
+
+import java.net.InetAddress;
+import java.util.concurrent.TimeUnit;
+
+/**
+ * HostUtils
+ */
+public class HostUtils {
+
+ private static final Logger LOG = LogManager.getLogger(HostUtils.class);
+ private static final LoadingCache<String, String> HOST_TO_IP_CACHE =
Caffeine.newBuilder()
Review Comment:
This cache can make the new `Ip` columns stale in exactly the FQDN-mode case
they are meant to help. `enable_fqdn_mode` is used when the pod name remains
stable but the IP can change; Doris already sets the JVM DNS TTL to 60s and has
`Env.getDnsCache()` refreshing FQDN answers every 60s while preserving the last
good IP on lookup failure. This new Caffeine cache keeps a successful answer
for 10 minutes and also caches the literal `Unknown` returned on a transient
failure, so `SHOW BACKENDS`/`SHOW FRONTENDS`/TVFs can report an obsolete IP or
`Unknown` well after DNS has recovered. Please reuse the existing DNS cache
behavior or avoid caching failed resolutions.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]