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/05/18 16:08:44 UTC

[GitHub] [dubbo-go] flycash opened a new pull request #519: remove lock from url

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


   <!--  Thanks for sending a pull request! 
   -->
   
   **What this PR does**:
   
   Remove the RWLock from baseURL
   
   **Which issue(s) this PR fixes**:
   
   As my understanding, the URL struct should be immutable. But there are some Set* and Add* methods which can modify the URL's instance.
   
   However, we need those methods to create a URL's instance. But the instance should not be modified anymore after finish initialization.
   
   Another concern is that when we try to clone a URL instance, the lock will be cloned too. It will cause some concurrent problems.
   
   Thus remove this lock will be more reasonable. 
   
   As the expense of that, the developer should be more careful to use the URL, especially when they decide to invoke Set* or Add* method.
   
   <!--
   *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] flycash commented on a change in pull request #519: remove lock from url

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



##########
File path: common/url.go
##########
@@ -409,8 +408,8 @@ func (c *URL) RangeParams(f func(key, value string) bool) {
 
 // GetParam ...
 func (c URL) GetParam(s string, d string) string {
-	c.paramsLock.RLock()
-	defer c.paramsLock.RUnlock()
+	// c.paramsLock.RLock()
+	// defer c.paramsLock.RUnlock()

Review comment:
       done

##########
File path: common/url.go
##########
@@ -425,8 +424,8 @@ func (c URL) GetParams() url.Values {
 
 // GetParamAndDecoded ...
 func (c URL) GetParamAndDecoded(key string) (string, error) {
-	c.paramsLock.RLock()
-	defer c.paramsLock.RUnlock()
+	// c.paramsLock.RLock()
+	// defer c.paramsLock.RUnlock()

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.

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 #519: remove lock from url

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


   # [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/519?src=pr&el=h1) Report
   > Merging [#519](https://codecov.io/gh/apache/dubbo-go/pull/519?src=pr&el=desc) into [develop](https://codecov.io/gh/apache/dubbo-go/commit/173790493e9c06d48d55ad67ee25b26913289a20&el=desc) will **decrease** coverage by `0.05%`.
   > The diff coverage is `28.57%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/dubbo-go/pull/519/graphs/tree.svg?width=650&height=150&src=pr&token=dcPE6RyFAL)](https://codecov.io/gh/apache/dubbo-go/pull/519?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff             @@
   ##           develop     #519      +/-   ##
   ===========================================
   - Coverage    66.48%   66.42%   -0.06%     
   ===========================================
     Files          184      184              
     Lines         9723     9709      -14     
   ===========================================
   - Hits          6464     6449      -15     
     Misses        2618     2618              
   - Partials       641      642       +1     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/519?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [common/url.go](https://codecov.io/gh/apache/dubbo-go/pull/519/diff?src=pr&el=tree#diff-Y29tbW9uL3VybC5nbw==) | `65.83% <0.00%> (-1.86%)` | :arrow_down: |
   | [config\_center/configurator/override.go](https://codecov.io/gh/apache/dubbo-go/pull/519/diff?src=pr&el=tree#diff-Y29uZmlnX2NlbnRlci9jb25maWd1cmF0b3Ivb3ZlcnJpZGUuZ28=) | `75.00% <100.00%> (-0.41%)` | :arrow_down: |
   | [registry/protocol/protocol.go](https://codecov.io/gh/apache/dubbo-go/pull/519/diff?src=pr&el=tree#diff-cmVnaXN0cnkvcHJvdG9jb2wvcHJvdG9jb2wuZ28=) | `80.78% <100.00%> (-0.33%)` | :arrow_down: |
   | [remoting/kubernetes/watch.go](https://codecov.io/gh/apache/dubbo-go/pull/519/diff?src=pr&el=tree#diff-cmVtb3Rpbmcva3ViZXJuZXRlcy93YXRjaC5nbw==) | `78.30% <0.00%> (-0.95%)` | :arrow_down: |
   | [remoting/kubernetes/listener.go](https://codecov.io/gh/apache/dubbo-go/pull/519/diff?src=pr&el=tree#diff-cmVtb3Rpbmcva3ViZXJuZXRlcy9saXN0ZW5lci5nbw==) | `57.00% <0.00%> (+0.93%)` | :arrow_up: |
   | [cluster/cluster\_impl/failback\_cluster\_invoker.go](https://codecov.io/gh/apache/dubbo-go/pull/519/diff?src=pr&el=tree#diff-Y2x1c3Rlci9jbHVzdGVyX2ltcGwvZmFpbGJhY2tfY2x1c3Rlcl9pbnZva2VyLmdv) | `80.64% <0.00%> (+2.15%)` | :arrow_up: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/519?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/519?src=pr&el=footer). Last update [1737904...0f64e2c](https://codecov.io/gh/apache/dubbo-go/pull/519?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


[GitHub] [dubbo-go] zouyx commented on pull request #519: remove lock from url

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


   resolve conflicts


----------------------------------------------------------------
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] flycash merged pull request #519: remove lock from url

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


   


----------------------------------------------------------------
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-commenter edited a comment on pull request #519: remove lock from url

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #519:
URL: https://github.com/apache/dubbo-go/pull/519#issuecomment-630837556


   # [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/519?src=pr&el=h1) Report
   > Merging [#519](https://codecov.io/gh/apache/dubbo-go/pull/519?src=pr&el=desc) into [develop](https://codecov.io/gh/apache/dubbo-go/commit/fdf51a1ca1de5ed3bb80d75602c36df8577507a4&el=desc) will **decrease** coverage by `0.14%`.
   > The diff coverage is `28.57%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/dubbo-go/pull/519/graphs/tree.svg?width=650&height=150&src=pr&token=dcPE6RyFAL)](https://codecov.io/gh/apache/dubbo-go/pull/519?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff             @@
   ##           develop     #519      +/-   ##
   ===========================================
   - Coverage    66.56%   66.42%   -0.15%     
   ===========================================
     Files          184      184              
     Lines         9720     9709      -11     
   ===========================================
   - Hits          6470     6449      -21     
   - Misses        2612     2618       +6     
   - Partials       638      642       +4     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/519?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [common/url.go](https://codecov.io/gh/apache/dubbo-go/pull/519/diff?src=pr&el=tree#diff-Y29tbW9uL3VybC5nbw==) | `65.83% <0.00%> (-1.86%)` | :arrow_down: |
   | [config\_center/configurator/override.go](https://codecov.io/gh/apache/dubbo-go/pull/519/diff?src=pr&el=tree#diff-Y29uZmlnX2NlbnRlci9jb25maWd1cmF0b3Ivb3ZlcnJpZGUuZ28=) | `75.00% <100.00%> (-0.41%)` | :arrow_down: |
   | [registry/protocol/protocol.go](https://codecov.io/gh/apache/dubbo-go/pull/519/diff?src=pr&el=tree#diff-cmVnaXN0cnkvcHJvdG9jb2wvcHJvdG9jb2wuZ28=) | `80.78% <100.00%> (-0.33%)` | :arrow_down: |
   | [filter/filter\_impl/hystrix\_filter.go](https://codecov.io/gh/apache/dubbo-go/pull/519/diff?src=pr&el=tree#diff-ZmlsdGVyL2ZpbHRlcl9pbXBsL2h5c3RyaXhfZmlsdGVyLmdv) | `68.64% <0.00%> (-3.39%)` | :arrow_down: |
   | [protocol/dubbo/client.go](https://codecov.io/gh/apache/dubbo-go/pull/519/diff?src=pr&el=tree#diff-cHJvdG9jb2wvZHViYm8vY2xpZW50Lmdv) | `67.87% <0.00%> (-1.22%)` | :arrow_down: |
   | [remoting/zookeeper/listener.go](https://codecov.io/gh/apache/dubbo-go/pull/519/diff?src=pr&el=tree#diff-cmVtb3Rpbmcvem9va2VlcGVyL2xpc3RlbmVyLmdv) | `51.38% <0.00%> (-0.29%)` | :arrow_down: |
   | [protocol/dubbo/pool.go](https://codecov.io/gh/apache/dubbo-go/pull/519/diff?src=pr&el=tree#diff-cHJvdG9jb2wvZHViYm8vcG9vbC5nbw==) | `76.71% <0.00%> (-0.11%)` | :arrow_down: |
   | [remoting/zookeeper/client.go](https://codecov.io/gh/apache/dubbo-go/pull/519/diff?src=pr&el=tree#diff-cmVtb3Rpbmcvem9va2VlcGVyL2NsaWVudC5nbw==) | `68.57% <0.00%> (-0.11%)` | :arrow_down: |
   | [config/consumer\_config.go](https://codecov.io/gh/apache/dubbo-go/pull/519/diff?src=pr&el=tree#diff-Y29uZmlnL2NvbnN1bWVyX2NvbmZpZy5nbw==) | `56.25% <0.00%> (ø)` | |
   | [registry/directory/directory.go](https://codecov.io/gh/apache/dubbo-go/pull/519/diff?src=pr&el=tree#diff-cmVnaXN0cnkvZGlyZWN0b3J5L2RpcmVjdG9yeS5nbw==) | `81.21% <0.00%> (ø)` | |
   | ... and [4 more](https://codecov.io/gh/apache/dubbo-go/pull/519/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/519?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/519?src=pr&el=footer). Last update [fdf51a1...f763779](https://codecov.io/gh/apache/dubbo-go/pull/519?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


[GitHub] [dubbo-go] codecov-commenter edited a comment on pull request #519: remove lock from url

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #519:
URL: https://github.com/apache/dubbo-go/pull/519#issuecomment-630837556


   # [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/519?src=pr&el=h1) Report
   > Merging [#519](https://codecov.io/gh/apache/dubbo-go/pull/519?src=pr&el=desc) into [develop](https://codecov.io/gh/apache/dubbo-go/commit/fdf51a1ca1de5ed3bb80d75602c36df8577507a4&el=desc) will **decrease** coverage by `0.07%`.
   > The diff coverage is `28.57%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/dubbo-go/pull/519/graphs/tree.svg?width=650&height=150&src=pr&token=dcPE6RyFAL)](https://codecov.io/gh/apache/dubbo-go/pull/519?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff             @@
   ##           develop     #519      +/-   ##
   ===========================================
   - Coverage    66.56%   66.48%   -0.08%     
   ===========================================
     Files          184      184              
     Lines         9720     9706      -14     
   ===========================================
   - Hits          6470     6453      -17     
     Misses        2612     2612              
   - Partials       638      641       +3     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/519?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [common/url.go](https://codecov.io/gh/apache/dubbo-go/pull/519/diff?src=pr&el=tree#diff-Y29tbW9uL3VybC5nbw==) | `65.83% <0.00%> (-1.86%)` | :arrow_down: |
   | [config\_center/configurator/override.go](https://codecov.io/gh/apache/dubbo-go/pull/519/diff?src=pr&el=tree#diff-Y29uZmlnX2NlbnRlci9jb25maWd1cmF0b3Ivb3ZlcnJpZGUuZ28=) | `75.00% <100.00%> (-0.41%)` | :arrow_down: |
   | [registry/protocol/protocol.go](https://codecov.io/gh/apache/dubbo-go/pull/519/diff?src=pr&el=tree#diff-cmVnaXN0cnkvcHJvdG9jb2wvcHJvdG9jb2wuZ28=) | `80.78% <100.00%> (-0.33%)` | :arrow_down: |
   | [config\_center/nacos/facade.go](https://codecov.io/gh/apache/dubbo-go/pull/519/diff?src=pr&el=tree#diff-Y29uZmlnX2NlbnRlci9uYWNvcy9mYWNhZGUuZ28=) | `37.50% <0.00%> (-25.00%)` | :arrow_down: |
   | [filter/filter\_impl/hystrix\_filter.go](https://codecov.io/gh/apache/dubbo-go/pull/519/diff?src=pr&el=tree#diff-ZmlsdGVyL2ZpbHRlcl9pbXBsL2h5c3RyaXhfZmlsdGVyLmdv) | `68.64% <0.00%> (-3.39%)` | :arrow_down: |
   | [cluster/cluster\_impl/failback\_cluster\_invoker.go](https://codecov.io/gh/apache/dubbo-go/pull/519/diff?src=pr&el=tree#diff-Y2x1c3Rlci9jbHVzdGVyX2ltcGwvZmFpbGJhY2tfY2x1c3Rlcl9pbnZva2VyLmdv) | `78.49% <0.00%> (-2.16%)` | :arrow_down: |
   | [config\_center/nacos/client.go](https://codecov.io/gh/apache/dubbo-go/pull/519/diff?src=pr&el=tree#diff-Y29uZmlnX2NlbnRlci9uYWNvcy9jbGllbnQuZ28=) | `55.55% <0.00%> (-1.71%)` | :arrow_down: |
   | [remoting/kubernetes/watch.go](https://codecov.io/gh/apache/dubbo-go/pull/519/diff?src=pr&el=tree#diff-cmVtb3Rpbmcva3ViZXJuZXRlcy93YXRjaC5nbw==) | `79.24% <0.00%> (+0.94%)` | :arrow_up: |
   | [protocol/dubbo/listener.go](https://codecov.io/gh/apache/dubbo-go/pull/519/diff?src=pr&el=tree#diff-cHJvdG9jb2wvZHViYm8vbGlzdGVuZXIuZ28=) | `60.21% <0.00%> (+2.68%)` | :arrow_up: |
   | [protocol/dubbo/pool.go](https://codecov.io/gh/apache/dubbo-go/pull/519/diff?src=pr&el=tree#diff-cHJvdG9jb2wvZHViYm8vcG9vbC5nbw==) | `81.36% <0.00%> (+4.54%)` | :arrow_up: |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/519?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/519?src=pr&el=footer). Last update [fdf51a1...f763779](https://codecov.io/gh/apache/dubbo-go/pull/519?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


[GitHub] [dubbo-go] zouyx commented on a change in pull request #519: remove lock from url

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



##########
File path: common/url.go
##########
@@ -409,8 +408,8 @@ func (c *URL) RangeParams(f func(key, value string) bool) {
 
 // GetParam ...
 func (c URL) GetParam(s string, d string) string {
-	c.paramsLock.RLock()
-	defer c.paramsLock.RUnlock()
+	// c.paramsLock.RLock()
+	// defer c.paramsLock.RUnlock()

Review comment:
       should you delete it?

##########
File path: common/url.go
##########
@@ -425,8 +424,8 @@ func (c URL) GetParams() url.Values {
 
 // GetParamAndDecoded ...
 func (c URL) GetParamAndDecoded(key string) (string, error) {
-	c.paramsLock.RLock()
-	defer c.paramsLock.RUnlock()
+	// c.paramsLock.RLock()
+	// defer c.paramsLock.RUnlock()

Review comment:
       should you delete it?




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