Skip to content

Commit

Permalink
Merge pull request #213 from nacos-group/develop
Browse files Browse the repository at this point in the history
0.4.4
  • Loading branch information
paderlol committed Feb 25, 2021
2 parents 8188868 + 0c1f7de commit 144d5f7
Show file tree
Hide file tree
Showing 7 changed files with 22 additions and 21 deletions.
2 changes: 1 addition & 1 deletion nacossync-console/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<parent>
<artifactId>nacossync-parent</artifactId>
<groupId>com.alibaba.nacossync</groupId>
<version>0.4.3</version>
<version>0.4.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion nacossync-distribution/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<artifactId>nacossync-parent</artifactId>
<groupId>com.alibaba.nacossync</groupId>
<version>0.4.3</version>
<version>0.4.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<packaging>pom</packaging>
Expand Down
4 changes: 2 additions & 2 deletions nacossync-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
<parent>
<artifactId>nacossync-parent</artifactId>
<groupId>com.alibaba.nacossync</groupId>
<version>0.4.3</version>
<version>0.4.4</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand All @@ -39,7 +39,7 @@
<dependency>
<groupId>com.alibaba.nacossync</groupId>
<artifactId>nacossync-worker</artifactId>
<version>0.4.3</version>
<version>0.4.4</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
Expand Down
4 changes: 2 additions & 2 deletions nacossync-worker/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@
<parent>
<artifactId>nacossync-parent</artifactId>
<groupId>com.alibaba.nacossync</groupId>
<version>0.4.3</version>
<version>0.4.4</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>nacossync-worker</artifactId>
<version>0.4.3</version>
<version>0.4.4</version>
<properties>
<zookeeper.version>3.4.9</zookeeper.version>
<curator.version>4.1.0</curator.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,26 +103,27 @@ public boolean sync(TaskDO taskDO) {

List<Instance> sourceInstances = sourceNamingService.getAllInstances(taskDO.getServiceName(),
new ArrayList<>(), false);
log.info("任务Id:{},迁入实例数量:{}", taskId, sourceInstances.size());
// 先删除不存在的
this.removeInvalidInstance(taskDO, taskId, destNamingService, sourceInstances);

Set<String> latestSyncInstance = new TreeSet<>();
//再次添加新实例
Set<String> instanceKeys = sourceInstanceSnapshot.get(taskId);
for (Instance instance : sourceInstances) {
if (needSync(instance.getMetadata())) {
destNamingService.registerInstance(taskDO.getServiceName(),
buildSyncInstance(instance, taskDO));
this.sourceInstanceSnapshot.compute(taskId, (key, value) -> {
if (CollectionUtils.isEmpty(value)) {
value = new TreeSet<>();
}
log.info("任务Id:{},已同步实例:{}", taskId, composeInstanceKey(instance));
value.add(composeInstanceKey(instance));
return value;
});
String instanceKey = composeInstanceKey(instance);
if (CollectionUtils.isEmpty(instanceKeys) || !instanceKeys.contains(instanceKey)) {
destNamingService.registerInstance(taskDO.getServiceName(),
buildSyncInstance(instance, taskDO));
}
latestSyncInstance.add(instanceKey);

}
}
if (CollectionUtils.isNotEmpty(latestSyncInstance)) {

log.info("任务Id:{},已同步实例个数:{}", taskId, latestSyncInstance.size());
sourceInstanceSnapshot.put(taskId, latestSyncInstance);
}
} catch (Exception e) {
log.error("event process fail, taskId:{}", taskId, e);
metricsManager.recordError(MetricsStatisticsType.SYNC_ERROR);
Expand Down
4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@

<groupId>com.alibaba.nacossync</groupId>
<artifactId>nacossync-parent</artifactId>
<version>0.4.3</version>
<version>0.4.4</version>
<modules>
<module>nacossync-console</module>
<module>nacossync-worker</module>
Expand Down Expand Up @@ -73,7 +73,7 @@
<dependency>
<groupId>com.alibaba.nacossync</groupId>
<artifactId>nacossync-worker</artifactId>
<version>0.4.3</version>
<version>0.4.4</version>
</dependency>
</dependencies>
</dependencyManagement>
Expand Down

0 comments on commit 144d5f7

Please sign in to comment.