From 75964e0c3413d0337ea55692af708a77d9d3802e Mon Sep 17 00:00:00 2001 From: "shangyu.wh" Date: Wed, 3 Apr 2019 22:20:09 +0800 Subject: [PATCH 1/5] fix temp push --- .../data/bootstrap/DataServerConfig.java | 20 +++++++ .../server/data/change/DataChangeHandler.java | 16 +++++- .../change/event/DataChangeEventQueue.java | 27 ++++++++- .../src/main/resources/application.properties | 1 + .../task/DataChangeFetchCloudTask.java | 5 +- .../session/scheduler/task/DataPushTask.java | 55 ++++--------------- .../registry/test/BaseIntegrationTest.java | 2 + .../test/pubsub/TempPublisherTest.java | 45 +++++++++++++++ 8 files changed, 119 insertions(+), 52 deletions(-) diff --git a/server/server/data/src/main/java/com/alipay/sofa/registry/server/data/bootstrap/DataServerConfig.java b/server/server/data/src/main/java/com/alipay/sofa/registry/server/data/bootstrap/DataServerConfig.java index 4d801b711..58eeb29cd 100644 --- a/server/server/data/src/main/java/com/alipay/sofa/registry/server/data/bootstrap/DataServerConfig.java +++ b/server/server/data/src/main/java/com/alipay/sofa/registry/server/data/bootstrap/DataServerConfig.java @@ -55,6 +55,8 @@ public class DataServerConfig { private int clientOffDelayMs; + private int notifyTempDataIntervalMs; + private int rpcTimeout; private CommonConfig commonConfig; @@ -233,6 +235,24 @@ public void setNotifyIntervalMs(int notifyIntervalMs) { this.notifyIntervalMs = notifyIntervalMs; } + /** + * Getter method for property notifyTempDataIntervalMs. + * + * @return property value of notifyTempDataIntervalMs + */ + public int getNotifyTempDataIntervalMs() { + return notifyTempDataIntervalMs; + } + + /** + * Setter method for property notifyTempDataIntervalMs. + * + * @param notifyTempDataIntervalMs value to be assigned to property notifyTempDataIntervalMs + */ + public void setNotifyTempDataIntervalMs(int notifyTempDataIntervalMs) { + this.notifyTempDataIntervalMs = notifyTempDataIntervalMs; + } + /** * Getter method for property rpcTimeout. * diff --git a/server/server/data/src/main/java/com/alipay/sofa/registry/server/data/change/DataChangeHandler.java b/server/server/data/src/main/java/com/alipay/sofa/registry/server/data/change/DataChangeHandler.java index 6bf66a946..a45c718ba 100644 --- a/server/server/data/src/main/java/com/alipay/sofa/registry/server/data/change/DataChangeHandler.java +++ b/server/server/data/src/main/java/com/alipay/sofa/registry/server/data/change/DataChangeHandler.java @@ -17,6 +17,7 @@ package com.alipay.sofa.registry.server.data.change; import com.alipay.sofa.registry.common.model.dataserver.Datum; +import com.alipay.sofa.registry.common.model.store.Publisher; import com.alipay.sofa.registry.log.Logger; import com.alipay.sofa.registry.log.LoggerFactory; import com.alipay.sofa.registry.server.data.bootstrap.DataServerConfig; @@ -31,6 +32,7 @@ import javax.annotation.Resource; import java.util.List; +import java.util.Map; import java.util.concurrent.Executor; /** @@ -178,11 +180,19 @@ private void notifyTempPub(Datum datum, DataSourceTypeEnum sourceType, String dataCenter = datum.getDataCenter(); String dataInfoId = datum.getDataInfoId(); long version = datum.getVersion(); + + Datum existDatum = DatumCache.get(dataCenter, dataInfoId); + if (existDatum != null) { + Map cachePubMap = existDatum.getPubMap(); + if (cachePubMap != null && !cachePubMap.isEmpty()) { + datum.getPubMap().putAll(cachePubMap); + } + } + LOGGER .info( - "[DataChangeHandler][{}] datum handle temp pub,datum={},dataCenter={}, dataInfoId={}, version={}, sourceType={}, changeType={},isContainsUnPub={}", - name, datum.hashCode(), dataCenter, dataInfoId, version, sourceType, - changeType, datum.isContainsUnPub()); + "[DataChangeHandler][{}] datum handle temp pub,datum={},dataCenter={}, dataInfoId={}, version={}, sourceType={}, changeType={}", + name, datum.hashCode(), dataCenter, dataInfoId, version, sourceType, changeType); for (IDataChangeNotifier notifier : dataChangeNotifiers) { if (notifier.getSuitableSource().contains(sourceType)) { diff --git a/server/server/data/src/main/java/com/alipay/sofa/registry/server/data/change/event/DataChangeEventQueue.java b/server/server/data/src/main/java/com/alipay/sofa/registry/server/data/change/event/DataChangeEventQueue.java index 45e5cffab..ae996d04f 100644 --- a/server/server/data/src/main/java/com/alipay/sofa/registry/server/data/change/event/DataChangeEventQueue.java +++ b/server/server/data/src/main/java/com/alipay/sofa/registry/server/data/change/event/DataChangeEventQueue.java @@ -16,6 +16,7 @@ */ package com.alipay.sofa.registry.server.data.change.event; +import com.alipay.sofa.registry.common.model.PublishType; import com.alipay.sofa.registry.common.model.dataserver.Datum; import com.alipay.sofa.registry.common.model.store.Publisher; import com.alipay.sofa.registry.log.Logger; @@ -72,6 +73,8 @@ public class DataChangeEventQueue { private final int notifyIntervalMs; + private final int notifyTempDataIntervalMs; + private final ReentrantLock lock = new ReentrantLock(); private DataServerConfig dataServerConfig; @@ -92,6 +95,7 @@ public DataChangeEventQueue(int idx, DataServerConfig dataServerConfig) { eventQueue = new LinkedBlockingDeque<>(queueSize); } this.notifyIntervalMs = dataServerConfig.getNotifyIntervalMs(); + this.notifyTempDataIntervalMs = dataServerConfig.getNotifyTempDataIntervalMs(); } /** @@ -121,7 +125,9 @@ public ChangeData take() throws InterruptedException { lock.lock(); try { Datum datum = changeData.getDatum(); - CHANGE_DATA_MAP.get(datum.getDataCenter()).remove(datum.getDataInfoId()); + if (changeData.getSourceType() != DataSourceTypeEnum.PUB_TEMP) { + CHANGE_DATA_MAP.get(datum.getDataCenter()).remove(datum.getDataInfoId()); + } return changeData; } finally { lock.unlock(); @@ -174,8 +180,15 @@ public void start() { DataChangeScopeEnum scope = event.getScope(); if (scope == DataChangeScopeEnum.DATUM) { DataChangeEvent dataChangeEvent = (DataChangeEvent) event; - handleDatum(dataChangeEvent.getChangeType(), - dataChangeEvent.getSourceType(), dataChangeEvent.getDatum()); + //Temporary push data will be notify as soon as,and not merge to normal pub data; + if (dataChangeEvent.getSourceType() == DataSourceTypeEnum.PUB_TEMP){ + addTempChangeData(dataChangeEvent.getDatum(),dataChangeEvent.getChangeType(), + dataChangeEvent.getSourceType()); + } + else { + handleDatum(dataChangeEvent.getChangeType(), + dataChangeEvent.getSourceType(), dataChangeEvent.getDatum()); + } } else if (scope == DataChangeScopeEnum.CLIENT) { handleHost((ClientChangeEvent) event); } @@ -255,4 +268,12 @@ private void handleDatum(DataChangeTypeEnum changeType, DataSourceTypeEnum sourc lock.unlock(); } } + + private void addTempChangeData(Datum targetDatum, DataChangeTypeEnum changeType, + DataSourceTypeEnum sourceType) { + + ChangeData tempChangeData = new ChangeData(targetDatum, this.notifyTempDataIntervalMs, + sourceType, changeType); + CHANGE_QUEUE.put(tempChangeData); + } } \ No newline at end of file diff --git a/server/server/data/src/main/resources/application.properties b/server/server/data/src/main/resources/application.properties index 77c9484d3..6a28ef486 100644 --- a/server/server/data/src/main/resources/application.properties +++ b/server/server/data/src/main/resources/application.properties @@ -10,6 +10,7 @@ data.server.httpServerPort=9622 data.server.queueCount=4 data.server.queueSize=10240 data.server.notifyIntervalMs=500 +data.server.notifyTempDataIntervalMs=10 data.server.rpcTimeout=3000 data.server.metaServerPort=9611 data.server.storeNodes=3 diff --git a/server/server/session/src/main/java/com/alipay/sofa/registry/server/session/scheduler/task/DataChangeFetchCloudTask.java b/server/server/session/src/main/java/com/alipay/sofa/registry/server/session/scheduler/task/DataChangeFetchCloudTask.java index d6a423adc..a149fe500 100644 --- a/server/server/session/src/main/java/com/alipay/sofa/registry/server/session/scheduler/task/DataChangeFetchCloudTask.java +++ b/server/server/session/src/main/java/com/alipay/sofa/registry/server/session/scheduler/task/DataChangeFetchCloudTask.java @@ -239,6 +239,7 @@ private void fireReceiveDataPushTask(Map datums, Map subscriberMap, PushTaskClosure pushTaskClosure) { Collection subscribers = new ArrayList<>(subscriberMap.values()); + LOGGER.info("Datums push={}", datums); ReceivedData receivedData = ReceivedDataConverter.getReceivedDataMulti(datums, scopeEnum, subscriberRegisterIdList, subscriber); @@ -248,8 +249,8 @@ private void fireReceiveDataPushTask(Map datums, TaskEvent taskEvent = new TaskEvent(parameter, TaskType.RECEIVED_DATA_MULTI_PUSH_TASK); taskEvent.setTaskClosure(pushTaskClosure); taskEvent.setAttribute(Constant.PUSH_CLIENT_SUBSCRIBERS, subscribers); - taskLogger.info("send {} taskURL:{},taskScope:{}", taskEvent.getTaskType(), - subscriber.getSourceAddress(), scopeEnum); + taskLogger.info("send {} taskURL:{},taskScope:{},version:{}", taskEvent.getTaskType(), + subscriber.getSourceAddress(), scopeEnum, receivedData.getVersion()); taskListenerManager.sendTaskEvent(taskEvent); } diff --git a/server/server/session/src/main/java/com/alipay/sofa/registry/server/session/scheduler/task/DataPushTask.java b/server/server/session/src/main/java/com/alipay/sofa/registry/server/session/scheduler/task/DataPushTask.java index e372dc21c..52eb5bcfc 100644 --- a/server/server/session/src/main/java/com/alipay/sofa/registry/server/session/scheduler/task/DataPushTask.java +++ b/server/server/session/src/main/java/com/alipay/sofa/registry/server/session/scheduler/task/DataPushTask.java @@ -89,8 +89,6 @@ public void execute() { String dataInfoId = datum.getDataInfoId(); - PushTaskClosure pushTaskClosure = getTaskClosure(); - for (ScopeEnum scopeEnum : ScopeEnum.values()) { Map> map = getCache(scopeEnum, dataInfoId); @@ -113,11 +111,11 @@ public void execute() { if (ifLocalDataCenter) { if (isOldVersion) { fireUserDataElementPushTask(entry.getKey(), datum, - subscribersSend, pushTaskClosure); + subscribersSend); } else { fireReceivedDataMultiPushTask(datum, subscriberRegisterIdList, ScopeEnum.zone, - subscriber, pushTaskClosure, subscriberMap); + subscriber, subscriberMap); } } break; @@ -125,17 +123,17 @@ public void execute() { if (ifLocalDataCenter) { if (isOldVersion) { fireUserDataElementMultiPushTask(entry.getKey(), datum, - subscribersSend, pushTaskClosure); + subscribersSend); } else { fireReceivedDataMultiPushTask(datum, subscriberRegisterIdList, scopeEnum, subscriber, - pushTaskClosure, subscriberMap); + subscriberMap); } } break; case global: fireReceivedDataMultiPushTask(datum, subscriberRegisterIdList, - scopeEnum, subscriber, pushTaskClosure, subscriberMap); + scopeEnum, subscriber, subscriberMap); break; default: LOGGER.warn("unknown scope, {}", subscriber); @@ -144,38 +142,11 @@ public void execute() { } } } - pushTaskClosure.start(); } } - public PushTaskClosure getTaskClosure() { - PushTaskClosure pushTaskClosure = new PushTaskClosure(executorManager.getPushTaskClosureExecutor()); - pushTaskClosure.setTaskClosure((status, task) -> { - if (status == ProcessingResult.Success) { - Datum datum = dataPushRequest.getDatum(); - String dataCenter = datum.getDataCenter(); - String dataInfoId = datum.getDataInfoId(); - Long version = datum.getVersion(); - - if (sessionServerConfig.isStopPushSwitch()) { - LOGGER.info("Stop Push switch on,dataCenter {} dataInfoId {} version {} can not be update!", - dataCenter, dataInfoId, version); - return; - } - - LOGGER.info("Push all temp data tasks success,dataCenter:{} dataInfoId:{} version:{} update!", - dataCenter, dataInfoId, - version); - } else { - LOGGER.warn("Push temp data tasks found error,subscribers version can not be update!"); - } - }); - return pushTaskClosure; - } - private void fireReceivedDataMultiPushTask(Datum datum, List subscriberRegisterIdList, - ScopeEnum scopeEnum, Subscriber subscriber, - PushTaskClosure pushTaskClosure, Map subscriberMap) { + ScopeEnum scopeEnum, Subscriber subscriber, Map subscriberMap) { Collection subscribers = new ArrayList<>(subscriberMap.values()); String dataId = datum.getDataId(); Predicate zonePredicate = (zone) -> { @@ -194,6 +165,7 @@ private void fireReceivedDataMultiPushTask(Datum datum, List subscriberR } return false; }; + LOGGER.info("Datum push={}",datum); ReceivedData receivedData = ReceivedDataConverter.getReceivedDataMulti(datum, scopeEnum, subscriberRegisterIdList, sessionServerConfig.getSessionServerRegion(), zonePredicate); @@ -201,10 +173,9 @@ private void fireReceivedDataMultiPushTask(Datum datum, List subscriberR Map parameter = new HashMap<>(); parameter.put(receivedData, subscriber.getSourceAddress()); TaskEvent taskEvent = new TaskEvent(parameter, TaskType.RECEIVED_DATA_MULTI_PUSH_TASK); - taskEvent.setTaskClosure(pushTaskClosure); taskEvent.setAttribute(Constant.PUSH_CLIENT_SUBSCRIBERS, subscribers); - taskLogger.info("send {} taskURL:{},taskScope:{}", taskEvent.getTaskType(), subscriber.getSourceAddress(), - scopeEnum); + taskLogger.info("send {} taskURL:{},taskScope:{},version:{}", taskEvent.getTaskType(), subscriber.getSourceAddress(), + scopeEnum,receivedData.getVersion()); taskListenerManager.sendTaskEvent(taskEvent); } @@ -214,11 +185,9 @@ private Map> getCache(ScopeEnum scope } private void fireUserDataElementPushTask(InetSocketAddress address, Datum datum, - Collection subscribers, - PushTaskClosure pushTaskClosure) { + Collection subscribers) { TaskEvent taskEvent = new TaskEvent(TaskType.USER_DATA_ELEMENT_PUSH_TASK); - taskEvent.setTaskClosure(pushTaskClosure); taskEvent.setAttribute(Constant.PUSH_CLIENT_SUBSCRIBERS, subscribers); taskEvent.setAttribute(Constant.PUSH_CLIENT_DATUM, datum); @@ -233,11 +202,9 @@ private void fireUserDataElementPushTask(InetSocketAddress address, Datum datum, } private void fireUserDataElementMultiPushTask(InetSocketAddress address, Datum datum, - Collection subscribers, - PushTaskClosure pushTaskClosure) { + Collection subscribers) { TaskEvent taskEvent = new TaskEvent(TaskType.USER_DATA_ELEMENT_MULTI_PUSH_TASK); - taskEvent.setTaskClosure(pushTaskClosure); taskEvent.setAttribute(Constant.PUSH_CLIENT_SUBSCRIBERS, subscribers); taskEvent.setAttribute(Constant.PUSH_CLIENT_DATUM, datum); diff --git a/test/src/test/java/com/alipay/sofa/registry/test/BaseIntegrationTest.java b/test/src/test/java/com/alipay/sofa/registry/test/BaseIntegrationTest.java index 2693e7cff..079de2ad1 100644 --- a/test/src/test/java/com/alipay/sofa/registry/test/BaseIntegrationTest.java +++ b/test/src/test/java/com/alipay/sofa/registry/test/BaseIntegrationTest.java @@ -165,6 +165,8 @@ public class MySubscriberDataObserver implements SubscriberDataObserver { public void handleData(String dataId, UserData data) { BaseIntegrationTest.this.dataId = dataId; BaseIntegrationTest.this.userData = data; + System.out.println("MySubscriberDataObserver:" + + userData.getZoneData().get(LOCAL_REGION).size()); } } diff --git a/test/src/test/java/com/alipay/sofa/registry/test/pubsub/TempPublisherTest.java b/test/src/test/java/com/alipay/sofa/registry/test/pubsub/TempPublisherTest.java index 19628ec7f..a1dfbd736 100644 --- a/test/src/test/java/com/alipay/sofa/registry/test/pubsub/TempPublisherTest.java +++ b/test/src/test/java/com/alipay/sofa/registry/test/pubsub/TempPublisherTest.java @@ -17,6 +17,7 @@ package com.alipay.sofa.registry.test.pubsub; import com.alipay.sofa.registry.client.api.model.RegistryType; +import com.alipay.sofa.registry.client.api.registration.PublisherRegistration; import com.alipay.sofa.registry.client.api.registration.SubscriberRegistration; import com.alipay.sofa.registry.common.model.PublishType; import com.alipay.sofa.registry.common.model.ServerDataBox; @@ -93,4 +94,48 @@ public void doTest() throws Exception { assertEquals(0, userData.getZoneData().size()); registryClient1.unregister(dataId, DEFAULT_GROUP, RegistryType.SUBSCRIBER); } + + @Test + public void doTestPubAndTempPubSameTime() throws Exception { + String dataId = "test-same-time-pub&tempPub-" + System.currentTimeMillis(); + String value = "test same time publish"; + + SubscriberRegistration subReg = new SubscriberRegistration(dataId, + new MySubscriberDataObserver()); + subReg.setScopeEnum(ScopeEnum.zone); + registryClient1.register(subReg); + Thread.sleep(1000L); + + // publish data + PublisherRegistration registration = new PublisherRegistration(dataId); + registryClient1.register(registration, "test publish"); + + Thread.sleep(100L); + + // publish temp data + Publisher tempPublisher = new Publisher(); + tempPublisher.setPublishType(PublishType.TEMPORARY); + tempPublisher.setCell(LOCAL_REGION); + tempPublisher.setDataId(dataId); + tempPublisher.setGroup(DEFAULT_GROUP); + tempPublisher.setInstanceId(DEFAULT_INSTANCE_ID); + tempPublisher.setVersion(System.currentTimeMillis()); + tempPublisher.setRegisterTimestamp(System.currentTimeMillis()); + tempPublisher.setClientRegisterTimestamp(System.currentTimeMillis()); + tempPublisher.setRegisterId(UUID.randomUUID().toString()); + tempPublisher.setDataInfoId(DataInfo.toDataInfoId(dataId, DEFAULT_INSTANCE_ID, + DEFAULT_GROUP)); + List dataBoxData = new ArrayList(1); + dataBoxData.add(new ServerDataBox(object2bytes(value))); + tempPublisher.setDataList(dataBoxData); + sessionApplicationContext.getBean(DataNodeService.class).register(tempPublisher); + + Thread.sleep(1000L); + + assertEquals(1, userData.getZoneData().size()); + assertEquals(2, userData.getZoneData().get(LOCAL_REGION).size()); + + registryClient1.unregister(dataId, DEFAULT_GROUP, RegistryType.SUBSCRIBER); + registryClient1.unregister(dataId, DEFAULT_GROUP, RegistryType.PUBLISHER); + } } From ebce157f4e62e3fc9a53c240d1c028931a27c3b9 Mon Sep 17 00:00:00 2001 From: "shangyu.wh" Date: Fri, 12 Apr 2019 10:53:26 +0800 Subject: [PATCH 2/5] update version 5.2.1-SNAPSHOT --- client/all/pom.xml | 2 +- client/api/pom.xml | 2 +- client/impl/pom.xml | 2 +- client/log/pom.xml | 2 +- client/pom.xml | 2 +- core/pom.xml | 2 +- pom.xml | 2 +- server/common/model/pom.xml | 2 +- server/common/pom.xml | 2 +- server/common/util/pom.xml | 2 +- server/consistency/pom.xml | 2 +- server/distribution/data/pom.xml | 2 +- server/distribution/integration/pom.xml | 2 +- server/distribution/meta/pom.xml | 2 +- server/distribution/pom.xml | 2 +- server/distribution/session/pom.xml | 2 +- server/pom.xml | 2 +- server/remoting/api/pom.xml | 2 +- server/remoting/bolt/pom.xml | 2 +- server/remoting/http/pom.xml | 2 +- server/remoting/pom.xml | 2 +- server/server/data/pom.xml | 2 +- server/server/integration/pom.xml | 2 +- server/server/meta/pom.xml | 2 +- server/server/pom.xml | 2 +- server/server/session/pom.xml | 2 +- server/store/api/pom.xml | 2 +- server/store/jraft/pom.xml | 2 +- server/store/pom.xml | 2 +- test/pom.xml | 2 +- 30 files changed, 30 insertions(+), 30 deletions(-) diff --git a/client/all/pom.xml b/client/all/pom.xml index 9f2ff4faa..a4f06ded3 100644 --- a/client/all/pom.xml +++ b/client/all/pom.xml @@ -6,7 +6,7 @@ com.alipay.sofa registry-client-all - 5.2.0 + 5.2.1-SNAPSHOT ${project.groupId}:${project.artifactId} http://github.com/alipay/sofa-registry diff --git a/client/api/pom.xml b/client/api/pom.xml index ae29a4493..04292d197 100644 --- a/client/api/pom.xml +++ b/client/api/pom.xml @@ -5,7 +5,7 @@ com.alipay.sofa registry-client-parent - 5.2.0 + 5.2.1-SNAPSHOT ../pom.xml 4.0.0 diff --git a/client/impl/pom.xml b/client/impl/pom.xml index 873ec62a6..b4179ca3d 100644 --- a/client/impl/pom.xml +++ b/client/impl/pom.xml @@ -5,7 +5,7 @@ com.alipay.sofa registry-client-parent - 5.2.0 + 5.2.1-SNAPSHOT ../pom.xml 4.0.0 diff --git a/client/log/pom.xml b/client/log/pom.xml index 1d94e9b76..9059c5354 100644 --- a/client/log/pom.xml +++ b/client/log/pom.xml @@ -5,7 +5,7 @@ com.alipay.sofa registry-client-parent - 5.2.0 + 5.2.1-SNAPSHOT ../pom.xml 4.0.0 diff --git a/client/pom.xml b/client/pom.xml index f753f37eb..a717d1f38 100644 --- a/client/pom.xml +++ b/client/pom.xml @@ -7,7 +7,7 @@ com.alipay.sofa registry-parent - 5.2.0 + 5.2.1-SNAPSHOT ../pom.xml diff --git a/core/pom.xml b/core/pom.xml index 9eea6264e..53b8c83d2 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -5,7 +5,7 @@ com.alipay.sofa registry-parent - 5.2.0 + 5.2.1-SNAPSHOT ../pom.xml 4.0.0 diff --git a/pom.xml b/pom.xml index a030f6367..2822dd6c9 100644 --- a/pom.xml +++ b/pom.xml @@ -6,7 +6,7 @@ com.alipay.sofa registry-parent - 5.2.0 + 5.2.1-SNAPSHOT pom ${project.groupId}:${project.artifactId} diff --git a/server/common/model/pom.xml b/server/common/model/pom.xml index d459c1328..534a888df 100644 --- a/server/common/model/pom.xml +++ b/server/common/model/pom.xml @@ -5,7 +5,7 @@ com.alipay.sofa registry-common - 5.2.0 + 5.2.1-SNAPSHOT ../pom.xml 4.0.0 diff --git a/server/common/pom.xml b/server/common/pom.xml index cdc1aef3a..23e48515d 100644 --- a/server/common/pom.xml +++ b/server/common/pom.xml @@ -5,7 +5,7 @@ com.alipay.sofa registry-server-parent - 5.2.0 + 5.2.1-SNAPSHOT ../pom.xml 4.0.0 diff --git a/server/common/util/pom.xml b/server/common/util/pom.xml index 500d96ade..bc5bae85f 100644 --- a/server/common/util/pom.xml +++ b/server/common/util/pom.xml @@ -5,7 +5,7 @@ com.alipay.sofa registry-common - 5.2.0 + 5.2.1-SNAPSHOT ../pom.xml 4.0.0 diff --git a/server/consistency/pom.xml b/server/consistency/pom.xml index 16e893a89..74f34ed4f 100644 --- a/server/consistency/pom.xml +++ b/server/consistency/pom.xml @@ -5,7 +5,7 @@ com.alipay.sofa registry-server-parent - 5.2.0 + 5.2.1-SNAPSHOT ../pom.xml 4.0.0 diff --git a/server/distribution/data/pom.xml b/server/distribution/data/pom.xml index 0f3058ae7..7a0bcf99f 100644 --- a/server/distribution/data/pom.xml +++ b/server/distribution/data/pom.xml @@ -5,7 +5,7 @@ com.alipay.sofa registry-distribution - 5.2.0 + 5.2.1-SNAPSHOT ../pom.xml 4.0.0 diff --git a/server/distribution/integration/pom.xml b/server/distribution/integration/pom.xml index c994c31c2..acc7bd614 100644 --- a/server/distribution/integration/pom.xml +++ b/server/distribution/integration/pom.xml @@ -5,7 +5,7 @@ com.alipay.sofa registry-distribution - 5.2.0 + 5.2.1-SNAPSHOT ../pom.xml 4.0.0 diff --git a/server/distribution/meta/pom.xml b/server/distribution/meta/pom.xml index 29c2f346d..7eb2cb232 100644 --- a/server/distribution/meta/pom.xml +++ b/server/distribution/meta/pom.xml @@ -5,7 +5,7 @@ com.alipay.sofa registry-distribution - 5.2.0 + 5.2.1-SNAPSHOT ../pom.xml 4.0.0 diff --git a/server/distribution/pom.xml b/server/distribution/pom.xml index eb832bd67..d86e17598 100644 --- a/server/distribution/pom.xml +++ b/server/distribution/pom.xml @@ -6,7 +6,7 @@ com.alipay.sofa registry-server-parent - 5.2.0 + 5.2.1-SNAPSHOT ../pom.xml 4.0.0 diff --git a/server/distribution/session/pom.xml b/server/distribution/session/pom.xml index bbd4f1459..afb87cdd1 100644 --- a/server/distribution/session/pom.xml +++ b/server/distribution/session/pom.xml @@ -5,7 +5,7 @@ com.alipay.sofa registry-distribution - 5.2.0 + 5.2.1-SNAPSHOT ../pom.xml 4.0.0 diff --git a/server/pom.xml b/server/pom.xml index 23292aa40..b82e3c0dd 100644 --- a/server/pom.xml +++ b/server/pom.xml @@ -7,7 +7,7 @@ com.alipay.sofa registry-parent - 5.2.0 + 5.2.1-SNAPSHOT ../pom.xml diff --git a/server/remoting/api/pom.xml b/server/remoting/api/pom.xml index 8280a7f94..bc3fef23a 100644 --- a/server/remoting/api/pom.xml +++ b/server/remoting/api/pom.xml @@ -5,7 +5,7 @@ com.alipay.sofa registry-remoting - 5.2.0 + 5.2.1-SNAPSHOT ../pom.xml 4.0.0 diff --git a/server/remoting/bolt/pom.xml b/server/remoting/bolt/pom.xml index 64004ee22..0298c7669 100644 --- a/server/remoting/bolt/pom.xml +++ b/server/remoting/bolt/pom.xml @@ -5,7 +5,7 @@ com.alipay.sofa registry-remoting - 5.2.0 + 5.2.1-SNAPSHOT ../pom.xml 4.0.0 diff --git a/server/remoting/http/pom.xml b/server/remoting/http/pom.xml index 0df19fd39..e58a1ed56 100644 --- a/server/remoting/http/pom.xml +++ b/server/remoting/http/pom.xml @@ -5,7 +5,7 @@ com.alipay.sofa registry-remoting - 5.2.0 + 5.2.1-SNAPSHOT ../pom.xml 4.0.0 diff --git a/server/remoting/pom.xml b/server/remoting/pom.xml index 54767f4db..ad33907d6 100644 --- a/server/remoting/pom.xml +++ b/server/remoting/pom.xml @@ -5,7 +5,7 @@ com.alipay.sofa registry-server-parent - 5.2.0 + 5.2.1-SNAPSHOT ../pom.xml 4.0.0 diff --git a/server/server/data/pom.xml b/server/server/data/pom.xml index 6e52e0ebd..6860a8ab6 100644 --- a/server/server/data/pom.xml +++ b/server/server/data/pom.xml @@ -5,7 +5,7 @@ com.alipay.sofa registry-server - 5.2.0 + 5.2.1-SNAPSHOT ../pom.xml 4.0.0 diff --git a/server/server/integration/pom.xml b/server/server/integration/pom.xml index c4e0e45e8..1a6b754ab 100644 --- a/server/server/integration/pom.xml +++ b/server/server/integration/pom.xml @@ -5,7 +5,7 @@ com.alipay.sofa registry-server - 5.2.0 + 5.2.1-SNAPSHOT ../pom.xml 4.0.0 diff --git a/server/server/meta/pom.xml b/server/server/meta/pom.xml index 25bd602aa..aa668a070 100644 --- a/server/server/meta/pom.xml +++ b/server/server/meta/pom.xml @@ -5,7 +5,7 @@ com.alipay.sofa registry-server - 5.2.0 + 5.2.1-SNAPSHOT ../pom.xml 4.0.0 diff --git a/server/server/pom.xml b/server/server/pom.xml index a88ad57f0..315e167ae 100644 --- a/server/server/pom.xml +++ b/server/server/pom.xml @@ -5,7 +5,7 @@ com.alipay.sofa registry-server-parent - 5.2.0 + 5.2.1-SNAPSHOT ../pom.xml 4.0.0 diff --git a/server/server/session/pom.xml b/server/server/session/pom.xml index 49c4f1832..4762a1c9c 100644 --- a/server/server/session/pom.xml +++ b/server/server/session/pom.xml @@ -5,7 +5,7 @@ com.alipay.sofa registry-server - 5.2.0 + 5.2.1-SNAPSHOT ../pom.xml 4.0.0 diff --git a/server/store/api/pom.xml b/server/store/api/pom.xml index a266b9971..df0b06621 100644 --- a/server/store/api/pom.xml +++ b/server/store/api/pom.xml @@ -5,7 +5,7 @@ com.alipay.sofa registry-store - 5.2.0 + 5.2.1-SNAPSHOT ../pom.xml 4.0.0 diff --git a/server/store/jraft/pom.xml b/server/store/jraft/pom.xml index f02d8c6b2..eb7356bbd 100644 --- a/server/store/jraft/pom.xml +++ b/server/store/jraft/pom.xml @@ -6,7 +6,7 @@ com.alipay.sofa registry-store - 5.2.0 + 5.2.1-SNAPSHOT ../pom.xml diff --git a/server/store/pom.xml b/server/store/pom.xml index 190977b79..0381e92a1 100644 --- a/server/store/pom.xml +++ b/server/store/pom.xml @@ -5,7 +5,7 @@ com.alipay.sofa registry-server-parent - 5.2.0 + 5.2.1-SNAPSHOT ../pom.xml 4.0.0 diff --git a/test/pom.xml b/test/pom.xml index c30264625..c81b32c84 100644 --- a/test/pom.xml +++ b/test/pom.xml @@ -5,7 +5,7 @@ com.alipay.sofa registry-parent - 5.2.0 + 5.2.1-SNAPSHOT ../pom.xml 4.0.0 From 5241284f7e0efa7b0e4870fd67b187d03af97bff Mon Sep 17 00:00:00 2001 From: "shangyu.wh" Date: Wed, 24 Apr 2019 17:28:43 +0800 Subject: [PATCH 3/5] fix test case --- .../com/alipay/sofa/registry/test/pubsub/TempPublisherTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/src/test/java/com/alipay/sofa/registry/test/pubsub/TempPublisherTest.java b/test/src/test/java/com/alipay/sofa/registry/test/pubsub/TempPublisherTest.java index 1f1787b5c..96d1f9bd1 100644 --- a/test/src/test/java/com/alipay/sofa/registry/test/pubsub/TempPublisherTest.java +++ b/test/src/test/java/com/alipay/sofa/registry/test/pubsub/TempPublisherTest.java @@ -108,7 +108,7 @@ public void doTestPubAndTempPubSameTime() throws Exception { PublisherRegistration registration = new PublisherRegistration(dataId); registryClient1.register(registration, "test publish"); - Thread.sleep(100L); + Thread.sleep(1000L); // publish temp data Publisher tempPublisher = new Publisher(); From 69d18e325fec19c0afcec2d3ea19dd1daac5d1a2 Mon Sep 17 00:00:00 2001 From: "shangyu.wh" Date: Mon, 29 Apr 2019 13:11:51 +0800 Subject: [PATCH 4/5] fix jetty version,and fix rest api for dataInfoIds --- pom.xml | 2 +- .../server/session/resource/SessionDigestResource.java | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/pom.xml b/pom.xml index 2822dd6c9..1b15dc405 100644 --- a/pom.xml +++ b/pom.xml @@ -78,7 +78,7 @@ 1.2.4 4.0.2 2.4 - 9.4.12.v20180830 + [9.4.17.v20190418,) ${user.dir} -Dnetwork_interface_denylist=docker0 diff --git a/server/server/session/src/main/java/com/alipay/sofa/registry/server/session/resource/SessionDigestResource.java b/server/server/session/src/main/java/com/alipay/sofa/registry/server/session/resource/SessionDigestResource.java index 74f25329b..46d408b4f 100644 --- a/server/server/session/src/main/java/com/alipay/sofa/registry/server/session/resource/SessionDigestResource.java +++ b/server/server/session/src/main/java/com/alipay/sofa/registry/server/session/resource/SessionDigestResource.java @@ -37,6 +37,7 @@ import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; +import java.util.HashSet; import java.util.List; import java.util.Map; @@ -146,18 +147,17 @@ public Map getPushSwitch() { @Path("getDataInfoIdList") @Produces(MediaType.APPLICATION_JSON) public Collection getDataInfoIdList() { - Collection ret = new ArrayList<>(); + Collection ret = new HashSet<>(); ret.addAll(sessionInterests.getInterestDataInfoIds()); ret.addAll(sessionDataStore.getStoreDataInfoIds()); - return sessionInterests.getInterestDataInfoIds(); + return ret; } @GET @Path("checkSumDataInfoIdList") @Produces(MediaType.APPLICATION_JSON) public int checkSumDataInfoIdList() { - return sessionInterests.getInterestDataInfoIds().hashCode() - + sessionDataStore.getStoreDataInfoIds().hashCode(); + return getDataInfoIdList().hashCode(); } private void fillServerList(String type, From 2bd6ee524167ea61c7c7e89c296a1b8a31705533 Mon Sep 17 00:00:00 2001 From: "shangyu.wh" Date: Mon, 29 Apr 2019 14:39:47 +0800 Subject: [PATCH 5/5] fix hashcode test --- .../test/resource/session/SessionDigestResourceTest.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/src/test/java/com/alipay/sofa/registry/test/resource/session/SessionDigestResourceTest.java b/test/src/test/java/com/alipay/sofa/registry/test/resource/session/SessionDigestResourceTest.java index 96b1c144f..2c0b7f28c 100644 --- a/test/src/test/java/com/alipay/sofa/registry/test/resource/session/SessionDigestResourceTest.java +++ b/test/src/test/java/com/alipay/sofa/registry/test/resource/session/SessionDigestResourceTest.java @@ -183,6 +183,6 @@ public void testGetDataInfoIdList() { public void testCheckSumDataInfoIdList() { int result = sessionChannel.getWebTarget().path("digest/checkSumDataInfoIdList") .request(APPLICATION_JSON).get(int.class); - assertTrue(result > 0); + assertTrue(result != 0); } }