diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000000000000000000000000000000000000..6e7fb6b4ac7048604883304adbeb6af9f7a98b79 --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,18 @@ +# To get started with Dependabot version updates, you'll need to specify which +# package ecosystems to update and where the package manifests are located. +# Please see the documentation for all configuration options: +# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates + +version: 2 +updates: + - package-ecosystem: "gomod" # See documentation for possible values + directory: "/" # Location of package manifests + schedule: + interval: "daily" + + - package-ecosystem: "github-actions" + # Workflow files stored in the + # default location of `.github/workflows` + directory: "/" + schedule: + interval: "daily" \ No newline at end of file diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml new file mode 100644 index 0000000000000000000000000000000000000000..f2e185cc1eb21e0ac3458f06ef21c407c8e0d06f --- /dev/null +++ b/.github/workflows/codeql-analysis.yml @@ -0,0 +1,54 @@ +name: "CodeQL" + +on: + push: + branches: [master, ] + pull_request: + # The branches below must be a subset of the branches above + branches: [master] + schedule: + - cron: '0 4 * * 5' + +jobs: + analyse: + name: Analyse + runs-on: ubuntu-latest + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + with: + # We must fetch at least the immediate parents so that if this is + # a pull request then we can checkout the head. + fetch-depth: 2 + + # If this run was triggered by a pull request event, then checkout + # the head of the pull request instead of the merge commit. + - run: git checkout HEAD^2 + if: ${{ github.event_name == 'pull_request' }} + + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + # Override language selection by uncommenting this and choosing your languages + # with: + # languages: go, javascript, csharp, python, cpp, java + + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v1 + + # ℹ️ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl + + # ✏️ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language + + #- run: | + # make bootstrap + # make release + + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/github-actions.yml b/.github/workflows/github-actions.yml index 7875ca65968a430e03583f91a82784118963e4bc..a585029b03331736773282d043e7d743fd1bb2f9 100644 --- a/.github/workflows/github-actions.yml +++ b/.github/workflows/github-actions.yml @@ -50,18 +50,13 @@ jobs: go get -v -t -d ./... fi - - name: License Check + - name: Verify run: | - go fmt ./... && [[ -z `git status -s` ]] - sh before_validate_license.sh - chmod u+x /tmp/tools/license/license-header-checker - /tmp/tools/license/license-header-checker -v -a -r -i vendor /tmp/tools/license/license.txt . go && [[ -z `git status -s` ]] + make verify - - name: Test + - name: Integrate Test run: | - chmod u+x before_ut.sh && ./before_ut.sh - go mod vendor && go test ./... -coverprofile=coverage.txt -covermode=atomic chmod +x integrate_test.sh && ./integrate_test.sh - - name: Coverage + - name: Post Coverage run: bash <(curl -s https://codecov.io/bash) \ No newline at end of file diff --git a/.gitignore b/.gitignore index 8158b497e3620a15fc5a52e91020e1fcebd5be41..898962e244d0ba1d030837f76fed47576f38ab5e 100644 --- a/.gitignore +++ b/.gitignore @@ -36,3 +36,5 @@ config_center/apollo/mockDubbog.properties.json # vim stuff *~ .*.sw? +/license-header-checker-linux/ +/license-header-checker-linux.zip diff --git a/.travis.yml b/.travis.yml index 566c88ece05bd80175eea2d1de8fd061a279e273..7b338c277962b1aa4defbf0b285d58cc7c503dbe 100644 --- a/.travis.yml +++ b/.travis.yml @@ -16,15 +16,7 @@ install: true # define ci-stage script: # license-check - - echo 'start license check' - - go fmt ./... && [[ -z `git status -s` ]] - - sh before_validate_license.sh - - chmod u+x /tmp/tools/license/license-header-checker - - /tmp/tools/license/license-header-checker -v -a -r -i vendor /tmp/tools/license/license.txt . go && [[ -z `git status -s` ]] - # unit-test - - echo 'start unit-test' - - chmod u+x before_ut.sh && ./before_ut.sh - - go mod vendor && go test ./... -coverprofile=coverage.txt -covermode=atomic + - make verify # integrate-test - chmod +x integrate_test.sh && ./integrate_test.sh diff --git a/CHANGE.md b/CHANGE.md index 90cb5a1443e8062125cbb9f2b3cc0ac1cf759d06..a2849f40648b89d2c7fb9d7f180bfedb729e71d4 100644 --- a/CHANGE.md +++ b/CHANGE.md @@ -1,6 +1,51 @@ # Release Notes --- +## 1.5.4 + +### Bugfixes +- [Fix etcd cluster reconnect](https://github.com/apache/dubbo-go/pull/828) +- [Fix zookeeper deadlock problem](https://github.com/apache/dubbo-go/pull/826) +- [Fix generic struct2MapAll](https://github.com/apache/dubbo-go/pull/822) +- [Fix Consumer panic when restart provider](https://github.com/apache/dubbo-go/pull/803) +- [Fix etcd can not registry](https://github.com/apache/dubbo-go/pull/819) [@lin-jianjun](https://github.com/lin-jianjun) +- [Fix cannot call go provider service when used by java dubbo 2.7.7 version](https://github.com/apache/dubbo-go/pull/815) [@jack15083](https://github.com/jack15083) +- [Fix go client quit abnormally when it connects java server](https://github.com/apache/dubbo-go/pull/820) [@wenxuwan](https://github.com/wenxuwan) +- [Fix sentinel windows issue](https://github.com/apache/dubbo-go/pull/821) [@louyuting](https://github.com/louyuting) +- [Fix metadata default port](https://github.com/apache/dubbo-go/pull/821) [@sanxun0325](https://github.com/sanxun0325) +- [Fix consul can not destory](https://github.com/apache/dubbo-go/pull/788) [@LaurenceLiZhixin](https://github.com/LaurenceLiZhixin) + +Milestone: [https://github.com/apache/dubbo-go/milestone/6](https://github.com/apache/dubbo-go/milestone/6?closed=1) + +## 1.5.3 + +### New Features +- [Add consul service discovery](https://github.com/apache/dubbo-go/pull/701) [@zhangshen023](https://github.com/zhangshen023) +- [Add File system service discovery](https://github.com/apache/dubbo-go/pull/732) [@DogBaoBao](https://github.com/DogBaoBao) +- [Migrate travis Ci to Github Actions](https://github.com/apache/dubbo-go/pull/752) [@sdttttt](https://github.com/sdttttt) +- [Add sentinel-golang flow control/circuit breaker](https://github.com/apache/dubbo-go/pull/748) [@louyuting](https://github.com/louyuting) +- [Add dubbo-go docs and blog into doc directory](https://github.com/apache/dubbo-go/pull/767) [@oaoit](https://github.com/oaoit) + +### Enhancement +- [Add address notification batch mode](https://github.com/apache/dubbo-go/pull/741) [@beiwei30](https://github.com/beiwei30) +- [Refactor network and codec model](https://github.com/apache/dubbo-go/pull/673) [@fangyincheng](https://github.com/fangyincheng) [@georgehao](https://github.com/georgehao) +- [Remove unnecessary return and judgement](https://github.com/apache/dubbo-go/pull/730) [@YongHaoWu](https://github.com/YongHaoWu) +- [Improve exporter append method](https://github.com/apache/dubbo-go/pull/722) [@gaoxinge](https://github.com/gaoxinge) +- [Refactor for proxyInvoker cannot be extended](https://github.com/apache/dubbo-go/pull/747) [@cvictory](https://github.com/cvictory) +- [Refactor attachment type from map\[string\]stiring to map\[string\]interface{}](https://github.com/apache/dubbo-go/pull/713) [@cvictory](https://github.com/cvictory) +- [Improve map access concurrency](https://github.com/apache/dubbo-go/pull/739) [@skyao](https://github.com/skyao) +- [Improve code quantity](https://github.com/apache/dubbo-go/pull/763) [@gaoxinge](https://github.com/gaoxinge) + +### Bugfixes +- [Fix etcdv3 lease](https://github.com/apache/dubbo-go/pull/738) [@zhangshen023](https://github.com/zhangshen023) +- [Fix rename SethealthChecker to SetHealthChecker](https://github.com/apache/dubbo-go/pull/746) [@watermelo](https://github.com/watermelo) +- [Fix init config problem in HystrixFilter](https://github.com/apache/dubbo-go/pull/731) [@YGrylls](https://github.com/YGrylls) +- [Fix zookeeper listener report error after started](https://github.com/apache/dubbo-go/pull/735) [@wenxuwan](https://github.com/wenxuwan) + +Milestone: [https://github.com/apache/dubbo-go/milestone/4](https://github.com/apache/dubbo-go/milestone/4?closed=1) + +Project: [https://github.com/apache/dubbo-go/projects/10](https://github.com/apache/dubbo-go/projects/10) + ## 1.5.1 ### New Features diff --git a/Makefile b/Makefile new file mode 100644 index 0000000000000000000000000000000000000000..2f6c9bd4e21a56fa4a6060db8795ba6e716160bb --- /dev/null +++ b/Makefile @@ -0,0 +1,76 @@ +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with +# this work for additional information regarding copyright ownership. +# The ASF licenses this file to You under the Apache License, Version 2.0 +# (the "License"); you may not use this file except in compliance with +# the License. You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +VERSION ?= latest + +GO = go +GO_PATH = $(shell $(GO) env GOPATH) +GO_OS = $(shell $(GO) env GOOS) +ifeq ($(GO_OS), darwin) + GO_OS = mac +endif +GO_BUILD = $(GO) build +GO_GET = $(GO) get +GO_TEST = $(GO) test +GO_BUILD_FLAGS = -v +GO_BUILD_LDFLAGS = -X main.version=$(VERSION) + +GO_LICENSE_CHECKER_DIR = license-header-checker-$(GO_OS) +GO_LICENSE_CHECKER = $(GO_PATH)/bin/license-header-checker +LICENSE_DIR = /tmp/tools/license + +ARCH = amd64 +# for add zookeeper fatjar +ZK_TEST_LIST=config_center/zookeeper registry/zookeeper cluster/router/chain cluster/router/condition cluster/router/tag metadata/report/zookeeper +ZK_JAR_NAME=zookeeper-3.4.9-fatjar.jar +ZK_FATJAR_BASE=/zookeeper-4unittest/contrib/fatjar +ZK_JAR_PATH=remoting/zookeeper$(ZK_FATJAR_BASE) +ZK_JAR=$(ZK_JAR_PATH)/$(ZK_JAR_NAME) + +SHELL = /bin/bash + +prepareLic: + $(GO_LICENSE_CHECKER) -version || (wget https://github.com/lsm-dev/license-header-checker/releases/download/v1.2.0/$(GO_LICENSE_CHECKER_DIR).zip -O $(GO_LICENSE_CHECKER_DIR).zip && unzip -o $(GO_LICENSE_CHECKER_DIR).zip && mkdir -p $(GO_PATH)/bin/ && cp $(GO_LICENSE_CHECKER_DIR)/64bit/license-header-checker $(GO_PATH)/bin/) + ls /tmp/tools/license/license.txt || wget -P $(LICENSE_DIR) https://github.com/dubbogo/resources/raw/master/tools/license/license.txt + +prepareZk: + ls $(ZK_JAR) || (mkdir -p $(ZK_JAR_PATH)&& wget -P $(ZK_JAR_PATH) https://github.com/dubbogo/resources/raw/master/zookeeper-4unitest/contrib/fatjar/${ZK_JAR_NAME}) + @for i in $(ZK_TEST_LIST); do \ + mkdir -p $$i$(ZK_FATJAR_BASE);\ + cp ${ZK_JAR} $$i$(ZK_FATJAR_BASE);\ + done + +prepare: prepareZk prepareLic + +.PHONE: test +test: clean prepareZk + $(GO_TEST) ./... -coverprofile=coverage.txt -covermode=atomic + +deps: prepare + $(GO_GET) -v -t -d ./... + +.PHONY: license +license: clean prepareLic + $(GO_LICENSE_CHECKER) -v -a -r -i vendor $(LICENSE_DIR)/license.txt . go && [[ -z `git status -s` ]] + +.PHONY: verify +verify: clean license test + +.PHONY: clean +clean: prepare + rm -rf coverage.txt + rm -rf license-header-checker* diff --git a/README.md b/README.md index 9e1edd3af1cd8957b1daa9b9fe2cadf121bc2d6d..bf0a5e9a64cb240de7b9a410f0e879401d9aa266 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,12 @@ Apache License, Version 2.0 ## Release note ## +[v1.5.4 - Nov 1, 2020](https://github.com/apache/dubbo-go/releases/tag/v1.5.4) + +[v1.5.3 - Sep 23, 2020](https://github.com/apache/dubbo-go/releases/tag/v1.5.3) + +[v1.5.2 - discard]() + [v1.5.1 - Aug 23, 2020](https://github.com/apache/dubbo-go/releases/tag/v1.5.1) [v1.5.0 - July 24, 2020](https://github.com/apache/dubbo-go/releases/tag/v1.5.0) @@ -60,7 +66,7 @@ Finished List: * Jsonrpc2.0 * [gRPC](https://github.com/apache/dubbo-go/pull/311) * [RESTful](https://github.com/apache/dubbo-go/pull/352) - + - Router * [Condition router](https://github.com/apache/dubbo-go/pull/294) * [Health check router](https://github.com/apache/dubbo-go/pull/389) @@ -105,7 +111,7 @@ Finished List: - Invoke * [generic invoke](https://github.com/apache/dubbo-go/pull/122) - + - Monitor * Opentracing API * [Prometheus](https://github.com/apache/dubbo-go/pull/342) @@ -144,28 +150,26 @@ https://dubbogo.github.io/dubbo-go-website (**Improving**) ## Quick Start -[dubbo-samples/golang](https://github.com/dubbogo/dubbo-samples) shows how to use dubbo-go. Please read the [dubbo-samples/golang/README.md](https://github.com/dubbogo/dubbo-samples/blob/master/golang/README.md) carefully to learn how to dispose the configuration and compile the program. +[dubbo-go-samples](https://github.com/apache/dubbo-go-samples) shows how to use dubbo-go. Please read the [dubbo-samples/golang/README.md](https://github.com/apache/dubbo-go-samples/blob/master/README.md) carefully to learn how to dispose the configuration and compile the program. ## Running unit tests -### Prepare +### Run -Mac/Linux ```bash -sh ./before_ut.sh +make verify ``` -Windows +### Verify license + ```bash -before_ut.bat +make license ``` -### Run -```bash -go test ./... +### Run unit test -# coverage -go test ./... -coverprofile=coverage.txt -covermode=atomic +```bash +make test ``` ## Build @@ -212,6 +216,19 @@ If you are using [apache/dubbo-go](github.com/apache/dubbo-go) and think that it <img width="222px" src="https://raw.githubusercontent.com/mosn/community/master/icons/png/mosn-labeled-horizontal.png"> </a> </td> + <td align="center" valign="middle"> + <a href="" target="_blank"> + <img width="222px" src="https://festatic.estudy.cn/assets/xhx-web/layout/logo.png"> + </a> + </td> + </tr> + <tr></tr> + <tr> + <td align="center" valign="middle"> + <a href="http://www.j.cn" target="_blank"> + <img width="222px" src="http://image.guang.j.cn/bbs/imgs/home/pc/icon_8500.png"> + </a> + </td> </tr> <tr></tr> </tbody> diff --git a/README_CN.md b/README_CN.md index b76d8983deae427f9317c4f930f0e06da479f484..5b83e8b79f9ed81442ba6ee9cf56758feac1c016 100644 --- a/README_CN.md +++ b/README_CN.md @@ -15,6 +15,14 @@ Apache License, Version 2.0 ## 发布日志 ## +[v1.5.4 - 2020年11月1日](https://github.com/apache/dubbo-go/releases/tag/v1.5.4) + +[v1.5.3 - 2020年9月23日](https://github.com/apache/dubbo-go/releases/tag/v1.5.3) + +[v1.5.2 - 舍弃]() + +[v1.5.1 - 2020年8月23日](https://github.com/apache/dubbo-go/releases/tag/v1.5.1) + [v1.5.0 - 2020年7月24日](https://github.com/apache/dubbo-go/releases/tag/v1.5.0) [v1.4.0 - 2020年3月17日](https://github.com/apache/dubbo-go/releases/tag/v1.4.0) @@ -95,6 +103,7 @@ Apache License, Version 2.0 * [AccessLogFilter](https://github.com/apache/dubbo-go/pull/214) * [TpsLimitFilter](https://github.com/apache/dubbo-go/pull/237) * [ExecuteLimitFilter](https://github.com/apache/dubbo-go/pull/246) + * [GenericServiceFilter](https://github.com/apache/dubbo-go/pull/291) * [Auth/Sign](https://github.com/apache/dubbo-go/pull/323) * [Metrics filter](https://github.com/apache/dubbo-go/pull/342) * [Tracing filter](https://github.com/apache/dubbo-go/pull/335) @@ -144,29 +153,27 @@ https://dubbogo.github.io/dubbo-go-website (**完善中**) ## 运行单测 -### 准备 +### 执行全部校验 -Mac/Linux ```bash -sh ./before_ut.sh +make verify ``` -Windows +### 校验许可证 + ```bash -before_ut.bat +make license ``` -### 执行 -```bash -go test ./... +### 执行单元测试 -# coverage -go test ./... -coverprofile=coverage.txt -covermode=atomic +```bash +make test ``` ## 编译 -请移步 [dubbo-samples/golang](https://github.com/dubbogo/dubbo-samples) +请移步 [dubbo-go-samples](https://github.com/apache/dubbo-go-samples) ## 如何贡献 @@ -207,8 +214,21 @@ go test ./... -coverprofile=coverage.txt -covermode=atomic <img width="222px" src="https://raw.githubusercontent.com/mosn/community/master/icons/png/mosn-labeled-horizontal.png"> </a> </td> + <td align="center" valign="middle"> + <a href="" target="_blank"> + <img width="222px" src="https://festatic.estudy.cn/assets/xhx-web/layout/logo.png"> + </a> + </td> + </tr> + <tr></tr> + <tr> + <td align="center" valign="middle"> + <a href="http://www.j.cn" target="_blank"> + <img width="222px" src="http://image.guang.j.cn/bbs/imgs/home/pc/icon_8500.png"> + </a> + </td> </tr> <tr></tr> </tbody> </table> -</div> +</div> \ No newline at end of file diff --git a/before_ut.bat b/before_ut.bat deleted file mode 100644 index b8d72e4a873ef4ff9653c6f16ebd4378ce1ee172..0000000000000000000000000000000000000000 --- a/before_ut.bat +++ /dev/null @@ -1,43 +0,0 @@ -:: -:: Licensed to the Apache Software Foundation (ASF) under one or more -:: contributor license agreements. See the NOTICE file distributed with -:: this work for additional information regarding copyright ownership. -:: The ASF licenses this file to You under the Apache License, Version 2.0 -:: (the "License"); you may not use this file except in compliance with -:: the License. You may obtain a copy of the License at -:: -:: http://www.apache.org/licenses/LICENSE-2.0 -:: -:: Unless required by applicable law or agreed to in writing, software -:: distributed under the License is distributed on an "AS IS" BASIS, -:: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -:: See the License for the specific language governing permissions and -:: limitations under the License. - -set zkJarName=zookeeper-3.4.9-fatjar.jar -set remoteJarUrl="https://github.com/dubbogo/resources/raw/master/zookeeper-4unitest/contrib/fatjar/%zkJarName%" -set zkJarPath=remoting/zookeeper/zookeeper-4unittest/contrib/fatjar -set zkJar=%zkJarPath%/%zkJarName% - -if not exist "%zkJar%" ( - md "%zkJarPath%" - curl -L %remoteJarUrl% -o %zkJar% -) - -md config_center\zookeeper\zookeeper-4unittest\contrib\fatjar -xcopy /f "%zkJar%" "config_center/zookeeper/zookeeper-4unittest/contrib/fatjar/" - -md registry\zookeeper\zookeeper-4unittest\contrib\fatjar -xcopy /f "%zkJar%" "registry/zookeeper/zookeeper-4unittest/contrib/fatjar/" - -md cluster\router\chain\zookeeper-4unittest\contrib\fatjar -xcopy /f "%zkJar%" "cluster/router/chain/zookeeper-4unittest/contrib/fatjar/" - -md cluster\router\condition\zookeeper-4unittest\contrib\fatjar -xcopy /f "%zkJar%" "cluster/router/condition/zookeeper-4unittest/contrib/fatjar/" - -md cluster/router/tag/zookeeper-4unittest/contrib/fatjar -xcopy /f "%zkJar%" "cluster/router/tag/zookeeper-4unittest/contrib/fatjar/" - -md metadata\report\zookeeper\zookeeper-4unittest\contrib\fatjar -xcopy /f "%zkJar%" "metadata/report/zookeeper/zookeeper-4unittest/contrib/fatjar/" \ No newline at end of file diff --git a/before_ut.sh b/before_ut.sh deleted file mode 100755 index b55e424ef72b33181b2ea40fdb37ac319110aec0..0000000000000000000000000000000000000000 --- a/before_ut.sh +++ /dev/null @@ -1,43 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -zkJarName="zookeeper-3.4.9-fatjar.jar" -remoteJarUrl="https://github.com/dubbogo/resources/raw/master/zookeeper-4unitest/contrib/fatjar/${zkJarName}" -zkJarPath="remoting/zookeeper/zookeeper-4unittest/contrib/fatjar" -zkJar="${zkJarPath}/${zkJarName}" - -if [ ! -f "${zkJar}" ]; then - mkdir -p ${zkJarPath} - wget -P "${zkJarPath}" ${remoteJarUrl} -fi - -mkdir -p config_center/zookeeper/zookeeper-4unittest/contrib/fatjar -cp ${zkJar} config_center/zookeeper/zookeeper-4unittest/contrib/fatjar - -mkdir -p registry/zookeeper/zookeeper-4unittest/contrib/fatjar -cp ${zkJar} registry/zookeeper/zookeeper-4unittest/contrib/fatjar - -mkdir -p cluster/router/chain/zookeeper-4unittest/contrib/fatjar -cp ${zkJar} cluster/router/chain/zookeeper-4unittest/contrib/fatjar - -mkdir -p cluster/router/condition/zookeeper-4unittest/contrib/fatjar -cp ${zkJar} cluster/router/condition/zookeeper-4unittest/contrib/fatjar - -mkdir -p cluster/router/tag/zookeeper-4unittest/contrib/fatjar -cp ${zkJar} cluster/router/tag/zookeeper-4unittest/contrib/fatjar - -mkdir -p metadata/report/zookeeper/zookeeper-4unittest/contrib/fatjar -cp ${zkJar} metadata/report/zookeeper/zookeeper-4unittest/contrib/fatjar \ No newline at end of file diff --git a/before_validate_license.sh b/before_validate_license.sh deleted file mode 100644 index 8fa6e381c7a4cd44835d107ba9213f685f899a10..0000000000000000000000000000000000000000 --- a/before_validate_license.sh +++ /dev/null @@ -1,26 +0,0 @@ -# -# Licensed to the Apache Software Foundation (ASF) under one or more -# contributor license agreements. See the NOTICE file distributed with -# this work for additional information regarding copyright ownership. -# The ASF licenses this file to You under the Apache License, Version 2.0 -# (the "License"); you may not use this file except in compliance with -# the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -remoteLicenseCheckerPath="https://github.com/dubbogo/resources/raw/master/tools/license" -remoteLicenseCheckerName="license-header-checker" -remoteLicenseCheckerURL="${remoteLicenseCheckerPath}/${remoteLicenseCheckerName}" -remoteLicenseName="license.txt" -remoteLicenseURL="${remoteLicenseCheckerPath}/${remoteLicenseName}" - -licensePath="/tmp/tools/license" -mkdir -p ${licensePath} -wget -P "${licensePath}" ${remoteLicenseCheckerURL} -wget -P "${licensePath}" ${remoteLicenseURL} diff --git a/cluster/cluster_impl/base_cluster_invoker.go b/cluster/cluster_impl/base_cluster_invoker.go index ced5b15cb9a1c2292ca866f6f7478ce2b23a30b9..0ac851f72752ab7f91ff3cd7bc9a9e462a927c57 100644 --- a/cluster/cluster_impl/base_cluster_invoker.go +++ b/cluster/cluster_impl/base_cluster_invoker.go @@ -22,7 +22,6 @@ import ( ) import ( - gxnet "github.com/dubbogo/gost/net" perrors "github.com/pkg/errors" "go.uber.org/atomic" ) @@ -32,6 +31,7 @@ import ( "github.com/apache/dubbo-go/common" "github.com/apache/dubbo-go/common/constant" "github.com/apache/dubbo-go/common/extension" + "github.com/apache/dubbo-go/common/logger" "github.com/apache/dubbo-go/protocol" ) @@ -72,7 +72,7 @@ func (invoker *baseClusterInvoker) IsAvailable() bool { //check invokers availables func (invoker *baseClusterInvoker) checkInvokers(invokers []protocol.Invoker, invocation protocol.Invocation) error { if len(invokers) == 0 { - ip, _ := gxnet.GetLocalIP() + ip := common.GetLocalIp() return perrors.Errorf("Failed to invoke the method %v. No provider available for the service %v from "+ "registry %v on the consumer %v using the dubbo version %v .Please check if the providers have been started and registered.", invocation.MethodName(), invoker.directory.GetUrl().SubURL.Key(), invoker.directory.GetUrl().String(), ip, constant.Version) @@ -84,7 +84,7 @@ func (invoker *baseClusterInvoker) checkInvokers(invokers []protocol.Invoker, in //check cluster invoker is destroyed or not func (invoker *baseClusterInvoker) checkWhetherDestroyed() error { if invoker.destroyed.Load() { - ip, _ := gxnet.GetLocalIP() + ip := common.GetLocalIp() return perrors.Errorf("Rpc cluster invoker for %v on consumer %v use dubbo version %v is now destroyed! can not invoke any more. ", invoker.directory.GetUrl().Service(), ip, constant.Version) } @@ -120,6 +120,10 @@ func (invoker *baseClusterInvoker) doSelect(lb cluster.LoadBalance, invocation p } func (invoker *baseClusterInvoker) doSelectInvoker(lb cluster.LoadBalance, invocation protocol.Invocation, invokers []protocol.Invoker, invoked []protocol.Invoker) protocol.Invoker { + if len(invokers) == 0 { + logger.Errorf("the invokers of %s is nil. ", invocation.Invoker().GetUrl().ServiceKey()) + return nil + } if len(invokers) == 1 { return invokers[0] } @@ -134,6 +138,8 @@ func (invoker *baseClusterInvoker) doSelectInvoker(lb cluster.LoadBalance, invoc for _, invoker := range invokers { if !invoker.IsAvailable() { + logger.Infof("the invoker of %s is not available, maybe some network error happened or the server is shutdown.", + invoker.GetUrl().Ip) continue } @@ -145,6 +151,7 @@ func (invoker *baseClusterInvoker) doSelectInvoker(lb cluster.LoadBalance, invoc if len(reslectInvokers) > 0 { selectedInvoker = lb.Select(reslectInvokers, invocation) } else { + logger.Errorf("all %d invokers is unavailable for %s.", len(invokers), selectedInvoker.GetUrl().String()) return nil } } diff --git a/cluster/cluster_impl/failover_cluster_invoker.go b/cluster/cluster_impl/failover_cluster_invoker.go index 4260a9324dd360ac24f80e425d8542a423c8815e..ca490e7f8e2ff44303abe7d695313153b7466a00 100644 --- a/cluster/cluster_impl/failover_cluster_invoker.go +++ b/cluster/cluster_impl/failover_cluster_invoker.go @@ -24,12 +24,12 @@ import ( ) import ( - gxnet "github.com/dubbogo/gost/net" perrors "github.com/pkg/errors" ) import ( "github.com/apache/dubbo-go/cluster" + "github.com/apache/dubbo-go/common" "github.com/apache/dubbo-go/common/constant" "github.com/apache/dubbo-go/common/logger" "github.com/apache/dubbo-go/protocol" @@ -51,6 +51,7 @@ func (invoker *failoverClusterInvoker) Invoke(ctx context.Context, invocation pr result protocol.Result invoked []protocol.Invoker providers []string + ivk protocol.Invoker ) invokers := invoker.directory.List(invocation) @@ -75,7 +76,7 @@ func (invoker *failoverClusterInvoker) Invoke(ctx context.Context, invocation pr return &protocol.RPCResult{Err: err} } } - ivk := invoker.doSelect(loadBalance, invocation, invokers, invoked) + ivk = invoker.doSelect(loadBalance, invocation, invokers, invoked) if ivk == nil { continue } @@ -88,10 +89,17 @@ func (invoker *failoverClusterInvoker) Invoke(ctx context.Context, invocation pr } return result } - - ip, _ := gxnet.GetLocalIP() + ip := common.GetLocalIp() invokerSvc := invoker.GetUrl().Service() invokerUrl := invoker.directory.GetUrl() + if ivk == nil { + logger.Errorf("Failed to invoke the method %s of the service %s .No provider is available.", methodName, invokerSvc) + return &protocol.RPCResult{ + Err: perrors.Errorf("Failed to invoke the method %s of the service %s .No provider is available because can't connect server.", + methodName, invokerSvc), + } + } + return &protocol.RPCResult{ Err: perrors.Wrap(result.Error(), fmt.Sprintf("Failed to invoke the method %v in the service %v. "+ "Tried %v times of the providers %v (%v/%v)from the registry %v on the consumer %v using the dubbo version %v. "+ diff --git a/cluster/cluster_impl/forking_cluster_invoker.go b/cluster/cluster_impl/forking_cluster_invoker.go index 168444881653ca38ef61a9bc8e50f2d4bc3e624c..3ffda580ce9847bb60a0a837c5fac6b420450141 100644 --- a/cluster/cluster_impl/forking_cluster_invoker.go +++ b/cluster/cluster_impl/forking_cluster_invoker.go @@ -56,7 +56,7 @@ func (invoker *forkingClusterInvoker) Invoke(ctx context.Context, invocation pro } var selected []protocol.Invoker - forks := int(invoker.GetUrl().GetParamInt(constant.FORKS_KEY, constant.DEFAULT_FORKS)) + forks := invoker.GetUrl().GetParamByIntValue(constant.FORKS_KEY, constant.DEFAULT_FORKS) timeouts := invoker.GetUrl().GetParamInt(constant.TIMEOUT_KEY, constant.DEFAULT_TIMEOUT) if forks < 0 || forks > len(invokers) { selected = invokers diff --git a/cluster/directory/base_directory_test.go b/cluster/directory/base_directory_test.go index a2b62dfa008e6cd17b1200d93cd235da17d03905..e51e533f2e27ac8fbb6e4b19e8a32e6be2025855 100644 --- a/cluster/directory/base_directory_test.go +++ b/cluster/directory/base_directory_test.go @@ -24,7 +24,6 @@ import ( ) import ( - gxnet "github.com/dubbogo/gost/net" "github.com/stretchr/testify/assert" ) @@ -55,7 +54,7 @@ func TestBuildRouterChain(t *testing.T) { assert.NotNil(t, directory) - localIP, _ := gxnet.GetLocalIP() + localIP := common.GetLocalIp() rule := base64.URLEncoding.EncodeToString([]byte("true => " + " host = " + localIP)) routeURL := getRouteURL(rule, anyURL) routeURL.AddParam(constant.INTERFACE_KEY, "mock-app") @@ -79,7 +78,7 @@ func TestIsProperRouter(t *testing.T) { regURL := url regURL.AddParam(constant.APPLICATION_KEY, "mock-app") d := NewBaseDirectory(®URL) - localIP, _ := gxnet.GetLocalIP() + localIP := common.GetLocalIp() rule := base64.URLEncoding.EncodeToString([]byte("true => " + " host = " + localIP)) routeURL := getRouteURL(rule, anyURL) routeURL.AddParam(constant.APPLICATION_KEY, "mock-app") diff --git a/cluster/loadbalance/consistent_hash.go b/cluster/loadbalance/consistent_hash.go index 27ce2369f9de6dfe76bd35581ea26f0e0c24e480..3d036b4f3c5c50874e09efb8fd1ef34e969585d8 100644 --- a/cluster/loadbalance/consistent_hash.go +++ b/cluster/loadbalance/consistent_hash.go @@ -105,7 +105,7 @@ func newConsistentHashSelector(invokers []protocol.Invoker, methodName string, selector.virtualInvokers = make(map[uint32]protocol.Invoker) selector.hashCode = hashCode url := invokers[0].GetUrl() - selector.replicaNum = int(url.GetMethodParamInt(methodName, HashNodes, 160)) + selector.replicaNum = url.GetMethodParamIntValue(methodName, HashNodes, 160) indices := re.Split(url.GetMethodParam(methodName, HashArguments, "0"), -1) for _, index := range indices { i, err := strconv.Atoi(index) diff --git a/cluster/router/chain/chain.go b/cluster/router/chain/chain.go index 04129ebb435de5dac6a8548bbd9962d720a134ec..bb88efe02bd550c7f9e7a3cef745f91de5f6ede6 100644 --- a/cluster/router/chain/chain.go +++ b/cluster/router/chain/chain.go @@ -125,8 +125,8 @@ func (c *RouterChain) SetInvokers(invokers []protocol.Invoker) { // loop listens on events to update the address cache when it's necessary, either when it receives notification // from address update, or when timeInterval exceeds. func (c *RouterChain) loop() { + ticker := time.NewTicker(timeInterval) for { - ticker := time.NewTicker(timeInterval) select { case <-ticker.C: c.buildCache() diff --git a/cluster/router/condition/factory_test.go b/cluster/router/condition/factory_test.go index b31f6c7a82ea102c6e0b80d68e43f7b359785544..8fdfae7404e25179350bd2d2279bb0f1a21169fc 100644 --- a/cluster/router/condition/factory_test.go +++ b/cluster/router/condition/factory_test.go @@ -26,7 +26,6 @@ import ( ) import ( - "github.com/dubbogo/gost/net" perrors "github.com/pkg/errors" "github.com/stretchr/testify/assert" ) @@ -164,7 +163,7 @@ func TestRoute_matchWhen(t *testing.T) { } func TestRoute_matchFilter(t *testing.T) { - localIP, _ := gxnet.GetLocalIP() + localIP := common.GetLocalIp() t.Logf("The local ip is %s", localIP) url1, _ := common.NewURL("dubbo://10.20.3.3:20880/com.foo.BarService?default.serialization=fastjson") url2, _ := common.NewURL(fmt.Sprintf(factoryDubboFormat, localIP)) @@ -223,7 +222,7 @@ func TestRoute_methodRoute(t *testing.T) { func TestRoute_ReturnFalse(t *testing.T) { url, _ := common.NewURL("") - localIP, _ := gxnet.GetLocalIP() + localIP := common.GetLocalIp() invokers := []protocol.Invoker{NewMockInvoker(url, 1), NewMockInvoker(url, 2), NewMockInvoker(url, 3)} inv := &invocation.RPCInvocation{} rule := base64.URLEncoding.EncodeToString([]byte("host = " + localIP + " => false")) @@ -234,7 +233,7 @@ func TestRoute_ReturnFalse(t *testing.T) { } func TestRoute_ReturnEmpty(t *testing.T) { - localIP, _ := gxnet.GetLocalIP() + localIP := common.GetLocalIp() url, _ := common.NewURL("") invokers := []protocol.Invoker{NewMockInvoker(url, 1), NewMockInvoker(url, 2), NewMockInvoker(url, 3)} inv := &invocation.RPCInvocation{} @@ -246,7 +245,7 @@ func TestRoute_ReturnEmpty(t *testing.T) { } func TestRoute_ReturnAll(t *testing.T) { - localIP, _ := gxnet.GetLocalIP() + localIP := common.GetLocalIp() urlString := "dubbo://" + localIP + "/com.foo.BarService" dubboURL, _ := common.NewURL(urlString) mockInvoker1 := NewMockInvoker(dubboURL, 1) @@ -262,7 +261,7 @@ func TestRoute_ReturnAll(t *testing.T) { } func TestRoute_HostFilter(t *testing.T) { - localIP, _ := gxnet.GetLocalIP() + localIP := common.GetLocalIp() url1, _ := common.NewURL(factory333URL) url2, _ := common.NewURL(fmt.Sprintf(factoryDubboFormat, localIP)) url3, _ := common.NewURL(fmt.Sprintf(factoryDubboFormat, localIP)) @@ -281,7 +280,7 @@ func TestRoute_HostFilter(t *testing.T) { } func TestRoute_Empty_HostFilter(t *testing.T) { - localIP, _ := gxnet.GetLocalIP() + localIP := common.GetLocalIp() url1, _ := common.NewURL(factory333URL) url2, _ := common.NewURL(fmt.Sprintf(factoryDubboFormat, localIP)) url3, _ := common.NewURL(fmt.Sprintf(factoryDubboFormat, localIP)) @@ -300,7 +299,7 @@ func TestRoute_Empty_HostFilter(t *testing.T) { } func TestRoute_False_HostFilter(t *testing.T) { - localIP, _ := gxnet.GetLocalIP() + localIP := common.GetLocalIp() url1, _ := common.NewURL(factory333URL) url2, _ := common.NewURL(fmt.Sprintf(factoryDubboFormat, localIP)) url3, _ := common.NewURL(fmt.Sprintf(factoryDubboFormat, localIP)) @@ -319,7 +318,7 @@ func TestRoute_False_HostFilter(t *testing.T) { } func TestRoute_Placeholder(t *testing.T) { - localIP, _ := gxnet.GetLocalIP() + localIP := common.GetLocalIp() url1, _ := common.NewURL(factory333URL) url2, _ := common.NewURL(fmt.Sprintf(factoryDubboFormat, localIP)) url3, _ := common.NewURL(fmt.Sprintf(factoryDubboFormat, localIP)) @@ -338,7 +337,7 @@ func TestRoute_Placeholder(t *testing.T) { } func TestRoute_NoForce(t *testing.T) { - localIP, _ := gxnet.GetLocalIP() + localIP := common.GetLocalIp() url1, _ := common.NewURL(factory333URL) url2, _ := common.NewURL(fmt.Sprintf(factoryDubboFormat, localIP)) url3, _ := common.NewURL(fmt.Sprintf(factoryDubboFormat, localIP)) @@ -355,7 +354,7 @@ func TestRoute_NoForce(t *testing.T) { } func TestRoute_Force(t *testing.T) { - localIP, _ := gxnet.GetLocalIP() + localIP := common.GetLocalIp() url1, _ := common.NewURL(factory333URL) url2, _ := common.NewURL(fmt.Sprintf(factoryDubboFormat, localIP)) url3, _ := common.NewURL(fmt.Sprintf(factoryDubboFormat, localIP)) diff --git a/cluster/router/condition/router.go b/cluster/router/condition/router.go index 4267f5b405367950d38c5d7af705e663f4416602..48f2aae133e5c784570dc4b470766b431938efc4 100644 --- a/cluster/router/condition/router.go +++ b/cluster/router/condition/router.go @@ -25,7 +25,6 @@ import ( import ( "github.com/RoaringBitmap/roaring" "github.com/dubbogo/gost/container/set" - "github.com/dubbogo/gost/net" perrors "github.com/pkg/errors" ) @@ -184,7 +183,7 @@ func (c *ConditionRouter) Route(invokers *roaring.Bitmap, cache router.Cache, ur return result } else if c.Force { rule, _ := url.GetParamAndDecoded(constant.RULE_KEY) - localIP, _ := gxnet.GetLocalIP() + localIP := common.GetLocalIp() logger.Warnf("The route result is empty and force execute. consumer: %s, service: %s, router: %s", localIP, url.Service(), rule) return result } diff --git a/cluster/router/healthcheck/default_health_check.go b/cluster/router/healthcheck/default_health_check.go index c522bdf0f98244f5f8bdfba6085cb45dd89c1004..3effd779c989ed8e68c91eb6eab20d10d8b04e8c 100644 --- a/cluster/router/healthcheck/default_health_check.go +++ b/cluster/router/healthcheck/default_health_check.go @@ -48,6 +48,10 @@ type DefaultHealthChecker struct { // IsHealthy evaluates the healthy state on the given Invoker based on the number of successive bad request // and the current active request func (c *DefaultHealthChecker) IsHealthy(invoker protocol.Invoker) bool { + if !invoker.IsAvailable() { + return false + } + urlStatus := protocol.GetURLStatus(invoker.GetUrl()) if c.isCircuitBreakerTripped(urlStatus) || urlStatus.GetActive() > c.GetOutStandingRequestCountLimit() { logger.Debugf("Invoker [%s] is currently in circuitbreaker tripped state", invoker.GetUrl().Key()) @@ -92,6 +96,7 @@ func (c *DefaultHealthChecker) getCircuitBreakerSleepWindowTime(status *protocol return int64(sleepWindow) } + // GetRequestSuccessiveFailureThreshold return the requestSuccessiveFailureThreshold bound to this DefaultHealthChecker func (c *DefaultHealthChecker) GetRequestSuccessiveFailureThreshold() int32 { return c.requestSuccessiveFailureThreshold @@ -110,8 +115,8 @@ func (c *DefaultHealthChecker) GetOutStandingRequestCountLimit() int32 { // NewDefaultHealthChecker constructs a new DefaultHealthChecker based on the url func NewDefaultHealthChecker(url *common.URL) router.HealthChecker { return &DefaultHealthChecker{ - outStandingRequestConutLimit: int32(url.GetParamInt(constant.OUTSTANDING_REQUEST_COUNT_LIMIT_KEY, math.MaxInt32)), - requestSuccessiveFailureThreshold: int32(url.GetParamInt(constant.SUCCESSIVE_FAILED_REQUEST_THRESHOLD_KEY, constant.DEFAULT_SUCCESSIVE_FAILED_REQUEST_MAX_DIFF)), - circuitTrippedTimeoutFactor: int32(url.GetParamInt(constant.CIRCUIT_TRIPPED_TIMEOUT_FACTOR_KEY, constant.DEFAULT_CIRCUIT_TRIPPED_TIMEOUT_FACTOR)), + outStandingRequestConutLimit: url.GetParamInt32(constant.OUTSTANDING_REQUEST_COUNT_LIMIT_KEY, math.MaxInt32), + requestSuccessiveFailureThreshold: url.GetParamInt32(constant.SUCCESSIVE_FAILED_REQUEST_THRESHOLD_KEY, constant.DEFAULT_SUCCESSIVE_FAILED_REQUEST_MAX_DIFF), + circuitTrippedTimeoutFactor: url.GetParamInt32(constant.CIRCUIT_TRIPPED_TIMEOUT_FACTOR_KEY, constant.DEFAULT_CIRCUIT_TRIPPED_TIMEOUT_FACTOR), } } diff --git a/common/constant/key.go b/common/constant/key.go index 943338f8e6f13512d96cfed4cbc4f275d6aab2cb..9525511cdaac64083cc595e1c0a6327a4ded6f9c 100644 --- a/common/constant/key.go +++ b/common/constant/key.go @@ -25,6 +25,7 @@ const ( GROUP_KEY = "group" VERSION_KEY = "version" INTERFACE_KEY = "interface" + MESSAGE_SIZE_KEY = "message_size" PATH_KEY = "path" SERVICE_KEY = "service" METHODS_KEY = "methods" diff --git a/common/host_util.go b/common/host_util.go new file mode 100644 index 0000000000000000000000000000000000000000..9861c92bee15624dd79e02a6e3aba6b443dbd7da --- /dev/null +++ b/common/host_util.go @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package common + +import gxnet "github.com/dubbogo/gost/net" + +var localIp string + +func GetLocalIp() string { + if len(localIp) != 0 { + return localIp + } + localIp, _ = gxnet.GetLocalIP() + return localIp +} diff --git a/common/host_util_test.go b/common/host_util_test.go new file mode 100644 index 0000000000000000000000000000000000000000..ad96dde4c77667a940c27455262a6aeca921a73d --- /dev/null +++ b/common/host_util_test.go @@ -0,0 +1,30 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package common + +import ( + "testing" +) + +import ( + "github.com/stretchr/testify/assert" +) + +func TestGetLocalIp(t *testing.T) { + assert.NotNil(t, GetLocalIp()) +} diff --git a/common/proxy/proxy_test.go b/common/proxy/proxy_test.go index c6066157fd8d2147fd3a319c8d48fdd910752711..9f5eaadf7cb5967fb585e2df808b0194e6abe249 100644 --- a/common/proxy/proxy_test.go +++ b/common/proxy/proxy_test.go @@ -24,7 +24,6 @@ import ( ) import ( - "github.com/apache/dubbo-go/protocol/invocation" perrors "github.com/pkg/errors" "github.com/stretchr/testify/assert" ) @@ -34,6 +33,7 @@ import ( "github.com/apache/dubbo-go/common/constant" "github.com/apache/dubbo-go/protocol" "github.com/apache/dubbo-go/protocol/dubbo/hessian2" + "github.com/apache/dubbo-go/protocol/invocation" ) type TestService struct { diff --git a/common/url.go b/common/url.go index 8297afdaad235cbd9a70b057e0f43db6c48dbf82..3a88001c5fb345aa004e5a3975df89cbec2c415a 100644 --- a/common/url.go +++ b/common/url.go @@ -484,22 +484,49 @@ func (c URL) GetParamBool(key string, d bool) bool { return r } -// GetParamInt gets int value by @key +// GetParamInt gets int64 value by @key func (c URL) GetParamInt(key string, d int64) int64 { - r, err := strconv.Atoi(c.GetParam(key, "")) - if r == 0 || err != nil { + r, err := strconv.ParseInt(c.GetParam(key, ""), 10, 64) + if err != nil { return d } - return int64(r) + return r +} + +// GetParamInt32 gets int32 value by @key +func (c URL) GetParamInt32(key string, d int32) int32 { + r, err := strconv.ParseInt(c.GetParam(key, ""), 10, 32) + if err != nil { + return d + } + return int32(r) +} + +// GetParamByIntValue gets int value by @key +func (c URL) GetParamByIntValue(key string, d int) int { + r, err := strconv.ParseInt(c.GetParam(key, ""), 10, 0) + if err != nil { + return d + } + return int(r) } // GetMethodParamInt gets int method param func (c URL) GetMethodParamInt(method string, key string, d int64) int64 { - r, err := strconv.Atoi(c.GetParam("methods."+method+"."+key, "")) - if r == 0 || err != nil { + r, err := strconv.ParseInt(c.GetParam("methods."+method+"."+key, ""), 10, 64) + if err != nil { + return d + } + return r +} + +// GetMethodParamIntValue gets int method param +func (c URL) GetMethodParamIntValue(method string, key string, d int) int { + r, err := strconv.ParseInt(c.GetParam("methods."+method+"."+key, ""), 10, 0) + if err != nil { return d } - return int64(r) + return int(r) } // GetMethodParamInt64 gets int64 method param diff --git a/common/url_test.go b/common/url_test.go index 6845190a7362571ebbd4738bd146c94f6d644253..12020f4289904d22c0d64a6df1cea2903394a016 100644 --- a/common/url_test.go +++ b/common/url_test.go @@ -167,10 +167,22 @@ func TestURLGetParam(t *testing.T) { func TestURLGetParamInt(t *testing.T) { params := url.Values{} - params.Set("key", "3") + params.Set("key", "") u := URL{baseUrl: baseUrl{params: params}} v := u.GetParamInt("key", 1) - assert.Equal(t, int64(3), v) + assert.Equal(t, int64(1), v) + + u = URL{} + v = u.GetParamInt("key", 1) + assert.Equal(t, int64(1), v) +} + +func TestURLGetParamIntValue(t *testing.T) { + params := url.Values{} + params.Set("key", "0") + u := URL{baseUrl: baseUrl{params: params}} + v := u.GetParamInt("key", 1) + assert.Equal(t, int64(0), v) u = URL{} v = u.GetParamInt("key", 1) diff --git a/config/config_loader.go b/config/config_loader.go index c66e526921e7e5ab017105e2f4ea2baa62563205..f2102249c6e835c62e69613388bdd0c3dc4c750a 100644 --- a/config/config_loader.go +++ b/config/config_loader.go @@ -28,7 +28,6 @@ import ( ) import ( - gxnet "github.com/dubbogo/gost/net" perrors "github.com/pkg/errors" ) @@ -250,7 +249,7 @@ func createInstance(url common.URL) (registry.ServiceInstance, error) { host := url.Ip if len(host) == 0 { - host, err = gxnet.GetLocalIP() + host = common.GetLocalIp() if err != nil { return nil, perrors.WithMessage(err, "could not get the local Ip") } diff --git a/config/service_config.go b/config/service_config.go index 48632a1b1e295eb5ec3027bd495ef8d19e978ec4..9a274436dd510ce18d2dda6f11dd6d5ef298f0be 100644 --- a/config/service_config.go +++ b/config/service_config.go @@ -73,6 +73,7 @@ type ServiceConfig struct { Auth string `yaml:"auth" json:"auth,omitempty" property:"auth"` ParamSign string `yaml:"param.sign" json:"param.sign,omitempty" property:"param.sign"` Tag string `yaml:"tag" json:"tag,omitempty" property:"tag"` + GrpcMaxMessageSize int `default:"4" yaml:"max_message_size" json:"max_message_size,omitempty"` Protocols map[string]*ProtocolConfig unexported *atomic.Bool @@ -271,6 +272,7 @@ func (c *ServiceConfig) getUrlMap() url.Values { urlMap.Set(constant.ROLE_KEY, strconv.Itoa(common.PROVIDER)) urlMap.Set(constant.RELEASE_KEY, "dubbo-golang-"+constant.Version) urlMap.Set(constant.SIDE_KEY, (common.RoleType(common.PROVIDER)).Role()) + urlMap.Set(constant.MESSAGE_SIZE_KEY, strconv.Itoa(c.GrpcMaxMessageSize)) // todo: move urlMap.Set(constant.SERIALIZATION_KEY, c.Serialization) // application info diff --git a/config/service_config_test.go b/config/service_config_test.go index 4d4122ee7057043af47aa0400ca8c5b5e9a20cd0..61c8864b6ab7eb146a92e76187cd6363bbdb8dc8 100644 --- a/config/service_config_test.go +++ b/config/service_config_test.go @@ -18,11 +18,11 @@ package config import ( + "github.com/apache/dubbo-go/common" "testing" ) import ( - gxnet "github.com/dubbogo/gost/net" "github.com/stretchr/testify/assert" "go.uber.org/atomic" ) @@ -184,7 +184,7 @@ func TestExport(t *testing.T) { func TestGetRandomPort(t *testing.T) { protocolConfigs := make([]*ProtocolConfig, 0, 3) - ip, err := gxnet.GetLocalIP() + ip := common.GetLocalIp() protocolConfigs = append(protocolConfigs, &ProtocolConfig{ Ip: ip, }) @@ -194,7 +194,7 @@ func TestGetRandomPort(t *testing.T) { protocolConfigs = append(protocolConfigs, &ProtocolConfig{ Ip: ip, }) - assert.NoError(t, err) + //assert.NoError(t, err) ports := getRandomPort(protocolConfigs) assert.Equal(t, ports.Len(), len(protocolConfigs)) diff --git a/config_center/configurator/override.go b/config_center/configurator/override.go index ec4e606e0dff300729e2a2bc56f510db94ea9f26..7f5abb6175056b44a5d9c6a9fa527ad6e9ac6791 100644 --- a/config_center/configurator/override.go +++ b/config_center/configurator/override.go @@ -23,7 +23,6 @@ import ( import ( gxset "github.com/dubbogo/gost/container/set" - gxnet "github.com/dubbogo/gost/net" ) import ( @@ -61,7 +60,7 @@ func (c *overrideConfigurator) Configure(url *common.URL) { currentSide := url.GetParam(constant.SIDE_KEY, "") configuratorSide := c.configuratorUrl.GetParam(constant.SIDE_KEY, "") if currentSide == configuratorSide && common.DubboRole[common.CONSUMER] == currentSide && c.configuratorUrl.Port == "0" { - localIP, _ := gxnet.GetLocalIP() + localIP := common.GetLocalIp() c.configureIfMatch(localIP, url) } else if currentSide == configuratorSide && common.DubboRole[common.PROVIDER] == currentSide && c.configuratorUrl.Port == url.Port { c.configureIfMatch(url.Ip, url) @@ -127,7 +126,7 @@ func (c *overrideConfigurator) configureDeprecated(url *common.URL) { // 1.If it is a consumer ip address, the intention is to control a specific consumer instance, it must takes effect at the consumer side, any provider received this override url should ignore; // 2.If the ip is 0.0.0.0, this override url can be used on consumer, and also can be used on provider if url.GetParam(constant.SIDE_KEY, "") == common.DubboRole[common.CONSUMER] { - localIP, _ := gxnet.GetLocalIP() + localIP := common.GetLocalIp() c.configureIfMatch(localIP, url) } else { c.configureIfMatch(constant.ANYHOST_VALUE, url) diff --git a/doc/apache/apache-release-procedure-20200306.md b/doc/apache/apache-release-procedure-20200306.md new file mode 100644 index 0000000000000000000000000000000000000000..3f677ff56b8a97f881ae3d1b9bf842754ddb05ab --- /dev/null +++ b/doc/apache/apache-release-procedure-20200306.md @@ -0,0 +1,448 @@ + +# Apache 软件发版流程 + +> author: wongoo@apache.org +> last updated: 2020-03-06 + +Apache开源软件是有社区驱动的,为了提高发布软件质量而指定了软件发布流程,本文主要介绍此流程,以给第一次发布打包的apacher参考。 + +如果你要准备打包一个apache软件了,想必你已经是一个项目的committer了,而且知道社区、PMC这些概念,而你现在还担任本次发布的 release manager 一职。 + +发版流程其实也很简单,无非如下: +1. 整理变更内容,打包并对打包文件签名; +2. 将签名文件上传apache svn仓库; +3. 发邮件请社区PMC大佬投票; +4. 投票通过后发一个投票结果通告邮件; +5. 发版 +6. 发版邮件通告社区新版本发布; + +下面详细整理发版的一些流程步骤,使用 dubbo 的子项目 dubbog-go-hessian2 发版为例! + + +## 1. 发版准备 + +发版文件需要签名,需要安装pgp工具. + +```bash +$ brew install gpg +$ gpg --version +$ gpg --full-gen-key + (1) RSA and RSA (default) <-- RSA 类型 + What keysize do you want? (2048) 4096 <-- key大小为4096 + 0 = key does not expire <-- 永不过期 + Real name: Liu Yang + Email address: wongoo@apache.org + Comment: CODE SIGNING KEY + + gpg: /Users/gelnyang/.gnupg/trustdb.gpg: trustdb created + gpg: key 7DB68550D366E4C0 marked as ultimately trusted + gpg: revocation certificate stored as '/Users/gelnyang/.gnupg/openpgp-revocs.d/1376A2FF67E4C477573909BD7DB68550D366E4C0.rev' + public and secret key created and signed. + + pub rsa4096 2019-10-17 [SC] + 1376A2FF67E4C477573909BD7DB68550D366E4C0 + uid Liu Yang (CODE SIGNING KEY) <wongoo@apache.org> + sub rsa4096 2019-10-17 [E] + +$ gpg --list-keys + gpg: checking the trustdb + gpg: marginals needed: 3 completes needed: 1 trust model: pgp + gpg: depth: 0 valid: 1 signed: 0 trust: 0-, 0q, 0n, 0m, 0f, 1u + /Users/gelnyang/.gnupg/pubring.kbx + ---------------------------------- + pub rsa4096 2019-10-17 [SC] + 1376A2FF67E4C477573909BD7DB68550D366E4C0 + uid [ultimate] Liu Yang (CODE SIGNING KEY) <wongoo@apache.org> + sub rsa4096 2019-10-17 [E] + + +# 公钥服务器是网络上专门储存用户公钥的服务器 +# 通过key id发送public key到keyserver +$ gpg --keyserver pgpkeys.mit.edu --send-key 1376A2FF67E4C477573909BD7DB68550D366E4C0 + gpg: sending key 7DB68550D366E4C0 to hkp://pgpkeys.mit.edu +# 其中,pgpkeys.mit.edu为随意挑选的keyserver,keyserver列表为:https://sks-keyservers.net/status/,为相互之间是自动同步的,选任意一个都可以。 + +# 如果有多个public key,设置默认key。修改 ~/.gnupg/gpg.conf +$ vi ~/.gnupg/gpg.conf +default-key 7DB68550D366E4C0 + +# 如果有多个public key, 也可以删除无用的key: +### 先删除私钥,再删除公钥 +$ gpg --yes --delete-secret-keys shenglicao2@gmail.com ###老的私钥,指明邮箱即可 +$ gpg --delete-keys 1808C6444C781C0AEA0AAD4C4D6A8007D20DB8A4 + +## 由于公钥服务器没有检查机制,任何人都可以用你的名义上传公钥,所以没有办法保证服务器上的公钥的可靠性。 +## 通常,你可以在网站上公布一个公钥指纹,让其他人核对下载到的公钥是否为真。 +# fingerprint参数生成公钥指纹: +$ gpg --fingerprint wongoo + + pub rsa4096 2019-10-17 [SC] + 1376 A2FF 67E4 C477 5739 09BD 7DB6 8550 D366 E4C0 + uid [ultimate] Liu Yang (CODE SIGNING KEY) <wongoo@apache.org> + sub rsa4096 2019-10-17 [E] + # 将上面的 fingerprint (即 1376 A2FF 67E4 C477 5739 09BD 7DB6 8550 D366 E4C0)粘贴到自己的用户信息中: + # https://id.apache.org OpenPGP Public Key Primary Fingerprint: +``` + +> 详细参考: +> - 发布签名: http://www.apache.org/dev/release-signing.html +> - 发布策略: http://www.apache.org/dev/release-distribution +> - 将密钥上传到公共密钥服务器: https://www.apache.org/dev/openpgp.html#generate-key + +## 2. 打包签名 + +准备打包前(尤其提第一次打包)需要注意以下内容: +- 每个文件的LICENSE头部是否正确, 包括 `*.java`, `*.go`, `*.xml`, `Makefile` 等 +- LICENSE 文件是否存在 +- NOTICE 文件是否存在 +- CHANGE.md 是否存在 (变更内容格式符合规范) + +以上可以参考其他已发布项目的配置。 + + +``` + +# NOTICE: 这里切分支,分支名称不要和版本号(tag用)类似,不然会有冲突 +$ git checkout -b 1.4 + +$ git tag -a v1.4.0-rc1 -m "v1.4.0 release candidate 1" + +$ git push --tags + +# 打包 +$ git archive --format=tar 1.4 --prefix=dubbo-go-hessian2-v1.4.0/ | gzip > dubbo-go-hessian2-v1.4.0-src.tar.gz + +# 签名 +$ gpg -u wongoo@apache.org --armor --output dubbo-go-hessian2-v1.4.0-src.tar.gz.asc --detach-sign dubbo-go-hessian2-v1.4.0-src.tar.gz + +# 验证签名 +$ gpg --verify dubbo-go-hessian2-v1.4.0-src.tar.gz.asc dubbo-go-hessian2-v1.4.0-src.tar.gz + +# hash +$ shasum -a 512 dubbo-go-hessian2-v1.4.0-src.tar.gz > dubbo-go-hessian2-v1.4.0-src.tar.gz.sha512 + +# 验证 hash +$ shasum --check dubbo-go-hessian2-v1.4.0-src.tar.gz.sha512 + +``` + +> 发布版本: http://www.apache.org/dev/release-publishing.html + +## 3. 上传打包文件到svn仓库 + +``` +$ svn checkout https://dist.apache.org/repos/dist/dev/dubbo + +$ cd dubbo + +# 更新 +$ svn update + +# 添加 签名 和 public key 到KEYS文件并提交到SVN仓库 +# 这里是将公钥KEYS放到根目录, 有的项目放到本次打包文件目录 +$ (gpg --list-sigs wongoo && gpg --armor --export wongoo) >> KEYS + +$ mkdir -p dubbo-go-hessian2/v1.4.0-rc1 + +# 拷贝相关文件到新建目录下 + +$ tree dubbo-go-hessian2 +dubbo-go-hessian2 +└── v1.4.0-rc1 + ├── dubbo-go-hessian2-v1.4.0-src.tar.gz + ├── dubbo-go-hessian2-v1.4.0-src.tar.gz.asc + └── dubbo-go-hessian2-v1.4.0-src.tar.gz.sha512 + +$ svn add dubbo-go-hessian2 +$ svn add dubbo-go-hessian2/* +$ svn status +$ svn commit --username wongoo -m "Release dubbo-go-hessian2 v1.4.0-rc1" +``` + +> 详细参考: svn版本管理 https://www.apache.org/dev/version-control.html + + +## 4. 发投票 [VOTE] 邮件 + +发任何邮件都是有一定格式的,你加入社区邮件列表后,就会收到很多这样的邮件,多看看就知道了,具体邮件范本参考文章后面的邮件范本。 + +发完【VOTE】邮件,私下沟通群里面请大佬PMC投票。 +PMC投票会对你上传打包文件进行相关检查, +详细可以了解孵化中的项目发布完整的检查项参考: https://cwiki.apache.org/confluence/display/INCUBATOR2/IncubatorReleaseChecklist + +收到3个binding邮件且超过72小时后,就可以发 投票结果 [RESULT] [VOTE] 邮件了。 + +> 原则上只有PMC的投票才算binding邮件, 当然也可以由社区决定。 + +这一步骤最常见有以下问题: +- 文件签名有问题 +- 引用项目LICENSE问题 +- 单元测试不通过 + +> 另外需要注意: 一个apache项目可能包含很多子项目,项目的PMC可能只对主项目比较了解, 他们并不清楚如何将子项目跑起来,也不知道如何跑单元测试,最好在邮件中附带一个如何进行单元测试的连接。例如 PMC 最了解 java,但子项目是golang,python,js等,你需要告诉他们如何测试你的项目。 + +可以参考投票规则: https://www.apache.org/foundation/voting.html + +## 5. 发布版本 + +当正式发布投票成功后,先发[Result]邮件,然后就准备 release package。 +将之前在dev下发布的对应rc文件夹下的源码包、签名文件和hash文件拷贝到另一个目录 v1.4.0, +注意文件名字中不要rcxx (可以rename,但不要重新计算签名,hash可以重新计算,结果不会变)。 + +将release包移动到正式版目录。如果你的软件是需要客户从apache下载的,则这一步是必须的。如果不是,比如golang引用github打包地址的则可以忽略。 +``` +svn up +cd dubbo-go-hessian2 +svn move v1.4.0-rc1 v1.4.0 +svn status +svn commit --username wongoo -m "Release dubbo-go-hessian2 v1.4.0" +``` + +移到发版目录后,还需要进行相应的正式版本发布, 这里将具体发布方式整理到单独的章节 `7. 不同语言版本发布`,因为发布流程马上就要结束了 ^v^ + + +## 6. 新版本通告 ANNOUNCE 邮件 + +恭喜你你已经到发版最后一步了,邮件格式参考以下邮件范本! + + +## 7. 不同语言版本发布 + +### 7.1 golang + +在 github 基于投票分支发布了 release 版本。 + +### 7.2 java + +java项目发版需发布到java maven仓库。 + +TODO + +### 7.3 js + +js项目发版需发布到npm仓库。 + +TODO + +### 7.4 python + +TODO + +## 8. 邮件范本 + +### 8.1. 提出发版投票 + +- TO: dev@dubbo.apache.org +- Title: [VOTE] Release Apache dubbo-go-hessian2 v1.4.0 RC1 + +``` +Hello Dubbo/Dubbogo Community, + + This is a call for vote to release Apache dubbo-go-hessian2 version v1.4.0 RC1. + + The release candidates: https://dist.apache.org/repos/dist/dev/dubbo/dubbo-go-hessian2/v1.4.0-rc1/ + Git tag for the release: https://github.com/apache/dubbo-go-hessian2/tree/1.4 + Hash for the release tag: 4c31e88c35afe84c0321d9f12f036e6d3c8962d0 + Release Notes: https://github.com/apache/dubbo-go-hessian2/blob/1.4/CHANGE.md + The artifacts have been signed with Key :7DB68550D366E4C0, which can be found in the keys file: + https://dist.apache.org/repos/dist/dev/dubbo/KEYS + + The vote will be open for at least 72 hours or until necessary number of votes are reached. + + Please vote accordingly: + [ ] +1 approve + [ ] +0 no opinion + [ ] -1 disapprove with the reason + + Thanks, + The Apache Dubbo-go Team + ``` + + +### 8.2. PMC 投票邮件回复 + + +范例1: +``` ++1 approve <-- 首先表明同不同意 + +I have checked: <-- 其次要说明自己检查了哪些项 + +1.source code can build <-- 能否构建 +2.tests can pass in my local <-- 单元测试能否通过 +3. NOTICE LICENSE file exist <-- 协议文件是否存在 +4.git tag is correct <-- git tag 是否正确 + +there is one minor thing that in change logs file, there is no space +between text And link. I suggest add one to make it looks better. <--- 一些其他改进建议 +``` + +范例2: +``` ++1 + +I checked the following items: + +[v] Are release files in correct location? <-- 发布文件目录是否正确 +[v] Do release files have the word incubating in their name? +[v] Are the digital signature and hashes correct? <-- 签名、hash是否正确 +[v] Do LICENSE and NOTICE files exists? +[v] Is the LICENSE and NOTICE text correct? <-- 协议文本是否正确 +[v] Is the NOTICE year correct? <-- 注意年份是否正确 +[v] Un-included software dependencies are not mentioned in LICENSE or NOTICE? <-- 没有包含协议或注意没有提到的软件依赖 +[v] License information is not mentioned in NOTICE? <-- 协议信息没有在注意中提及 +[x] Is there any 3rd party code contained inside the release? If so: <-- 是否包含第三方代码 + [ ] Does the software have a compatible license? + [ ] Are all software licenses mentioned in LICENSE? + [ ] Is the full text of the licenses (or pointers to it) in LICENSE? + Is any of this code Apache licensed? Do they have NOTICE files? If so: + [ ] Have relevant parts of those NOTICE files been added to this NOTICE file? +[v] Do all source files have ASF headers? <-- 是否所有源码都有ASF头部 +[v] Do the contents of the release match with what's tagged in version control? <-- 发布的文件是否和github中tag标记的版本一致 +[x] Are there any unexpected binary files in the release? <-- 是否包含不应该存在的二进制文件 +[v] Can you compile from source? Are the instruction clear? <-- 能否编译?指令是否明确? + +On my mac laptop, I could compile successfully but there's one failed unit +test against net.go. I believe this issue [1] can be fixed with [2] in the +next release. <-- 编译问题及建议 + +Is the issue minor? <-- 编译存在的问题是否都是较小的? +[v] Yes [ ] No [ ] Unsure + +Could it possibly be fixed in the next release? <-- 能否在下一版本修复? +[v] Yes [ ] No [ ] Unsure + +I vote with: <-- 我的投票 +[v] +1 release the software +[ ] +0 not sure if it should be released +[ ] -1 don’t release the software because... + +Regards, +-Ian. + +1. https://github.com/apache/dubbo-go/issues/207 +2. https://github.com/apache/dubbo-go/pull/209 +``` + +范例3: +``` ++1 + +I checked the following items: + +[√] Do LICENSE and NOTICE files exists? +[√] Is the LICENSE and NOTICE text correct? +[√] Is the NOTICE year correct? +[√] Do all source files have ASF headers? +[√] Do the contents of the release match with what's tagged in version control? +[√] Can you compile from source? +I could compile successfully but there's failed units test. I run the unit +test refer to :https://github.com/apache/dubbo-go#running-unit-tests . +But I think it is not matter, the test can be fixed in next release. + + +I vote with: +[√] +1 release the software +``` + +范例4: +``` +Great improvement over the previous release but there are still issues from the last vote that have not been resolved. e.g. [6][7][8] + +Can someone tell me if these files [1][2][3][4][5] are just missing ASF headers or have a different license? + +If they are just missing headers and [6][7][8] explained then it +1 form me, otherwise it’s probably a -1. + +Can people please carefully check the contents, and write down what you checked, rather than just saying +1. + +I checked: +- signatures and hashes good +- LICENSE is missing the appendix (not a major issue) +- LICENSE may be is missing some information[1][2][3][4][5] +- NOTICE is fine +- No binaries in source release +- Some files are missing ASF headers or other license headers [1][2][3][4][5] - please fix + +Thanks, +Justin + +1. dubbo-go-1.1.0/cluster/loadbalance/round_robin_test.go +2. dubbo-go-1.1.0/common/extension/router_factory.go +3. dubbo-go-1.1.0/config_center/configuration_parser.go +4. dubbo-go-1.1.0/config_center/configuration_parser_test.go +5. dubbo-go-1.1.0/registry/zookeeper/listener_test.go +6. dubbo-go-1.1.0/cluster/loadbalance/least_active.go +7. dubbo-go-1.1.0/protocol/RpcStatus.go +8. dubbo-go-1.1.0/filter/impl/active_filter.go +``` + + +### 8.3. 发 [RESULT] [VOTE] 投票结果通知邮件 + +- TO: dev@dubbo.apache.org +- Title: [RESULT] [VOTE]: Release Apache dubbo-go-hessian2 v1.4.0 RC1 + + +``` +Hello Dubbo/Dubbogo Community, + +The release dubbo-go-hessian2 v1.4.0 RC1 vote finished, We’ve received 3 +1 (binding) votes. + ++1 binding, Stocks Alex ++1 binding, Ian Luo ++1 binding, Jun Liu + +The vote and result thread: +https://lists.apache.org/thread.html/r8070f3b00984888069dd4ddad1bbc424cde51ea68b6ff0520e609e18%40%3Cdev.dubbo.apache.org%3E + + +The vote passed. Thanks all. +I will proceed with the formal release later. + + +Best regards, + +The Apache Dubbogo Team +``` + + +### 8.4. 发 Announce 发版邮件 + +- TO: dev@dubbo.apache.org +- [ANNOUNCE] Apache Dubbo version 2.7.4 Released + +``` +Hello Community, + +The Apache Dubbo team is pleased to announce that the 2.7.4 has been +released. + +Apache Dubbo™ is a high-performance, java based, open source +RPC framework. Dubbo offers three key functionalities, which include +interface based remote call, fault tolerance & load balancing, and +automatic service registration & discovery. + +Both the source release[1] and the maven binary release[2] are available +now, you can also find the detailed release notes in here[3]. + + +If you have any usage questions, or have problems when upgrading or find +any problems about enhancements included in this release, please don’t +hesitate to let us know by sending feedback to this mailing list or filing +an issue on GitHub[4]. + + + +[1] http://dubbo.apache.org/en-us/blog/download.html +[2] http://central.maven.org/maven2/org/apache/dubbo +[3] https://github.com/apache/dubbo/releases +[4] https://github.com/apache/dubbo/issues +``` + +## 9. 参考 + +- dubbo发布流程: http://dubbo.apache.org/zh-cn/docs/developers/committer-guide/release-guide_dev.html +- doris发布流程: https://github.com/apache/incubator-doris/blob/master/docs/documentation/cn/community/release-process.md +- spark发布流程: http://spark0apache0org.icopy.site/release-process.html + + diff --git a/doc/apache/release_note.md b/doc/apache/release_note.md new file mode 100644 index 0000000000000000000000000000000000000000..747a3348a1324cc059906fae16cb432b3bc6188d --- /dev/null +++ b/doc/apache/release_note.md @@ -0,0 +1,11 @@ +### How to release a new version? +--- + +* 1 Check the time range of NOTICE; +* 2 Add the features to the feature list of README.md/README_CN.md/CHANGE.md; +* 3 Check whether every code file has the Apache License 2.0 or not; +* 4 There should not be author info(name & email etc) exist in code file; +* 5 Run all unit tests; +* 6 Run all samples in apache/dubbo-samples/golang; +* 7 Write "What's New" by releaser who should be an apache/dubbo-go committer; +* 8 And then, u can release a new version refer to [Apache 软件发版流程](./apache-release-procedure-20200306.md); \ No newline at end of file diff --git a/doc/pic/arch/dubbo-go-arch.png b/doc/pic/arch/dubbo-go-arch.png new file mode 100644 index 0000000000000000000000000000000000000000..0a28cb6a3af6953d2ad10390ddff5b7d82166ecc Binary files /dev/null and b/doc/pic/arch/dubbo-go-arch.png differ diff --git a/doc/pic/arch/dubbo-go-ext.png b/doc/pic/arch/dubbo-go-ext.png new file mode 100644 index 0000000000000000000000000000000000000000..b60ecdf47ef190f097fccaf2d74070f6712ea80d Binary files /dev/null and b/doc/pic/arch/dubbo-go-ext.png differ diff --git a/filter/filter_impl/generic_filter.go b/filter/filter_impl/generic_filter.go index d385054ed98518177aea5e574e034cb35c72e398..36b4b13186361d85beea0625eeda1ad58c3f2dca 100644 --- a/filter/filter_impl/generic_filter.go +++ b/filter/filter_impl/generic_filter.go @@ -21,6 +21,7 @@ import ( "context" "reflect" "strings" + "time" ) import ( @@ -93,13 +94,21 @@ func struct2MapAll(obj interface{}) interface{} { if t.Kind() == reflect.Struct { result := make(map[string]interface{}, t.NumField()) for i := 0; i < t.NumField(); i++ { - if v.Field(i).Kind() == reflect.Struct || v.Field(i).Kind() == reflect.Slice || v.Field(i).Kind() == reflect.Map { - if v.Field(i).CanInterface() { - setInMap(result, t.Field(i), struct2MapAll(v.Field(i).Interface())) + field := t.Field(i) + value := v.Field(i) + kind := value.Kind() + if kind == reflect.Struct || kind == reflect.Slice || kind == reflect.Map { + if value.CanInterface() { + tmp := value.Interface() + if _, ok := tmp.(time.Time); ok { + setInMap(result, field, tmp) + continue + } + setInMap(result, field, struct2MapAll(tmp)) } } else { - if v.Field(i).CanInterface() { - setInMap(result, t.Field(i), v.Field(i).Interface()) + if value.CanInterface() { + setInMap(result, field, value.Interface()) } } } diff --git a/filter/filter_impl/generic_filter_test.go b/filter/filter_impl/generic_filter_test.go index e40733209b2e1db972ab576dea54f206a1e888c0..40cf743106821f12425d1abe6dbc82bad0559917 100644 --- a/filter/filter_impl/generic_filter_test.go +++ b/filter/filter_impl/generic_filter_test.go @@ -20,6 +20,7 @@ package filter_impl import ( "reflect" "testing" + "time" ) import ( @@ -38,6 +39,8 @@ func TestStruct2MapAll(t *testing.T) { Xx string `m:"xx"` } `m:"xxYy"` } `m:"caCa"` + DaDa time.Time + EeEe int } testData.AaAa = "1" testData.BaBa = "1" @@ -45,6 +48,8 @@ func TestStruct2MapAll(t *testing.T) { testData.CaCa.AaAa = "2" testData.CaCa.XxYy.xxXx = "3" testData.CaCa.XxYy.Xx = "3" + testData.DaDa = time.Date(2020, 10, 29, 2, 34, 0, 0, time.Local) + testData.EeEe = 100 m := struct2MapAll(testData).(map[string]interface{}) assert.Equal(t, "1", m["aaAa"].(string)) assert.Equal(t, "1", m["baBa"].(string)) @@ -53,6 +58,8 @@ func TestStruct2MapAll(t *testing.T) { assert.Equal(t, reflect.Map, reflect.TypeOf(m["caCa"]).Kind()) assert.Equal(t, reflect.Map, reflect.TypeOf(m["caCa"].(map[string]interface{})["xxYy"]).Kind()) + assert.Equal(t, "2020-10-29 02:34:00", m["daDa"].(time.Time).Format("2006-01-02 15:04:05")) + assert.Equal(t, 100, m["eeEe"].(int)) } type testStruct struct { diff --git a/go.mod b/go.mod index 6e06e034404a20c2e8f00b302b856340a3fe72dd..a9ed0b574aa7f1c795ea3d7e912fa97646d9cf87 100644 --- a/go.mod +++ b/go.mod @@ -2,24 +2,24 @@ module github.com/apache/dubbo-go require ( github.com/NYTimes/gziphandler v1.1.1 // indirect - github.com/RoaringBitmap/roaring v0.4.23 - github.com/Workiva/go-datastructures v1.0.50 + github.com/RoaringBitmap/roaring v0.5.5 + github.com/Workiva/go-datastructures v1.0.52 github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5 - github.com/alibaba/sentinel-golang v0.6.1 + github.com/alibaba/sentinel-golang v0.6.2 github.com/apache/dubbo-getty v1.3.10 github.com/apache/dubbo-go-hessian2 v1.7.0 github.com/coreos/etcd v3.3.25+incompatible - github.com/creasty/defaults v1.3.0 - github.com/dubbogo/go-zookeeper v1.0.1 - github.com/dubbogo/gost v1.9.1 + github.com/creasty/defaults v1.5.1 + github.com/dubbogo/go-zookeeper v1.0.2 + github.com/dubbogo/gost v1.9.2 github.com/elazarl/go-bindata-assetfs v1.0.0 // indirect github.com/emicklei/go-restful/v3 v3.0.0 github.com/frankban/quicktest v1.4.1 // indirect github.com/fsnotify/fsnotify v1.4.7 github.com/go-co-op/gocron v0.1.1 - github.com/go-resty/resty/v2 v2.1.0 - github.com/golang/mock v1.3.1 - github.com/golang/protobuf v1.4.0 + github.com/go-resty/resty/v2 v2.3.0 + github.com/golang/mock v1.4.4 + github.com/golang/protobuf v1.4.3 github.com/grpc-ecosystem/grpc-opentracing v0.0.0-20180507213350-8e809c8a8645 github.com/hashicorp/consul v1.8.0 github.com/hashicorp/consul/api v1.5.0 @@ -28,19 +28,19 @@ require ( github.com/hashicorp/vault/sdk v0.1.14-0.20191112033314-390e96e22eb2 github.com/jinzhu/copier v0.0.0-20190625015134-976e0346caa8 github.com/magiconair/properties v1.8.1 - github.com/mitchellh/mapstructure v1.2.3 + github.com/mitchellh/mapstructure v1.3.3 github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd - github.com/nacos-group/nacos-sdk-go v1.0.0 - github.com/opentracing/opentracing-go v1.1.0 + github.com/nacos-group/nacos-sdk-go v1.0.1 + github.com/opentracing/opentracing-go v1.2.0 github.com/pierrec/lz4 v2.2.6+incompatible // indirect github.com/pkg/errors v0.9.1 github.com/prometheus/client_golang v1.1.0 github.com/satori/go.uuid v1.2.1-0.20181028125025-b2ce2384e17b github.com/stretchr/objx v0.2.0 // indirect - github.com/stretchr/testify v1.5.1 - github.com/zouyx/agollo/v3 v3.4.4 + github.com/stretchr/testify v1.6.1 + github.com/zouyx/agollo/v3 v3.4.5 go.uber.org/atomic v1.6.0 - go.uber.org/zap v1.15.0 + go.uber.org/zap v1.16.0 google.golang.org/grpc v1.26.0 gopkg.in/yaml.v2 v2.2.8 k8s.io/api v0.16.9 diff --git a/go.sum b/go.sum index f35b6c58451a11fb721471d9b124bdaa21c1b857..87d8029a1cf88bdd55f9c126bd9e4dd502ad5cae 100644 --- a/go.sum +++ b/go.sum @@ -74,16 +74,16 @@ github.com/OneOfOne/xxhash v1.2.2/go.mod h1:HSdplMjZKSmBqAxg5vPj2TmRDmfkzw+cTzAE github.com/OpenDNS/vegadns2client v0.0.0-20180418235048-a3fa4a771d87/go.mod h1:iGLljf5n9GjT6kc0HBvyI1nOKnGQbNB66VzSNbK5iks= github.com/PuerkitoBio/purell v1.0.0/go.mod h1:c11w/QuzBsJSee3cPx9rAFu61PvFxuPbtSwDGJws/X0= github.com/PuerkitoBio/urlesc v0.0.0-20160726150825-5bd2802263f2/go.mod h1:uGdkoq3SwY9Y+13GIhn11/XLaGBb4BfwItxLd5jeuXE= -github.com/RoaringBitmap/roaring v0.4.23 h1:gpyfd12QohbqhFO4NVDUdoPOCXsyahYRQhINmlHxKeo= -github.com/RoaringBitmap/roaring v0.4.23/go.mod h1:D0gp8kJQgE1A4LQ5wFLggQEyvDi06Mq5mKs52e1TwOo= +github.com/RoaringBitmap/roaring v0.5.5 h1:naNqvO1mNnghk2UvcsqnzHDBn9DRbCIRy94GmDTRVTQ= +github.com/RoaringBitmap/roaring v0.5.5/go.mod h1:puNo5VdzwbaIQxSiDIwfXl4Hnc+fbovcX4IW/dSTtUk= github.com/Shopify/sarama v1.19.0/go.mod h1:FVkBWblsNy7DGZRfXLU0O9RCGt5g3g3yEuWXgklEdEo= github.com/Shopify/toxiproxy v2.1.4+incompatible/go.mod h1:OXgGpZ6Cli1/URJOF1DMxUHB2q5Ap20/P/eIdh4G0pI= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6 h1:fLjPD/aNc3UIOA6tDi6QXUemppXK3P9BI7mr2hd6gx8= github.com/StackExchange/wmi v0.0.0-20180116203802-5d049714c4a6/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d h1:G0m3OIz70MZUWq3EgK3CesDbo8upS2Vm9/P3FtgI+Jk= github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d/go.mod h1:3eOhrUMpNV+6aFIbp5/iudMxNCF27Vw2OZgy4xEx0Fg= -github.com/Workiva/go-datastructures v1.0.50 h1:slDmfW6KCHcC7U+LP3DDBbm4fqTwZGn1beOFPfGaLvo= -github.com/Workiva/go-datastructures v1.0.50/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3UkzuWYS/oBZz5a7VVA= +github.com/Workiva/go-datastructures v1.0.52 h1:PLSK6pwn8mYdaoaCZEMsXBpBotr4HHn9abU0yMQt0NI= +github.com/Workiva/go-datastructures v1.0.52/go.mod h1:Z+F2Rca0qCsVYDS8z7bAGm8f3UkzuWYS/oBZz5a7VVA= github.com/abdullin/seq v0.0.0-20160510034733-d5467c17e7af h1:DBNMBMuMiWYu0b+8KMJuWmfCkcxl09JwdlqwDZZ6U14= github.com/abdullin/seq v0.0.0-20160510034733-d5467c17e7af/go.mod h1:5Jv4cbFiHJMsVxt52+i0Ha45fjshj6wxYr1r19tB9bw= github.com/afex/hystrix-go v0.0.0-20180502004556-fa1af6a1f4f5 h1:rFw4nCn9iMW+Vajsk51NtYIcwSTkXr+JGrMd36kTDJw= @@ -93,8 +93,8 @@ github.com/alangpierce/go-forceexport v0.0.0-20160317203124-8f1d6941cd75/go.mod github.com/alcortesm/tgz v0.0.0-20161220082320-9c5fe88206d7/go.mod h1:6zEj6s6u/ghQa61ZWa/C2Aw3RkjiTBOix7dkqa1VLIs= github.com/alecthomas/template v0.0.0-20160405071501-a0175ee3bccc/go.mod h1:LOuyumcjzFXgccqObfd/Ljyb9UuFJ6TxHnclSeseNhc= github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0= -github.com/alibaba/sentinel-golang v0.6.1 h1:Pxyw2X7ryklvToF40KG9l4uuO90jRZA2MWb8Z3d1wPo= -github.com/alibaba/sentinel-golang v0.6.1/go.mod h1:5jemKdyCQCKVf+quEia53fo9a17OSe+wnl9HX2NbNpc= +github.com/alibaba/sentinel-golang v0.6.2 h1:1OjjpljJbNKWp9p5RJKxOqS1gHGZPUWPlCcokv5xYJs= +github.com/alibaba/sentinel-golang v0.6.2/go.mod h1:5jemKdyCQCKVf+quEia53fo9a17OSe+wnl9HX2NbNpc= github.com/aliyun/alibaba-cloud-sdk-go v0.0.0-20190808125512-07798873deee/go.mod h1:myCDvQSzCW+wB1WAlocEru4wMGJxy+vlxHdhegi1CDQ= github.com/aliyun/alibaba-cloud-sdk-go v1.61.18 h1:zOVTBdCKFd9JbCKz9/nt+FovbjPFmb7mUnp8nH9fQBA= github.com/aliyun/alibaba-cloud-sdk-go v1.61.18/go.mod h1:v8ESoHo4SyHmuB4b1tJqDHxfTGEciD+yhvOU/5s1Rfk= @@ -183,8 +183,8 @@ github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwc github.com/cpuguy83/go-md2man/v2 v2.0.0-20190314233015-f79a8a8ca69d/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/cpuguy83/go-md2man/v2 v2.0.0/go.mod h1:maD7wRr/U5Z6m/iR4s+kqSMx2CaBsrgA7czyZG/E6dU= github.com/creack/pty v1.1.9/go.mod h1:oKZEueFk5CKHvIhNR5MUki03XCEU+Q6VDXinZuGJ33E= -github.com/creasty/defaults v1.3.0 h1:uG+RAxYbJgOPCOdKEcec9ZJXeva7Y6mj/8egdzwmLtw= -github.com/creasty/defaults v1.3.0/go.mod h1:CIEEvs7oIVZm30R8VxtFJs+4k201gReYyuYHJxZc68I= +github.com/creasty/defaults v1.5.1 h1:j8WexcS3d/t4ZmllX4GEkl4wIB/trOr035ajcLHCISM= +github.com/creasty/defaults v1.5.1/go.mod h1:FPZ+Y0WNrbqOVw+c6av63eyHUAl6pMHZwqLPvXUZGfY= github.com/davecgh/go-spew v0.0.0-20151105211317-5215b55f46b2/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= @@ -210,11 +210,11 @@ github.com/docker/go-connections v0.4.0 h1:El9xVISelRB7BuFusrZozjnkIM5YnzCViNKoh github.com/docker/go-connections v0.4.0/go.mod h1:Gbd7IOopHjR8Iph03tsViu4nIes5XhDvyHbTtUxmeec= github.com/docker/go-units v0.4.0/go.mod h1:fgPhTUdO+D/Jk86RDLlptpiXQzgHJF7gydDDbaIK4Dk= github.com/docker/spdystream v0.0.0-20160310174837-449fdfce4d96/go.mod h1:Qh8CwZgvJUkLughtfhJv5dyTYa91l1fOUCrgjqmcifM= -github.com/dubbogo/go-zookeeper v1.0.1 h1:irLzvOsDOTNsN8Sv9tvYYxVu6DCQfLtziZQtUHmZgz8= -github.com/dubbogo/go-zookeeper v1.0.1/go.mod h1:fn6n2CAEer3novYgk9ULLwAjuV8/g4DdC2ENwRb6E+c= +github.com/dubbogo/go-zookeeper v1.0.2 h1:xmEnPL8SlCe3/+J5ZR9e8qE35LmFVYe8VVpDakjNM4A= +github.com/dubbogo/go-zookeeper v1.0.2/go.mod h1:fn6n2CAEer3novYgk9ULLwAjuV8/g4DdC2ENwRb6E+c= github.com/dubbogo/gost v1.9.0/go.mod h1:pPTjVyoJan3aPxBPNUX0ADkXjPibLo+/Ib0/fADXSG8= -github.com/dubbogo/gost v1.9.1 h1:0/PPFo13zPbjt4Ia0zYWMFi3C6rAe9X7O1J2Iv+BHNM= -github.com/dubbogo/gost v1.9.1/go.mod h1:pPTjVyoJan3aPxBPNUX0ADkXjPibLo+/Ib0/fADXSG8= +github.com/dubbogo/gost v1.9.2 h1:lTo5WETmqDKSW4d+Fr3Emiz1rKsVaQCPWRypJPAAfcw= +github.com/dubbogo/gost v1.9.2/go.mod h1:QNM5RaeRdNWehUu8S0hUP5Qa8QUfGf6KH1JhqOVFvEI= github.com/dustin/go-humanize v1.0.0 h1:VSnTsYCnlFHaM2/igO1h6X3HA71jcobQuxemgkq4zYo= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/eapache/go-resiliency v1.1.0/go.mod h1:kFI+JgMyC7bLPUVY133qvEBtVayf5mFgVsvEsIPBvNs= @@ -294,8 +294,8 @@ github.com/go-openapi/swag v0.0.0-20160704191624-1d0bd113de87/go.mod h1:DXUve3Dp github.com/go-playground/locales v0.12.1/go.mod h1:IUMDtCfWo/w/mtMfIE/IG2K+Ey3ygWanZIBtBW0W2TM= github.com/go-playground/universal-translator v0.16.0/go.mod h1:1AnU7NaIRDWWzGEKwgtJRd2xk99HeFyHw3yid4rvQIY= github.com/go-redis/redis v6.15.5+incompatible/go.mod h1:NAIEuMOZ/fxfXJIrKDQDz8wamY7mA7PouImQ2Jvg6kA= -github.com/go-resty/resty/v2 v2.1.0 h1:Z6IefCpUMfnvItVJaJXWv/pMiiD11So35QgwEELsldE= -github.com/go-resty/resty/v2 v2.1.0/go.mod h1:dZGr0i9PLlaaTD4H/hoZIDjQ+r6xq8mgbRzHZf7f2J8= +github.com/go-resty/resty/v2 v2.3.0 h1:JOOeAvjSlapTT92p8xiS19Zxev1neGikoHsXJeOq8So= +github.com/go-resty/resty/v2 v2.3.0/go.mod h1:UpN9CgLZNsv4e9XG50UU8xdI0F43UQ4HmxLBDwaroHU= github.com/go-stack/stack v1.8.0/go.mod h1:v0f6uXyyMGvRgIKkXu+yp6POWl0qKG85gN/melR3HDY= github.com/go-telegram-bot-api/telegram-bot-api v4.6.4+incompatible/go.mod h1:qf9acutJ8cwBUhm1bqgz6Bei9/C/c93FPDljKWwsOgM= github.com/go-test/deep v1.0.2-0.20181118220953-042da051cf31/go.mod h1:wGDj63lr65AM2AQyKZd/NYHGb0R+1RLqB8NKt3aSFNA= @@ -326,6 +326,8 @@ github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfb github.com/golang/mock v1.2.0/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/mock v1.3.1 h1:qGJ6qTW+x6xX/my+8YUVl4WNpX9B7+/l2tRsHGZ7f2s= github.com/golang/mock v1.3.1/go.mod h1:sBzyDLLjw3U8JLTeZvSv8jJB+tU5PVekmnlKIyFUx0Y= +github.com/golang/mock v1.4.4 h1:l75CXGRSwbaYNpl/Z2X1XIIAMSCquvXgpVZDhwEIJsc= +github.com/golang/mock v1.4.4/go.mod h1:l3mdAwkq5BuhzHwde/uurv3sEJeZMXNpwsxVWU71h+4= github.com/golang/protobuf v0.0.0-20161109072736-4bd1920723d7/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/golang/protobuf v1.3.0/go.mod h1:Qd/q+1AKNOZr9uGQzbzCmRO6sUih6GTPZv6a1/R87v0= @@ -339,6 +341,8 @@ github.com/golang/protobuf v1.4.0-rc.2/go.mod h1:LlEzMj4AhA7rCAGe4KMBDvJI+AwstrU github.com/golang/protobuf v1.4.0-rc.4.0.20200313231945-b860323f09d0/go.mod h1:WU3c8KckQ9AFe+yFwt9sWVRKCVIyN9cPHBJSNnbL67w= github.com/golang/protobuf v1.4.0 h1:oOuy+ugB+P/kBdUnG5QaMXSIyJ1q38wWSojYCb3z5VQ= github.com/golang/protobuf v1.4.0/go.mod h1:jodUvKwWbYaEsadDk5Fwe5c77LiNKVO9IDvqG2KuDX0= +github.com/golang/protobuf v1.4.3 h1:JjCZWpVbqXDqFVmTfYWEVTMIYrL/NPdPSCHPJ0T/raM= +github.com/golang/protobuf v1.4.3/go.mod h1:oDoupMAO8OvCJWAcko0GGGIgR6R6ocIYbsSw735rRwI= github.com/golang/snappy v0.0.0-20180518054509-2e65f85255db/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= github.com/golang/snappy v0.0.1 h1:Qgr9rKW7uDUkrbSmQeiDsGa8SjGyCOGtuasMWwvp2P4= github.com/golang/snappy v0.0.1/go.mod h1:/XxbfmMg8lxefKM7IXC3fBNl/7bRcc72aCRzEWrmP2Q= @@ -545,6 +549,8 @@ github.com/jstemmer/go-junit-report v0.0.0-20190106144839-af01ea7f8024/go.mod h1 github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo= github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU= github.com/julienschmidt/httprouter v1.2.0/go.mod h1:SYymIcj16QtmaHHD7aYtjjsJG7VTCxuUUipMqKk8s4w= +github.com/k0kubun/colorstring v0.0.0-20150214042306-9440f1994b88/go.mod h1:3w7q1U84EfirKl04SVQ/s7nPm1ZPhiXd34z40TNz36k= +github.com/k0kubun/pp v3.0.1+incompatible/go.mod h1:GWse8YhT0p8pT4ir3ZgBbfZild3tgzSScAn6HmfYukg= github.com/kevinburke/ssh_config v0.0.0-20190725054713-01f96b0aa0cd/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q= github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00= @@ -594,6 +600,8 @@ github.com/mattn/go-colorable v0.1.2/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVc github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE= github.com/mattn/go-colorable v0.1.6 h1:6Su7aK7lXmJ/U79bYtBjLNaha4Fs1Rg9plHpcH+vvnE= github.com/mattn/go-colorable v0.1.6/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= +github.com/mattn/go-colorable v0.1.7 h1:bQGKb3vps/j0E9GfJQ03JyhRuxsvdAanXlT9BTw3mdw= +github.com/mattn/go-colorable v0.1.7/go.mod h1:u6P/XSegPjTcexA+o6vUJrdnUu04hMope9wVRipJSqc= github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4= github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s= github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ= @@ -638,6 +646,8 @@ github.com/mitchellh/mapstructure v0.0.0-20160808181253-ca63d7c062ee/go.mod h1:F github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= github.com/mitchellh/mapstructure v1.2.3 h1:f/MjBEBDLttYCGfRaKBbKSRVF5aV2O6fnBpzknuE3jU= github.com/mitchellh/mapstructure v1.2.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= +github.com/mitchellh/mapstructure v1.3.3 h1:SzB1nHZ2Xi+17FP0zVQBHIZqvwRN9408fJO8h+eeNA8= +github.com/mitchellh/mapstructure v1.3.3/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/pointerstructure v1.0.0 h1:ATSdz4NWrmWPOF1CeCBU4sMCno2hgqdbSrRPFWQSVZI= github.com/mitchellh/pointerstructure v1.0.0/go.mod h1:k4XwG94++jLVsSiTxo7qdIfXA9pj9EAeo0QsNNJOLZ8= github.com/mitchellh/reflectwalk v1.0.0/go.mod h1:mSTlrgnPZtwu0c4WaC2kGObEpuNDbx0jmZXqmk4esnw= @@ -658,6 +668,8 @@ github.com/mwitkow/go-conntrack v0.0.0-20161129095857-cc309e4a2223/go.mod h1:qRW github.com/mxk/go-flowrate v0.0.0-20140419014527-cca7078d478f/go.mod h1:ZdcZmHo+o7JKHSa8/e818NopupXU1YMK5fe1lsApnBw= github.com/nacos-group/nacos-sdk-go v1.0.0 h1:CufUF7DZca2ZzIrJtMMCDih1sA58BWCglArLMCZArUc= github.com/nacos-group/nacos-sdk-go v1.0.0/go.mod h1:hlAPn3UdzlxIlSILAyOXKxjFSvDJ9oLzTJ9hLAK1KzA= +github.com/nacos-group/nacos-sdk-go v1.0.1 h1:VNmXGlSS28xOmkO5Nxk5WRp6f1HMosAmG9pDtcnUFcw= +github.com/nacos-group/nacos-sdk-go v1.0.1/go.mod h1:hlAPn3UdzlxIlSILAyOXKxjFSvDJ9oLzTJ9hLAK1KzA= github.com/namedotcom/go v0.0.0-20180403034216-08470befbe04/go.mod h1:5sN+Lt1CaY4wsPvgQH/jsuJi4XO2ssZbdsIizr4CVC8= github.com/nats-io/jwt v0.3.2/go.mod h1:/euKqTS1ZD+zzjYrY7pseZrTtWQSjujC7xjPc8wL6eU= github.com/nats-io/nats-server/v2 v2.1.6/go.mod h1:BL1NOtaBQ5/y97djERRVWNouMW7GT3gxnmbE/eC8u8A= @@ -699,6 +711,8 @@ github.com/opencontainers/runtime-spec v0.1.2-0.20190507144316-5b71a03e2700/go.m github.com/opencontainers/runtime-tools v0.0.0-20181011054405-1d69bd0f9c39/go.mod h1:r3f7wjNzSs2extwzU3Y+6pKfobzPh+kKFJ3ofN+3nfs= github.com/opentracing/opentracing-go v1.1.0 h1:pWlfV3Bxv7k65HYwkikxat0+s3pV4bsqf19k25Ur8rU= github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o= +github.com/opentracing/opentracing-go v1.2.0 h1:uEJPy/1a5RIPAJ0Ov+OIO8OxWu77jEv+1B0VhjKrZUs= +github.com/opentracing/opentracing-go v1.2.0/go.mod h1:GxEUsuufX4nBwe+T+Wl9TAgYrxe9dPLANfrWvHYVTgc= github.com/openzipkin/zipkin-go v0.1.6/go.mod h1:QgAqvLzwWbR/WpD4A3cGpPtJrZXNIiJc5AZX7/PBEpw= github.com/oracle/oci-go-sdk v7.0.0+incompatible/go.mod h1:VQb79nF8Z2cwLkLS35ukwStZIg5F66tcBccjip/j888= github.com/ovh/go-ovh v0.0.0-20181109152953-ba5adb4cf014/go.mod h1:joRatxRJaZBsY3JAOEMcoOp05CnZzsx4scTxi95DHyQ= @@ -819,8 +833,8 @@ github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA= github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/viper v1.3.2/go.mod h1:ZiWeW+zYFKm7srdB9IoDzzZXaJaI5eL9QjNiN/DMA2s= github.com/spf13/viper v1.4.0/go.mod h1:PTJ7Z/lr49W6bUbkmS1V3by4uWynFiR9p7+dSq/yZzE= -github.com/spf13/viper v1.7.0 h1:xVKxvI7ouOI5I+U9s2eeiUfMaWBVoXA3AWskkrqK0VM= -github.com/spf13/viper v1.7.0/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= +github.com/spf13/viper v1.7.1 h1:pM5oEahlgWv/WnHXpgbKz7iLIxRf65tye2Ci+XFK5sk= +github.com/spf13/viper v1.7.1/go.mod h1:8WkrPz2fc9jxqZNCJI/76HCieCp4Q8HaLFoCha5qpdg= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/objx v0.2.0 h1:Hbg2NidpLE8veEBkEZTL3CvlkUIVzuU9jDplZO54c48= @@ -831,6 +845,8 @@ github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UV github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= github.com/stretchr/testify v1.5.1 h1:nOGnQDM7FYENwehXlg/kFVnos3rEvtKTjRvOWSzb6H4= github.com/stretchr/testify v1.5.1/go.mod h1:5W2xD1RspED5o8YsWQXVCued0rvSQ+mT+I5cxcmMvtA= +github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0= +github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= github.com/subosito/gotenv v1.2.0 h1:Slr1R9HxAlEKefgq5jn9U+DnETlIUa6HfgEzj0g5d7s= github.com/subosito/gotenv v1.2.0/go.mod h1:N0PQaV/YGNqwC0u51sEeR/aUtSLEXKX9iv69rRypqCw= github.com/syndtr/gocapability v0.0.0-20170704070218-db04d3cc01c8/go.mod h1:hkRG7XYTFWNJGYcbNJQlaLq0fg1yr4J4t/NcTQtrfww= @@ -878,8 +894,9 @@ github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2 h1:eY9dn8+vbi4tKz5 github.com/xiang90/probing v0.0.0-20190116061207-43a291ad63a2/go.mod h1:UETIi67q53MR2AWcXfiuqkDkRtnGDLqkBTpCHuJHxtU= github.com/xordataexchange/crypt v0.0.3-0.20170626215501-b2862e3d0a77/go.mod h1:aYKd//L2LvnjZzWKhF00oedf4jCCReLcmhLdhm1A27Q= github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= -github.com/zouyx/agollo/v3 v3.4.4 h1:5G7QNw3fw74Ns8SfnHNhjndV2mlz5Fg8bB7q84ydFYI= -github.com/zouyx/agollo/v3 v3.4.4/go.mod h1:ag0XmE1r4iAgPd6PUnU9TJ0DMEjM1VKX1HUNqQJ2ywU= +github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= +github.com/zouyx/agollo/v3 v3.4.5 h1:7YCxzY9ZYaH9TuVUBvmI6Tk0mwMggikah+cfbYogcHQ= +github.com/zouyx/agollo/v3 v3.4.5/go.mod h1:LJr3kDmm23QSW+F1Ol4TMHDa7HvJvscMdVxJ2IpUTVc= go.etcd.io/bbolt v1.3.2/go.mod h1:IbVyRI1SCnLcuJnV2u8VeU0CEYM7e686BmAb1XKL+uU= go.etcd.io/bbolt v1.3.4 h1:hi1bXHMVrlQh6WwxAy+qZCV/SYIlqo+Ushwdpa4tAKg= go.etcd.io/bbolt v1.3.4/go.mod h1:G5EMThwa9y8QZGBClrRx5EY+Yw9kAhnjy3bSjsnlVTQ= @@ -904,6 +921,8 @@ go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q= go.uber.org/zap v1.13.0/go.mod h1:zwrFLgMcdUuIBviXEYEH1YKNaOBnKXsx2IPda5bBwHM= go.uber.org/zap v1.15.0 h1:ZZCA22JRF2gQE5FoNmhmrf7jeJJ2uhqDUNRYKm8dvmM= go.uber.org/zap v1.15.0/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc= +go.uber.org/zap v1.16.0 h1:uFRZXykJGK9lLY4HtgSw44DnIcAM+kRBP7x5m+NpAOM= +go.uber.org/zap v1.16.0/go.mod h1:MA8QOfq0BHJwdXa996Y4dYkAqRKB8/1K1QMMZVaNZjQ= golang.org/x/crypto v0.0.0-20180621125126-a49355c7e3f8/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= golang.org/x/crypto v0.0.0-20181029021203-45a5f77698d3/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4= @@ -929,6 +948,8 @@ golang.org/x/crypto v0.0.0-20200302210943-78000ba7a073/go.mod h1:LzIPMQfyMNhhGPh golang.org/x/crypto v0.0.0-20200323165209-0ec3e9974c59/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37 h1:cg5LA/zNPRzIXIWSCxQW10Rvpy94aQh3LT/ShoCpkHw= golang.org/x/crypto v0.0.0-20200510223506-06a226fb4e37/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI= +golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto= golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190306152737-a1d7652674e8/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA= golang.org/x/exp v0.0.0-20190510132918-efd6b22b2522/go.mod h1:ZjyILWgesfNpC6sMxTJOJm9Kp84zZh5NQWvqDGG3Qr8= @@ -947,6 +968,8 @@ golang.org/x/lint v0.0.0-20190930215403-16217165b5de h1:5hukYrvBGR8/eNkX5mdUezrA golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc= golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f h1:J5lckAjkw6qYlOZNj90mLYNTEKDvWeuc1yieZ8qUzUE= golang.org/x/lint v0.0.0-20191125180803-fdd1cda4f05f/go.mod h1:5qLYkcX4OjUUV8bRuDixDT3tpyyb+LUpUlRWLxfhWrs= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b h1:Wh+f8QHJXR411sJR8/vRBTZ7YapZaRvUcLFFJhusH0k= +golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY= golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20190719004257-d2bd2a29d028/go.mod h1:E/iHnbuqvinMTCcRqshq8CkpyQDoeVncDDYHnLhea+o= golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc= @@ -954,6 +977,8 @@ golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.2.0 h1:KU7oHjnv3XNWfa5COkzUifxZmxp1TyI7ImMXqFxLwvQ= golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4= +golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/net v0.0.0-20170114055629-f2499483f923/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180611182652-db08ff08e862/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -975,7 +1000,6 @@ golang.org/x/net v0.0.0-20190522155817-f3200d17e092/go.mod h1:HSz+uSET+XFnRR8LxR golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks= golang.org/x/net v0.0.0-20190613194153-d28f0bde5980/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= -golang.org/x/net v0.0.0-20190628185345-da137c7871d7/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190724013045-ca1201d0de80/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190923162816-aa69164e4478/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20190930134127-c5a3c61f89f3/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -984,8 +1008,11 @@ golang.org/x/net v0.0.0-20191027093000-83d349e8ac1a/go.mod h1:z5CRVTTTmAJ677TzLL golang.org/x/net v0.0.0-20200226121028-0de0cce0169b h1:0mm1VjtFUOIlE1SbDlwjYaDxZVDP2S5ou6y0gSgXHu8= golang.org/x/net v0.0.0-20200226121028-0de0cce0169b/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= golang.org/x/net v0.0.0-20200301022130-244492dfa37a/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20200513185701-a91f0712d120/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2 h1:eDrdRpKgkcCqKZQwyZRyeFZgfqt37SL7Kv3tok06cKE= golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/N6yyVIVM9cpaDIP3A8BGJEC5A= +golang.org/x/net v0.0.0-20200822124328-c89045814202 h1:VvcQYSHwXgi7W+TpUR6A9g6Up98WAHf3f/ulnJ62IyA= +golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw= golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45 h1:SVwTIAaPC2U/AvvLNZ2a7OVsmBpC8L5BlwK1whH3hm0= @@ -997,6 +1024,8 @@ golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e h1:vcxGaoTs7kV8m5Np9uUNQin4BrLOthgV7252N8V+FwY= golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208 h1:qwRHBd0NqMbJxfbotnDhm2ByMI1Shq4Y6oRJo21SGJA= +golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sys v0.0.0-20170830134202-bb24a47a89ea/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180622082034-63fc586f45fe/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= golang.org/x/sys v0.0.0-20180823144017-11551d06cbcc/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -1084,12 +1113,17 @@ golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtn golang.org/x/tools v0.0.0-20191125144606-a911d9008d1f/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.0.0-20191216052735-49a3e744a425/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20191216173652-a0e659d51361/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= +golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28= golang.org/x/tools v0.0.0-20200426102838-f3a5411a4c3b h1:zSzQJAznWxAh9fZxiPy2FZo+ZZEYoYFYYDYdOrU7AaM= golang.org/x/tools v0.0.0-20200426102838-f3a5411a4c3b/go.mod h1:EkVYQZoAsY45+roYkvgYkIh4xh/qjgUK9TdY2XT94GE= +golang.org/x/tools v0.0.0-20200928182047-19e03678916f h1:VwGa2Wf+rHGIxvsssCkUNIyFv8jQY0VCBCNWtikoWq0= +golang.org/x/tools v0.0.0-20200928182047-19e03678916f/go.mod h1:z6u4i615ZeAfBE4XtMziQW1fSVJXACjjbWkB/mvPzlU= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4= golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1 h1:go1bK/D/BFZV2I8cIQd1NKEZ+0owSTG1fDTci4IqFcE= +golang.org/x/xerrors v0.0.0-20200804184101-5ec99f83aff1/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= google.golang.org/api v0.3.1/go.mod h1:6wY9I6uQWHQ8EM57III9mq/AjF+i8G65rmVagqKMtkk= google.golang.org/api v0.4.0/go.mod h1:8k5glujaEP+g9n7WNsDg8QP6cUVNI86fCNMcbazEtwE= google.golang.org/api v0.7.0/go.mod h1:WtwebWUNSVBH/HAw79HIFXZNqEvBhG+Ra+ax0hx3E3M= @@ -1139,6 +1173,8 @@ google.golang.org/protobuf v1.20.1-0.20200309200217-e05f789c0967/go.mod h1:A+miE google.golang.org/protobuf v1.21.0/go.mod h1:47Nbq4nVaFHyn7ilMalzfO3qCViNmqZ2kzikPIcrTAo= google.golang.org/protobuf v1.22.0 h1:cJv5/xdbk1NnMPR1VP9+HU6gupuG9MLBoH1r6RHZ2MY= google.golang.org/protobuf v1.22.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= +google.golang.org/protobuf v1.23.0 h1:4MY060fB1DLGMB/7MBTLnwQUY6+F09GEiz6SsrNqyzM= +google.golang.org/protobuf v1.23.0/go.mod h1:EGpADcykh3NcUnDUJcl1+ZksZNG86OlYog2l/sGQquU= gopkg.in/airbrake/gobrake.v2 v2.0.9/go.mod h1:/h5ZAUhDkGaJfjzjKLSjv6zCL6O0LLBxU4K+aSYdM/U= gopkg.in/alecthomas/kingpin.v2 v2.2.6/go.mod h1:FMv+mEhP44yOT+4EoQTLFTRgOQ1FBLkstjWtayDeSgw= gopkg.in/asn1-ber.v1 v1.0.0-20181015200546-f715ec2f112d/go.mod h1:cuepJuh7vyXfUyUwEgHQXw849cJrilpS5NeIjOWESAw= @@ -1178,6 +1214,8 @@ gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= gopkg.in/yaml.v2 v2.2.8 h1:obN1ZagJSUGI0Ek/LBmuj4SNLPfIny3KsKFopxRdj10= gopkg.in/yaml.v2 v2.2.8/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo= +gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gotest.tools v2.2.0+incompatible/go.mod h1:DsYFclhRJ6vuDpmuTbkuFWG+y2sxOXAzmJt81HFBacw= honnef.co/go/tools v0.0.0-20180728063816-88497007e858/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4= diff --git a/metadata/service/exporter/configurable/exporter.go b/metadata/service/exporter/configurable/exporter.go index 5a930c5e953aead15e4673f1b9537197128a7b35..75e52d8d1b833f95d7f6f09a778bd916bd4afee9 100644 --- a/metadata/service/exporter/configurable/exporter.go +++ b/metadata/service/exporter/configurable/exporter.go @@ -19,6 +19,7 @@ package configurable import ( "context" + "errors" "sync" ) @@ -46,12 +47,18 @@ func NewMetadataServiceExporter(metadataService service.MetadataService) exporte } // Export will export the metadataService -func (exporter *MetadataServiceExporter) Export() error { +func (exporter *MetadataServiceExporter) Export(url *common.URL) error { if !exporter.IsExported() { serviceConfig := config.NewServiceConfig(constant.SIMPLE_METADATA_SERVICE_NAME, context.Background()) serviceConfig.Protocol = constant.DEFAULT_PROTOCOL + if url == nil || url.SubURL == nil { + return errors.New("metadata server url is nil, pls check your configuration") + } serviceConfig.Protocols = map[string]*config.ProtocolConfig{ - constant.DEFAULT_PROTOCOL: generateMetadataProtocol(), + constant.DEFAULT_PROTOCOL: { + Name: url.SubURL.Protocol, + Port: url.SubURL.Port, + }, } serviceConfig.InterfaceName = constant.METADATA_SERVICE_NAME // identify this is a golang server @@ -95,11 +102,3 @@ func (exporter *MetadataServiceExporter) IsExported() bool { defer exporter.lock.RUnlock() return exporter.ServiceConfig != nil && exporter.ServiceConfig.IsExport() } - -// generateMetadataProtocol will return a default ProtocolConfig -func generateMetadataProtocol() *config.ProtocolConfig { - return &config.ProtocolConfig{ - Name: constant.DEFAULT_PROTOCOL, - Port: "20000", - } -} diff --git a/metadata/service/exporter/configurable/exporter_test.go b/metadata/service/exporter/configurable/exporter_test.go index b304b9153f92f1a7ab8176236fd9648e09f4366b..ceda2550e2e60ed2e587dabe92cca20831e708a6 100644 --- a/metadata/service/exporter/configurable/exporter_test.go +++ b/metadata/service/exporter/configurable/exporter_test.go @@ -26,6 +26,7 @@ import ( ) import ( + "github.com/apache/dubbo-go/common" _ "github.com/apache/dubbo-go/common/proxy/proxy_factory" "github.com/apache/dubbo-go/config" _ "github.com/apache/dubbo-go/filter/filter_impl" @@ -55,12 +56,23 @@ func TestConfigurableExporter(t *testing.T) { mockInitProviderWithSingleRegistry() metadataService, _ := inmemory.NewMetadataService() exported := NewMetadataServiceExporter(metadataService) - assert.Equal(t, false, exported.IsExported()) - assert.NoError(t, exported.Export()) - assert.Equal(t, true, exported.IsExported()) - assert.Regexp(t, "dubbo://:20000/MetadataService*", exported.GetExportedURLs()[0].String()) - exported.Unexport() - assert.Equal(t, false, exported.IsExported()) + + t.Run("configurableExporterUrlNil", func(t *testing.T) { + assert.Equal(t, false, exported.IsExported()) + assert.Error(t, exported.Export(nil), "metadata server url is nil, pls check your configuration") + }) + + t.Run("configurableExporter", func(t *testing.T) { + registryURL, _ := common.NewURL("service-discovery://localhost:12345") + subURL, _ := common.NewURL("dubbo://localhost:20003") + registryURL.SubURL = &subURL + assert.Equal(t, false, exported.IsExported()) + assert.NoError(t, exported.Export(®istryURL)) + assert.Equal(t, true, exported.IsExported()) + assert.Regexp(t, "dubbo://:20003/MetadataService*", exported.GetExportedURLs()[0].String()) + exported.Unexport() + assert.Equal(t, false, exported.IsExported()) + }) } // mockInitProviderWithSingleRegistry will init a mocked providerConfig diff --git a/metadata/service/exporter/exporter.go b/metadata/service/exporter/exporter.go index cfdef3a0e79d29ce31717c0fc3c575e9e4ba1759..33ceaca467220d1c0e39225abb006485e026f961 100644 --- a/metadata/service/exporter/exporter.go +++ b/metadata/service/exporter/exporter.go @@ -23,7 +23,7 @@ import ( // MetadataServiceExporter will export & unexport the metadata service, get exported url, and return is exported or not type MetadataServiceExporter interface { - Export() error + Export(url *common.URL) error Unexport() GetExportedURLs() []*common.URL IsExported() bool diff --git a/protocol/dubbo/dubbo_invoker.go b/protocol/dubbo/dubbo_invoker.go index bce33508bec92b706a1722c3bbc0ed0607e66643..e72ca28299727d9865664036016671670f5935a0 100644 --- a/protocol/dubbo/dubbo_invoker.go +++ b/protocol/dubbo/dubbo_invoker.go @@ -161,6 +161,10 @@ func (di *DubboInvoker) getTimeout(invocation *invocation_impl.RPCInvocation) ti return di.timeout } +func (di *DubboInvoker) IsAvailable() bool { + return di.client.IsAvailable() +} + // Destroy destroy dubbo client invoker. func (di *DubboInvoker) Destroy() { di.quitOnce.Do(func() { diff --git a/protocol/grpc/client.go b/protocol/grpc/client.go index a0ab0be80cc905115e675c1c4dea2b1c748f6c09..9b31a8c626ab0cdec8404da6712d88376be28f2f 100644 --- a/protocol/grpc/client.go +++ b/protocol/grpc/client.go @@ -19,6 +19,7 @@ package grpc import ( "reflect" + "strconv" ) import ( @@ -93,9 +94,13 @@ func NewClient(url common.URL) *Client { // if global trace instance was set , it means trace function enabled. If not , will return Nooptracer tracer := opentracing.GlobalTracer() dailOpts := make([]grpc.DialOption, 0, 4) + maxMessageSize, _ := strconv.Atoi(url.GetParam(constant.MESSAGE_SIZE_KEY, "4")) dailOpts = append(dailOpts, grpc.WithInsecure(), grpc.WithBlock(), grpc.WithUnaryInterceptor( otgrpc.OpenTracingClientInterceptor(tracer, otgrpc.LogPayloads())), - grpc.WithDefaultCallOptions(grpc.CallContentSubtype(clientConf.ContentSubType))) + grpc.WithDefaultCallOptions( + grpc.CallContentSubtype(clientConf.ContentSubType), + grpc.MaxCallRecvMsgSize(1024*1024*maxMessageSize), + grpc.MaxCallSendMsgSize(1024*1024*maxMessageSize))) conn, err := grpc.Dial(url.Location, dailOpts...) if err != nil { panic(err) diff --git a/protocol/grpc/grpc_protocol.go b/protocol/grpc/grpc_protocol.go index 68594a4b35921b6e3b1d59d404ed163025d57a81..396ff473f24f525c41bf117af9c12df3fbad1ebe 100644 --- a/protocol/grpc/grpc_protocol.go +++ b/protocol/grpc/grpc_protocol.go @@ -18,11 +18,13 @@ package grpc import ( + "strconv" "sync" ) import ( "github.com/apache/dubbo-go/common" + "github.com/apache/dubbo-go/common/constant" "github.com/apache/dubbo-go/common/extension" "github.com/apache/dubbo-go/common/logger" "github.com/apache/dubbo-go/protocol" @@ -76,7 +78,9 @@ func (gp *GrpcProtocol) openServer(url common.URL) { gp.serverLock.Lock() _, ok = gp.serverMap[url.Location] if !ok { + grpcMessageSize, _ := strconv.Atoi(url.GetParam(constant.MESSAGE_SIZE_KEY, "4")) srv := NewServer() + srv.SetBufferSize(grpcMessageSize) gp.serverMap[url.Location] = srv srv.Start(url) } diff --git a/protocol/grpc/protoc-gen-dubbo/plugin/dubbo/dubbo.go b/protocol/grpc/protoc-gen-dubbo/plugin/dubbo/dubbo.go index 1af4fafdc606783e937ede63f99e5a08f0b2419e..a9f50e82879e1d6448300ec7b2a92e2a68070dc8 100644 --- a/protocol/grpc/protoc-gen-dubbo/plugin/dubbo/dubbo.go +++ b/protocol/grpc/protoc-gen-dubbo/plugin/dubbo/dubbo.go @@ -220,7 +220,23 @@ func (g *dubboGrpc) generateService(file *generator.FileDescriptor, service *pb. g.P("},") } g.P("},") - g.P("Streams: []", grpcPkg, ".StreamDesc{},") + g.P("Streams: []", grpcPkg, ".StreamDesc{") + for i, method := range service.Method { + if !method.GetClientStreaming() && !method.GetServerStreaming() { + continue + } + g.P("{") + g.P("StreamName: ", strconv.Quote(method.GetName()), ",") + g.P("Handler: ", handlerNames[i], ",") + if method.GetServerStreaming() { + g.P("ServerStreams: true,") + } + if method.GetClientStreaming() { + g.P("ClientStreams: true,") + } + g.P("},") + } + g.P("},") g.P("Metadata: \"", file.GetName(), "\",") g.P("}") g.P("}") @@ -241,6 +257,7 @@ func (g *dubboGrpc) generateClientSignature(servName string, method *pb.MethodDe respName := "out *" + g.typeName(method.GetOutputType()) if method.GetServerStreaming() || method.GetClientStreaming() { respName = servName + "_" + generator.CamelCase(origMethName) + "Client" + return fmt.Sprintf("%s func(ctx %s.Context%s) (%s, error)", methName, contextPkg, reqArg, respName) } return fmt.Sprintf("%s func(ctx %s.Context%s, %s) error", methName, contextPkg, reqArg, respName) } @@ -252,7 +269,6 @@ func (g *dubboGrpc) generateServerMethod(servName, fullServName string, method * methName := generator.CamelCase(method.GetName()) hname := fmt.Sprintf("_DUBBO_%s_%s_Handler", servName, methName) inType := g.typeName(method.GetInputType()) - outType := g.typeName(method.GetOutputType()) if !method.GetServerStreaming() && !method.GetClientStreaming() { g.P("func ", hname, "(srv interface{}, ctx ", contextPkg, ".Context, dec func(interface{}) error, interceptor ", grpcPkg, ".UnaryServerInterceptor) (interface{}, error) {") @@ -286,6 +302,11 @@ func (g *dubboGrpc) generateServerMethod(servName, fullServName string, method * } streamType := unexport(servName) + methName + "Server" g.P("func ", hname, "(srv interface{}, stream ", grpcPkg, ".ServerStream) error {") + g.P("_, ok := srv.(dgrpc.DubboGrpcService)") + g.P(`invo := invocation.NewRPCInvocation("`, methName, `", nil, nil)`) + g.P("if !ok {") + g.P("fmt.Println(invo)") + g.P("}") if !method.GetClientStreaming() { g.P("m := new(", inType, ")") g.P("if err := stream.RecvMsg(m); err != nil { return err }") @@ -296,50 +317,5 @@ func (g *dubboGrpc) generateServerMethod(servName, fullServName string, method * g.P("}") g.P() - genSend := method.GetServerStreaming() - genSendAndClose := !method.GetServerStreaming() - genRecv := method.GetClientStreaming() - - // Stream auxiliary types and methods. - g.P("type ", servName, "_", methName, "Server interface {") - if genSend { - g.P("Send(*", outType, ") error") - } - if genSendAndClose { - g.P("SendAndClose(*", outType, ") error") - } - if genRecv { - g.P("Recv() (*", inType, ", error)") - } - g.P(grpcPkg, ".ServerStream") - g.P("}") - g.P() - - g.P("type ", streamType, " struct {") - g.P(grpcPkg, ".ServerStream") - g.P("}") - g.P() - - if genSend { - g.P("func (x *", streamType, ") Send(m *", outType, ") error {") - g.P("return x.ServerStream.SendMsg(m)") - g.P("}") - g.P() - } - if genSendAndClose { - g.P("func (x *", streamType, ") SendAndClose(m *", outType, ") error {") - g.P("return x.ServerStream.SendMsg(m)") - g.P("}") - g.P() - } - if genRecv { - g.P("func (x *", streamType, ") Recv() (*", inType, ", error) {") - g.P("m := new(", inType, ")") - g.P("if err := x.ServerStream.RecvMsg(m); err != nil { return nil, err }") - g.P("return m, nil") - g.P("}") - g.P() - } - return hname } diff --git a/protocol/grpc/server.go b/protocol/grpc/server.go index 2b7b1adddf573e3b84db32a11cfc286ff22a0276..30bdf77e77e478763a5cc6b1e81f021dd3573bc4 100644 --- a/protocol/grpc/server.go +++ b/protocol/grpc/server.go @@ -40,6 +40,7 @@ import ( // Server is a gRPC server type Server struct { grpcServer *grpc.Server + bufferSize int } // NewServer creates a new server @@ -57,6 +58,10 @@ type DubboGrpcService interface { ServiceDesc() *grpc.ServiceDesc } +func (s *Server) SetBufferSize(n int) { + s.bufferSize = n +} + // Start gRPC server with @url func (s *Server) Start(url common.URL) { var ( @@ -72,7 +77,9 @@ func (s *Server) Start(url common.URL) { // if global trace instance was set, then server tracer instance can be get. If not , will return Nooptracer tracer := opentracing.GlobalTracer() server := grpc.NewServer( - grpc.UnaryInterceptor(otgrpc.OpenTracingServerInterceptor(tracer))) + grpc.UnaryInterceptor(otgrpc.OpenTracingServerInterceptor(tracer)), + grpc.MaxRecvMsgSize(1024*1024*s.bufferSize), + grpc.MaxSendMsgSize(1024*1024*s.bufferSize)) key := url.GetParam(constant.BEAN_NAME_KEY, "") service := config.GetProviderService(key) diff --git a/registry/base_registry.go b/registry/base_registry.go index ad1a3b61741e003625612ad58409eb8615271a84..d6f5ceb91b1b46135d2da36418ac69fa71f53d48 100644 --- a/registry/base_registry.go +++ b/registry/base_registry.go @@ -29,7 +29,6 @@ import ( ) import ( - gxnet "github.com/dubbogo/gost/net" perrors "github.com/pkg/errors" ) @@ -53,7 +52,7 @@ var ( func init() { processID = fmt.Sprintf("%d", os.Getpid()) - localIP, _ = gxnet.GetLocalIP() + localIP = common.GetLocalIp() } type createPathFunc func(dubboPath string) error @@ -314,7 +313,7 @@ func (r *BaseRegistry) providerRegistry(c common.URL, params url.Values, f creat // Dubbo java consumer to start looking for the provider url,because the category does not match, // the provider will not find, causing the consumer can not start, so we use consumers. - if len(c.Methods) == 0 { + if len(c.Methods) != 0 { params.Add(constant.METHODS_KEY, strings.Join(c.Methods, ",")) } logger.Debugf("provider url params:%#v", params) @@ -326,7 +325,16 @@ func (r *BaseRegistry) providerRegistry(c common.URL, params url.Values, f creat } host += ":" + c.Port - rawURL = fmt.Sprintf("%s://%s%s?%s", c.Protocol, host, c.Path, params.Encode()) + //delete empty param key + for key, val := range params { + if len(val) > 0 && val[0] == "" { + params.Del(key) + } + } + + s, _ := url.QueryUnescape(params.Encode()) + rawURL = fmt.Sprintf("%s://%s%s?%s", c.Protocol, host, c.Path, s) + // Print your own registration service providers. dubboPath = fmt.Sprintf("/dubbo/%s/%s", r.service(c), (common.RoleType(common.PROVIDER)).String()) logger.Debugf("provider path:%s, url:%s", dubboPath, rawURL) @@ -361,7 +369,8 @@ func (r *BaseRegistry) consumerRegistry(c common.URL, params url.Values, f creat } params.Add("protocol", c.Protocol) - rawURL = fmt.Sprintf("consumer://%s%s?%s", localIP, c.Path, params.Encode()) + s, _ := url.QueryUnescape(params.Encode()) + rawURL = fmt.Sprintf("consumer://%s%s?%s", localIP, c.Path, s) dubboPath = fmt.Sprintf("/dubbo/%s/%s", r.service(c), (common.RoleType(common.CONSUMER)).String()) logger.Debugf("consumer path:%s, url:%s", dubboPath, rawURL) diff --git a/registry/consul/utils.go b/registry/consul/utils.go index 05ac5e76e292a2b574bd5e661bbbcca4f419fc22..f5babf69d5970a495f8f0c23a254fe4b2a9ffbee 100644 --- a/registry/consul/utils.go +++ b/registry/consul/utils.go @@ -25,7 +25,6 @@ import ( ) import ( - gxnet "github.com/dubbogo/gost/net" consul "github.com/hashicorp/consul/api" perrors "github.com/pkg/errors" ) @@ -47,7 +46,7 @@ func buildService(url common.URL) (*consul.AgentServiceRegistration, error) { // address if url.Ip == "" { - url.Ip, _ = gxnet.GetLocalIP() + url.Ip = common.GetLocalIp() } // port diff --git a/registry/directory/directory.go b/registry/directory/directory.go index ccd87c80b2d76b9d35c7a81d1c975d9bac3b30ee..009b279faab6db1296d0ed0863ea8e2c0877c191 100644 --- a/registry/directory/directory.go +++ b/registry/directory/directory.go @@ -25,7 +25,6 @@ import ( ) import ( - gxnet "github.com/dubbogo/gost/net" perrors "github.com/pkg/errors" "go.uber.org/atomic" ) @@ -404,7 +403,7 @@ func (dir *RegistryDirectory) overrideUrl(targetUrl *common.URL) { func (dir *RegistryDirectory) getConsumerUrl(c *common.URL) *common.URL { processID := fmt.Sprintf("%d", os.Getpid()) - localIP, _ := gxnet.GetLocalIP() + localIP := common.GetLocalIp() params := url.Values{} c.RangeParams(func(key, value string) bool { diff --git a/registry/etcdv3/registry.go b/registry/etcdv3/registry.go index 9cbc4945605c2ac42242d7c0727e8cd487703c9c..f3cc379bd8e94b15b678f0ac1d5ed5b6c917da6a 100644 --- a/registry/etcdv3/registry.go +++ b/registry/etcdv3/registry.go @@ -91,7 +91,7 @@ func newETCDV3Registry(url *common.URL) (registry.Registry, error) { r, etcdv3.WithName(etcdv3.RegistryETCDV3Client), etcdv3.WithTimeout(timeout), - etcdv3.WithEndpoints(url.Location), + etcdv3.WithEndpoints(strings.Split(url.Location, ",")...), ); err != nil { return nil, err } diff --git a/registry/etcdv3/service_discovery.go b/registry/etcdv3/service_discovery.go index dceaa99df8061c6f46baa52eb6f5cebe4477f120..e8d4aea9a42634896c3c30e5c6b527a935179873 100644 --- a/registry/etcdv3/service_discovery.go +++ b/registry/etcdv3/service_discovery.go @@ -19,6 +19,7 @@ package etcdv3 import ( "fmt" + "strings" "sync" "time" ) @@ -313,7 +314,7 @@ func newEtcdV3ServiceDiscovery(name string) (registry.ServiceDiscovery, error) { client := etcdv3.NewServiceDiscoveryClient( etcdv3.WithName(etcdv3.RegistryETCDV3Client), etcdv3.WithTimeout(timeout), - etcdv3.WithEndpoints(remoteConfig.Address), + etcdv3.WithEndpoints(strings.Split(remoteConfig.Address, ",")...), ) descriptor := fmt.Sprintf("etcd-service-discovery[%s]", remoteConfig.Address) diff --git a/registry/kubernetes/registry.go b/registry/kubernetes/registry.go index 88895855689df42f2cd66ec158e6b8f2806ef6f0..c1e559e48dcc64972c9405e15405d7e6febcc845 100644 --- a/registry/kubernetes/registry.go +++ b/registry/kubernetes/registry.go @@ -27,7 +27,6 @@ import ( import ( "github.com/apache/dubbo-getty" - "github.com/dubbogo/gost/net" perrors "github.com/pkg/errors" v1 "k8s.io/api/core/v1" ) @@ -54,7 +53,7 @@ const ( func init() { processID = fmt.Sprintf("%d", os.Getpid()) - localIP, _ = gxnet.GetLocalIP() + localIP = common.GetLocalIp() extension.SetRegistry(Name, newKubernetesRegistry) } diff --git a/registry/nacos/registry.go b/registry/nacos/registry.go index 757474455b7e5df6e5fb454228cdcb551b6a3a0e..51428864fbe45aac6257d7fc1f68abcf53f638f1 100644 --- a/registry/nacos/registry.go +++ b/registry/nacos/registry.go @@ -26,7 +26,6 @@ import ( ) import ( - gxnet "github.com/dubbogo/gost/net" "github.com/nacos-group/nacos-sdk-go/clients" "github.com/nacos-group/nacos-sdk-go/clients/naming_client" nacosConstant "github.com/nacos-group/nacos-sdk-go/common/constant" @@ -52,7 +51,7 @@ const ( ) func init() { - localIP, _ = gxnet.GetLocalIP() + localIP = common.GetLocalIp() extension.SetRegistry(constant.NACOS_KEY, newNacosRegistry) } diff --git a/registry/servicediscovery/service_discovery_registry.go b/registry/servicediscovery/service_discovery_registry.go index 7576804eb563e16a043f63f17db2532f48c878f1..4db2c5aad438784b1289b4473aa8d23c4f8d923f 100644 --- a/registry/servicediscovery/service_discovery_registry.go +++ b/registry/servicediscovery/service_discovery_registry.go @@ -75,7 +75,7 @@ type serviceDiscoveryRegistry struct { func newServiceDiscoveryRegistry(url *common.URL) (registry.Registry, error) { - tryInitMetadataService() + tryInitMetadataService(url) serviceDiscovery, err := creatServiceDiscovery(url) if err != nil { @@ -642,7 +642,7 @@ var ( // tryInitMetadataService will try to initialize metadata service // TODO (move to somewhere) -func tryInitMetadataService() { +func tryInitMetadataService(url *common.URL) { ms, err := extension.GetMetadataService(config.GetApplicationConfig().MetadataType) if err != nil { @@ -662,7 +662,7 @@ func tryInitMetadataService() { expt := configurable.NewMetadataServiceExporter(ms) - err = expt.Export() + err = expt.Export(url) if err != nil { logger.Errorf("could not export the metadata service", err) } diff --git a/remoting/etcdv3/facade.go b/remoting/etcdv3/facade.go index 52b1cce3e4618e9c2669e7a3b37256ebe6d61c41..614ba9ae3a1407daea2d9d534a0474a28ad8cac9 100644 --- a/remoting/etcdv3/facade.go +++ b/remoting/etcdv3/facade.go @@ -63,7 +63,7 @@ LOOP: r.ClientLock().Lock() clientName := RegistryETCDV3Client timeout, _ := time.ParseDuration(r.GetUrl().GetParam(constant.REGISTRY_TIMEOUT_KEY, constant.DEFAULT_REG_TIMEOUT)) - endpoint := r.GetUrl().Location + endpoints := r.Client().endpoints r.Client().Close() r.SetClient(nil) r.ClientLock().Unlock() @@ -80,11 +80,11 @@ LOOP: err = ValidateClient( r, WithName(clientName), - WithEndpoints(endpoint), + WithEndpoints(endpoints...), WithTimeout(timeout), ) logger.Infof("ETCDV3ProviderRegistry.validateETCDV3Client(etcd Addr{%s}) = error{%#v}", - endpoint, perrors.WithStack(err)) + endpoints, perrors.WithStack(err)) if err == nil && r.RestartCallBack() { break } diff --git a/remoting/exchange_client.go b/remoting/exchange_client.go index efcfca55868e7042b685adb5fb2452dd2d3a65c0..26fa5d5740e72c69d1a712146b6e1b0424885c21 100644 --- a/remoting/exchange_client.go +++ b/remoting/exchange_client.go @@ -47,6 +47,8 @@ type Client interface { Close() // send request to server. Request(request *Request, timeout time.Duration, response *PendingResponse) error + // check if the client is still available + IsAvailable() bool } // This is abstraction level. it is like facade. @@ -180,6 +182,13 @@ func (client *ExchangeClient) Send(invocation *protocol.Invocation, url common.U // close client func (client *ExchangeClient) Close() { client.client.Close() + // for reinit client + client.init = false +} + +// IsAvailable to check if the underlying network client is available yet. +func (client *ExchangeClient) IsAvailable() bool { + return client.client.IsAvailable() } // handle the response from server diff --git a/remoting/getty/getty_client.go b/remoting/getty/getty_client.go index 6af3971f5c1f9ff5b0fafbc00ae2ba3f44eb34b5..7edc1cf8c59f86a3f89c623b4ed02b6b0a0495ec 100644 --- a/remoting/getty/getty_client.go +++ b/remoting/getty/getty_client.go @@ -204,6 +204,14 @@ func (c *Client) Request(request *remoting.Request, timeout time.Duration, respo return perrors.WithStack(err) } +// isAvailable returns true if the connection is available, or it can be re-established. +func (c *Client) IsAvailable() bool { + client, _, err := c.selectSession(c.addr) + return err == nil && + // defensive check + client != nil +} + func (c *Client) selectSession(addr string) (*gettyRPCClient, getty.Session, error) { rpcClient, err := c.pool.getGettyRpcClient(addr) if err != nil { diff --git a/remoting/getty/pool.go b/remoting/getty/pool.go index 8ceb673aa9ef714d9189355a16de03628269b04c..9689175bcf9838de595f292779b099ae9615d8e8 100644 --- a/remoting/getty/pool.go +++ b/remoting/getty/pool.go @@ -392,6 +392,7 @@ func (p *gettyRPCClientPool) get() (*gettyRPCClient, error) { if d := now - conn.getActive(); d > p.ttl { p.remove(conn) go conn.close() + num = len(p.conns) continue } conn.updateActive(now) //update active time diff --git a/remoting/getty/pool_test.go b/remoting/getty/pool_test.go new file mode 100644 index 0000000000000000000000000000000000000000..1115a490428da14a72f5c40e1b98b2a7fb3f80ad --- /dev/null +++ b/remoting/getty/pool_test.go @@ -0,0 +1,51 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package getty + +import ( + "testing" + "time" +) + +import ( + "github.com/stretchr/testify/assert" +) + +func TestGetConnFromPool(t *testing.T) { + var rpcClient Client + + clientPoll := newGettyRPCClientConnPool(&rpcClient, 1, time.Duration(5*time.Second)) + + var conn1 gettyRPCClient + conn1.active = time.Now().Unix() + clientPoll.put(&conn1) + assert.Equal(t, 1, len(clientPoll.conns)) + + var conn2 gettyRPCClient + conn2.active = time.Now().Unix() + clientPoll.put(&conn2) + assert.Equal(t, 1, len(clientPoll.conns)) + conn, err := clientPoll.get() + assert.Nil(t, err) + assert.Equal(t, &conn1, conn) + time.Sleep(6 * time.Second) + conn, err = clientPoll.get() + assert.Nil(t, conn) + assert.Nil(t, err) + assert.Equal(t, 0, len(clientPoll.conns)) +} diff --git a/remoting/zookeeper/listener.go b/remoting/zookeeper/listener.go index b6c6d78106a5a97ec94e621d2e664185a8216656..e5ddcadeaca9c3ce972cbe781413ebec7393afce 100644 --- a/remoting/zookeeper/listener.go +++ b/remoting/zookeeper/listener.go @@ -301,6 +301,9 @@ func (l *ZkEventListener) listenDirEvent(conf *common.URL, zkPath string, listen go func(zkPath string, listener remoting.DataListener) { if l.listenServiceNodeEvent(zkPath) { listener.DataChange(remoting.Event{Path: zkPath, Action: remoting.EventTypeDel}) + l.pathMapLock.Lock() + defer l.pathMapLock.Unlock() + delete(l.pathMap, zkPath) } logger.Warnf("listenSelf(zk path{%s}) goroutine exit now", zkPath) }(dubboPath, listener)