Merge branch 'develop' of https://github.com/alibaba/nacos into jraft_naming
This commit is contained in:
commit
d3ce09bb79
41
.github/ISSUE_TEMPLATE/bug-report.md
vendored
Normal file
41
.github/ISSUE_TEMPLATE/bug-report.md
vendored
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
---
|
||||||
|
name: Bug report
|
||||||
|
about: Create a report to help us improve
|
||||||
|
title: ''
|
||||||
|
labels: ''
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<!-- Here is for bug reports and feature requests ONLY!
|
||||||
|
|
||||||
|
If you're looking for help, please check our mail list、WeChat group and the Gitter room.
|
||||||
|
|
||||||
|
Please try to use English to describe your issue, or at least provide a snippet of English translation.
|
||||||
|
我们鼓励使用英文,如果不能直接使用,可以使用翻译软件,您仍旧可以保留中文原文。
|
||||||
|
-->
|
||||||
|
|
||||||
|
**Describe the bug**
|
||||||
|
A clear and concise description of what the bug is.
|
||||||
|
|
||||||
|
**Expected behavior**
|
||||||
|
A clear and concise description of what you expected to happen.
|
||||||
|
|
||||||
|
**Acutally behavior**
|
||||||
|
A clear and concise description of what you actually to happen.
|
||||||
|
|
||||||
|
**How to Reproduce**
|
||||||
|
Steps to reproduce the behavior:
|
||||||
|
1. Go to '...'
|
||||||
|
2. Click on '....'
|
||||||
|
3. Scroll down to '....'
|
||||||
|
4. See error
|
||||||
|
|
||||||
|
**Desktop (please complete the following information):**
|
||||||
|
- OS: [e.g. Centos]
|
||||||
|
- Version [e.g. nacos-server 1.3.1, nacos-client 1.3.1]
|
||||||
|
- Module [e.g. naming/config]
|
||||||
|
- SDK [e.g. original, spring-cloud-alibaba-nacos, dubbo]
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context about the problem here.
|
28
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
28
.github/ISSUE_TEMPLATE/feature_request.md
vendored
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
---
|
||||||
|
name: Feature request
|
||||||
|
about: Suggest an idea for this project
|
||||||
|
title: ''
|
||||||
|
labels: ''
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<!-- Here is for bug reports and feature requests ONLY!
|
||||||
|
|
||||||
|
If you're looking for help, please check our mail list、WeChat group and the Gitter room.
|
||||||
|
|
||||||
|
Please try to use English to describe your issue, or at least provide a snippet of English translation.
|
||||||
|
我们鼓励使用英文,如果不能直接使用,可以使用翻译软件,您仍旧可以保留中文原文。
|
||||||
|
-->
|
||||||
|
|
||||||
|
**Is your feature request related to a problem? Please describe.**
|
||||||
|
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||||
|
|
||||||
|
**Describe the solution you'd like**
|
||||||
|
A clear and concise description of what you want to happen.
|
||||||
|
|
||||||
|
**Describe alternatives you've considered**
|
||||||
|
A clear and concise description of any alternative solutions or features you've considered.
|
||||||
|
|
||||||
|
**Additional context**
|
||||||
|
Add any other context or screenshots about the feature request here.
|
37
.github/ISSUE_TEMPLATE/old-issue-template.md
vendored
Normal file
37
.github/ISSUE_TEMPLATE/old-issue-template.md
vendored
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
---
|
||||||
|
name: Old issue template
|
||||||
|
about: Describe this issue template's purpose here.
|
||||||
|
title: ''
|
||||||
|
labels: ''
|
||||||
|
assignees: ''
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
<!-- Here is for bug reports and feature requests ONLY!
|
||||||
|
|
||||||
|
If you're looking for help, please check our mail list、WeChat group and the Gitter room.
|
||||||
|
|
||||||
|
Please try to use English to describe your issue, or at least provide a snippet of English translation.
|
||||||
|
我们鼓励使用英文,如果不能直接使用,可以使用翻译软件,您仍旧可以保留中文原文。
|
||||||
|
-->
|
||||||
|
|
||||||
|
## Issue Description
|
||||||
|
|
||||||
|
Type: *bug report* or *feature request*
|
||||||
|
|
||||||
|
### Describe what happened (or what feature you want)
|
||||||
|
|
||||||
|
|
||||||
|
### Describe what you expected to happen
|
||||||
|
|
||||||
|
|
||||||
|
### How to reproduce it (as minimally and precisely as possible)
|
||||||
|
|
||||||
|
1.
|
||||||
|
2.
|
||||||
|
3.
|
||||||
|
|
||||||
|
### Tell us your environment
|
||||||
|
|
||||||
|
|
||||||
|
### Anything else we need to know?
|
@ -231,6 +231,19 @@ public class Instance {
|
|||||||
Constants.DEFAULT_INSTANCE_ID_GENERATOR);
|
Constants.DEFAULT_INSTANCE_ID_GENERATOR);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns {@code true} if this metadata contains the specified key.
|
||||||
|
*
|
||||||
|
* @param key metadata key
|
||||||
|
* @return {@code true} if this metadata contains the specified key
|
||||||
|
*/
|
||||||
|
public boolean containsMetadata(final String key) {
|
||||||
|
if (getMetadata() == null || getMetadata().isEmpty()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return getMetadata().containsKey(key);
|
||||||
|
}
|
||||||
|
|
||||||
private long getMetaDataByKeyWithDefault(final String key, final long defaultValue) {
|
private long getMetaDataByKeyWithDefault(final String key, final long defaultValue) {
|
||||||
if (getMetadata() == null || getMetadata().isEmpty()) {
|
if (getMetadata() == null || getMetadata().isEmpty()) {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
|
@ -25,8 +25,8 @@ import com.alibaba.nacos.common.http.HttpClientBeanHolder;
|
|||||||
import com.alibaba.nacos.common.http.HttpClientConfig;
|
import com.alibaba.nacos.common.http.HttpClientConfig;
|
||||||
import com.alibaba.nacos.common.http.HttpClientFactory;
|
import com.alibaba.nacos.common.http.HttpClientFactory;
|
||||||
import com.alibaba.nacos.common.http.client.HttpClientRequestInterceptor;
|
import com.alibaba.nacos.common.http.client.HttpClientRequestInterceptor;
|
||||||
import com.alibaba.nacos.common.http.client.HttpClientResponse;
|
|
||||||
import com.alibaba.nacos.common.http.client.NacosRestTemplate;
|
import com.alibaba.nacos.common.http.client.NacosRestTemplate;
|
||||||
|
import com.alibaba.nacos.common.http.client.response.HttpClientResponse;
|
||||||
import com.alibaba.nacos.common.http.param.Header;
|
import com.alibaba.nacos.common.http.param.Header;
|
||||||
import com.alibaba.nacos.common.lifecycle.Closeable;
|
import com.alibaba.nacos.common.lifecycle.Closeable;
|
||||||
import com.alibaba.nacos.common.model.RequestHttpEntity;
|
import com.alibaba.nacos.common.model.RequestHttpEntity;
|
||||||
|
@ -16,10 +16,10 @@
|
|||||||
|
|
||||||
package com.alibaba.nacos.common.http;
|
package com.alibaba.nacos.common.http;
|
||||||
|
|
||||||
import com.alibaba.nacos.common.http.client.DefaultAsyncHttpClientRequest;
|
|
||||||
import com.alibaba.nacos.common.http.client.JdkHttpClientRequest;
|
|
||||||
import com.alibaba.nacos.common.http.client.NacosAsyncRestTemplate;
|
import com.alibaba.nacos.common.http.client.NacosAsyncRestTemplate;
|
||||||
import com.alibaba.nacos.common.http.client.NacosRestTemplate;
|
import com.alibaba.nacos.common.http.client.NacosRestTemplate;
|
||||||
|
import com.alibaba.nacos.common.http.client.request.DefaultAsyncHttpClientRequest;
|
||||||
|
import com.alibaba.nacos.common.http.client.request.JdkHttpClientRequest;
|
||||||
import org.apache.http.client.config.RequestConfig;
|
import org.apache.http.client.config.RequestConfig;
|
||||||
import org.apache.http.impl.nio.client.HttpAsyncClients;
|
import org.apache.http.impl.nio.client.HttpAsyncClients;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -17,6 +17,10 @@
|
|||||||
package com.alibaba.nacos.common.http.client;
|
package com.alibaba.nacos.common.http.client;
|
||||||
|
|
||||||
import com.alibaba.nacos.common.constant.ResponseHandlerType;
|
import com.alibaba.nacos.common.constant.ResponseHandlerType;
|
||||||
|
import com.alibaba.nacos.common.http.client.handler.BeanResponseHandler;
|
||||||
|
import com.alibaba.nacos.common.http.client.handler.ResponseHandler;
|
||||||
|
import com.alibaba.nacos.common.http.client.handler.RestResultResponseHandler;
|
||||||
|
import com.alibaba.nacos.common.http.client.handler.StringResponseHandler;
|
||||||
import com.alibaba.nacos.common.utils.JacksonUtils;
|
import com.alibaba.nacos.common.utils.JacksonUtils;
|
||||||
import com.fasterxml.jackson.databind.JavaType;
|
import com.fasterxml.jackson.databind.JavaType;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
package com.alibaba.nacos.common.http.client;
|
package com.alibaba.nacos.common.http.client;
|
||||||
|
|
||||||
|
import com.alibaba.nacos.common.http.client.request.HttpClientRequest;
|
||||||
|
import com.alibaba.nacos.common.http.client.response.HttpClientResponse;
|
||||||
import com.alibaba.nacos.common.model.RequestHttpEntity;
|
import com.alibaba.nacos.common.model.RequestHttpEntity;
|
||||||
|
|
||||||
import java.net.URI;
|
import java.net.URI;
|
||||||
|
@ -16,6 +16,8 @@
|
|||||||
|
|
||||||
package com.alibaba.nacos.common.http.client;
|
package com.alibaba.nacos.common.http.client;
|
||||||
|
|
||||||
|
import com.alibaba.nacos.common.http.client.request.HttpClientRequest;
|
||||||
|
import com.alibaba.nacos.common.http.client.response.HttpClientResponse;
|
||||||
import com.alibaba.nacos.common.model.RequestHttpEntity;
|
import com.alibaba.nacos.common.model.RequestHttpEntity;
|
||||||
|
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
@ -18,6 +18,9 @@ package com.alibaba.nacos.common.http.client;
|
|||||||
|
|
||||||
import com.alibaba.nacos.common.http.Callback;
|
import com.alibaba.nacos.common.http.Callback;
|
||||||
import com.alibaba.nacos.common.http.HttpUtils;
|
import com.alibaba.nacos.common.http.HttpUtils;
|
||||||
|
import com.alibaba.nacos.common.http.client.handler.ResponseHandler;
|
||||||
|
import com.alibaba.nacos.common.http.client.request.AsyncHttpClientRequest;
|
||||||
|
import com.alibaba.nacos.common.http.client.response.HttpClientResponse;
|
||||||
import com.alibaba.nacos.common.http.param.Header;
|
import com.alibaba.nacos.common.http.param.Header;
|
||||||
import com.alibaba.nacos.common.http.param.MediaType;
|
import com.alibaba.nacos.common.http.param.MediaType;
|
||||||
import com.alibaba.nacos.common.http.param.Query;
|
import com.alibaba.nacos.common.http.param.Query;
|
||||||
|
@ -19,6 +19,9 @@ package com.alibaba.nacos.common.http.client;
|
|||||||
import com.alibaba.nacos.common.http.HttpClientConfig;
|
import com.alibaba.nacos.common.http.HttpClientConfig;
|
||||||
import com.alibaba.nacos.common.http.HttpRestResult;
|
import com.alibaba.nacos.common.http.HttpRestResult;
|
||||||
import com.alibaba.nacos.common.http.HttpUtils;
|
import com.alibaba.nacos.common.http.HttpUtils;
|
||||||
|
import com.alibaba.nacos.common.http.client.handler.ResponseHandler;
|
||||||
|
import com.alibaba.nacos.common.http.client.request.HttpClientRequest;
|
||||||
|
import com.alibaba.nacos.common.http.client.response.HttpClientResponse;
|
||||||
import com.alibaba.nacos.common.http.param.Header;
|
import com.alibaba.nacos.common.http.param.Header;
|
||||||
import com.alibaba.nacos.common.http.param.MediaType;
|
import com.alibaba.nacos.common.http.param.MediaType;
|
||||||
import com.alibaba.nacos.common.http.param.Query;
|
import com.alibaba.nacos.common.http.param.Query;
|
||||||
|
@ -14,9 +14,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.alibaba.nacos.common.http.client;
|
package com.alibaba.nacos.common.http.client.handler;
|
||||||
|
|
||||||
import com.alibaba.nacos.common.http.HttpRestResult;
|
import com.alibaba.nacos.common.http.HttpRestResult;
|
||||||
|
import com.alibaba.nacos.common.http.client.response.HttpClientResponse;
|
||||||
import com.alibaba.nacos.common.http.param.Header;
|
import com.alibaba.nacos.common.http.param.Header;
|
||||||
import com.alibaba.nacos.common.utils.IoUtils;
|
import com.alibaba.nacos.common.utils.IoUtils;
|
||||||
import org.apache.http.HttpStatus;
|
import org.apache.http.HttpStatus;
|
@ -14,9 +14,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.alibaba.nacos.common.http.client;
|
package com.alibaba.nacos.common.http.client.handler;
|
||||||
|
|
||||||
import com.alibaba.nacos.common.http.HttpRestResult;
|
import com.alibaba.nacos.common.http.HttpRestResult;
|
||||||
|
import com.alibaba.nacos.common.http.client.response.HttpClientResponse;
|
||||||
import com.alibaba.nacos.common.http.param.Header;
|
import com.alibaba.nacos.common.http.param.Header;
|
||||||
import com.alibaba.nacos.common.utils.JacksonUtils;
|
import com.alibaba.nacos.common.utils.JacksonUtils;
|
||||||
|
|
@ -14,9 +14,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.alibaba.nacos.common.http.client;
|
package com.alibaba.nacos.common.http.client.handler;
|
||||||
|
|
||||||
import com.alibaba.nacos.common.http.HttpRestResult;
|
import com.alibaba.nacos.common.http.HttpRestResult;
|
||||||
|
import com.alibaba.nacos.common.http.client.response.HttpClientResponse;
|
||||||
|
|
||||||
import java.lang.reflect.Type;
|
import java.lang.reflect.Type;
|
||||||
|
|
@ -14,9 +14,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.alibaba.nacos.common.http.client;
|
package com.alibaba.nacos.common.http.client.handler;
|
||||||
|
|
||||||
import com.alibaba.nacos.common.http.HttpRestResult;
|
import com.alibaba.nacos.common.http.HttpRestResult;
|
||||||
|
import com.alibaba.nacos.common.http.client.response.HttpClientResponse;
|
||||||
import com.alibaba.nacos.common.http.param.Header;
|
import com.alibaba.nacos.common.http.param.Header;
|
||||||
import com.alibaba.nacos.common.model.RestResult;
|
import com.alibaba.nacos.common.model.RestResult;
|
||||||
import com.alibaba.nacos.common.utils.JacksonUtils;
|
import com.alibaba.nacos.common.utils.JacksonUtils;
|
@ -14,9 +14,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.alibaba.nacos.common.http.client;
|
package com.alibaba.nacos.common.http.client.handler;
|
||||||
|
|
||||||
import com.alibaba.nacos.common.http.HttpRestResult;
|
import com.alibaba.nacos.common.http.HttpRestResult;
|
||||||
|
import com.alibaba.nacos.common.http.client.response.HttpClientResponse;
|
||||||
import com.alibaba.nacos.common.http.param.Header;
|
import com.alibaba.nacos.common.http.param.Header;
|
||||||
import com.alibaba.nacos.common.utils.IoUtils;
|
import com.alibaba.nacos.common.utils.IoUtils;
|
||||||
|
|
@ -14,9 +14,10 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.alibaba.nacos.common.http.client;
|
package com.alibaba.nacos.common.http.client.request;
|
||||||
|
|
||||||
import com.alibaba.nacos.common.http.Callback;
|
import com.alibaba.nacos.common.http.Callback;
|
||||||
|
import com.alibaba.nacos.common.http.client.handler.ResponseHandler;
|
||||||
import com.alibaba.nacos.common.model.RequestHttpEntity;
|
import com.alibaba.nacos.common.model.RequestHttpEntity;
|
||||||
|
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
@ -14,10 +14,12 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.alibaba.nacos.common.http.client;
|
package com.alibaba.nacos.common.http.client.request;
|
||||||
|
|
||||||
import com.alibaba.nacos.common.http.Callback;
|
import com.alibaba.nacos.common.http.Callback;
|
||||||
import com.alibaba.nacos.common.http.HttpRestResult;
|
import com.alibaba.nacos.common.http.HttpRestResult;
|
||||||
|
import com.alibaba.nacos.common.http.client.handler.ResponseHandler;
|
||||||
|
import com.alibaba.nacos.common.http.client.response.DefaultClientHttpResponse;
|
||||||
import com.alibaba.nacos.common.model.RequestHttpEntity;
|
import com.alibaba.nacos.common.model.RequestHttpEntity;
|
||||||
import org.apache.http.HttpResponse;
|
import org.apache.http.HttpResponse;
|
||||||
import org.apache.http.client.methods.HttpRequestBase;
|
import org.apache.http.client.methods.HttpRequestBase;
|
@ -14,11 +14,13 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.alibaba.nacos.common.http.client;
|
package com.alibaba.nacos.common.http.client.request;
|
||||||
|
|
||||||
import com.alibaba.nacos.common.constant.HttpHeaderConsts;
|
import com.alibaba.nacos.common.constant.HttpHeaderConsts;
|
||||||
import com.alibaba.nacos.common.http.BaseHttpMethod;
|
import com.alibaba.nacos.common.http.BaseHttpMethod;
|
||||||
import com.alibaba.nacos.common.http.HttpClientConfig;
|
import com.alibaba.nacos.common.http.HttpClientConfig;
|
||||||
|
import com.alibaba.nacos.common.http.client.response.DefaultClientHttpResponse;
|
||||||
|
import com.alibaba.nacos.common.http.client.response.HttpClientResponse;
|
||||||
import com.alibaba.nacos.common.http.param.Header;
|
import com.alibaba.nacos.common.http.param.Header;
|
||||||
import com.alibaba.nacos.common.http.param.MediaType;
|
import com.alibaba.nacos.common.http.param.MediaType;
|
||||||
import com.alibaba.nacos.common.model.RequestHttpEntity;
|
import com.alibaba.nacos.common.model.RequestHttpEntity;
|
@ -14,8 +14,9 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.alibaba.nacos.common.http.client;
|
package com.alibaba.nacos.common.http.client.request;
|
||||||
|
|
||||||
|
import com.alibaba.nacos.common.http.client.response.HttpClientResponse;
|
||||||
import com.alibaba.nacos.common.model.RequestHttpEntity;
|
import com.alibaba.nacos.common.model.RequestHttpEntity;
|
||||||
|
|
||||||
import java.io.Closeable;
|
import java.io.Closeable;
|
@ -14,11 +14,13 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.alibaba.nacos.common.http.client;
|
package com.alibaba.nacos.common.http.client.request;
|
||||||
|
|
||||||
import com.alibaba.nacos.common.constant.HttpHeaderConsts;
|
import com.alibaba.nacos.common.constant.HttpHeaderConsts;
|
||||||
import com.alibaba.nacos.common.http.HttpClientConfig;
|
import com.alibaba.nacos.common.http.HttpClientConfig;
|
||||||
import com.alibaba.nacos.common.http.HttpUtils;
|
import com.alibaba.nacos.common.http.HttpUtils;
|
||||||
|
import com.alibaba.nacos.common.http.client.response.HttpClientResponse;
|
||||||
|
import com.alibaba.nacos.common.http.client.response.JdkHttpClientResponse;
|
||||||
import com.alibaba.nacos.common.http.param.Header;
|
import com.alibaba.nacos.common.http.param.Header;
|
||||||
import com.alibaba.nacos.common.http.param.MediaType;
|
import com.alibaba.nacos.common.http.param.MediaType;
|
||||||
import com.alibaba.nacos.common.model.RequestHttpEntity;
|
import com.alibaba.nacos.common.model.RequestHttpEntity;
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.alibaba.nacos.common.http.client;
|
package com.alibaba.nacos.common.http.client.response;
|
||||||
|
|
||||||
import com.alibaba.nacos.common.http.param.Header;
|
import com.alibaba.nacos.common.http.param.Header;
|
||||||
import org.apache.http.HttpResponse;
|
import org.apache.http.HttpResponse;
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.alibaba.nacos.common.http.client;
|
package com.alibaba.nacos.common.http.client.response;
|
||||||
|
|
||||||
import com.alibaba.nacos.common.http.param.Header;
|
import com.alibaba.nacos.common.http.param.Header;
|
||||||
|
|
@ -14,7 +14,7 @@
|
|||||||
* limitations under the License.
|
* limitations under the License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package com.alibaba.nacos.common.http.client;
|
package com.alibaba.nacos.common.http.client.response;
|
||||||
|
|
||||||
import com.alibaba.nacos.common.http.param.Header;
|
import com.alibaba.nacos.common.http.param.Header;
|
||||||
import com.alibaba.nacos.common.utils.IoUtils;
|
import com.alibaba.nacos.common.utils.IoUtils;
|
@ -1078,8 +1078,8 @@ public class EmbeddedStoragePersistServiceImpl implements PersistService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int configInfoCount(String tenant) {
|
public int configInfoCount(String tenant) {
|
||||||
String sql = " SELECT COUNT(ID) FROM config_info where tenant_id like '" + tenant + "'";
|
String sql = " SELECT COUNT(ID) FROM config_info where tenant_id like ?";
|
||||||
Integer result = databaseOperate.queryOne(sql, Integer.class);
|
Integer result = databaseOperate.queryOne(sql, new Object[] {tenant}, Integer.class);
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
throw new IllegalArgumentException("configInfoCount error");
|
throw new IllegalArgumentException("configInfoCount error");
|
||||||
}
|
}
|
||||||
@ -2194,7 +2194,7 @@ public class EmbeddedStoragePersistServiceImpl implements PersistService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean isExistTable(String tableName) {
|
public boolean isExistTable(String tableName) {
|
||||||
String sql = String.format("select 1 from %s limit 1", tableName);
|
String sql = String.format("SELECT 1 FROM %s FETCH FIRST ROW ONLY", tableName);
|
||||||
try {
|
try {
|
||||||
databaseOperate.queryOne(sql, Integer.class);
|
databaseOperate.queryOne(sql, Integer.class);
|
||||||
return true;
|
return true;
|
||||||
|
@ -1130,8 +1130,8 @@ public class ExternalStoragePersistServiceImpl implements PersistService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int configInfoCount(String tenant) {
|
public int configInfoCount(String tenant) {
|
||||||
String sql = " SELECT COUNT(ID) FROM config_info where tenant_id like '" + tenant + "'";
|
String sql = " SELECT COUNT(ID) FROM config_info where tenant_id like ?";
|
||||||
Integer result = jt.queryForObject(sql, Integer.class);
|
Integer result = jt.queryForObject(sql, new Object[] {tenant}, Integer.class);
|
||||||
if (result == null) {
|
if (result == null) {
|
||||||
throw new IllegalArgumentException("configInfoCount error");
|
throw new IllegalArgumentException("configInfoCount error");
|
||||||
}
|
}
|
||||||
|
@ -64,11 +64,11 @@ public class NacosRoleServiceImpl {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private PermissionPersistService permissionPersistService;
|
private PermissionPersistService permissionPersistService;
|
||||||
|
|
||||||
private final Set<String> roleSet = new ConcurrentHashSet<>();
|
private volatile Set<String> roleSet = new ConcurrentHashSet<>();
|
||||||
|
|
||||||
private final Map<String, List<RoleInfo>> roleInfoMap = new ConcurrentHashMap<>();
|
private volatile Map<String, List<RoleInfo>> roleInfoMap = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
private final Map<String, List<PermissionInfo>> permissionInfoMap = new ConcurrentHashMap<>();
|
private volatile Map<String, List<PermissionInfo>> permissionInfoMap = new ConcurrentHashMap<>();
|
||||||
|
|
||||||
@Scheduled(initialDelay = 5000, fixedDelay = 15000)
|
@Scheduled(initialDelay = 5000, fixedDelay = 15000)
|
||||||
private void reload() {
|
private void reload() {
|
||||||
@ -95,9 +95,9 @@ public class NacosRoleServiceImpl {
|
|||||||
tmpPermissionInfoMap.put(role, permissionInfoPage.getPageItems());
|
tmpPermissionInfoMap.put(role, permissionInfoPage.getPageItems());
|
||||||
}
|
}
|
||||||
|
|
||||||
roleSet.addAll(tmpRoleSet);
|
roleSet = tmpRoleSet;
|
||||||
roleInfoMap.putAll(tmpRoleInfoMap);
|
roleInfoMap = tmpRoleInfoMap;
|
||||||
permissionInfoMap.putAll(tmpPermissionInfoMap);
|
permissionInfoMap = tmpPermissionInfoMap;
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
Loggers.AUTH.warn("[LOAD-ROLES] load failed", e);
|
Loggers.AUTH.warn("[LOAD-ROLES] load failed", e);
|
||||||
}
|
}
|
||||||
|
@ -528,7 +528,7 @@ const request = (function(_global) {
|
|||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
[401, 403].includes(status) &&
|
[401, 403].includes(status) &&
|
||||||
['unknown user!', 'token invalid', 'token expired!'].includes(responseJSON.message)
|
['unknown user!', 'token invalid!', 'token expired!'].includes(responseJSON.message)
|
||||||
) {
|
) {
|
||||||
goLogin();
|
goLogin();
|
||||||
}
|
}
|
||||||
|
@ -85,7 +85,7 @@ const request = () => {
|
|||||||
|
|
||||||
if (
|
if (
|
||||||
[401, 403].includes(status) &&
|
[401, 403].includes(status) &&
|
||||||
['unknown user!', 'token invalid', 'token expired!'].includes(message)
|
['unknown user!', 'token invalid!', 'token expired!'].includes(message)
|
||||||
) {
|
) {
|
||||||
goLogin();
|
goLogin();
|
||||||
}
|
}
|
||||||
|
@ -24,7 +24,7 @@ set BASE_DIR="%BASE_DIR:~0,-5%"
|
|||||||
set DEFAULT_SEARCH_LOCATIONS="classpath:/,classpath:/config/,file:./,file:./config/"
|
set DEFAULT_SEARCH_LOCATIONS="classpath:/,classpath:/config/,file:./,file:./config/"
|
||||||
set CUSTOM_SEARCH_LOCATIONS=%DEFAULT_SEARCH_LOCATIONS%,file:%BASE_DIR%/conf/
|
set CUSTOM_SEARCH_LOCATIONS=%DEFAULT_SEARCH_LOCATIONS%,file:%BASE_DIR%/conf/
|
||||||
|
|
||||||
set MODE="standalone"
|
set MODE="cluster"
|
||||||
set FUNCTION_MODE="all"
|
set FUNCTION_MODE="all"
|
||||||
set SERVER=nacos-server
|
set SERVER=nacos-server
|
||||||
set MODE_INDEX=-1
|
set MODE_INDEX=-1
|
||||||
@ -36,46 +36,61 @@ set EMBEDDED_STORAGE=""
|
|||||||
|
|
||||||
set i=0
|
set i=0
|
||||||
for %%a in (%*) do (
|
for %%a in (%*) do (
|
||||||
if "%%a" == "-m" ( set /a MODE_INDEX=!i!+1 )
|
if "%%a" == "-m" ( set /a MODE_INDEX=!i!+1 )
|
||||||
if "%%a" == "-f" ( set /a FUNCTION_MODE_INDEX=!i!+1 )
|
if "%%a" == "-f" ( set /a FUNCTION_MODE_INDEX=!i!+1 )
|
||||||
if "%%a" == "-s" ( set /a SERVER_INDEX=!i!+1 )
|
if "%%a" == "-s" ( set /a SERVER_INDEX=!i!+1 )
|
||||||
if "%%a" == "-p" ( set /a EMBEDDED_STORAGE_INDEX=!i!+1 )
|
if "%%a" == "-p" ( set /a EMBEDDED_STORAGE_INDEX=!i!+1 )
|
||||||
set /a i+=1
|
set /a i+=1
|
||||||
)
|
)
|
||||||
|
|
||||||
set i=0
|
set i=0
|
||||||
for %%a in (%*) do (
|
for %%a in (%*) do (
|
||||||
if %MODE_INDEX% == !i! ( set MODE="%%a" )
|
if %MODE_INDEX% == !i! ( set MODE="%%a" )
|
||||||
if %FUNCTION_MODE_INDEX% == !i! ( set FUNCTION_MODE="%%a" )
|
if %FUNCTION_MODE_INDEX% == !i! ( set FUNCTION_MODE="%%a" )
|
||||||
if %SERVER_INDEX% == !i! (set SERVER="%%a")
|
if %SERVER_INDEX% == !i! (set SERVER="%%a")
|
||||||
if %EMBEDDED_STORAGE_INDEX% == !i! (set EMBEDDED_STORAGE="%%a")
|
if %EMBEDDED_STORAGE_INDEX% == !i! (set EMBEDDED_STORAGE="%%a")
|
||||||
set /a i+=1
|
set /a i+=1
|
||||||
)
|
)
|
||||||
|
|
||||||
|
rem if nacos startup mode is standalone
|
||||||
if %MODE% == "standalone" (
|
if %MODE% == "standalone" (
|
||||||
set "JAVA_OPT=%JAVA_OPT% -Xms512m -Xmx512m -Xmn256m"
|
echo "nacos is starting with standalone"
|
||||||
set "JAVA_OPT=%JAVA_OPT% -Dnacos.standalone=true"
|
set "NACOS_OPTS=-Dnacos.standalone=true"
|
||||||
) else (
|
set "NACOS_JVM_OPTS=-Xms512m -Xmx512m -Xmn256m"
|
||||||
if %EMBEDDED_STORAGE% == "embedded" (
|
|
||||||
set "JAVA_OPT=%JAVA_OPT% -DembeddedStorage=true"
|
|
||||||
)
|
|
||||||
set "JAVA_OPT=%JAVA_OPT% -server -Xms2g -Xmx2g -Xmn1g -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m"
|
|
||||||
set "JAVA_OPT=%JAVA_OPT% -XX:-OmitStackTraceInFastThrow XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=%BASE_DIR%\logs\java_heapdump.hprof"
|
|
||||||
set "JAVA_OPT=%JAVA_OPT% -XX:-UseLargePages"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
|
rem if nacos startup mode is cluster
|
||||||
|
if %MODE% == "cluster" (
|
||||||
|
echo "nacos is starting with cluster"
|
||||||
|
if %EMBEDDED_STORAGE% == "embedded" (
|
||||||
|
set "NACOS_OPTS=-DembeddedStorage=true"
|
||||||
|
)
|
||||||
|
|
||||||
|
set "NACOS_JVM_OPTS=-server -Xms2g -Xmx2g -Xmn1g -XX:MetaspaceSize=128m -XX:MaxMetaspaceSize=320m -XX:-OmitStackTraceInFastThrow -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=%BASE_DIR%\logs\java_heapdump.hprof -XX:-UseLargePages"
|
||||||
|
)
|
||||||
|
|
||||||
|
rem set nacos's functionMode
|
||||||
if %FUNCTION_MODE% == "config" (
|
if %FUNCTION_MODE% == "config" (
|
||||||
set "JAVA_OPT=%JAVA_OPT% -Dnacos.functionMode=config"
|
set "NACOS_OPTS=%NACOS_OPTS% -Dnacos.functionMode=config"
|
||||||
)
|
)
|
||||||
|
|
||||||
if %FUNCTION_MODE% == "naming" (
|
if %FUNCTION_MODE% == "naming" (
|
||||||
set "JAVA_OPT=%JAVA_OPT% -Dnacos.functionMode=naming"
|
set "NACOS_OPTS=%NACOS_OPTS% -Dnacos.functionMode=naming"
|
||||||
)
|
)
|
||||||
|
|
||||||
set "JAVA_OPT=%JAVA_OPT% -Dloader.path=%BASE_DIR%/plugins/health,%BASE_DIR%/plugins/cmdb"
|
rem set nacos options
|
||||||
|
set "NACOS_OPTS=%NACOS_OPTS% -Dloader.path=%BASE_DIR%/plugins/health,%BASE_DIR%/plugins/cmdb"
|
||||||
|
set "NACOS_OPTS=%NACOS_OPTS% -Dnacos.home=%BASE_DIR%"
|
||||||
|
set "NACOS_OPTS=%NACOS_OPTS% -jar %BASE_DIR%\target\%SERVER%.jar"
|
||||||
|
|
||||||
set "JAVA_OPT=%JAVA_OPT% -Dnacos.home=%BASE_DIR%"
|
rem set nacos spring config location
|
||||||
set "JAVA_OPT=%JAVA_OPT% -jar %BASE_DIR%\target\%SERVER%.jar"
|
set "NACOS_CONFIG_OPTS=--spring.config.location=%CUSTOM_SEARCH_LOCATIONS%"
|
||||||
set "JAVA_OPT=%JAVA_OPT% --spring.config.location=%CUSTOM_SEARCH_LOCATIONS%"
|
|
||||||
set "JAVA_OPT=%JAVA_OPT% --logging.config=%BASE_DIR%/conf/nacos-logback.xml"
|
|
||||||
|
|
||||||
call "%JAVA%" %JAVA_OPT% nacos.nacos %*
|
rem set nacos log4j file location
|
||||||
|
set "NACOS_LOG4J_OPTS=--logging.config=%BASE_DIR%/conf/nacos-logback.xml"
|
||||||
|
|
||||||
|
|
||||||
|
set COMMAND="%JAVA%" %NACOS_JVM_OPTS% %NACOS_OPTS% %NACOS_CONFIG_OPTS% %NACOS_LOG4J_OPTS% nacos.nacos %*
|
||||||
|
|
||||||
|
rem start nacos command
|
||||||
|
%COMMAND%
|
@ -55,7 +55,7 @@
|
|||||||
<file>
|
<file>
|
||||||
<!--打好的jar包名称和放置目录-->
|
<!--打好的jar包名称和放置目录-->
|
||||||
<source>../console/target/nacos-server.jar</source>
|
<source>../console/target/nacos-server.jar</source>
|
||||||
<outputDirectory>/target/</outputDirectory>
|
<outputDirectory>target/</outputDirectory>
|
||||||
</file>
|
</file>
|
||||||
</files>
|
</files>
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ import com.alibaba.nacos.api.common.Constants;
|
|||||||
import com.alibaba.nacos.api.exception.NacosException;
|
import com.alibaba.nacos.api.exception.NacosException;
|
||||||
import com.alibaba.nacos.api.naming.CommonParams;
|
import com.alibaba.nacos.api.naming.CommonParams;
|
||||||
import com.alibaba.nacos.api.naming.NamingResponseCode;
|
import com.alibaba.nacos.api.naming.NamingResponseCode;
|
||||||
|
import com.alibaba.nacos.api.naming.PreservedMetadataKeys;
|
||||||
import com.alibaba.nacos.api.naming.utils.NamingUtils;
|
import com.alibaba.nacos.api.naming.utils.NamingUtils;
|
||||||
import com.alibaba.nacos.common.utils.JacksonUtils;
|
import com.alibaba.nacos.common.utils.JacksonUtils;
|
||||||
import com.alibaba.nacos.core.auth.ActionTypes;
|
import com.alibaba.nacos.core.auth.ActionTypes;
|
||||||
@ -322,7 +323,7 @@ public class InstanceController {
|
|||||||
public ObjectNode beat(HttpServletRequest request) throws Exception {
|
public ObjectNode beat(HttpServletRequest request) throws Exception {
|
||||||
|
|
||||||
ObjectNode result = JacksonUtils.createEmptyJsonNode();
|
ObjectNode result = JacksonUtils.createEmptyJsonNode();
|
||||||
result.put("clientBeatInterval", switchDomain.getClientBeatInterval());
|
result.put(SwitchEntry.CLIENT_BEAT_INTERVAL, switchDomain.getClientBeatInterval());
|
||||||
|
|
||||||
String beat = WebUtils.optional(request, "beat", StringUtils.EMPTY);
|
String beat = WebUtils.optional(request, "beat", StringUtils.EMPTY);
|
||||||
RsInfo clientBeat = null;
|
RsInfo clientBeat = null;
|
||||||
@ -385,7 +386,9 @@ public class InstanceController {
|
|||||||
service.processClientBeat(clientBeat);
|
service.processClientBeat(clientBeat);
|
||||||
|
|
||||||
result.put(CommonParams.CODE, NamingResponseCode.OK);
|
result.put(CommonParams.CODE, NamingResponseCode.OK);
|
||||||
result.put("clientBeatInterval", instance.getInstanceHeartBeatInterval());
|
if (instance.containsMetadata(PreservedMetadataKeys.HEART_BEAT_INTERVAL)) {
|
||||||
|
result.put(SwitchEntry.CLIENT_BEAT_INTERVAL, instance.getInstanceHeartBeatInterval());
|
||||||
|
}
|
||||||
result.put(SwitchEntry.LIGHT_BEAT_ENABLED, switchDomain.isLightBeatEnabled());
|
result.put(SwitchEntry.LIGHT_BEAT_ENABLED, switchDomain.isLightBeatEnabled());
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
@ -21,8 +21,8 @@ import com.alibaba.nacos.api.exception.NacosException;
|
|||||||
import com.alibaba.nacos.common.http.HttpClientBeanHolder;
|
import com.alibaba.nacos.common.http.HttpClientBeanHolder;
|
||||||
import com.alibaba.nacos.common.http.HttpRestResult;
|
import com.alibaba.nacos.common.http.HttpRestResult;
|
||||||
import com.alibaba.nacos.common.http.client.HttpClientRequestInterceptor;
|
import com.alibaba.nacos.common.http.client.HttpClientRequestInterceptor;
|
||||||
import com.alibaba.nacos.common.http.client.HttpClientResponse;
|
|
||||||
import com.alibaba.nacos.common.http.client.NacosRestTemplate;
|
import com.alibaba.nacos.common.http.client.NacosRestTemplate;
|
||||||
|
import com.alibaba.nacos.common.http.client.response.HttpClientResponse;
|
||||||
import com.alibaba.nacos.common.http.param.Header;
|
import com.alibaba.nacos.common.http.param.Header;
|
||||||
import com.alibaba.nacos.common.http.param.Query;
|
import com.alibaba.nacos.common.http.param.Query;
|
||||||
import com.alibaba.nacos.common.model.RequestHttpEntity;
|
import com.alibaba.nacos.common.model.RequestHttpEntity;
|
||||||
|
Loading…
Reference in New Issue
Block a user