Skip to content

Commit

Permalink
Merge branch '3.0' into Ftr/proxy-service
Browse files Browse the repository at this point in the history
  • Loading branch information
LaurenceLiZhixin committed Apr 3, 2021
2 parents da6f6f6 + 9119d58 commit e3b2cf2
Show file tree
Hide file tree
Showing 322 changed files with 1,748 additions and 2,874 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "samples"]
path = samples
url = git@github.com:apache/dubbo-go-samples.git
20 changes: 19 additions & 1 deletion CHANGE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,17 @@
- [Add dubbo-go-cli telnet tool](https://github.com/apache/dubbo-go/pull/818)
- [Add Prox ImplementFunc to allow override impl](https://github.com/apache/dubbo-go/pull/1019)
- [Add read configuration path from the command line when start](https://github.com/apache/dubbo-go/pull/1039)
- [Add use invoker with same ip as client first](https://github.com/apache/dubbo-go/pull/1023)
- [Add an "api way" to set general configure](https://github.com/apache/dubbo-go/pull/1020)
- [Add registry ip:port set from enviroment variable](https://github.com/apache/dubbo-go/pull/1036)

### Enhancement
- [introduce ConfigPostProcessor extension](https://github.com/apache/dubbo-go/pull/943)
- [Impl extension of two urls comparison](https://github.com/apache/dubbo-go/pull/854)
- [using event-driven to let router send signal to notify channel](https://github.com/apache/dubbo-go/pull/976)
- [lint codes](https://github.com/apache/dubbo-go/pull/941)
- [Imp: destroy invoker smoothly](https://github.com/apache/dubbo-go/pull/1045)
- [Improve config center](https://github.com/apache/dubbo-go/pull/1030)

### Bugfixes
- [Fix: generic struct2MapAll key of map keep type](https://github.com/apache/dubbo-go/pull/928)
Expand All @@ -23,8 +28,21 @@
- [Fix: etcd exit panic](https://github.com/apache/dubbo-go/pull/1013)
- [Fix: when connect to provider fail, will occur panic](https://github.com/apache/dubbo-go/pull/1021)
- [Fix: support getty send Length, when the data transfer failed](https://github.com/apache/dubbo-go/pull/1028)
- [Fix: RPCInvocation.ServiceKey use PATH_KEY instead of INTERFACE_KEY ](https://github.com/apache/dubbo-go/pull/1078/files)
- [Fix: zk too many tcp conn](https://github.com/apache/dubbo-go/pull/1010)
- [Fix: fix zk listener func pathToKey](https://github.com/apache/dubbo-go/pull/1066)
- [Fix: graceful shutdown](https://github.com/apache/dubbo-go/pull/1007)
- [Fix: nacos service provider does not require subscribe](https://github.com/apache/dubbo-go/pull/1056)
- [Fix: key of generic map convert is more general](https://github.com/apache/dubbo-go/pull/1041)
- [Fix: body buffer too short](https://github.com/apache/dubbo-go/pull/1090)

Milestone: [https://github.com/apache/dubbo-go/milestone/7](https://github.com/apache/dubbo-go/milestone/7?closed=1)
### Dependencies
- [Bump dubbo-go-hessian2 from v1.9.0-rc1 to v1.9.1](https://github.com/apache/dubbo-go/pull/1088/files)
- [Bump github.com/nacos-group/nacos-sdk-go from 1.0.5 to v1.0.7](https://github.com/apache/dubbo-go/pull/1106)

Milestone:
- [https://github.com/apache/dubbo-go/milestone/7](https://github.com/apache/dubbo-go/milestone/7?closed=1)
- [https://github.com/apache/dubbo-go/milestone/10](https://github.com/apache/dubbo-go/milestone/10?closed=1)

## 1.5.5

Expand Down
5 changes: 5 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ Finished List:
- Router
* [Condition router](https://github.com/apache/dubbo-go/pull/294)
* [Health check router](https://github.com/apache/dubbo-go/pull/389)
* [Dynamic_tag_router](https://github.com/apache/dubbo-go/pull/703)

- Registry
* ZooKeeper
Expand Down Expand Up @@ -134,6 +135,10 @@ Finished List:
* [Nacos](https://github.com/apache/dubbo-go/blob/9a5990d9a9c3d5e6633c0d7d926c156416bcb931/registry/nacos/service_discovery.go)
* [Zookeeper](https://github.com/apache/dubbo-go/blob/9a5990d9a9c3d5e6633c0d7d926c156416bcb931/registry/zookeeper/service_discovery.go)
* [Etcd](https://github.com/apache/dubbo-go/blob/9a5990d9a9c3d5e6633c0d7d926c156416bcb931/registry/etcdv3/service_discovery.go)
* [File](https://github.com/apache/dubbo-go/pull/732)

- Tool
* [Dubbo-go-cli](https://github.com/apache/dubbo-go/pull/818)

You can know more about dubbo-go by its [roadmap](https://github.com/apache/dubbo-go/wiki/Roadmap).

Expand Down
22 changes: 21 additions & 1 deletion README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,7 @@ Apache License, Version 2.0
- 路由器
* [Condition router](https://github.com/apache/dubbo-go/pull/294)
* [Health check router](https://github.com/apache/dubbo-go/pull/389)
* [Dynamic_tag_router](https://github.com/apache/dubbo-go/pull/703)

- 注册中心
* ZooKeeper
Expand Down Expand Up @@ -133,6 +134,10 @@ Apache License, Version 2.0
* [Nacos](https://github.com/apache/dubbo-go/blob/9a5990d9a9c3d5e6633c0d7d926c156416bcb931/registry/nacos/service_discovery.go)
* [Zookeeper](https://github.com/apache/dubbo-go/blob/9a5990d9a9c3d5e6633c0d7d926c156416bcb931/registry/zookeeper/service_discovery.go)
* [Etcd](https://github.com/apache/dubbo-go/blob/9a5990d9a9c3d5e6633c0d7d926c156416bcb931/registry/etcdv3/service_discovery.go)
* [File](https://github.com/apache/dubbo-go/pull/732)

- 工具箱
* [Dubbo-go-cli](https://github.com/apache/dubbo-go/pull/818)

你可以通过访问 [roadmap](https://github.com/apache/dubbo-go/wiki/Roadmap) 知道更多关于 dubbo-go 的信息。

Expand Down Expand Up @@ -194,7 +199,22 @@ make test
</table>
</div>

如果想加入到社区微信群,可以先添加社区负责人 于雨 的微信 AlexanderStocks 。添加微信之前,请先给 dubbo-go 点 star 作为对项目的支持,添加好友时请报上 github ID 以进行验证。
dubbogo 社区已经开通微信公众号 "dubbogo大区",可在微信搜索 "dubbogo大区" 或者扫描如下二维码关注,可通过公众号私信留言加入 dubbogo 微信社区。

<div>
<table>
<tbody>
<tr></tr>
<tr>
<td align="center" valign="middle">
<img width="80px" height="115px" src="./doc/pic/misc/dubbogo-wechat.png">
</a>
</td>
</tr>
<tr></tr>
</tbody>
</table>
</div>

作为一个维护已经帮助构建了经受多家大型微服务系统的社区,我们足以为现有的成绩感到自豪。社区欢迎能提出建设性意见者,只知索取者和喷子请绕行。

Expand Down
6 changes: 2 additions & 4 deletions cluster/cluster_impl/available_cluster_invoker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,8 @@ import (
"github.com/apache/dubbo-go/protocol/mock"
)

var (
availableUrl, _ = common.NewURL(fmt.Sprintf("dubbo://%s:%d/com.ikurento.user.UserProvider",
constant.LOCAL_HOST_VALUE, constant.DEFAULT_PORT))
)
var availableUrl, _ = common.NewURL(fmt.Sprintf("dubbo://%s:%d/com.ikurento.user.UserProvider",
constant.LOCAL_HOST_VALUE, constant.DEFAULT_PORT))

func registerAvailable(invoker *mock.MockInvoker) protocol.Invoker {
extension.SetLoadbalance("random", loadbalance.NewRandomLoadBalance)
Expand Down
15 changes: 7 additions & 8 deletions cluster/cluster_impl/base_cluster_invoker.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ func (invoker *baseClusterInvoker) GetUrl() *common.URL {
}

func (invoker *baseClusterInvoker) Destroy() {
//this is must atom operation
// this is must atom operation
if invoker.destroyed.CAS(false, true) {
invoker.directory.Destroy()
}
Expand All @@ -69,7 +69,7 @@ func (invoker *baseClusterInvoker) IsAvailable() bool {
return invoker.directory.IsAvailable()
}

//check invokers availables
// check invokers availables
func (invoker *baseClusterInvoker) checkInvokers(invokers []protocol.Invoker, invocation protocol.Invocation) error {
if len(invokers) == 0 {
ip := common.GetLocalIp()
Expand All @@ -78,10 +78,9 @@ func (invoker *baseClusterInvoker) checkInvokers(invokers []protocol.Invoker, in
invocation.MethodName(), invoker.directory.GetUrl().SubURL.Key(), invoker.directory.GetUrl().String(), ip, constant.Version)
}
return nil

}

//check cluster invoker is destroyed or not
// check cluster invoker is destroyed or not
func (invoker *baseClusterInvoker) checkWhetherDestroyed() error {
if invoker.destroyed.Load() {
ip := common.GetLocalIp()
Expand All @@ -99,7 +98,7 @@ func (invoker *baseClusterInvoker) doSelect(lb cluster.LoadBalance, invocation p

url := invokers[0].GetUrl()
sticky := url.GetParamBool(constant.STICKY_KEY, false)
//Get the service method sticky config if have
// Get the service method sticky config if have
sticky = url.GetMethodParamBool(invocation.MethodName(), constant.STICKY_KEY, sticky)

if invoker.stickyInvoker != nil && !isInvoked(invoker.stickyInvoker, invokers) {
Expand Down Expand Up @@ -135,7 +134,7 @@ func (invoker *baseClusterInvoker) doSelectInvoker(lb cluster.LoadBalance, invoc

selectedInvoker := lb.Select(invokers, invocation)

//judge if the selected Invoker is invoked and available
// judge if the selected Invoker is invoked and available
if (!selectedInvoker.IsAvailable() && invoker.availablecheck) || isInvoked(selectedInvoker, invoked) {
protocol.SetInvokerUnhealthyStatus(selectedInvoker)
otherInvokers := getOtherInvokers(invokers, selectedInvoker)
Expand Down Expand Up @@ -193,10 +192,10 @@ func getLoadBalance(invoker protocol.Invoker, invocation protocol.Invocation) cl
url := invoker.GetUrl()

methodName := invocation.MethodName()
//Get the service loadbalance config
// Get the service loadbalance config
lb := url.GetParam(constant.LOADBALANCE_KEY, constant.DEFAULT_LOADBALANCE)

//Get the service method loadbalance config if have
// Get the service method loadbalance config if have
if v := url.GetMethodParam(methodName, constant.LOADBALANCE_KEY, ""); len(v) > 0 {
lb = v
}
Expand Down
1 change: 1 addition & 0 deletions cluster/cluster_impl/broadcast_cluster_invoker.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package cluster_impl
import (
"context"
)

import (
"github.com/apache/dubbo-go/cluster"
"github.com/apache/dubbo-go/common/logger"
Expand Down
6 changes: 2 additions & 4 deletions cluster/cluster_impl/broadcast_cluster_invoker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,8 @@ import (
"github.com/apache/dubbo-go/protocol/mock"
)

var (
broadcastUrl, _ = common.NewURL(
fmt.Sprintf("dubbo://%s:%d/com.ikurento.user.UserProvider", constant.LOCAL_HOST_VALUE, constant.DEFAULT_PORT))
)
var broadcastUrl, _ = common.NewURL(
fmt.Sprintf("dubbo://%s:%d/com.ikurento.user.UserProvider", constant.LOCAL_HOST_VALUE, constant.DEFAULT_PORT))

func registerBroadcast(mockInvokers ...*mock.MockInvoker) protocol.Invoker {
extension.SetLoadbalance("random", loadbalance.NewRandomLoadBalance)
Expand Down
6 changes: 3 additions & 3 deletions cluster/cluster_impl/failback_cluster_invoker.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,10 +137,10 @@ func (invoker *failbackClusterInvoker) Invoke(ctx context.Context, invocation pr
return &protocol.RPCResult{}
}

//Get the service loadbalance config
// Get the service loadbalance config
url := invokers[0].GetUrl()
lb := url.GetParam(constant.LOADBALANCE_KEY, constant.DEFAULT_LOADBALANCE)
//Get the service method loadbalance config if have
// Get the service method loadbalance config if have
methodName := invocation.MethodName()
if v := url.GetMethodParam(methodName, constant.LOADBALANCE_KEY, ""); v != "" {
lb = v
Expand All @@ -149,7 +149,7 @@ func (invoker *failbackClusterInvoker) Invoke(ctx context.Context, invocation pr
loadBalance := extension.GetLoadbalance(lb)
invoked := make([]protocol.Invoker, 0, len(invokers))
ivk := invoker.doSelect(loadBalance, invocation, invokers, invoked)
//DO INVOKE
// DO INVOKE
result := ivk.Invoke(ctx, invocation)
if result.Error() != nil {
invoker.once.Do(func() {
Expand Down
6 changes: 2 additions & 4 deletions cluster/cluster_impl/failback_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,8 @@ import (
"github.com/apache/dubbo-go/protocol/mock"
)

var (
failbackUrl, _ = common.NewURL(
fmt.Sprintf("dubbo://%s:%d/com.ikurento.user.UserProvider", constant.LOCAL_HOST_VALUE, constant.DEFAULT_PORT))
)
var failbackUrl, _ = common.NewURL(
fmt.Sprintf("dubbo://%s:%d/com.ikurento.user.UserProvider", constant.LOCAL_HOST_VALUE, constant.DEFAULT_PORT))

// registerFailback register failbackCluster to cluster extension.
func registerFailback(invoker *mock.MockInvoker) protocol.Invoker {
Expand Down
1 change: 1 addition & 0 deletions cluster/cluster_impl/failfast_cluster_invoker.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package cluster_impl
import (
"context"
)

import (
"github.com/apache/dubbo-go/cluster"
"github.com/apache/dubbo-go/protocol"
Expand Down
6 changes: 2 additions & 4 deletions cluster/cluster_impl/failfast_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,8 @@ import (
"github.com/apache/dubbo-go/protocol/mock"
)

var (
failfastUrl, _ = common.NewURL(
fmt.Sprintf("dubbo://%s:%d/com.ikurento.user.UserProvider", constant.LOCAL_HOST_VALUE, constant.DEFAULT_PORT))
)
var failfastUrl, _ = common.NewURL(
fmt.Sprintf("dubbo://%s:%d/com.ikurento.user.UserProvider", constant.LOCAL_HOST_VALUE, constant.DEFAULT_PORT))

// registerFailfast register failfastCluster to cluster extension.
func registerFailfast(invoker *mock.MockInvoker) protocol.Invoker {
Expand Down
13 changes: 7 additions & 6 deletions cluster/cluster_impl/failover_cluster_invoker.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,8 +64,8 @@ func (invoker *failoverClusterInvoker) Invoke(ctx context.Context, invocation pr
loadBalance := getLoadBalance(invokers[0], invocation)

for i := 0; i <= retries; i++ {
//Reselect before retry to avoid a change of candidate `invokers`.
//NOTE: if `invokers` changed, then `invoked` also lose accuracy.
// Reselect before retry to avoid a change of candidate `invokers`.
// NOTE: if `invokers` changed, then `invoked` also lose accuracy.
if i > 0 {
if err := invoker.checkWhetherDestroyed(); err != nil {
return &protocol.RPCResult{Err: err}
Expand All @@ -81,7 +81,7 @@ func (invoker *failoverClusterInvoker) Invoke(ctx context.Context, invocation pr
continue
}
invoked = append(invoked, ivk)
//DO INVOKE
// DO INVOKE
result = ivk.Invoke(ctx, invocation)
if result.Error() != nil {
providers = append(providers, ivk.GetUrl().Key())
Expand All @@ -105,7 +105,8 @@ func (invoker *failoverClusterInvoker) Invoke(ctx context.Context, invocation pr
"Tried %v times of the providers %v (%v/%v)from the registry %v on the consumer %v using the dubbo version %v. "+
"Last error is %+v.", methodName, invokerSvc, retries, providers, len(providers), len(invokers),
invokerUrl, ip, constant.Version, result.Error().Error()),
)}
),
}
}

func getRetries(invokers []protocol.Invoker, methodName string) int {
Expand All @@ -114,9 +115,9 @@ func getRetries(invokers []protocol.Invoker, methodName string) int {
}

url := invokers[0].GetUrl()
//get reties
// get reties
retriesConfig := url.GetParam(constant.RETRIES_KEY, constant.DEFAULT_RETRIES)
//Get the service method loadbalance config if have
// Get the service method loadbalance config if have
if v := url.GetMethodParam(methodName, constant.RETRIES_KEY, ""); len(v) != 0 {
retriesConfig = v
}
Expand Down
1 change: 1 addition & 0 deletions cluster/cluster_impl/failover_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ import (
"net/url"
"testing"
)

import (
perrors "github.com/pkg/errors"
"github.com/stretchr/testify/assert"
Expand Down
7 changes: 4 additions & 3 deletions cluster/cluster_impl/failsafe_cluster_invoker.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ package cluster_impl
import (
"context"
)

import (
"github.com/apache/dubbo-go/cluster"
"github.com/apache/dubbo-go/common/constant"
Expand Down Expand Up @@ -56,9 +57,9 @@ func (invoker *failsafeClusterInvoker) Invoke(ctx context.Context, invocation pr

url := invokers[0].GetUrl()
methodName := invocation.MethodName()
//Get the service loadbalance config
// Get the service loadbalance config
lb := url.GetParam(constant.LOADBALANCE_KEY, constant.DEFAULT_LOADBALANCE)
//Get the service method loadbalance config if have
// Get the service method loadbalance config if have
if v := url.GetMethodParam(methodName, constant.LOADBALANCE_KEY, ""); v != "" {
lb = v
}
Expand All @@ -68,7 +69,7 @@ func (invoker *failsafeClusterInvoker) Invoke(ctx context.Context, invocation pr
var result protocol.Result

ivk := invoker.doSelect(loadbalance, invocation, invokers, invoked)
//DO INVOKE
// DO INVOKE
result = ivk.Invoke(ctx, invocation)
if result.Error() != nil {
// ignore
Expand Down
6 changes: 2 additions & 4 deletions cluster/cluster_impl/failsafe_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,8 @@ import (
"github.com/apache/dubbo-go/protocol/mock"
)

var (
failsafeUrl, _ = common.NewURL(
fmt.Sprintf("dubbo://%s:%d/com.ikurento.user.UserProvider", constant.LOCAL_HOST_VALUE, constant.DEFAULT_PORT))
)
var failsafeUrl, _ = common.NewURL(
fmt.Sprintf("dubbo://%s:%d/com.ikurento.user.UserProvider", constant.LOCAL_HOST_VALUE, constant.DEFAULT_PORT))

// registerFailsafe register failsafeCluster to cluster extension.
func registerFailsafe(invoker *mock.MockInvoker) protocol.Invoker {
Expand Down
8 changes: 3 additions & 5 deletions cluster/cluster_impl/forking_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,8 @@ import (
"github.com/apache/dubbo-go/protocol/mock"
)

var (
forkingUrl, _ = common.NewURL(
fmt.Sprintf("dubbo://%s:%d/com.ikurento.user.UserProvider", constant.LOCAL_HOST_VALUE, constant.DEFAULT_PORT))
)
var forkingUrl, _ = common.NewURL(
fmt.Sprintf("dubbo://%s:%d/com.ikurento.user.UserProvider", constant.LOCAL_HOST_VALUE, constant.DEFAULT_PORT))

func registerForking(mockInvokers ...*mock.MockInvoker) protocol.Invoker {
extension.SetLoadbalance(loadbalance.RoundRobin, loadbalance.NewRoundRobinLoadBalance)
Expand All @@ -72,7 +70,7 @@ func TestForkingInvokeSuccess(t *testing.T) {

mockResult := &protocol.RPCResult{Rest: rest{tried: 0, success: true}}
forkingUrl.AddParam(constant.FORKS_KEY, strconv.Itoa(3))
//forkingUrl.AddParam(constant.TIMEOUT_KEY, strconv.Itoa(constant.DEFAULT_TIMEOUT))
// forkingUrl.AddParam(constant.TIMEOUT_KEY, strconv.Itoa(constant.DEFAULT_TIMEOUT))

var wg sync.WaitGroup
wg.Add(2)
Expand Down
1 change: 0 additions & 1 deletion cluster/cluster_impl/zone_aware_cluster_invoker.go
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,6 @@ func (invoker *zoneAwareClusterInvoker) BeforeInvoker(ctx context.Context, invoc
}

func (invoker *zoneAwareClusterInvoker) AfterInvoker(ctx context.Context, invocation protocol.Invocation) {

}

func matchParam(target, key, def string, invoker protocol.Invoker) bool {
Expand Down
Loading

0 comments on commit e3b2cf2

Please sign in to comment.