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 2020/10/22 09:21:32 UTC

[GitHub] [dubbo-go] beiwei30 opened a new pull request #800: enhance client's connectivity

beiwei30 opened a new pull request #800:
URL: https://github.com/apache/dubbo-go/pull/800


   <!--  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**:
   
   when the server is down by accident, we need a mechanism to detect this situation quickly, so that the health check router will not route the request to the problematic provider.
    
   **Which issue(s) this PR fixes**:
   <!--
   *Automatically closes linked issue when PR is merged.
   Usage: `Fixes #<issue number>`, or `Fixes (paste link of issue)`.
   _If PR is about `failing-tests or flakes`, please post the related issues/tests in a comment and do not use `Fixes`_*
   -->
   Fixes #
   
   **Special notes for your reviewer**:
   
   **Does this PR introduce a user-facing change?**:
   <!--
   If no, just write "NONE" in the release-note block below.
   If yes, a release note is required:
   Enter your extended release note in the block below. If the PR requires additional action from users switching to the new release, include the string "action required".
   -->
   ```release-note
   
   ```


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

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] wenxuwan commented on pull request #800: enhance client's connectivity

Posted by GitBox <gi...@apache.org>.
wenxuwan commented on pull request #800:
URL: https://github.com/apache/dubbo-go/pull/800#issuecomment-716921741


   LGTM


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

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] beiwei30 commented on a change in pull request #800: enhance client's connectivity

Posted by GitBox <gi...@apache.org>.
beiwei30 commented on a change in pull request #800:
URL: https://github.com/apache/dubbo-go/pull/800#discussion_r512479530



##########
File path: remoting/getty/getty_client.go
##########
@@ -204,6 +204,12 @@ func (c *Client) Request(request *remoting.Request, timeout time.Duration, respo
 	return perrors.WithStack(err)
 }
 
+// isAvailable returns true if the connection is available, or it can be re-established.
+func (c *Client) IsAvailable() bool {
+	_, _, err := c.selectSession(c.addr)
+	return err == nil

Review comment:
       add this defensive check, pls. check again.




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

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] wenxuwan commented on pull request #800: enhance client's connectivity

Posted by GitBox <gi...@apache.org>.
wenxuwan commented on pull request #800:
URL: https://github.com/apache/dubbo-go/pull/800#issuecomment-716279343


   selectSession function will try to get conn  or create new conn with lock, If we just want to check whether the conn of the gettyRPCClientPool  is healthy, we can add a flag to reduce the use of locks through atomic operations。


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

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] beiwei30 commented on a change in pull request #800: enhance client's connectivity

Posted by GitBox <gi...@apache.org>.
beiwei30 commented on a change in pull request #800:
URL: https://github.com/apache/dubbo-go/pull/800#discussion_r510560770



##########
File path: remoting/getty/getty_client.go
##########
@@ -204,6 +204,14 @@ func (c *Client) Request(request *remoting.Request, timeout time.Duration, respo
 	return perrors.WithStack(err)
 }
 
+func (c *Client) IsAvailable() bool {
+	client, err := c.pool.get()
+	if client == nil || !client.isAvailable() || err != nil {
+		return false
+	}
+	return true

Review comment:
       I have changed the implementation to 
   
   ```go
   // isAvailable returns true if the connection is available, or it can be re-established.
   func (c *Client) IsAvailable() bool {
   	_, _, err := c.selectSession(c.addr)
   	return err == nil
   }
   ```
   
   since we need to re-establish the connection if possible.




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

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] zouyx commented on a change in pull request #800: enhance client's connectivity

Posted by GitBox <gi...@apache.org>.
zouyx commented on a change in pull request #800:
URL: https://github.com/apache/dubbo-go/pull/800#discussion_r510020560



##########
File path: remoting/getty/getty_client.go
##########
@@ -204,6 +204,14 @@ func (c *Client) Request(request *remoting.Request, timeout time.Duration, respo
 	return perrors.WithStack(err)
 }
 
+func (c *Client) IsAvailable() bool {
+	client, err := c.pool.get()
+	if client == nil || !client.isAvailable() || err != nil {
+		return false
+	}
+	return true

Review comment:
       ```suggestion
   	return  client != nil && client.isAvailable() && err == nil 
   ```




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

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] zouyx commented on a change in pull request #800: enhance client's connectivity

Posted by GitBox <gi...@apache.org>.
zouyx commented on a change in pull request #800:
URL: https://github.com/apache/dubbo-go/pull/800#discussion_r512472300



