From 6eae075a486fa1f79387ac6c90020f9c1fd3b087 Mon Sep 17 00:00:00 2001 From: KomachiSion Date: Mon, 17 Oct 2022 19:23:13 +0800 Subject: [PATCH] Solve conflict. --- .../naming/cluster/transport/JacksonSerializer.java | 10 +--------- .../nacos/naming/cluster/transport/Serializer.java | 5 ----- .../distro/v2/DistroClientDataProcessor.java | 13 ++++--------- .../consistency/persistent/PersistentNotifier.java | 1 - .../alibaba/nacos/naming/misc/GlobalExecutor.java | 1 - .../naming/monitor/PerformanceLoggerThread.java | 4 +--- 6 files changed, 6 insertions(+), 28 deletions(-) diff --git a/naming/src/main/java/com/alibaba/nacos/naming/cluster/transport/JacksonSerializer.java b/naming/src/main/java/com/alibaba/nacos/naming/cluster/transport/JacksonSerializer.java index f08b85a22..5e19bc6f5 100644 --- a/naming/src/main/java/com/alibaba/nacos/naming/cluster/transport/JacksonSerializer.java +++ b/naming/src/main/java/com/alibaba/nacos/naming/cluster/transport/JacksonSerializer.java @@ -16,16 +16,8 @@ package com.alibaba.nacos.naming.cluster.transport; -import java.util.HashMap; -import java.util.Map; - -import org.springframework.stereotype.Component; - import com.alibaba.nacos.common.utils.JacksonUtils; -import com.alibaba.nacos.naming.consistency.Datum; -import com.alibaba.nacos.naming.pojo.Record; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.JsonNode; +import org.springframework.stereotype.Component; /** * Use Jackson to serialize data. diff --git a/naming/src/main/java/com/alibaba/nacos/naming/cluster/transport/Serializer.java b/naming/src/main/java/com/alibaba/nacos/naming/cluster/transport/Serializer.java index 884c693cf..229e068a2 100644 --- a/naming/src/main/java/com/alibaba/nacos/naming/cluster/transport/Serializer.java +++ b/naming/src/main/java/com/alibaba/nacos/naming/cluster/transport/Serializer.java @@ -16,11 +16,6 @@ package com.alibaba.nacos.naming.cluster.transport; -import com.alibaba.nacos.naming.consistency.Datum; -import com.alibaba.nacos.naming.pojo.Record; - -import java.util.Map; - /** * Serializer specially for large map of data. * diff --git a/naming/src/main/java/com/alibaba/nacos/naming/consistency/ephemeral/distro/v2/DistroClientDataProcessor.java b/naming/src/main/java/com/alibaba/nacos/naming/consistency/ephemeral/distro/v2/DistroClientDataProcessor.java index 285fc695c..eca5f7776 100644 --- a/naming/src/main/java/com/alibaba/nacos/naming/consistency/ephemeral/distro/v2/DistroClientDataProcessor.java +++ b/naming/src/main/java/com/alibaba/nacos/naming/consistency/ephemeral/distro/v2/DistroClientDataProcessor.java @@ -151,9 +151,9 @@ public class DistroClientDataProcessor extends SmartSubscriber implements Distro } private void handlerClientSyncData(ClientSyncData clientSyncData) { - Loggers.DISTRO.info("[Client-Add] Received distro client sync data {}, revision={}", - clientSyncData.getClientId(), - clientSyncData.getAttributes().getClientAttribute(ClientConstants.REVISION, 0L)); + Loggers.DISTRO + .info("[Client-Add] Received distro client sync data {}, revision={}", clientSyncData.getClientId(), + clientSyncData.getAttributes().getClientAttribute(ClientConstants.REVISION, 0L)); clientManager.syncClientConnected(clientSyncData.getClientId(), clientSyncData.getAttributes()); Client client = clientManager.getClient(clientSyncData.getClientId()); upgradeClient(client, clientSyncData); @@ -218,18 +218,13 @@ public class DistroClientDataProcessor extends SmartSubscriber implements Distro new ClientOperationEvent.ClientRegisterServiceEvent(singleton, client.getClientId())); } } - client.setRevision( - clientSyncData.getAttributes().getClientAttribute(ClientConstants.REVISION, 0)); + client.setRevision(clientSyncData.getAttributes().getClientAttribute(ClientConstants.REVISION, 0)); } @Override public boolean processVerifyData(DistroData distroData, String sourceAddress) { DistroClientVerifyInfo verifyData = ApplicationUtils.getBean(Serializer.class) .deserialize(distroData.getContent(), DistroClientVerifyInfo.class); - // If not upgraded to 2.0.X, just renew client and return. - if (!upgradeJudgement.isUseGrpcFeatures()) { - verifyData.setRevision(0L); - } if (clientManager.verifyClient(verifyData)) { return true; } diff --git a/naming/src/main/java/com/alibaba/nacos/naming/consistency/persistent/PersistentNotifier.java b/naming/src/main/java/com/alibaba/nacos/naming/consistency/persistent/PersistentNotifier.java index 3dac6967b..15750b314 100644 --- a/naming/src/main/java/com/alibaba/nacos/naming/consistency/persistent/PersistentNotifier.java +++ b/naming/src/main/java/com/alibaba/nacos/naming/consistency/persistent/PersistentNotifier.java @@ -20,7 +20,6 @@ import com.alibaba.nacos.common.notify.Event; import com.alibaba.nacos.common.notify.listener.Subscriber; import com.alibaba.nacos.common.utils.ConcurrentHashSet; import com.alibaba.nacos.consistency.DataOperation; -import com.alibaba.nacos.naming.consistency.KeyBuilder; import com.alibaba.nacos.naming.consistency.RecordListener; import com.alibaba.nacos.naming.consistency.ValueChangeEvent; import com.alibaba.nacos.naming.misc.Loggers; diff --git a/naming/src/main/java/com/alibaba/nacos/naming/misc/GlobalExecutor.java b/naming/src/main/java/com/alibaba/nacos/naming/misc/GlobalExecutor.java index 522dc6fb2..c23cb07bf 100644 --- a/naming/src/main/java/com/alibaba/nacos/naming/misc/GlobalExecutor.java +++ b/naming/src/main/java/com/alibaba/nacos/naming/misc/GlobalExecutor.java @@ -83,7 +83,6 @@ public class GlobalExecutor { private static final ExecutorService PUSH_CALLBACK_EXECUTOR = ExecutorFactory.Managed .newSingleExecutorService("Push", new NameThreadFactory("com.alibaba.nacos.naming.push.callback")); - public static void registerServerStatusUpdater(Runnable runnable) { NAMING_TIMER_EXECUTOR.scheduleAtFixedRate(runnable, 0, SERVER_STATUS_UPDATE_PERIOD, TimeUnit.MILLISECONDS); } diff --git a/naming/src/main/java/com/alibaba/nacos/naming/monitor/PerformanceLoggerThread.java b/naming/src/main/java/com/alibaba/nacos/naming/monitor/PerformanceLoggerThread.java index 9df746093..32b8d359b 100644 --- a/naming/src/main/java/com/alibaba/nacos/naming/monitor/PerformanceLoggerThread.java +++ b/naming/src/main/java/com/alibaba/nacos/naming/monitor/PerformanceLoggerThread.java @@ -18,7 +18,6 @@ package com.alibaba.nacos.naming.monitor; import com.alibaba.nacos.core.distributed.distro.monitor.DistroRecord; import com.alibaba.nacos.core.distributed.distro.monitor.DistroRecordsHolder; -import com.alibaba.nacos.naming.consistency.KeyBuilder; import com.alibaba.nacos.naming.consistency.ephemeral.distro.v2.DistroClientDataProcessor; import com.alibaba.nacos.naming.misc.GlobalExecutor; import com.alibaba.nacos.naming.misc.Loggers; @@ -115,8 +114,7 @@ public class PerformanceLoggerThread { v2SyncFail = v2Record.get().getFailedSyncCount(); v2VerifyFail = v2Record.get().getFailedVerifyCount(); } - Loggers.PERFORMANCE_LOG - .info("DISTRO:|{}|{}|{}|", v2SyncDone, v2SyncFail, v2VerifyFail); + Loggers.PERFORMANCE_LOG.info("DISTRO:|{}|{}|{}|", v2SyncDone, v2SyncFail, v2VerifyFail); } }