From 7115834a98e60b30800faae9f5980c4166bb0e89 Mon Sep 17 00:00:00 2001 From: nkorange Date: Mon, 10 Dec 2018 19:52:58 +0800 Subject: [PATCH 1/5] #421 Fixed --- .../alibaba/nacos/api/naming/pojo/ServiceInfo.java | 11 +++++++++++ .../nacos/client/naming/cache/DiskCache.java | 11 ++++++++--- .../com/alibaba/nacos/naming/raft/RaftStore.java | 14 +++++++++++--- 3 files changed, 30 insertions(+), 6 deletions(-) diff --git a/api/src/main/java/com/alibaba/nacos/api/naming/pojo/ServiceInfo.java b/api/src/main/java/com/alibaba/nacos/api/naming/pojo/ServiceInfo.java index 0bdb4a14b..b5dba2501 100644 --- a/api/src/main/java/com/alibaba/nacos/api/naming/pojo/ServiceInfo.java +++ b/api/src/main/java/com/alibaba/nacos/api/naming/pojo/ServiceInfo.java @@ -17,6 +17,8 @@ package com.alibaba.nacos.api.naming.pojo; import com.alibaba.fastjson.annotation.JSONField; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; import java.util.ArrayList; import java.util.Collection; import java.util.List; @@ -191,6 +193,15 @@ public class ServiceInfo { return getKey(name, clusters, env, isAllIPs()); } + @JSONField(serialize = false) + public String getKeyEncoded() { + try { + return getKey(URLEncoder.encode(name, "UTF-8"), clusters, env, isAllIPs()); + } catch (UnsupportedEncodingException e) { + return getKey(); + } + } + @JSONField(serialize = false) public static String getKey(String name, String clusters, String unit) { return getKey(name, clusters, unit, false); diff --git a/client/src/main/java/com/alibaba/nacos/client/naming/cache/DiskCache.java b/client/src/main/java/com/alibaba/nacos/client/naming/cache/DiskCache.java index 2de1b2834..396eb86f6 100644 --- a/client/src/main/java/com/alibaba/nacos/client/naming/cache/DiskCache.java +++ b/client/src/main/java/com/alibaba/nacos/client/naming/cache/DiskCache.java @@ -25,6 +25,7 @@ import com.alibaba.nacos.client.naming.utils.StringUtils; import java.io.BufferedReader; import java.io.File; import java.io.StringReader; +import java.net.URLDecoder; import java.nio.charset.Charset; import java.util.ArrayList; import java.util.HashMap; @@ -41,7 +42,9 @@ public class DiskCache { try { makeSureCacheDirExists(dir); - File file = new File(dir, dom.getKey()); + + + File file = new File(dir, dom.getKeyEncoded()); if (!file.exists()) { // add another !file.exists() to avoid conflicted creating-new-file from multi-instances if (!file.createNewFile() && !file.exists()) { @@ -87,9 +90,11 @@ public class DiskCache { continue; } - if (!(file.getName().endsWith(ServiceInfo.SPLITER + "meta") || file.getName().endsWith( + String fileName = URLDecoder.decode(file.getName(), "UTF-8"); + + if (!(fileName.endsWith(ServiceInfo.SPLITER + "meta") || fileName.endsWith( ServiceInfo.SPLITER + "special-url"))) { - ServiceInfo dom = new ServiceInfo(file.getName()); + ServiceInfo dom = new ServiceInfo(fileName); List ips = new ArrayList(); dom.setHosts(ips); diff --git a/naming/src/main/java/com/alibaba/nacos/naming/raft/RaftStore.java b/naming/src/main/java/com/alibaba/nacos/naming/raft/RaftStore.java index 0a4b3e716..d4e518403 100644 --- a/naming/src/main/java/com/alibaba/nacos/naming/raft/RaftStore.java +++ b/naming/src/main/java/com/alibaba/nacos/naming/raft/RaftStore.java @@ -107,7 +107,7 @@ public class RaftStore { Loggers.RAFT.warn("warning: encountered directory in cache dir: " + cache.getAbsolutePath()); } - if (!StringUtils.equals(cache.getName(), key)) { + if (!StringUtils.equals(decodeFileName(cache.getName()), key)) { continue; } @@ -139,7 +139,7 @@ public class RaftStore { } public synchronized static void write(final Datum datum) throws Exception { - File cacheFile = new File(CACHE_DIR + File.separator + datum.key); + File cacheFile = new File(CACHE_DIR + File.separator + encodeFileName(datum.key)); if (!cacheFile.exists() && !cacheFile.getParentFile().mkdirs() && !cacheFile.createNewFile()) { throw new IllegalStateException("can not make cache file: " + cacheFile.getName()); } @@ -169,7 +169,7 @@ public class RaftStore { } public static void delete(Datum datum) { - File cacheFile = new File(CACHE_DIR + File.separator + datum.key); + File cacheFile = new File(CACHE_DIR + File.separator + encodeFileName(datum.key)); if (!cacheFile.delete()) { Loggers.RAFT.error("RAFT-DELETE", "failed to delete datum: " + datum.key + ", value: " + datum.value); throw new IllegalStateException("failed to delete datum: " + datum.key); @@ -188,4 +188,12 @@ public class RaftStore { meta.store(outStream, null); } } + + private static String encodeFileName(String fileName) { + return fileName.replace(':', '#'); + } + + private static String decodeFileName(String fileName) { + return fileName.replace("#", ":"); + } } From 1b3c5fb4baaddde68ecec1ce9d562a599f52291a Mon Sep 17 00:00:00 2001 From: nkorange Date: Tue, 11 Dec 2018 16:34:43 +0800 Subject: [PATCH 2/5] Prepare for 0.6.1 --- CHANGELOG.md | 5 +++++ README.md | 4 ++-- api/pom.xml | 2 +- client/pom.xml | 2 +- common/pom.xml | 2 +- config/pom.xml | 2 +- console/pom.xml | 2 +- .../resources/static/console-fe/src/i18ndoc.js | 4 ++-- .../static/console-fe/src/locales/en-US.js | 2 +- .../static/console-fe/src/locales/zh-CN.js | 2 +- core/pom.xml | 2 +- distribution/pom.xml | 2 +- example/pom.xml | 2 +- naming/pom.xml | 2 +- pom.xml | 15 +++++++++++++-- test/pom.xml | 2 +- 16 files changed, 34 insertions(+), 18 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index ca639f871..7cb1f3d56 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +## 0.6.1(Dec, 2018) + +[#421] NamingService's serivce name can't use colon(:) in Windows +[#432] When packing nacos-core, ${user.home} is replaced in the logback configuration file (nacos.xml) + ## 0.6.0(Dec, 2018) [#388] Cluster name should be provided in the Instance diff --git a/README.md b/README.md index a91e959a9..8b4c18b15 100644 --- a/README.md +++ b/README.md @@ -40,9 +40,9 @@ It is super easy to get started with your first project. You can download the package from the [latest stable release](https://github.com/alibaba/nacos/releases). -Take release nacos-server-0.6.0.zip for example. +Take release nacos-server-0.6.1.zip for example. ``` -unzip nacos-server-0.6.0.zip +unzip nacos-server-0.6.1.zip cd nacos/bin ``` diff --git a/api/pom.xml b/api/pom.xml index 9756bb165..65c8031be 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -16,7 +16,7 @@ com.alibaba.nacos nacos-all - 0.6.0 + 0.6.1-SNAPSHOT 4.0.0 diff --git a/client/pom.xml b/client/pom.xml index 53b1959cd..d1a0bd002 100644 --- a/client/pom.xml +++ b/client/pom.xml @@ -16,7 +16,7 @@ com.alibaba.nacos nacos-all - 0.6.0 + 0.6.1-SNAPSHOT ../pom.xml diff --git a/common/pom.xml b/common/pom.xml index 7cdf938d9..e226b37c8 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -18,7 +18,7 @@ com.alibaba.nacos nacos-all - 0.6.0 + 0.6.1-SNAPSHOT ../pom.xml 4.0.0 diff --git a/config/pom.xml b/config/pom.xml index 44a5f1318..9ae6e39de 100644 --- a/config/pom.xml +++ b/config/pom.xml @@ -17,7 +17,7 @@ com.alibaba.nacos nacos-all - 0.6.0 + 0.6.1-SNAPSHOT 4.0.0 diff --git a/console/pom.xml b/console/pom.xml index a9be88585..cd58f3485 100644 --- a/console/pom.xml +++ b/console/pom.xml @@ -18,7 +18,7 @@ com.alibaba.nacos nacos-all - 0.6.0 + 0.6.1-SNAPSHOT nacos-console diff --git a/console/src/main/resources/static/console-fe/src/i18ndoc.js b/console/src/main/resources/static/console-fe/src/i18ndoc.js index 8c20956c4..ae005fc76 100644 --- a/console/src/main/resources/static/console-fe/src/i18ndoc.js +++ b/console/src/main/resources/static/console-fe/src/i18ndoc.js @@ -12,7 +12,7 @@ */ module.exports = { 'zh-cn': { - 'com.alibaba.nacos.layout.noenv.nacosversion': '0.6.0', + 'com.alibaba.nacos.layout.noenv.nacosversion': '0.6.1', 'com.alibaba.nacos.page.configurationManagementVirtual': '配置管理', 'com.alibaba.nacos.page.serviceManagementVirtual': '服务管理', 'nacos.component.ExportDialog.tags2': '标签:', @@ -574,7 +574,7 @@ module.exports = { 'nacos.page.ConfigEditor.submit_failed': '不能为空, 提交失败', }, 'en-us': { - 'com.alibaba.nacos.layout.noenv.nacosversion': '0.6.0', + 'com.alibaba.nacos.layout.noenv.nacosversion': '0.6.1', 'com.alibaba.nacos.page.configurationManagementVirtual': 'ConfigManagement', 'com.alibaba.nacos.page.serviceManagementVirtual': 'ServiceManagement', 'nacos.component.CloneDialog.the_same_configuration': 'Conflict:', diff --git a/console/src/main/resources/static/console-fe/src/locales/en-US.js b/console/src/main/resources/static/console-fe/src/locales/en-US.js index cbc45afe5..c63f7d7b9 100644 --- a/console/src/main/resources/static/console-fe/src/locales/en-US.js +++ b/console/src/main/resources/static/console-fe/src/locales/en-US.js @@ -21,7 +21,7 @@ const I18N_CONF = { }, MainLayout: { nacosName: 'NACOS', - nacosVersion: '0.6.0', + nacosVersion: '0.6.1', doesNotExist: 'The page you visit does not exist', configurationManagementVirtual: 'ConfigManagement', configurationManagement: 'Configurations', diff --git a/console/src/main/resources/static/console-fe/src/locales/zh-CN.js b/console/src/main/resources/static/console-fe/src/locales/zh-CN.js index bca7b585a..00b1216b0 100644 --- a/console/src/main/resources/static/console-fe/src/locales/zh-CN.js +++ b/console/src/main/resources/static/console-fe/src/locales/zh-CN.js @@ -21,7 +21,7 @@ const I18N_CONF = { }, MainLayout: { nacosName: 'NACOS', - nacosVersion: '0.6.0', + nacosVersion: '0.6.1', doesNotExist: '您访问的页面不存在', configurationManagementVirtual: '配置管理', configurationManagement: '配置列表', diff --git a/core/pom.xml b/core/pom.xml index 1c506063a..ca0edb1f3 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -18,7 +18,7 @@ com.alibaba.nacos nacos-all - 0.6.0 + 0.6.1-SNAPSHOT ../pom.xml diff --git a/distribution/pom.xml b/distribution/pom.xml index bef1c2c43..5577e6074 100644 --- a/distribution/pom.xml +++ b/distribution/pom.xml @@ -18,7 +18,7 @@ com.alibaba.nacos nacos-all - 0.6.0 + 0.6.1-SNAPSHOT ../pom.xml diff --git a/example/pom.xml b/example/pom.xml index 65e11a166..597c38a19 100644 --- a/example/pom.xml +++ b/example/pom.xml @@ -18,7 +18,7 @@ com.alibaba.nacos nacos-all - 0.6.0 + 0.6.1-SNAPSHOT ../pom.xml diff --git a/naming/pom.xml b/naming/pom.xml index 1d3137507..bcca6fc27 100644 --- a/naming/pom.xml +++ b/naming/pom.xml @@ -18,7 +18,7 @@ com.alibaba.nacos nacos-all - 0.6.0 + 0.6.1-SNAPSHOT ../pom.xml diff --git a/pom.xml b/pom.xml index 7f7603ba8..140c07fbe 100644 --- a/pom.xml +++ b/pom.xml @@ -21,7 +21,7 @@ 2018 com.alibaba.nacos nacos-all - 0.6.0 + 0.6.1-SNAPSHOT pom Alibaba NACOS ${project.version} @@ -36,7 +36,7 @@ git@github.com:alibaba/nacos.git scm:git@github.com:alibaba/nacos.git scm:git@github.com:alibaba/nacos.git - nacos-all-0.5.0 + nacos-all-0.6.1 @@ -726,5 +726,16 @@ + + + + releases + http://mvnrepo.alibaba-inc.com/mvn/releases + + + snapshots + http://mvnrepo.alibaba-inc.com/mvn/snapshots + + diff --git a/test/pom.xml b/test/pom.xml index 6913199b4..23acf981d 100644 --- a/test/pom.xml +++ b/test/pom.xml @@ -17,7 +17,7 @@ com.alibaba.nacos nacos-all - 0.6.0 + 0.6.1-SNAPSHOT ../pom.xml 4.0.0 From 0facefe9c3792104fb916fc5d65513d444344eee Mon Sep 17 00:00:00 2001 From: hxy1991 Date: Tue, 11 Dec 2018 16:44:26 +0800 Subject: [PATCH 3/5] Fixes #432 --- core/pom.xml | 9 --------- core/src/main/resources/banner.txt | 2 +- 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/core/pom.xml b/core/pom.xml index ca0edb1f3..22a1f29d9 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -64,13 +64,4 @@ - - - - - src/main/resources - true - - - diff --git a/core/src/main/resources/banner.txt b/core/src/main/resources/banner.txt index 7f33937ec..e00c23592 100644 --- a/core/src/main/resources/banner.txt +++ b/core/src/main/resources/banner.txt @@ -1,7 +1,7 @@ ,--. ,--.'| - ,--,: : | Nacos ${nacos.version} + ,--,: : | Nacos 0.6.0 ,`--.'`| ' : ,---. Running in ${nacos.mode} mode | : : | | ' ,'\ .--.--. Port: 8848 : | \ | : ,--.--. ,---. / / | / / ' Pid: ${pid} From a5e564dbe57e6a95a69d434b93917accf08694d3 Mon Sep 17 00:00:00 2001 From: nkorange Date: Tue, 11 Dec 2018 17:15:57 +0800 Subject: [PATCH 4/5] Update version to 0.6.1 --- api/pom.xml | 2 +- client/pom.xml | 2 +- common/pom.xml | 2 +- config/pom.xml | 2 +- console/pom.xml | 2 +- core/pom.xml | 2 +- core/src/main/resources/banner.txt | 2 +- distribution/pom.xml | 2 +- example/pom.xml | 2 +- naming/pom.xml | 2 +- pom.xml | 2 +- test/pom.xml | 2 +- 12 files changed, 12 insertions(+), 12 deletions(-) diff --git a/api/pom.xml b/api/pom.xml index 65c8031be..864b37c21 100644 --- a/api/pom.xml +++ b/api/pom.xml @@ -16,7 +16,7 @@ com.alibaba.nacos nacos-all - 0.6.1-SNAPSHOT + 0.6.1 4.0.0 diff --git a/client/pom.xml b/client/pom.xml index d1a0bd002..1a8edb402 100644 --- a/client/pom.xml +++ b/client/pom.xml @@ -16,7 +16,7 @@ com.alibaba.nacos nacos-all - 0.6.1-SNAPSHOT + 0.6.1 ../pom.xml diff --git a/common/pom.xml b/common/pom.xml index e226b37c8..8bd7e91f4 100644 --- a/common/pom.xml +++ b/common/pom.xml @@ -18,7 +18,7 @@ com.alibaba.nacos nacos-all - 0.6.1-SNAPSHOT + 0.6.1 ../pom.xml 4.0.0 diff --git a/config/pom.xml b/config/pom.xml index 9ae6e39de..28f51a6fc 100644 --- a/config/pom.xml +++ b/config/pom.xml @@ -17,7 +17,7 @@ com.alibaba.nacos nacos-all - 0.6.1-SNAPSHOT + 0.6.1 4.0.0 diff --git a/console/pom.xml b/console/pom.xml index cd58f3485..ea6ff4dde 100644 --- a/console/pom.xml +++ b/console/pom.xml @@ -18,7 +18,7 @@ com.alibaba.nacos nacos-all - 0.6.1-SNAPSHOT + 0.6.1 nacos-console diff --git a/core/pom.xml b/core/pom.xml index 22a1f29d9..eb76fe998 100644 --- a/core/pom.xml +++ b/core/pom.xml @@ -18,7 +18,7 @@ com.alibaba.nacos nacos-all - 0.6.1-SNAPSHOT + 0.6.1 ../pom.xml diff --git a/core/src/main/resources/banner.txt b/core/src/main/resources/banner.txt index e00c23592..22d52a96f 100644 --- a/core/src/main/resources/banner.txt +++ b/core/src/main/resources/banner.txt @@ -1,7 +1,7 @@ ,--. ,--.'| - ,--,: : | Nacos 0.6.0 + ,--,: : | Nacos 0.6.1 ,`--.'`| ' : ,---. Running in ${nacos.mode} mode | : : | | ' ,'\ .--.--. Port: 8848 : | \ | : ,--.--. ,---. / / | / / ' Pid: ${pid} diff --git a/distribution/pom.xml b/distribution/pom.xml index 5577e6074..c4664a7e6 100644 --- a/distribution/pom.xml +++ b/distribution/pom.xml @@ -18,7 +18,7 @@ com.alibaba.nacos nacos-all - 0.6.1-SNAPSHOT + 0.6.1 ../pom.xml diff --git a/example/pom.xml b/example/pom.xml index 597c38a19..afad2cd3c 100644 --- a/example/pom.xml +++ b/example/pom.xml @@ -18,7 +18,7 @@ com.alibaba.nacos nacos-all - 0.6.1-SNAPSHOT + 0.6.1 ../pom.xml diff --git a/naming/pom.xml b/naming/pom.xml index bcca6fc27..6dff54196 100644 --- a/naming/pom.xml +++ b/naming/pom.xml @@ -18,7 +18,7 @@ com.alibaba.nacos nacos-all - 0.6.1-SNAPSHOT + 0.6.1 ../pom.xml diff --git a/pom.xml b/pom.xml index 140c07fbe..614c451b1 100644 --- a/pom.xml +++ b/pom.xml @@ -21,7 +21,7 @@ 2018 com.alibaba.nacos nacos-all - 0.6.1-SNAPSHOT + 0.6.1 pom Alibaba NACOS ${project.version} diff --git a/test/pom.xml b/test/pom.xml index 23acf981d..0c90187c2 100644 --- a/test/pom.xml +++ b/test/pom.xml @@ -17,7 +17,7 @@ com.alibaba.nacos nacos-all - 0.6.1-SNAPSHOT + 0.6.1 ../pom.xml 4.0.0 From 308867f0e2f4df85b7d8bbdadafb5c3ff9ad6a89 Mon Sep 17 00:00:00 2001 From: nkorange Date: Tue, 11 Dec 2018 17:41:51 +0800 Subject: [PATCH 5/5] Remove unused config --- pom.xml | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/pom.xml b/pom.xml index 614c451b1..af95d9e05 100644 --- a/pom.xml +++ b/pom.xml @@ -726,16 +726,5 @@ - - - - releases - http://mvnrepo.alibaba-inc.com/mvn/releases - - - snapshots - http://mvnrepo.alibaba-inc.com/mvn/snapshots - -