##########
File path: remoting/getty/getty_client.go
##########
@@ -204,6 +204,12 @@ func (c *Client) Request(request *remoting.Request, timeout time.Duration, respo
 	return perrors.WithStack(err)
 }
 
+// isAvailable returns true if the connection is available, or it can be re-established.
+func (c *Client) IsAvailable() bool {
+	_, _, err := c.selectSession(c.addr)
+	return err == nil

Review comment:
       ```suggestion
   	c, _, err := c.selectSession(c.addr)
   	return c!=nil && err == nil
   ```




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

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 #800: enhance client's connectivity

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


   


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

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-io commented on pull request #800: enhance client's connectivity

Posted by GitBox <gi...@apache.org>.
codecov-io commented on pull request #800:
URL: https://github.com/apache/dubbo-go/pull/800#issuecomment-714363276


   # [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/800?src=pr&el=h1) Report
   > Merging [#800](https://codecov.io/gh/apache/dubbo-go/pull/800?src=pr&el=desc) into [master](https://codecov.io/gh/apache/dubbo-go/commit/a77747e41136741982696cb7a2b97fb4cc350fe3?el=desc) will **decrease** coverage by `0.16%`.
   > The diff coverage is `0.00%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/dubbo-go/pull/800/graphs/tree.svg?width=650&height=150&src=pr&token=dcPE6RyFAL)](https://codecov.io/gh/apache/dubbo-go/pull/800?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##           master     #800      +/-   ##
   ==========================================
   - Coverage   59.86%   59.70%   -0.17%     
   ==========================================
     Files         259      259              
     Lines       12751    12758       +7     
   ==========================================
   - Hits         7634     7617      -17     
   - Misses       4163     4185      +22     
   - Partials      954      956       +2     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/800?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [cluster/router/healthcheck/default\_health\_check.go](https://codecov.io/gh/apache/dubbo-go/pull/800/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvaGVhbHRoY2hlY2svZGVmYXVsdF9oZWFsdGhfY2hlY2suZ28=) | `94.11% <0.00%> (-5.89%)` | :arrow_down: |
   | [protocol/dubbo/dubbo\_invoker.go](https://codecov.io/gh/apache/dubbo-go/pull/800/diff?src=pr&el=tree#diff-cHJvdG9jb2wvZHViYm8vZHViYm9faW52b2tlci5nbw==) | `75.00% <0.00%> (-1.06%)` | :arrow_down: |
   | [remoting/getty/getty\_client.go](https://codecov.io/gh/apache/dubbo-go/pull/800/diff?src=pr&el=tree#diff-cmVtb3RpbmcvZ2V0dHkvZ2V0dHlfY2xpZW50Lmdv) | `39.32% <0.00%> (-1.86%)` | :arrow_down: |
   | [remoting/getty/pool.go](https://codecov.io/gh/apache/dubbo-go/pull/800/diff?src=pr&el=tree#diff-cmVtb3RpbmcvZ2V0dHkvcG9vbC5nbw==) | `47.34% <0.00%> (-12.84%)` | :arrow_down: |
   | [...tocol/rest/server/server\_impl/go\_restful\_server.go](https://codecov.io/gh/apache/dubbo-go/pull/800/diff?src=pr&el=tree#diff-cHJvdG9jb2wvcmVzdC9zZXJ2ZXIvc2VydmVyX2ltcGwvZ29fcmVzdGZ1bF9zZXJ2ZXIuZ28=) | `46.51% <0.00%> (-4.66%)` | :arrow_down: |
   | [cluster/cluster\_impl/failback\_cluster\_invoker.go](https://codecov.io/gh/apache/dubbo-go/pull/800/diff?src=pr&el=tree#diff-Y2x1c3Rlci9jbHVzdGVyX2ltcGwvZmFpbGJhY2tfY2x1c3Rlcl9pbnZva2VyLmdv) | `78.31% <0.00%> (+2.40%)` | :arrow_up: |
   | [metadata/report/delegate/delegate\_report.go](https://codecov.io/gh/apache/dubbo-go/pull/800/diff?src=pr&el=tree#diff-bWV0YWRhdGEvcmVwb3J0L2RlbGVnYXRlL2RlbGVnYXRlX3JlcG9ydC5nbw==) | `39.83% <0.00%> (+10.16%)` | :arrow_up: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/800?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/800?src=pr&el=footer). Last update [a77747e...042387d](https://codecov.io/gh/apache/dubbo-go/pull/800?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   


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

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