You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "yumosx (via GitHub)" <gi...@apache.org> on 2025/09/30 14:09:43 UTC
[PR] update the go version and gost version [dubbo-go]
yumosx opened a new pull request, #3046:
URL: https://github.com/apache/dubbo-go/pull/3046
- upgrade go from 1.23 to 1.24
- upgrade gost version from 1.14.1 to 1.14.2
fix #3044
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] update the go version and gost version [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#issuecomment-3501620266
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3046) **Quality Gate passed**
Issues
 [0 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3046&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3046&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3046&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3046&metric=new_coverage&view=list)
 [52.6% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3046&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3046)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat: update p2cLoadBalance randomPick strategy [dubbo-go]
Posted by "Alanxtl (via GitHub)" <gi...@apache.org>.
Alanxtl commented on code in PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#discussion_r2510866832
##########
cluster/loadbalance/p2c/loadbalance.go:
##########
@@ -37,28 +37,65 @@ import (
"dubbo.apache.org/dubbo-go/v3/protocol/base"
)
-var (
- randSeed = func() int64 {
- return time.Now().Unix()
- }
-)
-
func init() {
- rand.Seed(randSeed())
- extension.SetLoadbalance(constant.LoadBalanceKeyP2C, newP2CLoadBalance)
+ extension.SetLoadbalance(constant.LoadBalanceKeyP2C, func() loadbalance.LoadBalance {
+ return newP2CLoadBalance(nil)
+ })
}
var (
once sync.Once
instance loadbalance.LoadBalance
)
-type p2cLoadBalance struct{}
+// p2cLoadBalance is a load balancer implementation based on the Power of Two Choices algorithm.
+type p2cLoadBalance struct {
+ // randomPicker is injectable for testing; allows deterministic random selection.
+ randomPicker randomPicker
+}
+
+// randomPicker is a function type that randomly selects two distinct indices from a range [0, n).
+// This function type is designed ONLY FOR TEST purposes to inject predictable values.
+type randomPicker func(n int) (i, j int)
+
+var rndPool = sync.Pool{
+ New: func() any {
+ return rand.New(rand.NewSource(time.Now().Unix()))
+ },
+}
+
+// defaultRnd is the default implementation of randomPicker.
+// It handles edge cases for n <= 2 and ensures two distinct random indices for n > 2.
+func defaultRnd(n int) (i, j int) {
+ if n <= 1 {
+ return 0, 0
+ }
+ if n == 2 {
+ return 0, 1
+ }
+
+ rnd := rndPool.Get().(*rand.Rand)
+ defer rndPool.Put(rnd)
-func newP2CLoadBalance() loadbalance.LoadBalance {
+ i = rnd.Intn(n) // NOSONAR
+ j = rnd.Intn(n) // NOSONAR
+ for i == j {
+ j = rand.Intn(n) // NOSONAR
Review Comment:
```suggestion
j = rnd.Intn(n) // NOSONAR
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat: update p2cLoadBalance randomPick strategy [dubbo-go]
Posted by "Alanxtl (via GitHub)" <gi...@apache.org>.
Alanxtl commented on code in PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#discussion_r2510286596
##########
cluster/loadbalance/p2c/loadbalance.go:
##########
@@ -75,16 +117,7 @@ func (l *p2cLoadBalance) Select(invokers []base.Invoker, invocation base.Invocat
// The local metrics is available only for the earlier version.
m := metrics.LocalMetrics
// picks two nodes randomly
- var i, j int
- if len(invokers) == 2 {
- i, j = 0, 1
- } else {
- i = rand.Intn(len(invokers))
- j = i
- for i == j {
- j = rand.Intn(len(invokers))
- }
- }
+ i, j := l.randomPicker(len(invokers))
logger.Debugf("[P2C select] Two invokers were selected, invoker[%d]: %s, invoker[%d]: %s.",
Review Comment:
说实话我觉得整个都没必要改
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat: update p2cLoadBalance randomPick strategy [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#issuecomment-3512128714
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3046) **Quality Gate passed**
Issues
 [0 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3046&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3046&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3046&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3046&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3046&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3046)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] update the go version and gost version [dubbo-go]
Posted by "yumosx (via GitHub)" <gi...@apache.org>.
yumosx commented on code in PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#discussion_r2508742598
##########
registry/etcdv3/service_discovery_test.go:
##########
@@ -51,6 +52,7 @@ func TestEtcdV3ServiceDiscoveryGetDefaultPageSize(t *testing.T) {
}
func TestFunction(t *testing.T) {
+ t.Skip("Skipping test: CI environment does not support etcd dependency")
Review Comment:
@Alanxtl 雪涛哥这个是因为 ci 不支持那个 ectd, 这个测试没有去 mock,使用的是真实的连接,无法通过ci,只能这样去做
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] update the go version and gost version [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#issuecomment-3352393473
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3046) **Quality Gate passed**
Issues
 [0 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3046&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3046&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3046&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3046&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3046&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3046)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] update the go version and gost version [dubbo-go]
Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#issuecomment-3509169588
## [Codecov](https://app.codecov.io/gh/apache/dubbo-go/pull/3046?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
:white_check_mark: All modified and coverable lines are covered by tests.
:white_check_mark: Project coverage is 36.73%. Comparing base ([`60d1c2a`](https://app.codecov.io/gh/apache/dubbo-go/commit/60d1c2a949f0ee0da4be3fe09fb79d295491e040?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`89c8944`](https://app.codecov.io/gh/apache/dubbo-go/commit/89c89443e21447e6db63ccbbeaef2aea3b126b77?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
:warning: Report is 651 commits behind head on develop.
<details><summary>Additional details and impacted files</summary>
```diff
@@ Coverage Diff @@
## develop #3046 +/- ##
============================================
- Coverage 46.76% 36.73% -10.04%
============================================
Files 295 458 +163
Lines 17172 32536 +15364
============================================
+ Hits 8031 11952 +3921
- Misses 8287 19408 +11121
- Partials 854 1176 +322
```
</details>
[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/apache/dubbo-go/pull/3046?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
<details><summary> :rocket: New features to boost your workflow: </summary>
- :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
</details>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] update the go version and gost version [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#issuecomment-3510138230
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3046) **Quality Gate failed**
Failed conditions
 [3 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3046&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3046)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat: update p2cLoadBalance randomPick strategy [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#issuecomment-3511969121
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3046) **Quality Gate passed**
Issues
 [0 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3046&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3046&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3046&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3046&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3046&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3046)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] update the go version and gost version [dubbo-go]
Posted by "Alanxtl (via GitHub)" <gi...@apache.org>.
Alanxtl commented on code in PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#discussion_r2508686326
##########
registry/etcdv3/service_discovery_test.go:
##########
@@ -38,7 +38,8 @@ import (
const testName = "test"
func TestNewEtcdV3ServiceDiscovery(t *testing.T) {
- url, _ := common.NewURL("dubbo://127.0.0.1:2379")
+ t.Skip("Skipping test: CI environment does not support etcd dependency")
Review Comment:
这里skip test不合理
为什么之前的test能够正常运行,ci环境又没有修改
##########
cluster/loadbalance/p2c/loadbalance_test.go:
##########
@@ -144,13 +130,11 @@ func TestLoadBalance(t *testing.T) {
base.NewBaseInvoker(url2),
}
- ivk := lb.Select(ivkArr, invocation)
-
- assert.Equal(t, ivkArr[0].GetURL().String(), ivk.GetURL().String())
+ got := lb.Select(ivkArr, invocation)
+ assert.NotNil(t, got)
Review Comment:
same
##########
cluster/loadbalance/p2c/loadbalance_test.go:
##########
@@ -177,9 +162,7 @@ func TestLoadBalance(t *testing.T) {
base.NewBaseInvoker(url2),
}
- ivk := lb.Select(ivkArr, invocation)
-
- assert.Equal(t, ivkArr[1].GetURL().String(), ivk.GetURL().String())
+ got := lb.Select(ivkArr, invocation)
+ assert.NotNil(t, got)
Review Comment:
same
##########
cluster/loadbalance/p2c/loadbalance_test.go:
##########
@@ -101,28 +91,23 @@ func TestLoadBalance(t *testing.T) {
url1, _ := common.NewURL("dubbo://192.168.1.1:20000/com.ikurento.user.UserProvider")
url2, _ := common.NewURL("dubbo://192.168.1.2:20000/com.ikurento.user.UserProvider")
+ // P2C algorithm randomly selects 2 invokers, so we need to mock all possible combinations
m.EXPECT().
- GetMethodMetrics(gomock.Eq(url0), gomock.Eq(invocation.MethodName()), gomock.Eq(metrics.HillClimbing)).
- Times(1).
+ GetMethodMetrics(gomock.Any(), gomock.Eq(invocation.MethodName()), gomock.Eq(metrics.HillClimbing)).
+ Times(2).
Return(uint64(10), nil)
- m.EXPECT().
- GetMethodMetrics(gomock.Eq(url1), gomock.Eq(invocation.MethodName()), gomock.Eq(metrics.HillClimbing)).
- Times(1).
- Return(uint64(5), nil)
ivkArr := []base.Invoker{
base.NewBaseInvoker(url0),
base.NewBaseInvoker(url1),
base.NewBaseInvoker(url2),
}
- ivk := lb.Select(ivkArr, invocation)
-
- assert.Equal(t, ivkArr[0].GetURL().String(), ivk.GetURL().String())
+ got := lb.Select(ivkArr, invocation)
+ assert.NotNil(t, got)
Review Comment:
这里assert.Euqal不要改
##########
registry/etcdv3/service_discovery_test.go:
##########
@@ -51,6 +52,7 @@ func TestEtcdV3ServiceDiscoveryGetDefaultPageSize(t *testing.T) {
}
func TestFunction(t *testing.T) {
+ t.Skip("Skipping test: CI environment does not support etcd dependency")
Review Comment:
same
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] update the go version and gost version [dubbo-go]
Posted by "yumosx (via GitHub)" <gi...@apache.org>.
yumosx commented on code in PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#discussion_r2508740692
##########
cluster/loadbalance/p2c/loadbalance_test.go:
##########
@@ -101,28 +91,23 @@ func TestLoadBalance(t *testing.T) {
url1, _ := common.NewURL("dubbo://192.168.1.1:20000/com.ikurento.user.UserProvider")
url2, _ := common.NewURL("dubbo://192.168.1.2:20000/com.ikurento.user.UserProvider")
+ // P2C algorithm randomly selects 2 invokers, so we need to mock all possible combinations
m.EXPECT().
- GetMethodMetrics(gomock.Eq(url0), gomock.Eq(invocation.MethodName()), gomock.Eq(metrics.HillClimbing)).
- Times(1).
+ GetMethodMetrics(gomock.Any(), gomock.Eq(invocation.MethodName()), gomock.Eq(metrics.HillClimbing)).
+ Times(2).
Return(uint64(10), nil)
- m.EXPECT().
- GetMethodMetrics(gomock.Eq(url1), gomock.Eq(invocation.MethodName()), gomock.Eq(metrics.HillClimbing)).
- Times(1).
- Return(uint64(5), nil)
ivkArr := []base.Invoker{
base.NewBaseInvoker(url0),
base.NewBaseInvoker(url1),
base.NewBaseInvoker(url2),
}
- ivk := lb.Select(ivkArr, invocation)
-
- assert.Equal(t, ivkArr[0].GetURL().String(), ivk.GetURL().String())
+ got := lb.Select(ivkArr, invocation)
+ assert.NotNil(t, got)
Review Comment:
@Alanxtl 这是因为那个是随机数,没有办法去预测
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] update the go version and gost version [dubbo-go]
Posted by "yumosx (via GitHub)" <gi...@apache.org>.
yumosx commented on code in PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#discussion_r2508860681
##########
registry/etcdv3/service_discovery_test.go:
##########
@@ -51,6 +52,7 @@ func TestEtcdV3ServiceDiscoveryGetDefaultPageSize(t *testing.T) {
}
func TestFunction(t *testing.T) {
+ t.Skip("Skipping test: CI environment does not support etcd dependency")
Review Comment:
<img width="1428" height="581" alt="image" src="https://github.com/user-attachments/assets/1c4ac404-be71-486f-a86e-4445b6f7f537" />
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] update the go version and gost version [dubbo-go]
Posted by "yumosx (via GitHub)" <gi...@apache.org>.
yumosx commented on code in PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#discussion_r2509291931
##########
cluster/loadbalance/p2c/loadbalance_test.go:
##########
@@ -101,28 +91,23 @@ func TestLoadBalance(t *testing.T) {
url1, _ := common.NewURL("dubbo://192.168.1.1:20000/com.ikurento.user.UserProvider")
url2, _ := common.NewURL("dubbo://192.168.1.2:20000/com.ikurento.user.UserProvider")
+ // P2C algorithm randomly selects 2 invokers, so we need to mock all possible combinations
m.EXPECT().
- GetMethodMetrics(gomock.Eq(url0), gomock.Eq(invocation.MethodName()), gomock.Eq(metrics.HillClimbing)).
- Times(1).
+ GetMethodMetrics(gomock.Any(), gomock.Eq(invocation.MethodName()), gomock.Eq(metrics.HillClimbing)).
+ Times(2).
Return(uint64(10), nil)
- m.EXPECT().
- GetMethodMetrics(gomock.Eq(url1), gomock.Eq(invocation.MethodName()), gomock.Eq(metrics.HillClimbing)).
- Times(1).
- Return(uint64(5), nil)
ivkArr := []base.Invoker{
base.NewBaseInvoker(url0),
base.NewBaseInvoker(url1),
base.NewBaseInvoker(url2),
}
- ivk := lb.Select(ivkArr, invocation)
-
- assert.Equal(t, ivkArr[0].GetURL().String(), ivk.GetURL().String())
+ got := lb.Select(ivkArr, invocation)
+ assert.NotNil(t, got)
Review Comment:
done.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat: update p2cLoadBalance randomPick strategy [dubbo-go]
Posted by "Alanxtl (via GitHub)" <gi...@apache.org>.
Alanxtl commented on code in PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#discussion_r2510310612
##########
cluster/loadbalance/p2c/loadbalance.go:
##########
@@ -75,16 +117,7 @@ func (l *p2cLoadBalance) Select(invokers []base.Invoker, invocation base.Invocat
// The local metrics is available only for the earlier version.
m := metrics.LocalMetrics
// picks two nodes randomly
- var i, j int
- if len(invokers) == 2 {
- i, j = 0, 1
- } else {
- i = rand.Intn(len(invokers))
- j = i
- for i == j {
- j = rand.Intn(len(invokers))
- }
- }
+ i, j := l.randomPicker(len(invokers))
logger.Debugf("[P2C select] Two invokers were selected, invoker[%d]: %s, invoker[%d]: %s.",
Review Comment:
根据我的理解,这里只需要测试loadbalance是否达到预期期望吧,那么测试可以改成做n次loadbalance统计loadbalance结果,比较是否落在数学期望范围内
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] update the go version and gost version [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#issuecomment-3509183578
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3046) **Quality Gate passed**
Issues
 [0 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3046&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3046&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3046&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3046&metric=new_coverage&view=list)
 [45.5% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3046&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3046)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat: update p2cLoadBalance randomPick strategy [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#issuecomment-3511966489
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3046) **Quality Gate passed**
Issues
 [0 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3046&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3046&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3046&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3046&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3046&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3046)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] update the go version and gost version [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#issuecomment-3501028761
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3046) **Quality Gate passed**
Issues
 [0 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3046&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3046&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3046&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3046&metric=new_coverage&view=list)
 [36.4% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3046&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3046)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] update the go version and gost version [dubbo-go]
Posted by "Alanxtl (via GitHub)" <gi...@apache.org>.
Alanxtl commented on code in PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#discussion_r2510086046
##########
registry/etcdv3/service_discovery_test.go:
##########
@@ -51,6 +52,7 @@ func TestEtcdV3ServiceDiscoveryGetDefaultPageSize(t *testing.T) {
}
func TestFunction(t *testing.T) {
+ t.Skip("Skipping test: CI environment does not support etcd dependency")
Review Comment:
那这个 `gost` 更新应该是不合理的,这个依赖的链条是`gost` -> `etcd/clientv3` -> `grpc`,现在grpc弃用了`grpc.WithBlock()` 而 `etcd/clientv3` 并没有弃用 (关于他们弃不弃用我[问了](https://github.com/etcd-io/etcd/issues/20910)etcd他们),我们 `gost` 依赖的是 `etcd/clientv3`,却把 `grpc` 的方法删了,导致 `etcd/clientv3` 的行为没有达到预期
现在需要确定一个事情就就是:原来的报错是不是预期行为,这里看起来似乎就是要把它block住,如果是预期行为 那么这个 `gost` 更新是不合理的,如果不是预期行为那么说明以前就有bug,这里需要修bug
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] update the go version and gost version [dubbo-go]
Posted by "yumosx (via GitHub)" <gi...@apache.org>.
yumosx commented on PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#issuecomment-3466146230
> pls fix the ci fail
ok, I will look it later.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] update the go version and gost version [dubbo-go]
Posted by "Alanxtl (via GitHub)" <gi...@apache.org>.
Alanxtl commented on PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#issuecomment-3419652066
pls fix the ci fail
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] update the go version and gost version [dubbo-go]
Posted by "yumosx (via GitHub)" <gi...@apache.org>.
yumosx commented on code in PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#discussion_r2508787744
##########
registry/etcdv3/service_discovery_test.go:
##########
@@ -51,6 +52,7 @@ func TestEtcdV3ServiceDiscoveryGetDefaultPageSize(t *testing.T) {
}
func TestFunction(t *testing.T) {
+ t.Skip("Skipping test: CI environment does not support etcd dependency")
Review Comment:
这个我再看下吧, 原来好像可以跑, 但是也是有错误的,现在超时直接崩了
<img width="1993" height="547" alt="image" src="https://github.com/user-attachments/assets/e772761a-bd85-4c4f-b4f7-81af7ee8e3af" />
##########
registry/etcdv3/service_discovery_test.go:
##########
@@ -51,6 +52,7 @@ func TestEtcdV3ServiceDiscoveryGetDefaultPageSize(t *testing.T) {
}
func TestFunction(t *testing.T) {
+ t.Skip("Skipping test: CI environment does not support etcd dependency")
Review Comment:
@Alanxtl 雪涛哥这个是因为 ci 不支持那个 ectd, 这个测试没有去 mock,使用的是真实的连接,无法通过ci,只能这样去做
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] update the go version [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#issuecomment-3511172216
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3046) **Quality Gate passed**
Issues
 [0 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3046&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3046&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3046&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3046&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3046&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3046)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat: update p2cLoadBalance randomPick strategy [dubbo-go]
Posted by "yumosx (via GitHub)" <gi...@apache.org>.
yumosx commented on code in PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#discussion_r2510353282
##########
cluster/loadbalance/p2c/loadbalance.go:
##########
@@ -75,16 +117,7 @@ func (l *p2cLoadBalance) Select(invokers []base.Invoker, invocation base.Invocat
// The local metrics is available only for the earlier version.
m := metrics.LocalMetrics
// picks two nodes randomly
- var i, j int
- if len(invokers) == 2 {
- i, j = 0, 1
- } else {
- i = rand.Intn(len(invokers))
- j = i
- for i == j {
- j = rand.Intn(len(invokers))
- }
- }
+ i, j := l.randomPicker(len(invokers))
logger.Debugf("[P2C select] Two invokers were selected, invoker[%d]: %s, invoker[%d]: %s.",
Review Comment:
嗯这也是一种思路,我没有试过,但是应该每次去预测一下,我的想法是单独抽出来这个`type randomPicker func(n int) (i, j int)`
这样在测试的时候就直接控制它的结果, 一劳永逸简单一点,
之所以写这门复杂还有一点就是,math/rand 好像会爆安全问题, 所以只能写成 `secureRandomInt` 这种
##########
cluster/loadbalance/p2c/loadbalance.go:
##########
@@ -75,16 +117,7 @@ func (l *p2cLoadBalance) Select(invokers []base.Invoker, invocation base.Invocat
// The local metrics is available only for the earlier version.
m := metrics.LocalMetrics
// picks two nodes randomly
- var i, j int
- if len(invokers) == 2 {
- i, j = 0, 1
- } else {
- i = rand.Intn(len(invokers))
- j = i
- for i == j {
- j = rand.Intn(len(invokers))
- }
- }
+ i, j := l.randomPicker(len(invokers))
logger.Debugf("[P2C select] Two invokers were selected, invoker[%d]: %s, invoker[%d]: %s.",
Review Comment:
嗯这也是一种思路,我没有试过,但是应该每次要去预测一下,我的想法是单独抽出来这个`type randomPicker func(n int) (i, j int)`
这样在测试的时候就直接控制它的结果, 一劳永逸简单一点,
之所以写这门复杂还有一点就是,math/rand 好像会爆安全问题, 所以只能写成 `secureRandomInt` 这种
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat: update p2cLoadBalance randomPicker [dubbo-go]
Posted by "yumosx (via GitHub)" <gi...@apache.org>.
yumosx commented on PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#issuecomment-3511223477
> tools/dubbogo-cli/cmd/testGenCode/template/newApp/go.sum 和 tools/dubbogo-cli/cmd/testGenCode/template/newDemo/go.sum 不要上传
done.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat: update p2cLoadBalance randomPick strategy [dubbo-go]
Posted by "yumosx (via GitHub)" <gi...@apache.org>.
yumosx commented on code in PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#discussion_r2510289334
##########
cluster/loadbalance/p2c/loadbalance.go:
##########
@@ -75,16 +117,7 @@ func (l *p2cLoadBalance) Select(invokers []base.Invoker, invocation base.Invocat
// The local metrics is available only for the earlier version.
m := metrics.LocalMetrics
// picks two nodes randomly
- var i, j int
- if len(invokers) == 2 {
- i, j = 0, 1
- } else {
- i = rand.Intn(len(invokers))
- j = i
- for i == j {
- j = rand.Intn(len(invokers))
- }
- }
+ i, j := l.randomPicker(len(invokers))
logger.Debugf("[P2C select] Two invokers were selected, invoker[%d]: %s, invoker[%d]: %s.",
Review Comment:
抽出来这个是因为测试以前的测试 rand.Seed 是可以控制 rand 的行为的,但现在不行了,抽出来为了测试方便控制
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat: update go vesion to 1.24 and remove the use of rand.seed [dubbo-go]
Posted by "yumosx (via GitHub)" <gi...@apache.org>.
yumosx commented on code in PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#discussion_r2510876376
##########
cluster/loadbalance/p2c/loadbalance.go:
##########
@@ -37,28 +37,65 @@ import (
"dubbo.apache.org/dubbo-go/v3/protocol/base"
)
-var (
- randSeed = func() int64 {
- return time.Now().Unix()
- }
-)
-
func init() {
- rand.Seed(randSeed())
- extension.SetLoadbalance(constant.LoadBalanceKeyP2C, newP2CLoadBalance)
+ extension.SetLoadbalance(constant.LoadBalanceKeyP2C, func() loadbalance.LoadBalance {
+ return newP2CLoadBalance(nil)
+ })
}
var (
once sync.Once
instance loadbalance.LoadBalance
)
-type p2cLoadBalance struct{}
+// p2cLoadBalance is a load balancer implementation based on the Power of Two Choices algorithm.
+type p2cLoadBalance struct {
+ // randomPicker is injectable for testing; allows deterministic random selection.
+ randomPicker randomPicker
+}
+
+// randomPicker is a function type that randomly selects two distinct indices from a range [0, n).
+// This function type is designed ONLY FOR TEST purposes to inject predictable values.
+type randomPicker func(n int) (i, j int)
+
+var rndPool = sync.Pool{
+ New: func() any {
+ return rand.New(rand.NewSource(time.Now().Unix()))
+ },
+}
+
+// defaultRnd is the default implementation of randomPicker.
+// It handles edge cases for n <= 2 and ensures two distinct random indices for n > 2.
+func defaultRnd(n int) (i, j int) {
+ if n <= 1 {
+ return 0, 0
+ }
+ if n == 2 {
+ return 0, 1
+ }
+
+ rnd := rndPool.Get().(*rand.Rand)
+ defer rndPool.Put(rnd)
-func newP2CLoadBalance() loadbalance.LoadBalance {
+ i = rnd.Intn(n) // NOSONAR
+ j = rnd.Intn(n) // NOSONAR
+ for i == j {
+ j = rand.Intn(n) // NOSONAR
Review Comment:
done.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat: update p2cLoadBalance randomPicker [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#issuecomment-3511210728
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3046) **Quality Gate passed**
Issues
 [0 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3046&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3046&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3046&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3046&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3046&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3046)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] update the go version and gost version [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#issuecomment-3501006702
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3046) **Quality Gate passed**
Issues
 [0 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3046&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3046&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3046&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3046&metric=new_coverage&view=list)
 [26.7% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3046&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3046)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat: update p2cLoadBalance randomPicker [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#issuecomment-3511220365
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3046) **Quality Gate passed**
Issues
 [0 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3046&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3046&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3046&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3046&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3046&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3046)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] update the go version [dubbo-go]
Posted by "Alanxtl (via GitHub)" <gi...@apache.org>.
Alanxtl commented on PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#issuecomment-3511182027
tools/dubbogo-cli/cmd/testGenCode/template/newApp/go.sum 和 tools/dubbogo-cli/cmd/testGenCode/template/newDemo/go.sum 不要上传
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat: update p2cLoadBalance randomPick strategy [dubbo-go]
Posted by "Alanxtl (via GitHub)" <gi...@apache.org>.
Alanxtl commented on code in PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#discussion_r2510298830
##########
cluster/loadbalance/p2c/loadbalance.go:
##########
@@ -75,16 +117,7 @@ func (l *p2cLoadBalance) Select(invokers []base.Invoker, invocation base.Invocat
// The local metrics is available only for the earlier version.
m := metrics.LocalMetrics
// picks two nodes randomly
- var i, j int
- if len(invokers) == 2 {
- i, j = 0, 1
- } else {
- i = rand.Intn(len(invokers))
- j = i
- for i == j {
- j = rand.Intn(len(invokers))
- }
- }
+ i, j := l.randomPicker(len(invokers))
logger.Debugf("[P2C select] Two invokers were selected, invoker[%d]: %s, invoker[%d]: %s.",
Review Comment:
不是只有n > 2的情况需要 rand.Seed 来控制行为吗。既然如此,n > 2情况就只检测i和j不相同吧
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat: update p2cLoadBalance randomPick strategy [dubbo-go]
Posted by "Alanxtl (via GitHub)" <gi...@apache.org>.
Alanxtl commented on code in PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#discussion_r2510361045
##########
cluster/loadbalance/p2c/loadbalance.go:
##########
@@ -75,16 +117,7 @@ func (l *p2cLoadBalance) Select(invokers []base.Invoker, invocation base.Invocat
// The local metrics is available only for the earlier version.
m := metrics.LocalMetrics
// picks two nodes randomly
- var i, j int
- if len(invokers) == 2 {
- i, j = 0, 1
- } else {
- i = rand.Intn(len(invokers))
- j = i
- for i == j {
- j = rand.Intn(len(invokers))
- }
- }
+ i, j := l.randomPicker(len(invokers))
logger.Debugf("[P2C select] Two invokers were selected, invoker[%d]: %s, invoker[%d]: %s.",
Review Comment:
没必要抽象一个randomPicker,可以参考我这里写的test
https://github.com/apache/dubbo-go-pixiu/blob/develop/pkg/cluster/loadbalancer/weightrandom/weight_random_test.go
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat: update go vesion to 1.24 and remove the use of rand.seed [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#issuecomment-3512201037
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3046) **Quality Gate passed**
Issues
 [0 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3046&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3046&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3046&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3046&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3046&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3046)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] update the go version and gost version [dubbo-go]
Posted by "yumosx (via GitHub)" <gi...@apache.org>.
yumosx commented on code in PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#discussion_r2508740692
##########
cluster/loadbalance/p2c/loadbalance_test.go:
##########
@@ -101,28 +91,23 @@ func TestLoadBalance(t *testing.T) {
url1, _ := common.NewURL("dubbo://192.168.1.1:20000/com.ikurento.user.UserProvider")
url2, _ := common.NewURL("dubbo://192.168.1.2:20000/com.ikurento.user.UserProvider")
+ // P2C algorithm randomly selects 2 invokers, so we need to mock all possible combinations
m.EXPECT().
- GetMethodMetrics(gomock.Eq(url0), gomock.Eq(invocation.MethodName()), gomock.Eq(metrics.HillClimbing)).
- Times(1).
+ GetMethodMetrics(gomock.Any(), gomock.Eq(invocation.MethodName()), gomock.Eq(metrics.HillClimbing)).
+ Times(2).
Return(uint64(10), nil)
- m.EXPECT().
- GetMethodMetrics(gomock.Eq(url1), gomock.Eq(invocation.MethodName()), gomock.Eq(metrics.HillClimbing)).
- Times(1).
- Return(uint64(5), nil)
ivkArr := []base.Invoker{
base.NewBaseInvoker(url0),
base.NewBaseInvoker(url1),
base.NewBaseInvoker(url2),
}
- ivk := lb.Select(ivkArr, invocation)
-
- assert.Equal(t, ivkArr[0].GetURL().String(), ivk.GetURL().String())
+ got := lb.Select(ivkArr, invocation)
+ assert.NotNil(t, got)
Review Comment:
@Alanxtl 这是因为算法选择的是随机数,没有办法去预测
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] update the go version and gost version [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#issuecomment-3352456231
Please retry analysis of this Pull-Request directly on SonarQube Cloud
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] update the go version and gost version [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#issuecomment-3501029874
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3046) **Quality Gate passed**
Issues
 [0 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3046&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3046&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3046&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3046&metric=new_coverage&view=list)
 [36.4% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3046&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3046)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] update the go version and gost version [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#issuecomment-3510273381
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3046) **Quality Gate passed**
Issues
 [0 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3046&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3046&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3046&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3046&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3046&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3046)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] update the go version and gost version [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#issuecomment-3509162267
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3046) **Quality Gate passed**
Issues
 [0 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3046&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3046&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3046&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3046&metric=new_coverage&view=list)
 [9.5% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3046&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3046)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] update the go version and gost version [dubbo-go]
Posted by "yumosx (via GitHub)" <gi...@apache.org>.
yumosx commented on code in PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#discussion_r2508851666
##########
registry/etcdv3/service_discovery_test.go:
##########
@@ -51,6 +52,7 @@ func TestEtcdV3ServiceDiscoveryGetDefaultPageSize(t *testing.T) {
}
func TestFunction(t *testing.T) {
+ t.Skip("Skipping test: CI environment does not support etcd dependency")
Review Comment:
好像是 底层库 gost 的一个 api 被去掉了, 导致这个问题
```go
DialOptions: []grpc.DialOption{grpc.WithBlock()}
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] update the go version and gost version [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#issuecomment-3510221614
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3046) **Quality Gate failed**
Failed conditions
 [3 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3046&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3046)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat: update p2cLoadBalance randomPick strategy [dubbo-go]
Posted by "yumosx (via GitHub)" <gi...@apache.org>.
yumosx commented on code in PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#discussion_r2510480106
##########
cluster/loadbalance/p2c/loadbalance.go:
##########
@@ -75,16 +117,7 @@ func (l *p2cLoadBalance) Select(invokers []base.Invoker, invocation base.Invocat
// The local metrics is available only for the earlier version.
m := metrics.LocalMetrics
// picks two nodes randomly
- var i, j int
- if len(invokers) == 2 {
- i, j = 0, 1
- } else {
- i = rand.Intn(len(invokers))
- j = i
- for i == j {
- j = rand.Intn(len(invokers))
- }
- }
+ i, j := l.randomPicker(len(invokers))
logger.Debugf("[P2C select] Two invokers were selected, invoker[%d]: %s, invoker[%d]: %s.",
Review Comment:
@Alanxtl 我想了下好像还是只能这样,因为 rand.Int 不确定, GetMethodMetrics 也无法预测的, 所以要改掉的话,那去mock 的话比较麻烦
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat: update p2cLoadBalance randomPicker [dubbo-go]
Posted by "Alanxtl (via GitHub)" <gi...@apache.org>.
Alanxtl commented on code in PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#discussion_r2510279692
##########
cluster/loadbalance/p2c/loadbalance.go:
##########
@@ -75,16 +117,7 @@ func (l *p2cLoadBalance) Select(invokers []base.Invoker, invocation base.Invocat
// The local metrics is available only for the earlier version.
m := metrics.LocalMetrics
// picks two nodes randomly
- var i, j int
- if len(invokers) == 2 {
- i, j = 0, 1
- } else {
- i = rand.Intn(len(invokers))
- j = i
- for i == j {
- j = rand.Intn(len(invokers))
- }
- }
+ i, j := l.randomPicker(len(invokers))
logger.Debugf("[P2C select] Two invokers were selected, invoker[%d]: %s, invoker[%d]: %s.",
Review Comment:
在这个一整套的p2cLoadBalance实现里面randomPicker是不是只会为defaultRnd,因为并没有地方能让用户自定义randomPicker,既然如此就没必要抽象出一个randomPicker 来,randomPick 的策略写死不就行了吗,和你现在这种的结果是一样的
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat: update p2cLoadBalance randomPick strategy [dubbo-go]
Posted by "yumosx (via GitHub)" <gi...@apache.org>.
yumosx commented on code in PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#discussion_r2510292198
##########
cluster/loadbalance/p2c/loadbalance.go:
##########
@@ -75,16 +117,7 @@ func (l *p2cLoadBalance) Select(invokers []base.Invoker, invocation base.Invocat
// The local metrics is available only for the earlier version.
m := metrics.LocalMetrics
// picks two nodes randomly
- var i, j int
- if len(invokers) == 2 {
- i, j = 0, 1
- } else {
- i = rand.Intn(len(invokers))
- j = i
- for i == j {
- j = rand.Intn(len(invokers))
- }
- }
+ i, j := l.randomPicker(len(invokers))
logger.Debugf("[P2C select] Two invokers were selected, invoker[%d]: %s, invoker[%d]: %s.",
Review Comment:
因为这个在 go.1.24 中被丢弃了,已经无法使用了
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] update the go version and gost version [dubbo-go]
Posted by "AlexStocks (via GitHub)" <gi...@apache.org>.
AlexStocks commented on PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#issuecomment-3393203300
Please fix the ci failure.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat: update p2cLoadBalance randomPick strategy [dubbo-go]
Posted by "yumosx (via GitHub)" <gi...@apache.org>.
yumosx commented on code in PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#discussion_r2510480106
##########
cluster/loadbalance/p2c/loadbalance.go:
##########
@@ -75,16 +117,7 @@ func (l *p2cLoadBalance) Select(invokers []base.Invoker, invocation base.Invocat
// The local metrics is available only for the earlier version.
m := metrics.LocalMetrics
// picks two nodes randomly
- var i, j int
- if len(invokers) == 2 {
- i, j = 0, 1
- } else {
- i = rand.Intn(len(invokers))
- j = i
- for i == j {
- j = rand.Intn(len(invokers))
- }
- }
+ i, j := l.randomPicker(len(invokers))
logger.Debugf("[P2C select] Two invokers were selected, invoker[%d]: %s, invoker[%d]: %s.",
Review Comment:
@Alanxtl 我想了下好像还是只能这样,因为 rand.Int 导致 getMetrics 也是无法预测的, 所以要改掉的话,导致 `GetMethodMetrics` 要搞的很复杂,因为这个必须要`GetMethodMetrics` 的参数确定。
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] update the go version and gost version [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#issuecomment-3509190210
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3046) **Quality Gate passed**
Issues
 [0 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3046&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3046&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3046&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3046&metric=new_coverage&view=list)
 [45.5% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3046&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3046)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] update the go version and gost version [dubbo-go]
Posted by "yumosx (via GitHub)" <gi...@apache.org>.
yumosx commented on PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#issuecomment-3509191638
@Alanxtl all done. please check.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat: update go vesion to 1.24 and remove the use of rand.seed [dubbo-go]
Posted by "Alanxtl (via GitHub)" <gi...@apache.org>.
Alanxtl merged PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] update the go version and gost version [dubbo-go]
Posted by "Alanxtl (via GitHub)" <gi...@apache.org>.
Alanxtl commented on code in PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#discussion_r2510140897
##########
registry/etcdv3/service_discovery_test.go:
##########
@@ -51,6 +52,7 @@ func TestEtcdV3ServiceDiscoveryGetDefaultPageSize(t *testing.T) {
}
func TestFunction(t *testing.T) {
+ t.Skip("Skipping test: CI environment does not support etcd dependency")
Review Comment:
你这个pr先别更新gost了,就更新其他的然后我给你合并吧
关于这个WithBlock的问题你新开一个pr,记一下我的这个分析,然后更新前报的错和更新后报的错都贴到新pr里面去
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] update the go version and gost version [dubbo-go]
Posted by "yumosx (via GitHub)" <gi...@apache.org>.
yumosx commented on code in PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#discussion_r2508740692
##########
cluster/loadbalance/p2c/loadbalance_test.go:
##########
@@ -101,28 +91,23 @@ func TestLoadBalance(t *testing.T) {
url1, _ := common.NewURL("dubbo://192.168.1.1:20000/com.ikurento.user.UserProvider")
url2, _ := common.NewURL("dubbo://192.168.1.2:20000/com.ikurento.user.UserProvider")
+ // P2C algorithm randomly selects 2 invokers, so we need to mock all possible combinations
m.EXPECT().
- GetMethodMetrics(gomock.Eq(url0), gomock.Eq(invocation.MethodName()), gomock.Eq(metrics.HillClimbing)).
- Times(1).
+ GetMethodMetrics(gomock.Any(), gomock.Eq(invocation.MethodName()), gomock.Eq(metrics.HillClimbing)).
+ Times(2).
Return(uint64(10), nil)
- m.EXPECT().
- GetMethodMetrics(gomock.Eq(url1), gomock.Eq(invocation.MethodName()), gomock.Eq(metrics.HillClimbing)).
- Times(1).
- Return(uint64(5), nil)
ivkArr := []base.Invoker{
base.NewBaseInvoker(url0),
base.NewBaseInvoker(url1),
base.NewBaseInvoker(url2),
}
- ivk := lb.Select(ivkArr, invocation)
-
- assert.Equal(t, ivkArr[0].GetURL().String(), ivk.GetURL().String())
+ got := lb.Select(ivkArr, invocation)
+ assert.NotNil(t, got)
Review Comment:
@Alanxtl 这是因为算法选择的是随机数,没有办法去预测, 之前使用那个算法已经在 go1.24 给 drop 了
##########
cluster/loadbalance/p2c/loadbalance_test.go:
##########
@@ -101,28 +91,23 @@ func TestLoadBalance(t *testing.T) {
url1, _ := common.NewURL("dubbo://192.168.1.1:20000/com.ikurento.user.UserProvider")
url2, _ := common.NewURL("dubbo://192.168.1.2:20000/com.ikurento.user.UserProvider")
+ // P2C algorithm randomly selects 2 invokers, so we need to mock all possible combinations
m.EXPECT().
- GetMethodMetrics(gomock.Eq(url0), gomock.Eq(invocation.MethodName()), gomock.Eq(metrics.HillClimbing)).
- Times(1).
+ GetMethodMetrics(gomock.Any(), gomock.Eq(invocation.MethodName()), gomock.Eq(metrics.HillClimbing)).
+ Times(2).
Return(uint64(10), nil)
- m.EXPECT().
- GetMethodMetrics(gomock.Eq(url1), gomock.Eq(invocation.MethodName()), gomock.Eq(metrics.HillClimbing)).
- Times(1).
- Return(uint64(5), nil)
ivkArr := []base.Invoker{
base.NewBaseInvoker(url0),
base.NewBaseInvoker(url1),
base.NewBaseInvoker(url2),
}
- ivk := lb.Select(ivkArr, invocation)
-
- assert.Equal(t, ivkArr[0].GetURL().String(), ivk.GetURL().String())
+ got := lb.Select(ivkArr, invocation)
+ assert.NotNil(t, got)
Review Comment:
@Alanxtl 这是因为算法选择的是随机数,没有办法去预测, 之前使用那个 rand.seed 已经在 go1.24 给 drop 了
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] update the go version and gost version [dubbo-go]
Posted by "yumosx (via GitHub)" <gi...@apache.org>.
yumosx commented on code in PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#discussion_r2508745818
##########
cluster/loadbalance/p2c/loadbalance_test.go:
##########
@@ -101,28 +91,23 @@ func TestLoadBalance(t *testing.T) {
url1, _ := common.NewURL("dubbo://192.168.1.1:20000/com.ikurento.user.UserProvider")
url2, _ := common.NewURL("dubbo://192.168.1.2:20000/com.ikurento.user.UserProvider")
+ // P2C algorithm randomly selects 2 invokers, so we need to mock all possible combinations
m.EXPECT().
- GetMethodMetrics(gomock.Eq(url0), gomock.Eq(invocation.MethodName()), gomock.Eq(metrics.HillClimbing)).
- Times(1).
+ GetMethodMetrics(gomock.Any(), gomock.Eq(invocation.MethodName()), gomock.Eq(metrics.HillClimbing)).
+ Times(2).
Return(uint64(10), nil)
- m.EXPECT().
- GetMethodMetrics(gomock.Eq(url1), gomock.Eq(invocation.MethodName()), gomock.Eq(metrics.HillClimbing)).
- Times(1).
- Return(uint64(5), nil)
ivkArr := []base.Invoker{
base.NewBaseInvoker(url0),
base.NewBaseInvoker(url1),
base.NewBaseInvoker(url2),
}
- ivk := lb.Select(ivkArr, invocation)
-
- assert.Equal(t, ivkArr[0].GetURL().String(), ivk.GetURL().String())
+ got := lb.Select(ivkArr, invocation)
+ assert.NotNil(t, got)
Review Comment:
它这个算法的原理是出现多个节点随机挑选两个值,然后比较它的权重,权重大的就选择,这一点我们是无法去预测的
只能通过这种判空的方式去做
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat: update p2cLoadBalance randomPick strategy [dubbo-go]
Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#issuecomment-3511244674
## [](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3046) **Quality Gate passed**
Issues
 [0 New issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3046&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3046&issueStatuses=ACCEPTED)
Measures
 [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3046&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)
 [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3046&metric=new_coverage&view=list)
 [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3046&metric=new_duplicated_lines_density&view=list)
[See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3046)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org
Re: [PR] feat: update p2cLoadBalance randomPick strategy [dubbo-go]
Posted by "Alanxtl (via GitHub)" <gi...@apache.org>.
Alanxtl commented on code in PR #3046:
URL: https://github.com/apache/dubbo-go/pull/3046#discussion_r2510298830
##########
cluster/loadbalance/p2c/loadbalance.go:
##########
@@ -75,16 +117,7 @@ func (l *p2cLoadBalance) Select(invokers []base.Invoker, invocation base.Invocat
// The local metrics is available only for the earlier version.
m := metrics.LocalMetrics
// picks two nodes randomly
- var i, j int
- if len(invokers) == 2 {
- i, j = 0, 1
- } else {
- i = rand.Intn(len(invokers))
- j = i
- for i == j {
- j = rand.Intn(len(invokers))
- }
- }
+ i, j := l.randomPicker(len(invokers))
logger.Debugf("[P2C select] Two invokers were selected, invoker[%d]: %s, invoker[%d]: %s.",
Review Comment:
不是只有n > 2的情况需要 rand.Seed 来控制行为吗。既然如此,n > 2情况就只检测i和j不相同吧
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org