diff --git a/core/src/main/java/com/alibaba/nacos/core/cluster/MemberUtils.java b/core/src/main/java/com/alibaba/nacos/core/cluster/MemberUtils.java index abb515594..449f0d687 100644 --- a/core/src/main/java/com/alibaba/nacos/core/cluster/MemberUtils.java +++ b/core/src/main/java/com/alibaba/nacos/core/cluster/MemberUtils.java @@ -17,7 +17,6 @@ package com.alibaba.nacos.core.cluster; import com.alibaba.nacos.common.utils.ExceptionUtil; -import com.alibaba.nacos.common.utils.VersionUtils; import com.alibaba.nacos.core.utils.ApplicationUtils; import com.alibaba.nacos.core.utils.Loggers; import java.util.concurrent.ThreadLocalRandom; @@ -75,7 +74,6 @@ public class MemberUtils { Map extendInfo = new HashMap<>(4); // The Raft Port information needs to be set by default extendInfo.put(MemberMetaDataConstants.RAFT_PORT, String.valueOf(calculateRaftPort(target))); - extendInfo.put(MemberMetaDataConstants.VERSION, VersionUtils.VERSION); target.setExtendInfo(extendInfo); return target; } diff --git a/core/src/main/java/com/alibaba/nacos/core/cluster/ServerMemberManager.java b/core/src/main/java/com/alibaba/nacos/core/cluster/ServerMemberManager.java index b9905e114..3d69cc403 100644 --- a/core/src/main/java/com/alibaba/nacos/core/cluster/ServerMemberManager.java +++ b/core/src/main/java/com/alibaba/nacos/core/cluster/ServerMemberManager.java @@ -139,6 +139,7 @@ public class ServerMemberManager this.port = ApplicationUtils.getProperty("server.port", Integer.class, 8848); this.localAddress = InetUtils.getSelfIp() + ":" + port; this.self = MemberUtils.singleParse(this.localAddress); + this.self.setExtendVal(MemberMetaDataConstants.VERSION, VersionUtils.VERSION); serverList.put(self.getAddress(), self); // register NodeChangeEvent publisher to NotifyManager diff --git a/naming/src/main/java/com/alibaba/nacos/naming/core/DistroMapper.java b/naming/src/main/java/com/alibaba/nacos/naming/core/DistroMapper.java index ba2d5e2b0..90c91b333 100644 --- a/naming/src/main/java/com/alibaba/nacos/naming/core/DistroMapper.java +++ b/naming/src/main/java/com/alibaba/nacos/naming/core/DistroMapper.java @@ -28,6 +28,7 @@ import org.springframework.stereotype.Component; import javax.annotation.PostConstruct; import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.List; @@ -104,7 +105,7 @@ public class DistroMapper implements MemberChangeListener { int index = distroHash(serviceName) % servers.size(); return servers.get(index); } catch (Throwable e) { - Loggers.SRV_LOG.warn("distro mapper failed, return localhost: " + ApplicationUtils.getLocalAddress(), e); + Loggers.SRV_LOG.warn("[NACOS-DISTRO] distro mapper failed, return localhost: " + ApplicationUtils.getLocalAddress(), e); return ApplicationUtils.getLocalAddress(); } } @@ -119,8 +120,9 @@ public class DistroMapper implements MemberChangeListener { // node list is in the same order List list = MemberUtils.simpleMembers(event.getMembers()); Collections.sort(list); + Collection old = healthyList; healthyList = Collections.unmodifiableList(list); - System.out.println(healthyList); + Loggers.SRV_LOG.info("[NACOS-DISTRO] healthy server list changed, old: {}, new: {}", old, healthyList); } @Override