Solve conflict.

This commit is contained in:
KomachiSion 2022-10-17 19:23:13 +08:00
parent 22169055ed
commit 6eae075a48
6 changed files with 6 additions and 28 deletions

View File

@ -16,16 +16,8 @@
package com.alibaba.nacos.naming.cluster.transport; 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.common.utils.JacksonUtils;
import com.alibaba.nacos.naming.consistency.Datum; import org.springframework.stereotype.Component;
import com.alibaba.nacos.naming.pojo.Record;
import com.fasterxml.jackson.core.type.TypeReference;
import com.fasterxml.jackson.databind.JsonNode;
/** /**
* Use Jackson to serialize data. * Use Jackson to serialize data.

View File

@ -16,11 +16,6 @@
package com.alibaba.nacos.naming.cluster.transport; 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. * Serializer specially for large map of data.
* *

View File

@ -151,9 +151,9 @@ public class DistroClientDataProcessor extends SmartSubscriber implements Distro
} }
private void handlerClientSyncData(ClientSyncData clientSyncData) { private void handlerClientSyncData(ClientSyncData clientSyncData) {
Loggers.DISTRO.info("[Client-Add] Received distro client sync data {}, revision={}", Loggers.DISTRO
clientSyncData.getClientId(), .info("[Client-Add] Received distro client sync data {}, revision={}", clientSyncData.getClientId(),
clientSyncData.getAttributes().getClientAttribute(ClientConstants.REVISION, 0L)); clientSyncData.getAttributes().getClientAttribute(ClientConstants.REVISION, 0L));
clientManager.syncClientConnected(clientSyncData.getClientId(), clientSyncData.getAttributes()); clientManager.syncClientConnected(clientSyncData.getClientId(), clientSyncData.getAttributes());
Client client = clientManager.getClient(clientSyncData.getClientId()); Client client = clientManager.getClient(clientSyncData.getClientId());
upgradeClient(client, clientSyncData); upgradeClient(client, clientSyncData);
@ -218,18 +218,13 @@ public class DistroClientDataProcessor extends SmartSubscriber implements Distro
new ClientOperationEvent.ClientRegisterServiceEvent(singleton, client.getClientId())); new ClientOperationEvent.ClientRegisterServiceEvent(singleton, client.getClientId()));
} }
} }
client.setRevision( client.setRevision(clientSyncData.getAttributes().<Integer>getClientAttribute(ClientConstants.REVISION, 0));
clientSyncData.getAttributes().<Integer>getClientAttribute(ClientConstants.REVISION, 0));
} }
@Override @Override
public boolean processVerifyData(DistroData distroData, String sourceAddress) { public boolean processVerifyData(DistroData distroData, String sourceAddress) {
DistroClientVerifyInfo verifyData = ApplicationUtils.getBean(Serializer.class) DistroClientVerifyInfo verifyData = ApplicationUtils.getBean(Serializer.class)
.deserialize(distroData.getContent(), DistroClientVerifyInfo.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)) { if (clientManager.verifyClient(verifyData)) {
return true; return true;
} }

View File

@ -20,7 +20,6 @@ import com.alibaba.nacos.common.notify.Event;
import com.alibaba.nacos.common.notify.listener.Subscriber; import com.alibaba.nacos.common.notify.listener.Subscriber;
import com.alibaba.nacos.common.utils.ConcurrentHashSet; import com.alibaba.nacos.common.utils.ConcurrentHashSet;
import com.alibaba.nacos.consistency.DataOperation; 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.RecordListener;
import com.alibaba.nacos.naming.consistency.ValueChangeEvent; import com.alibaba.nacos.naming.consistency.ValueChangeEvent;
import com.alibaba.nacos.naming.misc.Loggers; import com.alibaba.nacos.naming.misc.Loggers;

View File

@ -83,7 +83,6 @@ public class GlobalExecutor {
private static final ExecutorService PUSH_CALLBACK_EXECUTOR = ExecutorFactory.Managed private static final ExecutorService PUSH_CALLBACK_EXECUTOR = ExecutorFactory.Managed
.newSingleExecutorService("Push", new NameThreadFactory("com.alibaba.nacos.naming.push.callback")); .newSingleExecutorService("Push", new NameThreadFactory("com.alibaba.nacos.naming.push.callback"));
public static void registerServerStatusUpdater(Runnable runnable) { public static void registerServerStatusUpdater(Runnable runnable) {
NAMING_TIMER_EXECUTOR.scheduleAtFixedRate(runnable, 0, SERVER_STATUS_UPDATE_PERIOD, TimeUnit.MILLISECONDS); NAMING_TIMER_EXECUTOR.scheduleAtFixedRate(runnable, 0, SERVER_STATUS_UPDATE_PERIOD, TimeUnit.MILLISECONDS);
} }

View File

@ -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.DistroRecord;
import com.alibaba.nacos.core.distributed.distro.monitor.DistroRecordsHolder; 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.consistency.ephemeral.distro.v2.DistroClientDataProcessor;
import com.alibaba.nacos.naming.misc.GlobalExecutor; import com.alibaba.nacos.naming.misc.GlobalExecutor;
import com.alibaba.nacos.naming.misc.Loggers; import com.alibaba.nacos.naming.misc.Loggers;
@ -115,8 +114,7 @@ public class PerformanceLoggerThread {
v2SyncFail = v2Record.get().getFailedSyncCount(); v2SyncFail = v2Record.get().getFailedSyncCount();
v2VerifyFail = v2Record.get().getFailedVerifyCount(); v2VerifyFail = v2Record.get().getFailedVerifyCount();
} }
Loggers.PERFORMANCE_LOG Loggers.PERFORMANCE_LOG.info("DISTRO:|{}|{}|{}|", v2SyncDone, v2SyncFail, v2VerifyFail);
.info("DISTRO:|{}|{}|{}|", v2SyncDone, v2SyncFail, v2VerifyFail);
} }
} }