From 22393e4456178f0100d7d4ae1c85458dbe454afe Mon Sep 17 00:00:00 2001 From: Pixy Yuan Date: Mon, 19 Jul 2021 16:42:34 +0800 Subject: [PATCH] [ISSUE #6386] Stop v1 distro verification when cluster upgraded to v2. (#6387) --- .../ephemeral/distro/DistroConsistencyServiceImpl.java | 4 ++++ .../ephemeral/distro/component/DistroDataStorageImpl.java | 5 +++++ 2 files changed, 9 insertions(+) diff --git a/naming/src/main/java/com/alibaba/nacos/naming/consistency/ephemeral/distro/DistroConsistencyServiceImpl.java b/naming/src/main/java/com/alibaba/nacos/naming/consistency/ephemeral/distro/DistroConsistencyServiceImpl.java index 260af4f36..7a611f582 100644 --- a/naming/src/main/java/com/alibaba/nacos/naming/consistency/ephemeral/distro/DistroConsistencyServiceImpl.java +++ b/naming/src/main/java/com/alibaba/nacos/naming/consistency/ephemeral/distro/DistroConsistencyServiceImpl.java @@ -311,6 +311,10 @@ public class DistroConsistencyServiceImpl implements EphemeralConsistencyService @Override public boolean processVerifyData(DistroData distroData, String sourceAddress) { + // If upgrade to 2.0.X, do not verify for v1. + if (ApplicationUtils.getBean(UpgradeJudgement.class).isUseGrpcFeatures()) { + return true; + } DistroHttpData distroHttpData = (DistroHttpData) distroData; Map verifyData = (Map) distroHttpData.getDeserializedContent(); onReceiveChecksums(verifyData, sourceAddress); diff --git a/naming/src/main/java/com/alibaba/nacos/naming/consistency/ephemeral/distro/component/DistroDataStorageImpl.java b/naming/src/main/java/com/alibaba/nacos/naming/consistency/ephemeral/distro/component/DistroDataStorageImpl.java index 28db3456e..1d1a925e0 100644 --- a/naming/src/main/java/com/alibaba/nacos/naming/consistency/ephemeral/distro/component/DistroDataStorageImpl.java +++ b/naming/src/main/java/com/alibaba/nacos/naming/consistency/ephemeral/distro/component/DistroDataStorageImpl.java @@ -26,6 +26,7 @@ import com.alibaba.nacos.naming.consistency.KeyBuilder; import com.alibaba.nacos.naming.consistency.ephemeral.distro.DataStore; import com.alibaba.nacos.naming.consistency.ephemeral.distro.combined.DistroHttpCombinedKey; import com.alibaba.nacos.naming.core.DistroMapper; +import com.alibaba.nacos.naming.core.v2.upgrade.UpgradeJudgement; import com.alibaba.nacos.sys.utils.ApplicationUtils; import java.util.Collections; @@ -84,6 +85,10 @@ public class DistroDataStorageImpl implements DistroDataStorage { @Override public List getVerifyData() { + // If upgrade to 2.0.X, do not verify for v1. + if (ApplicationUtils.getBean(UpgradeJudgement.class).isUseGrpcFeatures()) { + return Collections.emptyList(); + } Map keyChecksums = new HashMap<>(64); for (String key : dataStore.keys()) { if (!distroMapper.responsible(KeyBuilder.getServiceName(key))) {