From a1da8c121ec1f47bdd0ade3790be777e8a2fb4fa Mon Sep 17 00:00:00 2001
From: "Yangkai.Shen" <237497819@qq.com>
Date: Fri, 23 Aug 2019 14:06:27 +0800
Subject: [PATCH 1/7] :bug: remove server.contextPath
---
console/src/main/resources/application.properties | 1 -
1 file changed, 1 deletion(-)
diff --git a/console/src/main/resources/application.properties b/console/src/main/resources/application.properties
index 64c42676e..7e6495697 100644
--- a/console/src/main/resources/application.properties
+++ b/console/src/main/resources/application.properties
@@ -1,6 +1,5 @@
# spring
-server.contextPath=/nacos
server.servlet.contextPath=/nacos
server.port=8848
From bbad9d69b08f0b7acfc2a5d7b4a0110a92283dd5 Mon Sep 17 00:00:00 2001
From: Beldon <1047325205@qq.com>
Date: Sun, 25 Aug 2019 20:23:05 +0800
Subject: [PATCH 2/7] fix #1764.
---
.../nacos/naming/healthcheck/HealthCheckProcessorDelegate.java | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/naming/src/main/java/com/alibaba/nacos/naming/healthcheck/HealthCheckProcessorDelegate.java b/naming/src/main/java/com/alibaba/nacos/naming/healthcheck/HealthCheckProcessorDelegate.java
index 1de6acb09..8f4ad5c0a 100644
--- a/naming/src/main/java/com/alibaba/nacos/naming/healthcheck/HealthCheckProcessorDelegate.java
+++ b/naming/src/main/java/com/alibaba/nacos/naming/healthcheck/HealthCheckProcessorDelegate.java
@@ -50,7 +50,7 @@ public class HealthCheckProcessorDelegate implements HealthCheckProcessor {
String type = task.getCluster().getHealthChecker().getType();
HealthCheckProcessor processor = healthCheckProcessorMap.get(type);
if(processor == null){
- processor = healthCheckProcessorMap.get("none");
+ processor = healthCheckProcessorMap.get("NONE");
}
processor.process(task);
From 1fd5ee360e97c395f29c5eb727c47ec0d56b9632 Mon Sep 17 00:00:00 2001
From: ly <641921791@qq.com>
Date: Thu, 29 Aug 2019 01:23:12 +0800
Subject: [PATCH 3/7] [Issue] #1769 Solve the bug of the clone configuration
function
---
config/pom.xml | 4 +
.../server/controller/ConfigController.java | 25 +++---
.../config/server/model/ConfigAllInfo.java | 9 ---
.../nacos/config/server/model/ConfigInfo.java | 12 ++-
.../config/server/service/PersistService.java | 78 +++++++++++++++++--
5 files changed, 98 insertions(+), 30 deletions(-)
diff --git a/config/pom.xml b/config/pom.xml
index 68141b6b9..67915429d 100644
--- a/config/pom.xml
+++ b/config/pom.xml
@@ -46,6 +46,10 @@
${project.groupId}
nacos-core
+
+ com.alibaba
+ fastjson
+
com.google.guava
guava
diff --git a/config/src/main/java/com/alibaba/nacos/config/server/controller/ConfigController.java b/config/src/main/java/com/alibaba/nacos/config/server/controller/ConfigController.java
index 3ca85fb80..d45166b9a 100644
--- a/config/src/main/java/com/alibaba/nacos/config/server/controller/ConfigController.java
+++ b/config/src/main/java/com/alibaba/nacos/config/server/controller/ConfigController.java
@@ -50,6 +50,7 @@ import java.io.IOException;
import java.net.URLDecoder;
import java.sql.Timestamp;
import java.util.*;
+import java.util.stream.Collectors;
import static com.alibaba.nacos.core.utils.SystemUtils.LOCAL_IP;
@@ -570,26 +571,26 @@ public class ConfigController {
}
ids.removeAll(Collections.singleton(null));
- List queryedDataList = persistService.findAllConfigInfo4Export(null,null, null, null, ids);
+ List queryedDataList = persistService.findConfigAllInfoByIds(ids);
if(queryedDataList == null || queryedDataList.isEmpty()){
failedData.put("succCount", 0);
return ResultBuilder.buildResult(ResultCodeEnum.DATA_EMPTY, failedData);
}
- List configInfoList4Clone = new ArrayList<>(queryedDataList.size());
-
- for(ConfigInfo ci : queryedDataList){
+ String tenant = namespace;
+ List configInfoList4Clone = queryedDataList.stream().map(configAllInfo -> {
ConfigInfo ci4save = new ConfigInfo();
- ci4save.setTenant(namespace);
- ci4save.setGroup(ci.getGroup());
- ci4save.setDataId(ci.getDataId());
- ci4save.setContent(ci.getContent());
- if(StringUtils.isNotBlank(ci.getAppName())){
- ci4save.setAppName(ci.getAppName());
+ ci4save.setTenant(tenant);
+ ci4save.setGroup(configAllInfo.getGroup());
+ ci4save.setDataId(configAllInfo.getDataId());
+ ci4save.setContent(configAllInfo.getContent());
+ if(StringUtils.isNotBlank(configAllInfo.getAppName())){
+ ci4save.setAppName(configAllInfo.getAppName());
}
- configInfoList4Clone.add(ci4save);
- }
+ ci4save.setType(configAllInfo.getType());
+ return ci4save;
+ }).collect(Collectors.toList());
if (configInfoList4Clone.isEmpty()) {
failedData.put("succCount", 0);
diff --git a/config/src/main/java/com/alibaba/nacos/config/server/model/ConfigAllInfo.java b/config/src/main/java/com/alibaba/nacos/config/server/model/ConfigAllInfo.java
index 218d263a2..71ccf117f 100644
--- a/config/src/main/java/com/alibaba/nacos/config/server/model/ConfigAllInfo.java
+++ b/config/src/main/java/com/alibaba/nacos/config/server/model/ConfigAllInfo.java
@@ -34,7 +34,6 @@ public class ConfigAllInfo extends ConfigInfo {
private String desc;
private String use;
private String effect;
- private String type;
private String schema;
private String configTags;
@@ -97,14 +96,6 @@ public class ConfigAllInfo extends ConfigInfo {
this.effect = effect;
}
- public String getType() {
- return type;
- }
-
- public void setType(String type) {
- this.type = type;
- }
-
public String getSchema() {
return schema;
}
diff --git a/config/src/main/java/com/alibaba/nacos/config/server/model/ConfigInfo.java b/config/src/main/java/com/alibaba/nacos/config/server/model/ConfigInfo.java
index be0d2de0d..4073da20c 100644
--- a/config/src/main/java/com/alibaba/nacos/config/server/model/ConfigInfo.java
+++ b/config/src/main/java/com/alibaba/nacos/config/server/model/ConfigInfo.java
@@ -28,6 +28,8 @@ public class ConfigInfo extends ConfigInfoBase {
private String appName;
+ private String type;
+
public ConfigInfo() {
}
@@ -63,6 +65,14 @@ public class ConfigInfo extends ConfigInfoBase {
this.appName = appName;
}
+ public String getType() {
+ return type;
+ }
+
+ public void setType(String type) {
+ this.type = type;
+ }
+
@Override
public int hashCode() {
return super.hashCode();
@@ -77,7 +87,7 @@ public class ConfigInfo extends ConfigInfoBase {
public String toString() {
return "ConfigInfo{" + "id=" + getId() + ", dataId='" + getDataId() + '\'' + ", group='" + getGroup() + '\''
+ ", tenant='" + tenant + '\'' + ", appName='" + appName + '\'' + ", content='" + getContent() + '\''
- + ", md5='" + getMd5() + '\'' + '}';
+ + ", md5='" + getMd5() + '\'' + ", type='" + type + '\'' + '}';
}
}
diff --git a/config/src/main/java/com/alibaba/nacos/config/server/service/PersistService.java b/config/src/main/java/com/alibaba/nacos/config/server/service/PersistService.java
index ba64208a0..fc1b2353b 100755
--- a/config/src/main/java/com/alibaba/nacos/config/server/service/PersistService.java
+++ b/config/src/main/java/com/alibaba/nacos/config/server/service/PersistService.java
@@ -52,6 +52,7 @@ import java.io.IOException;
import java.sql.*;
import java.util.*;
import java.util.Map.Entry;
+import java.util.stream.Collectors;
import static com.alibaba.nacos.config.server.utils.LogUtil.defaultLog;
import static com.alibaba.nacos.config.server.utils.LogUtil.fatalLog;
@@ -3040,6 +3041,34 @@ public class PersistService {
}
}
+ /**
+ * Find ConfigAllInfo by ids
+ *
+ * @param ids ids
+ * @return ConfigAllInfo
+ */
+ public List findConfigAllInfoByIds(final List ids) {
+ if(CollectionUtils.isEmpty(ids)) {
+ return Collections.emptyList();
+ }
+
+ String[] array = new String[ids.size()];
+ Arrays.fill(array, "?");
+
+ String sql = "SELECT ID,data_id,group_id,tenant_id,app_name,content,md5,gmt_create,gmt_modified,src_user,src_ip,c_desc,c_use,effect,type,c_schema FROM config_info " +
+ "WHERE id IN (" + String.join(",", array) + ")";
+
+ try {
+ List
-
- com.alibaba
- fastjson
-
com.google.guava
guava
diff --git a/config/src/main/java/com/alibaba/nacos/config/server/controller/ConfigController.java b/config/src/main/java/com/alibaba/nacos/config/server/controller/ConfigController.java
index d45166b9a..cf0a7b9f4 100644
--- a/config/src/main/java/com/alibaba/nacos/config/server/controller/ConfigController.java
+++ b/config/src/main/java/com/alibaba/nacos/config/server/controller/ConfigController.java
@@ -50,7 +50,6 @@ import java.io.IOException;
import java.net.URLDecoder;
import java.sql.Timestamp;
import java.util.*;
-import java.util.stream.Collectors;
import static com.alibaba.nacos.core.utils.SystemUtils.LOCAL_IP;
@@ -436,7 +435,7 @@ public class ConfigController {
defaultValue = StringUtils.EMPTY) String tenant,
@RequestParam(value = "ids", required = false)List ids) {
ids.removeAll(Collections.singleton(null));
- List dataList = persistService.findAllConfigInfo4Export(dataId, group, tenant, appName, ids);
+ List dataList = persistService.findAllConfigInfo4Export(dataId, group, tenant, appName, ids);
List zipItemList = new ArrayList<>();
StringBuilder metaData = null;
for(ConfigInfo ci : dataList){
@@ -571,26 +570,27 @@ public class ConfigController {
}
ids.removeAll(Collections.singleton(null));
- List queryedDataList = persistService.findConfigAllInfoByIds(ids);
+ List queryedDataList = persistService.findAllConfigInfo4Export(null,null, null, null, ids);
if(queryedDataList == null || queryedDataList.isEmpty()){
failedData.put("succCount", 0);
return ResultBuilder.buildResult(ResultCodeEnum.DATA_EMPTY, failedData);
}
- String tenant = namespace;
- List configInfoList4Clone = queryedDataList.stream().map(configAllInfo -> {
+ List configInfoList4Clone = new ArrayList<>(queryedDataList.size());
+
+ for(ConfigInfo ci : queryedDataList){
ConfigInfo ci4save = new ConfigInfo();
- ci4save.setTenant(tenant);
- ci4save.setGroup(configAllInfo.getGroup());
- ci4save.setDataId(configAllInfo.getDataId());
- ci4save.setContent(configAllInfo.getContent());
- if(StringUtils.isNotBlank(configAllInfo.getAppName())){
- ci4save.setAppName(configAllInfo.getAppName());
+ ci4save.setTenant(namespace);
+ ci4save.setType(ci.getType());
+ ci4save.setGroup(ci.getGroup());
+ ci4save.setDataId(ci.getDataId());
+ ci4save.setContent(ci.getContent());
+ if(StringUtils.isNotBlank(ci.getAppName())){
+ ci4save.setAppName(ci.getAppName());
}
- ci4save.setType(configAllInfo.getType());
- return ci4save;
- }).collect(Collectors.toList());
+ configInfoList4Clone.add(ci4save);
+ }
if (configInfoList4Clone.isEmpty()) {
failedData.put("succCount", 0);
diff --git a/config/src/main/java/com/alibaba/nacos/config/server/model/ConfigAllInfo.java b/config/src/main/java/com/alibaba/nacos/config/server/model/ConfigAllInfo.java
index 71ccf117f..2c0505765 100644
--- a/config/src/main/java/com/alibaba/nacos/config/server/model/ConfigAllInfo.java
+++ b/config/src/main/java/com/alibaba/nacos/config/server/model/ConfigAllInfo.java
@@ -34,6 +34,7 @@ public class ConfigAllInfo extends ConfigInfo {
private String desc;
private String use;
private String effect;
+ private String type;
private String schema;
private String configTags;
@@ -96,6 +97,16 @@ public class ConfigAllInfo extends ConfigInfo {
this.effect = effect;
}
+ @Override
+ public String getType() {
+ return type;
+ }
+
+ @Override
+ public void setType(String type) {
+ this.type = type;
+ }
+
public String getSchema() {
return schema;
}
diff --git a/config/src/main/java/com/alibaba/nacos/config/server/service/PersistService.java b/config/src/main/java/com/alibaba/nacos/config/server/service/PersistService.java
index fc1b2353b..d3f626b63 100755
--- a/config/src/main/java/com/alibaba/nacos/config/server/service/PersistService.java
+++ b/config/src/main/java/com/alibaba/nacos/config/server/service/PersistService.java
@@ -52,7 +52,6 @@ import java.io.IOException;
import java.sql.*;
import java.util.*;
import java.util.Map.Entry;
-import java.util.stream.Collectors;
import static com.alibaba.nacos.config.server.utils.LogUtil.defaultLog;
import static com.alibaba.nacos.config.server.utils.LogUtil.fatalLog;
@@ -73,7 +72,7 @@ public class PersistService {
private DataSourceService dataSourceService;
- private static final String SQL_FIND_ALL_CONFIG_INFO = "select data_id,group_id,tenant_id,app_name,content,type from config_info";
+ private static final String SQL_FIND_ALL_CONFIG_INFO = "select id,data_id,group_id,tenant_id,app_name,content,type,md5,gmt_create,gmt_modified,src_user,src_ip,c_desc,c_use,effect,c_schema from config_info";
private static final String SQL_TENANT_INFO_COUNT_BY_TENANT_ID = "select count(1) from tenant_info where tenant_id = ?";
@@ -3041,34 +3040,6 @@ public class PersistService {
}
}
- /**
- * Find ConfigAllInfo by ids
- *
- * @param ids ids
- * @return ConfigAllInfo
- */
- public List findConfigAllInfoByIds(final List ids) {
- if(CollectionUtils.isEmpty(ids)) {
- return Collections.emptyList();
- }
-
- String[] array = new String[ids.size()];
- Arrays.fill(array, "?");
-
- String sql = "SELECT ID,data_id,group_id,tenant_id,app_name,content,md5,gmt_create,gmt_modified,src_user,src_ip,c_desc,c_use,effect,type,c_schema FROM config_info " +
- "WHERE id IN (" + String.join(",", array) + ")";
-
- try {
- List
+
+ com.google.guava
+ guava
+
diff --git a/api/src/main/java/com/alibaba/nacos/api/naming/pojo/AbstractHealthChecker.java b/api/src/main/java/com/alibaba/nacos/api/naming/pojo/AbstractHealthChecker.java
index 8f09604a5..97259572b 100644
--- a/api/src/main/java/com/alibaba/nacos/api/naming/pojo/AbstractHealthChecker.java
+++ b/api/src/main/java/com/alibaba/nacos/api/naming/pojo/AbstractHealthChecker.java
@@ -23,7 +23,7 @@ import org.apache.commons.lang3.StringUtils;
import java.util.Collections;
import java.util.HashMap;
import java.util.Map;
-import java.util.Objects;
+import com.google.common.base.Objects;
/**
* @author nkorange
@@ -138,7 +138,7 @@ public abstract class AbstractHealthChecker implements Cloneable {
@Override
public int hashCode() {
- return Objects.hash(path, headers, expectedResponseCode);
+ return Objects.hashCode(path, headers, expectedResponseCode);
}
@Override
@@ -184,7 +184,7 @@ public abstract class AbstractHealthChecker implements Cloneable {
@Override
public int hashCode() {
- return Objects.hash(TYPE);
+ return Objects.hashCode(TYPE);
}
@Override
@@ -250,7 +250,7 @@ public abstract class AbstractHealthChecker implements Cloneable {
@Override
public int hashCode() {
- return Objects.hash(user, pwd, cmd);
+ return Objects.hashCode(user, pwd, cmd);
}
@Override