Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merge 3.0 to master #1606

Merged
merged 37 commits into from
Nov 22, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
7b3c4c8
build(deps): bump github.com/hashicorp/vault/sdk from 0.2.1 to 0.3.0 …
dependabot[bot] Nov 2, 2021
a4641f5
delete useless codes (#1551)
AlexStocks Nov 2, 2021
bbd2bda
Update CHANGELOG.md
LaurenceLiZhixin Nov 2, 2021
1d2647d
[#1559]: adjust the startup process of the configuration center (#1560)
Mulavar Nov 5, 2021
35d27b4
[#1276]modify the name of the receiver to a single character (#1561)
Mulavar Nov 5, 2021
27aaaa9
style(common): rename constants in camel-case style (#1563)
justxuewei Nov 6, 2021
ff58c2a
fix: #1558: Set root config to global ptr in Init() function. (#1564)
LaurenceLiZhixin Nov 7, 2021
ebaa5b6
fix: in the Consumer service, the Reference config property ‘check’ u…
PhilYue Nov 7, 2021
cbb502f
Triple upgrade to grpc (#1566)
LaurenceLiZhixin Nov 7, 2021
f56cb86
Merge remote-tracking branch 'upstream/3.0' into fix/consumer_check
Nov 8, 2021
0b33524
register not use metadata configuration.
binbin0325 Nov 6, 2021
b275568
build(deps): bump github.com/go-resty/resty/v2 from 2.3.0 to 2.7.0 (#…
dependabot[bot] Nov 9, 2021
85ee27d
build(deps): bump google.golang.org/grpc from 1.41.0 to 1.42.0 (#1578)
dependabot[bot] Nov 9, 2021
6fe0c94
build(deps): bump github.com/knadh/koanf from 1.3.0 to 1.3.2 (#1577)
dependabot[bot] Nov 9, 2021
eb6010c
Merge pull request #1568 from PhilYue/fix/consumer_check
justxuewei Nov 9, 2021
5b74bf6
fix: registry param
Nov 9, 2021
8a011a9
Merge remote-tracking branch 'upstream/3.0' into 20211102_nacos
Nov 9, 2021
8f41bd1
fix: fix ns and group
Nov 9, 2021
94434b4
fix: integrate test
Nov 9, 2021
2ebc38b
Fix: integrate test
Nov 9, 2021
001f95c
fix: url fmt
LaurenceLiZhixin Nov 10, 2021
0c85c55
Merge pull request #1565 from sanxun0325/20211102_nacos
zhaoyunxing92 Nov 10, 2021
f38a0c2
fix: nacos servicediscovery group
LaurenceLiZhixin Nov 10, 2021
b02124d
Fix: enhance zk
LaurenceLiZhixin Nov 11, 2021
fce2f73
Merge pull request #1581 from apache/fix/nacos-2.0
justxuewei Nov 11, 2021
3182c7a
start application (#1571)
XiaoWeiKIN Nov 11, 2021
4185062
graceful shutdwon filter (#1585)
XiaoWeiKIN Nov 12, 2021
1fdd429
Fix: some bugs and features for 3.0 (#1586)
LaurenceLiZhixin Nov 12, 2021
19c0bb9
refactor listenDirEvent
Nov 15, 2021
b90089d
hessian encode attachments return error (#1588)
binbin0325 Nov 16, 2021
4d780a9
upgrade gost dependency version
Nov 17, 2021
2ae0b3e
upgrade hessian to v1.9.5 (#1595)
wongoo Nov 18, 2021
a812919
Merge pull request #1589 from Mulavar/3.0
justxuewei Nov 19, 2021
cc201e9
build(deps): bump k8s.io/apimachinery from 0.16.9 to 0.22.4 (#1600)
dependabot[bot] Nov 19, 2021
5c115cb
ftr: triple tracing (#1596)
LaurenceLiZhixin Nov 19, 2021
df9f3f9
[fix #1590] filter single instance (#1591)
XiaoWeiKIN Nov 19, 2021
7d08891
Ftr/triple reflect support (#1603)
LaurenceLiZhixin Nov 22, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
147 changes: 146 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,152 @@
# Release Notes
---

## 3.0.0
## 3.0.0-rc3

### Feature:

- Triple features

- [New triple pb generation tool](https://github.com/dubbogo/tools/pull/17)

Refer to [QuickStart of dubbo-go 3.0](https://dubbogo.github.io/zh-cn/docs/user/quickstart/3.0/quickstart.html), and [Dubbo-go-samples](https://github.com/apache/dubbo-go-samples) to try protoc-gen-go-triple pb generator plugin.

- [Response exception from client](https://github.com/dubbogo/triple/pull/30)

Triple client can get the error stacks from server, pointing to real error occurs position.

- [Multi params support](https://github.com/apache/dubbo-go/pull/1344)

- [New metrics support](https://github.com/apache/dubbo-go/pull/1540)

Refer to [Docs of dubbo-go 3.0 Metrics](https://dubbogo.github.io/zh-cn/docs/user/samples/metrics.html), and [dubbo-go-samples/metrics](https://github.com/apache/dubbo-go-samples/tree/master/metrics)] to try new metrics support.

- [Remove sleep to wait for service discovery logic](https://github.com/apache/dubbo-go/pull/1531)

Set reference check default to true and remove extra time.Sleep logic in client side during service-discovery [remove time.Sleep](https://github.com/apache/dubbo-go-samples/pull/276/files)

- [Registry Waittime configurable](https://github.com/apache/dubbo-go/pull/1516/files)

- [Dynamic Route Config](https://github.com/apache/dubbo-go/pull/1519)

Refer to [Docs of dubbo-go 3.0 Router](https://dubbogo.github.io/zh-cn/docs/user/samples/mesh_router.html), and [dubbo-go-samples/meshrouter](https://github.com/apache/dubbo-go-samples/tree/master/route/meshroute) to try dynamic mesh router support.

- [New config API support](https://github.com/apache/dubbo-go/pull/1499) [New root config API builder](https://github.com/apache/dubbo-go/pull/1491)

Refer to [Docs of dubbo-go 3.0 Configuration](https://dubbogo.github.io/zh-cn/docs/user/concept/configuration.html), and [dubbo-go-samples/config-api](https://github.com/apache/dubbo-go-samples/tree/master/config-api) to try new config API.

- [Support custom registry group name on Nacos](https://github.com/apache/dubbo-go/pull/1353)

- [GRPC supports multi pb](https://github.com/apache/dubbo-go/pull/1361)

- [New logger support](https://github.com/apache/dubbo-go/pull/1335)

Refer to [Docs of dubbo-go 3.0 logger](https://dubbogo.github.io/zh-cn/docs/user/samples/custom-logger.html), and [dubbo-go-samples/logger](https://github.com/apache/dubbo-go-samples/tree/master/logger) to try new logger support.

- [Generic invocation supports](https://github.com/apache/dubbo-go/pull/1315)

Refer to [Docs of dubbo-go 3.0 generic](https://dubbogo.github.io/zh-cn/docs/user/samples/generic.html), and [dubbo-go-samples/generic](https://github.com/apache/dubbo-go-samples/tree/master/generic) to try new generic support.

- [Support key generate function in service event](https://github.com/apache/dubbo-go/pull/1286)



### Enhancement:

- [Configuration Enhancement](https://github.com/apache/dubbo-go/commit/1397e8bba97f14b7656a5afc9bc92530bb693092)

One of the biggest update in this release is the configuration optimization. We discarded the old configuration and introduced a new one. Currently, the new configuration has been updated to [the master branch of samples](https://github.com/apache/dubbo-go-samples) (corresponding to latest dubbo-go 3.0), and there are introductions and detailed examples on the our website [dubbogo.github](https://dubbogo.github.io).

- Triple:

- [Triple CPU usage optimization](https://github.com/dubbogo/triple/pull/32/files)

Set default tcp read buffer to 4k to decrease gc, and descrease CPU usage by 60% of 3.0.0-rc2

- [Add Triple Debug Log](https://github.com/dubbogo/triple/pull/29)

- [Support Apollo secret](https://github.com/apache/dubbo-go/pull/1533)

- [Use class Name as the default reference name ](https://github.com/apache/dubbo-go/pull/1339)

You can set service/refernce key to provider/consumer's struct name: [Config samples](https://github.com/apache/dubbo-go-samples/blob/master/helloworld/go-server/conf/dubbogo.yml#L15) & [Target provider struct](https://github.com/apache/dubbo-go-samples/blob/master/helloworld/go-server/cmd/server.go#L45),

And there is no needs to define (p*Provider) Reference() method from now on.

- [Set default logger level to info](https://github.com/apache/dubbo-go/pull/1549/files#diff-d5ab135265094924568957f56eaef061c7948d2664daa995fbe0de4c7ab2d272R82)
- [Refactor of filter package sturcture](https://github.com/apache/dubbo-go/pull/1299)
- [Refactor of cluster package structure](https://github.com/apache/dubbo-go/pull/1507)



### Bugfix:

- [Heartbeat's timeout will modify consumer's timeout](https://github.com/apache/dubbo-go/pull/1532)

- [Remove zk test to ensure ut could be run locally](https://github.com/apache/dubbo-go/pull/1357)

- [Add Application Registry](https://github.com/apache/dubbo-go/pull/1493)

- [Change serviceName like java style on nacos](https://github.com/apache/dubbo-go/pull/1352)

- [Url serialization bug](https://github.com/apache/dubbo-go/pull/1292)

- [Change the key of a mock echo filter](https://github.com/apache/dubbo-go/pull/1381)

- [Fix: fix the exception when tcp timeout is less than 1s for 3.0 #1362](https://github.com/apache/dubbo-go/pull/1380)

- [Registry timeout not pars](https://github.com/apache/dubbo-go/pull/1392)

- [Fix Isprovider check](https://github.com/apache/dubbo-go/pull/1500)

- [Delete zk registry when set defualt consumer/provider config](https://github.com/apache/dubbo-go/pull/1324/files)


## 3.0.0-rc2

### New Features

- [Add Triple Msgpack Codec](https://github.com/apache/dubbo-go/pull/1242)
- [Add Triple user defined serializer support](https://github.com/apache/dubbo-go/pull/1242)
- [Add gRPC provider reference in codes generated by protoc-gen-dubbo3](https://github.com/apache/dubbo-go/pull/1240)
- [Add integration tests using dubbo-go-samples](https://github.com/apache/dubbo-go/pull/1223)
- [Add service discovery support etcd remote reporter](https://github.com/apache/dubbo-go/pull/1221)
- [Add service discovery support nacos remote reporter](https://github.com/apache/dubbo-go/pull/1218)
- [Add grpc server reflection register logic](https://github.com/apache/dubbo-go/pull/1216)

### Enhancement

- [Make remote metadata center configurable](https://github.com/apache/dubbo-go/pull/1258)
- [Enhance nacos connection](https://github.com/apache/dubbo-go/pull/1255)
- [Add unit tests for zk metadata report](https://github.com/apache/dubbo-go/pull/1229)
- [Restructuring remoting metadata service](https://github.com/apache/dubbo-go/pull/1227)
- [Dependency prompting for unit tests](https://github.com/apache/dubbo-go/pull/1212)
- [Make cluster interceptor a chain](https://github.com/apache/dubbo-go/pull/1211)
- [Improve etcd version and change create to put](https://github.com/apache/dubbo-go/pull/1203)
- [Remove reflect in grpc server](https://github.com/apache/dubbo-go/pull/1200)
- [Change lb hash logic](https://github.com/apache/dubbo-go/pull/1267)

### Bugfixes

- [Fix: zk invoker refer check fail,and service will be added in cache invokers fail problem](https://github.com/apache/dubbo-go/pull/1249)
- [Fix: app level service discovery local mod URL serialize fail problem](https://github.com/apache/dubbo-go/pull/1238)
- [Fix: m1 cpu exec fail problem](https://github.com/apache/dubbo-go/pull/1236)
- [Fix: metadata info struct contains unsupported field](https://github.com/apache/dubbo-go/pull/1234)
- [Fix: go race in directory](https://github.com/apache/dubbo-go/pull/1222)
- [Fix: zk name changes from default to conn location](https://github.com/apache/dubbo-go/pull/1263)

### Dependencies

- [bump actions/cache from 2.1.5 to 2.1.6](https://github.com/apache/dubbo-go/pull/1230)

Milestone:

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




## 3.0.0-rc1

### New Features
- [Add triple protocol](https://github.com/apache/dubbo-go/pull/1071)
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

[中文 🇨🇳](./README_CN.md)

Apache Dubbo-go, a Dubbo implementation written in Golang, is born to bridge the gap between Java and Golang. Please visit our [official website](https://dubbogo.github.io) for the quick start and documentation.
Apache Dubbo-go, a Dubbo implementation written in Golang, is born to bridge the gap between Java and Golang. Please visit our [official website](https://dubbo.apache.org/zh/docs/languages/golang/) for the quick start and documentation.

## Architecture

Expand Down
2 changes: 1 addition & 1 deletion README_CN.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

[English 🇺🇸](./README.md)

Apache Dubbo Go 语言实现,架起 Java 和 Golang 之间的桥梁,与 gRPC/Spring Cloud 生态互联互通,带领 Java 生态享受云原生时代的技术红利。请访问我们的[官方网站](https://dubbogo.github.io)查看快速开始和文档。
Apache Dubbo Go 语言实现,架起 Java 和 Golang 之间的桥梁,与 gRPC/Spring Cloud 生态互联互通,带领 Java 生态享受云原生时代的技术红利。请访问我们的[官方网站](https://dubbo.apache.org/zh/docs/languages/golang/)查看快速开始和文档。

## 架构

Expand Down
2 changes: 1 addition & 1 deletion cluster/cluster/available/cluster_invoker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import (
)

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

func registerAvailable(invoker *mock.MockInvoker) protocol.Invoker {
extension.SetLoadbalance("random", random.NewLoadBalance)
Expand Down
14 changes: 6 additions & 8 deletions cluster/cluster/base/cluster_invoker.go
Original file line number Diff line number Diff line change
Expand Up @@ -94,9 +94,9 @@ func (invoker *ClusterInvoker) DoSelect(lb loadbalance.LoadBalance, invocation p
}

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

if invoker.StickyInvoker != nil && !isInvoked(invoker.StickyInvoker, invokers) {
invoker.StickyInvoker = nil
Expand Down Expand Up @@ -155,11 +155,9 @@ func (invoker *ClusterInvoker) doSelectInvoker(lb loadbalance.LoadBalance, invoc
}
return reselectedInvoker
}
} else {
return selectedInvoker
}
logger.Errorf("all %d invokers is unavailable for %s.", len(invokers), selectedInvoker.GetURL().String())
return nil

return selectedInvoker
}

func isInvoked(selectedInvoker protocol.Invoker, invoked []protocol.Invoker) bool {
Expand All @@ -176,10 +174,10 @@ func GetLoadBalance(invoker protocol.Invoker, invocation protocol.Invocation) lo

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

// Get the service method loadbalance config if have
if v := url.GetMethodParam(methodName, constant.LOADBALANCE_KEY, ""); len(v) > 0 {
if v := url.GetMethodParam(methodName, constant.LoadbalanceKey, ""); len(v) > 0 {
lb = v
}
return extension.GetLoadbalance(lb)
Expand Down
2 changes: 1 addition & 1 deletion cluster/cluster/broadcast/cluster_invoker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ import (
)

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

func registerBroadcast(mockInvokers ...*mock.MockInvoker) protocol.Invoker {
extension.SetLoadbalance("random", random.NewLoadBalance)
Expand Down
12 changes: 6 additions & 6 deletions cluster/cluster/failback/cluster_invoker.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,16 +58,16 @@ func newClusterInvoker(directory directory.Directory) protocol.Invoker {
invoker := &clusterInvoker{
ClusterInvoker: base.NewClusterInvoker(directory),
}
retriesConfig := invoker.GetURL().GetParam(constant.RETRIES_KEY, constant.DEFAULT_FAILBACK_TIMES)
retriesConfig := invoker.GetURL().GetParam(constant.RetriesKey, constant.DefaultFailbackTimes)
retries, err := strconv.Atoi(retriesConfig)
if err != nil || retries < 0 {
logger.Error("Your retries config is invalid,pls do a check. And will use the default fail back times configuration instead.")
retries = constant.DEFAULT_FAILBACK_TIMES_INT
retries = constant.DefaultFailbackTimesInt
}

failbackTasksConfig := invoker.GetURL().GetParamInt(constant.FAIL_BACK_TASKS_KEY, constant.DEFAULT_FAILBACK_TASKS)
failbackTasksConfig := invoker.GetURL().GetParamInt(constant.FailBackTasksKey, constant.DefaultFailbackTasks)
if failbackTasksConfig <= 0 {
failbackTasksConfig = constant.DEFAULT_FAILBACK_TASKS
failbackTasksConfig = constant.DefaultFailbackTasks
}
invoker.maxRetries = int64(retries)
invoker.failbackTasks = failbackTasksConfig
Expand Down Expand Up @@ -141,10 +141,10 @@ func (invoker *clusterInvoker) Invoke(ctx context.Context, invocation protocol.I

// Get the service loadbalance config
url := invokers[0].GetURL()
lb := url.GetParam(constant.LOADBALANCE_KEY, constant.DEFAULT_LOADBALANCE)
lb := url.GetParam(constant.LoadbalanceKey, constant.DefaultLoadbalance)
// Get the service method loadbalance config if have
methodName := invocation.MethodName()
if v := url.GetMethodParam(methodName, constant.LOADBALANCE_KEY, ""); v != "" {
if v := url.GetMethodParam(methodName, constant.LoadbalanceKey, ""); v != "" {
lb = v
}

Expand Down
2 changes: 1 addition & 1 deletion cluster/cluster/failback/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ import (
)

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

// registerFailback register failbackCluster to cluster extension.
func registerFailback(invoker *mock.MockInvoker) protocol.Invoker {
Expand Down
2 changes: 1 addition & 1 deletion cluster/cluster/failfast/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import (
)

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

// registerFailfast register failfastCluster to cluster extension.
func registerFailfast(invoker *mock.MockInvoker) protocol.Invoker {
Expand Down
8 changes: 4 additions & 4 deletions cluster/cluster/failover/cluster_invoker.go
Original file line number Diff line number Diff line change
Expand Up @@ -111,21 +111,21 @@ func (invoker *clusterInvoker) Invoke(ctx context.Context, invocation protocol.I

func getRetries(invokers []protocol.Invoker, methodName string) int {
if len(invokers) <= 0 {
return constant.DEFAULT_RETRIES_INT
return constant.DefaultRetriesInt
}

url := invokers[0].GetURL()
// get reties
retriesConfig := url.GetParam(constant.RETRIES_KEY, constant.DEFAULT_RETRIES)
retriesConfig := url.GetParam(constant.RetriesKey, constant.DefaultRetries)
// Get the service method loadbalance config if have
if v := url.GetMethodParam(methodName, constant.RETRIES_KEY, ""); len(v) != 0 {
if v := url.GetMethodParam(methodName, constant.RetriesKey, ""); len(v) != 0 {
retriesConfig = v
}

retries, err := strconv.Atoi(retriesConfig)
if err != nil || retries < 0 {
logger.Error("Your retries config is invalid,pls do a check. And will use the default retries configuration instead.")
retries = constant.DEFAULT_RETRIES_INT
retries = constant.DefaultRetriesInt
}

if retries > len(invokers) {
Expand Down
6 changes: 3 additions & 3 deletions cluster/cluster/failover/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ func TestFailoverInvokeFail(t *testing.T) {
// nolint
func TestFailoverInvoke1(t *testing.T) {
urlParams := url.Values{}
urlParams.Set(constant.RETRIES_KEY, "3")
urlParams.Set(constant.RetriesKey, "3")
result := normalInvoke(4, urlParams)
assert.NoError(t, result.Error())
clusterpkg.Count = 0
Expand All @@ -86,8 +86,8 @@ func TestFailoverInvoke1(t *testing.T) {
// nolint
func TestFailoverInvoke2(t *testing.T) {
urlParams := url.Values{}
urlParams.Set(constant.RETRIES_KEY, "2")
urlParams.Set("methods.test."+constant.RETRIES_KEY, "3")
urlParams.Set(constant.RetriesKey, "2")
urlParams.Set("methods.test."+constant.RetriesKey, "3")

ivc := invocation.NewRPCInvocationWithOptions(invocation.WithMethodName("test"))
result := normalInvoke(4, urlParams, ivc)
Expand Down
4 changes: 2 additions & 2 deletions cluster/cluster/failsafe/cluster_invoker.go
Original file line number Diff line number Diff line change
Expand Up @@ -58,9 +58,9 @@ func (invoker *clusterInvoker) Invoke(ctx context.Context, invocation protocol.I
url := invokers[0].GetURL()
methodName := invocation.MethodName()
// Get the service loadbalance config
lb := url.GetParam(constant.LOADBALANCE_KEY, constant.DEFAULT_LOADBALANCE)
lb := url.GetParam(constant.LoadbalanceKey, constant.DefaultLoadbalance)
// Get the service method loadbalance config if have
if v := url.GetMethodParam(methodName, constant.LOADBALANCE_KEY, ""); v != "" {
if v := url.GetMethodParam(methodName, constant.LoadbalanceKey, ""); v != "" {
lb = v
}
loadbalance := extension.GetLoadbalance(lb)
Expand Down
2 changes: 1 addition & 1 deletion cluster/cluster/failsafe/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ import (
)

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

// registerFailsafe register failsafeCluster to cluster extension.
func registerFailsafe(invoker *mock.MockInvoker) protocol.Invoker {
Expand Down
4 changes: 2 additions & 2 deletions cluster/cluster/forking/cluster_invoker.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ func (invoker *clusterInvoker) Invoke(ctx context.Context, invocation protocol.I
}

var selected []protocol.Invoker
forks := invoker.GetURL().GetParamByIntValue(constant.FORKS_KEY, constant.DEFAULT_FORKS)
timeouts := invoker.GetURL().GetParamInt(constant.TIMEOUT_KEY, constant.DEFAULT_TIMEOUT)
forks := invoker.GetURL().GetParamByIntValue(constant.ForksKey, constant.DefaultForks)
timeouts := invoker.GetURL().GetParamInt(constant.TimeoutKey, constant.DefaultTimeout)
if forks < 0 || forks > len(invokers) {
selected = invokers
} else {
Expand Down
10 changes: 5 additions & 5 deletions cluster/cluster/forking/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ import (
)

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

func registerForking(mockInvokers ...*mock.MockInvoker) protocol.Invoker {
extension.SetLoadbalance(constant.LoadBalanceKeyRoundRobin, roundrobin.NewLoadBalance)
Expand All @@ -71,8 +71,8 @@ func TestForkingInvokeSuccess(t *testing.T) {
invokers := make([]*mock.MockInvoker, 0)

mockResult := &protocol.RPCResult{Rest: clusterpkg.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.ForksKey, strconv.Itoa(3))
// forkingUrl.AddParam(constant.TimeoutKey, strconv.Itoa(constant.DefaultTimeout))

var wg sync.WaitGroup
wg.Add(2)
Expand Down Expand Up @@ -101,7 +101,7 @@ func TestForkingInvokeTimeout(t *testing.T) {
invokers := make([]*mock.MockInvoker, 0)

mockResult := &protocol.RPCResult{Rest: clusterpkg.Rest{Tried: 0, Success: true}}
forkingUrl.AddParam(constant.FORKS_KEY, strconv.Itoa(3))
forkingUrl.AddParam(constant.ForksKey, strconv.Itoa(3))

var wg sync.WaitGroup
wg.Add(2)
Expand Down Expand Up @@ -132,7 +132,7 @@ func TestForkingInvokeHalfTimeout(t *testing.T) {
invokers := make([]*mock.MockInvoker, 0)

mockResult := &protocol.RPCResult{Rest: clusterpkg.Rest{Tried: 0, Success: true}}
forkingUrl.AddParam(constant.FORKS_KEY, strconv.Itoa(3))
forkingUrl.AddParam(constant.ForksKey, strconv.Itoa(3))

var wg sync.WaitGroup
wg.Add(2)
Expand Down
Loading