caiconghui commented on code in PR #9172: URL: https://github.com/apache/doris/pull/9172#discussion_r1032901887
########## fe/fe-core/src/main/java/org/apache/doris/system/FQDNManager.java: ########## @@ -0,0 +1,73 @@ +// 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.system; + +import org.apache.doris.catalog.Env; +import org.apache.doris.common.ClientPool; +import org.apache.doris.common.FeConstants; +import org.apache.doris.common.util.MasterDaemon; +import org.apache.doris.thrift.TNetworkAddress; + +import org.apache.logging.log4j.LogManager; +import org.apache.logging.log4j.Logger; + +import java.net.InetAddress; +import java.net.UnknownHostException; + +public class FQDNManager extends MasterDaemon { + private static final Logger LOG = LogManager.getLogger(FQDNManager.class); + + private SystemInfoService nodeMgr; + + public FQDNManager(SystemInfoService nodeMgr) { + super("FQDN mgr", FeConstants.ip_check_interval_second * 1000L); + this.nodeMgr = nodeMgr; + } + + /** + * At each round: check if ip of be has already been changed + */ + @Override + protected void runAfterCatalogReady() { + for (Backend be : nodeMgr.getIdToBackend().values()) { + if (be.getHostName() != null) { + try { + InetAddress inetAddress = InetAddress.getByName(be.getHostName()); + if (!be.getHost().equalsIgnoreCase(inetAddress.getHostAddress())) { + String ip = be.getHost(); + if (!ip.equalsIgnoreCase("unknown")) { + ClientPool.backendPool.clearPool(new TNetworkAddress(ip, be.getBePort())); Review Comment: actually if ip of pod changed, it means the pod has been reconstructed already, so I think it is ok to clear the client pool before changing BE'ip and writing edit log. And pod ip changed is driven by k8s, not by Manual operation,in other word,pod‘s ip is also stable,if the host machine not failed or there is not manual reconstructed pod operation -- 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]
