You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by GitBox <gi...@apache.org> on 2022/07/30 09:45:56 UTC

[GitHub] [dubbo-go] Lvnszn opened a new pull request, #2000: Fix: route with more invokers

Lvnszn opened a new pull request, #2000:
URL: https://github.com/apache/dubbo-go/pull/2000

   <!--  Thanks for sending a pull request!
   Read https://github.com/apache/dubbo-go/blob/master/CONTRIBUTING.md before commit pull request.
   -->
   
   **What this PR does**: 
   multiple invoker may include different methods, find correct invoker.
   
   **Which issue(s) this PR fixes**: 
   Fixes #
   
   **You should pay attention to items below to ensure your pr passes our ci test**
   We do not merge pr with ci tests failed
   
   - [ ] All ut passed (run 'go test ./...' in project root)
   - [ ] After go-fmt ed , run 'go fmt project' using goland.
   - [ ] Golangci-lint passed, run 'sudo golangci-lint run' in project root.
   - [ ] After import formatted, (using [imports-formatter](https://github.com/dubbogo/tools#5-how-to-get-imports-formatter) to run 'imports-formatter .' in project root, to format your import blocks, mentioned in [CONTRIBUTING.md](https://github.com/apache/dubbo-go/blob/master/CONTRIBUTING.md) above) 
   - [ ] Your new-created file needs to have [apache license](https://raw.githubusercontent.com/dubbogo/resources/master/tools/license/license.txt) at the top, like other existed file does.
   - [ ] All integration test passed. You can run integration test locally (with docker env). Clone our [dubbo-go-samples](https://github.com/apache/dubbo-go-samples) project and replace the go.mod to your dubbo-go, and run 'sudo sh start_integration_test.sh' at root of samples project root. (M1 Slice is not Support)


-- 
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


[GitHub] [dubbo-go] AlexStocks commented on pull request #2000: Fix: route with more invokers

Posted by GitBox <gi...@apache.org>.
AlexStocks commented on PR #2000:
URL: https://github.com/apache/dubbo-go/pull/2000#issuecomment-1200326745

   pls 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


[GitHub] [dubbo-go] codecov-commenter commented on pull request #2000: Fix: route with more invokers

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #2000:
URL: https://github.com/apache/dubbo-go/pull/2000#issuecomment-1200771973

   # [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/2000?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#2000](https://codecov.io/gh/apache/dubbo-go/pull/2000?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (d1c5340) into [3.0](https://codecov.io/gh/apache/dubbo-go/commit/013f0b2804ce40d33e1190bfdbd671980f3b1e12?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (013f0b2) will **decrease** coverage by `0.01%`.
   > The diff coverage is `0.00%`.
   
   ```diff
   @@            Coverage Diff             @@
   ##              3.0    #2000      +/-   ##
   ==========================================
   - Coverage   44.38%   44.37%   -0.02%     
   ==========================================
     Files         283      283              
     Lines       17067    17069       +2     
   ==========================================
   - Hits         7575     7574       -1     
   - Misses       8690     8693       +3     
     Partials      802      802              
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/2000?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [cluster/cluster/zoneaware/cluster\_interceptor.go](https://codecov.io/gh/apache/dubbo-go/pull/2000/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y2x1c3Rlci9jbHVzdGVyL3pvbmVhd2FyZS9jbHVzdGVyX2ludGVyY2VwdG9yLmdv) | `40.00% <ø> (ø)` | |
   | [cluster/router/tag/router.go](https://codecov.io/gh/apache/dubbo-go/pull/2000/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y2x1c3Rlci9yb3V0ZXIvdGFnL3JvdXRlci5nbw==) | `59.64% <ø> (ø)` | |
   | [common/url.go](https://codecov.io/gh/apache/dubbo-go/pull/2000/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y29tbW9uL3VybC5nbw==) | `59.04% <0.00%> (-0.27%)` | :arrow_down: |
   | [cluster/cluster/available/cluster\_invoker.go](https://codecov.io/gh/apache/dubbo-go/pull/2000/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-Y2x1c3Rlci9jbHVzdGVyL2F2YWlsYWJsZS9jbHVzdGVyX2ludm9rZXIuZ28=) | `66.66% <0.00%> (-6.67%)` | :arrow_down: |
   
   Help us with your feedback. Take ten seconds to tell us [how you rate us](https://about.codecov.io/nps?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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


[GitHub] [dubbo-go] Mulavar commented on a diff in pull request #2000: Fix: route with more invokers

Posted by GitBox <gi...@apache.org>.
Mulavar commented on code in PR #2000:
URL: https://github.com/apache/dubbo-go/pull/2000#discussion_r934114815


##########
cluster/router/chain/chain.go:
##########
@@ -52,7 +53,22 @@ type RouterChain struct {
 
 // Route Loop routers in RouterChain and call Route method to determine the target invokers list.
 func (c *RouterChain) Route(url *common.URL, invocation protocol.Invocation) []protocol.Invoker {
-	finalInvokers := c.invokers
+	finalInvokers := make([]protocol.Invoker, 0, len(c.invokers))
+	// multiple invoker may include different methods, find correct invoker otherwise
+	// will return the invoker without methods
+	for _, invoker := range c.invokers {
+		invokerURL := invoker.GetURL()
+		if invokerURL.Version() == url.Version() &&
+			invokerURL.Group() == url.Group() &&
+			invokerURL.Interface() == strings.Trim(url.Path, "/") {

Review Comment:
   replace / with constant



-- 
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


[GitHub] [dubbo-go] zhaoyunxing92 commented on a diff in pull request #2000: Fix: route with more invokers

Posted by GitBox <gi...@apache.org>.
zhaoyunxing92 commented on code in PR #2000:
URL: https://github.com/apache/dubbo-go/pull/2000#discussion_r934112012


##########
cluster/router/chain/chain.go:
##########
@@ -52,7 +53,22 @@ type RouterChain struct {
 
 // Route Loop routers in RouterChain and call Route method to determine the target invokers list.
 func (c *RouterChain) Route(url *common.URL, invocation protocol.Invocation) []protocol.Invoker {
-	finalInvokers := c.invokers
+	finalInvokers := make([]protocol.Invoker, 0, len(c.invokers))
+	// multiple invoker may include different methods, find correct invoker otherwise
+	// will return the invoker without methods
+	for _, invoker := range c.invokers {
+		invokerURL := invoker.GetURL()
+		if invokerURL.Version() == url.Version() &&

Review Comment:
   这个地方看看是不是使用[url.ServiceKey()](https://github.com/apache/dubbo-go/blob/master/common/url.go#L371-L374)会好点



-- 
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


[GitHub] [dubbo-go] AlexStocks merged pull request #2000: Fix: route with more invokers

Posted by GitBox <gi...@apache.org>.
AlexStocks merged PR #2000:
URL: https://github.com/apache/dubbo-go/pull/2000


-- 
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


[GitHub] [dubbo-go] Lvnszn commented on a diff in pull request #2000: Fix: route with more invokers

Posted by GitBox <gi...@apache.org>.
Lvnszn commented on code in PR #2000:
URL: https://github.com/apache/dubbo-go/pull/2000#discussion_r934171840


##########
cluster/router/chain/chain.go:
##########
@@ -52,7 +53,22 @@ type RouterChain struct {
 
 // Route Loop routers in RouterChain and call Route method to determine the target invokers list.
 func (c *RouterChain) Route(url *common.URL, invocation protocol.Invocation) []protocol.Invoker {
-	finalInvokers := c.invokers
+	finalInvokers := make([]protocol.Invoker, 0, len(c.invokers))
+	// multiple invoker may include different methods, find correct invoker otherwise
+	// will return the invoker without methods
+	for _, invoker := range c.invokers {
+		invokerURL := invoker.GetURL()
+		if invokerURL.Version() == url.Version() &&
+			invokerURL.Group() == url.Group() &&
+			invokerURL.Interface() == strings.Trim(url.Path, "/") {

Review Comment:
   addressed



##########
cluster/router/chain/chain.go:
##########
@@ -52,7 +53,22 @@ type RouterChain struct {
 
 // Route Loop routers in RouterChain and call Route method to determine the target invokers list.
 func (c *RouterChain) Route(url *common.URL, invocation protocol.Invocation) []protocol.Invoker {
-	finalInvokers := c.invokers
+	finalInvokers := make([]protocol.Invoker, 0, len(c.invokers))
+	// multiple invoker may include different methods, find correct invoker otherwise
+	// will return the invoker without methods
+	for _, invoker := range c.invokers {
+		invokerURL := invoker.GetURL()
+		if invokerURL.Version() == url.Version() &&

Review Comment:
   addressed
   



-- 
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


[GitHub] [dubbo-go] Mulavar commented on a diff in pull request #2000: Fix: route with more invokers

Posted by GitBox <gi...@apache.org>.
Mulavar commented on code in PR #2000:
URL: https://github.com/apache/dubbo-go/pull/2000#discussion_r934114815


##########
cluster/router/chain/chain.go:
##########
@@ -52,7 +53,22 @@ type RouterChain struct {
 
 // Route Loop routers in RouterChain and call Route method to determine the target invokers list.
 func (c *RouterChain) Route(url *common.URL, invocation protocol.Invocation) []protocol.Invoker {
-	finalInvokers := c.invokers
+	finalInvokers := make([]protocol.Invoker, 0, len(c.invokers))
+	// multiple invoker may include different methods, find correct invoker otherwise
+	// will return the invoker without methods
+	for _, invoker := range c.invokers {
+		invokerURL := invoker.GetURL()
+		if invokerURL.Version() == url.Version() &&
+			invokerURL.Group() == url.Group() &&
+			invokerURL.Interface() == strings.Trim(url.Path, "/") {

Review Comment:
   please replace "/" with `constantPathSeparator`



-- 
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