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/12/31 03:04:53 UTC

[GitHub] [dubbo-go] LaurenceLiZhixin opened a new pull request #976: Fix/event driven chain cache

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


   <!--  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**:
   This PR is based on pr #915
   pr 915 aims at fix health check——add black list logic, and split conn check router from health check router.
   This PR aims at using event-driven to let router send signal to notify channel, to notify chain to refresh its cache. 
   Not ticker dirven like before, but event driven.
   This can descrease the CPU usage, as there is no longer useless comparasion of invoker list of chain, but only compare when invokers/router change.
   
   **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`_*
   -->
   
   **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] codecov-io edited a comment on pull request #976: Fix/event driven chain cache

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


   # [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=h1) Report
   > Merging [#976](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=desc) (add1618) into [develop](https://codecov.io/gh/apache/dubbo-go/commit/cc3e8d608571c47c0e02330d3a15011b4427cf0e?el=desc) (cc3e8d6) will **increase** coverage by `0.01%`.
   > The diff coverage is `48.50%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/dubbo-go/pull/976/graphs/tree.svg?width=650&height=150&src=pr&token=dcPE6RyFAL)](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff             @@
   ##           develop     #976      +/-   ##
   ===========================================
   + Coverage    59.66%   59.68%   +0.01%     
   ===========================================
     Files          261      265       +4     
     Lines        12920    13011      +91     
   ===========================================
   + Hits          7709     7765      +56     
   - Misses        4240     4273      +33     
   - Partials       971      973       +2     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [cluster/router/healthcheck/default\_health\_check.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvaGVhbHRoY2hlY2svZGVmYXVsdF9oZWFsdGhfY2hlY2suZ28=) | `100.00% <ø> (+5.88%)` | :arrow_up: |
   | [cluster/router/healthcheck/factory.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvaGVhbHRoY2hlY2svZmFjdG9yeS5nbw==) | `66.66% <0.00%> (ø)` | |
   | [common/extension/conn\_checker.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y29tbW9uL2V4dGVuc2lvbi9jb25uX2NoZWNrZXIuZ28=) | `0.00% <0.00%> (ø)` | |
   | [config/reference\_config.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y29uZmlnL3JlZmVyZW5jZV9jb25maWcuZ28=) | `80.19% <ø> (ø)` | |
   | [protocol/rpc\_status.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-cHJvdG9jb2wvcnBjX3N0YXR1cy5nbw==) | `50.00% <5.26%> (-31.49%)` | :arrow_down: |
   | [config\_center/file/impl.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y29uZmlnX2NlbnRlci9maWxlL2ltcGwuZ28=) | `50.42% <42.85%> (-0.43%)` | :arrow_down: |
   | [cluster/cluster\_impl/base\_cluster\_invoker.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9jbHVzdGVyX2ltcGwvYmFzZV9jbHVzdGVyX2ludm9rZXIuZ28=) | `58.13% <50.00%> (-2.98%)` | :arrow_down: |
   | [cluster/router/condition/factory.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvY29uZGl0aW9uL2ZhY3RvcnkuZ28=) | `71.42% <50.00%> (ø)` | |
   | [cluster/router/conncheck/factory.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvY29ubmNoZWNrL2ZhY3RvcnkuZ28=) | `66.66% <66.66%> (ø)` | |
   | [cluster/router/conncheck/conn\_check\_route.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvY29ubmNoZWNrL2Nvbm5fY2hlY2tfcm91dGUuZ28=) | `68.18% <68.18%> (ø)` | |
   | ... and [20 more](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/976?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/976?src=pr&el=footer). Last update [5cb723a...add1618](https://codecov.io/gh/apache/dubbo-go/pull/976?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] watermelo commented on a change in pull request #976: Fix: event driven chain cache

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



##########
File path: protocol/rpc_status.go
##########
@@ -181,4 +194,84 @@ func CleanAllStatus() {
 		return true
 	}
 	serviceStatistic.Range(delete2)
+	delete3 := func(key, _ interface{}) bool {
+		invokerBlackList.Delete(key)
+		return true
+	}
+	invokerBlackList.Range(delete3)
+}
+
+// GetInvokerHealthyStatus get invoker's conn healthy status
+func GetInvokerHealthyStatus(invoker Invoker) bool {
+	_, found := invokerBlackList.Load(invoker.GetUrl().Key())
+	return !found
+}
+
+// SetInvokerUnhealthyStatus add target invoker to black list
+func SetInvokerUnhealthyStatus(invoker Invoker) {
+	invokerBlackList.Store(invoker.GetUrl().Key(), invoker)
+	logger.Info("Add invoker ip = ", invoker.GetUrl().Location, " to black list")
+	blackListCacheDirty.Store(true)
+}
+
+// RemoveInvokerUnhealthyStatus remove unhealthy status of target invoker from blacklist
+func RemoveInvokerUnhealthyStatus(invoker Invoker) {
+	invokerBlackList.Delete(invoker.GetUrl().Key())
+	logger.Info("Remove invoker ip = ", invoker.GetUrl().Location, " from black list")
+	blackListCacheDirty.Store(true)
+}
+
+// GetBlackListInvokers get at most size of blockSize invokers from black list
+func GetBlackListInvokers(blockSize int) []Invoker {
+	resultIvks := make([]Invoker, 0, 16)
+	invokerBlackList.Range(func(k, v interface{}) bool {
+		resultIvks = append(resultIvks, v.(Invoker))
+		return true
+	})
+	if blockSize > len(resultIvks) {
+		return resultIvks
+	}
+	return resultIvks[:blockSize]
+}
+
+// RemoveUrlKeyUnhealthyStatus called when event of provider unregister, delete from black list
+func RemoveUrlKeyUnhealthyStatus(key string) {
+	invokerBlackList.Delete(key)
+	logger.Info("Remove invoker key = ", key, " from black list")
+	blackListCacheDirty.Store(true)
+}
+
+func GetAndRefreshState() bool {
+	state := blackListCacheDirty.Load()
+	blackListCacheDirty.Store(false)
+	return state
+}
+
+// TryRefreshBlackList start 3 gr to check at most block=16 invokers in black list
+// if target invoker is available, then remove it from black list
+func TryRefreshBlackList() {
+	if atomic.CompareAndSwapInt32(&blackListRefreshing, 0, 1) {
+		wg := sync.WaitGroup{}
+		defer func() {
+			atomic.CompareAndSwapInt32(&blackListRefreshing, 1, 0)
+		}()
+
+		ivks := GetBlackListInvokers(constant.DEFAULT_BLACK_LIST_RECOVER_BLOCK)
+		logger.Debug("blackList len = ", len(ivks))
+
+		for i := 0; i < 3; i++ {
+			wg.Add(1)
+			go func(ivks []Invoker, i int) {
+				defer wg.Done()
+				for j, _ := range ivks {
+					if j%3-i == 0 {

Review comment:
       merge the `if`.

##########
File path: cluster/cluster_impl/base_cluster_invoker.go
##########
@@ -121,38 +121,45 @@ func (invoker *baseClusterInvoker) doSelect(lb cluster.LoadBalance, invocation p
 
 func (invoker *baseClusterInvoker) doSelectInvoker(lb cluster.LoadBalance, invocation protocol.Invocation, invokers []protocol.Invoker, invoked []protocol.Invoker) protocol.Invoker {
 	if len(invokers) == 0 {
-		logger.Errorf("the invokers of %s is nil. ", invocation.Invoker().GetUrl().ServiceKey())
 		return nil
 	}
+	go protocol.TryRefreshBlackList()
 	if len(invokers) == 1 {
-		return invokers[0]
+		if invokers[0].IsAvailable() {
+			return invokers[0]
+		}
+		protocol.SetInvokerUnhealthyStatus(invokers[0])
+		logger.Errorf("the invokers of %s is nil. ", invokers[0].GetUrl().ServiceKey())

Review comment:
       这个错误日志看起来跟上下文无关,或者是否应该放在 `SetInvokerUnhealthyStatus` 里更合适

##########
File path: cluster/cluster_impl/base_cluster_invoker.go
##########
@@ -121,38 +121,45 @@ func (invoker *baseClusterInvoker) doSelect(lb cluster.LoadBalance, invocation p
 
 func (invoker *baseClusterInvoker) doSelectInvoker(lb cluster.LoadBalance, invocation protocol.Invocation, invokers []protocol.Invoker, invoked []protocol.Invoker) protocol.Invoker {
 	if len(invokers) == 0 {
-		logger.Errorf("the invokers of %s is nil. ", invocation.Invoker().GetUrl().ServiceKey())
 		return nil
 	}
+	go protocol.TryRefreshBlackList()
 	if len(invokers) == 1 {
-		return invokers[0]
+		if invokers[0].IsAvailable() {
+			return invokers[0]
+		}
+		protocol.SetInvokerUnhealthyStatus(invokers[0])
+		logger.Errorf("the invokers of %s is nil. ", invokers[0].GetUrl().ServiceKey())
+		return nil
 	}
 
 	selectedInvoker := lb.Select(invokers, invocation)
 
-	//judge to if the selectedInvoker is invoked
-
+	//judge if the selected Invoker is invoked and available
 	if (!selectedInvoker.IsAvailable() && invoker.availablecheck) || isInvoked(selectedInvoker, invoked) {
+		protocol.SetInvokerUnhealthyStatus(selectedInvoker)
+		otherInvokers := getOtherInvokers(invokers, selectedInvoker)
 		// do reselect
-		var reslectInvokers []protocol.Invoker
-
-		for _, invoker := range invokers {
-			if !invoker.IsAvailable() {
+		for i := 0; i < 3; i++ {

Review comment:
       当整个循环次数超过 3 次,最后还是会返回最开始不可用的 `selectedInvoker `,是否符合预期




----------------------------------------------------------------
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 edited a comment on pull request #976: Fix/event driven chain cache

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


   # [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=h1) Report
   > Merging [#976](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=desc) (add1618) into [develop](https://codecov.io/gh/apache/dubbo-go/commit/cc3e8d608571c47c0e02330d3a15011b4427cf0e?el=desc) (cc3e8d6) will **increase** coverage by `0.01%`.
   > The diff coverage is `48.50%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/dubbo-go/pull/976/graphs/tree.svg?width=650&height=150&src=pr&token=dcPE6RyFAL)](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff             @@
   ##           develop     #976      +/-   ##
   ===========================================
   + Coverage    59.66%   59.68%   +0.01%     
   ===========================================
     Files          261      265       +4     
     Lines        12920    13011      +91     
   ===========================================
   + Hits          7709     7765      +56     
   - Misses        4240     4273      +33     
   - Partials       971      973       +2     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [cluster/router/healthcheck/default\_health\_check.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvaGVhbHRoY2hlY2svZGVmYXVsdF9oZWFsdGhfY2hlY2suZ28=) | `100.00% <ø> (+5.88%)` | :arrow_up: |
   | [cluster/router/healthcheck/factory.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvaGVhbHRoY2hlY2svZmFjdG9yeS5nbw==) | `66.66% <0.00%> (ø)` | |
   | [common/extension/conn\_checker.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y29tbW9uL2V4dGVuc2lvbi9jb25uX2NoZWNrZXIuZ28=) | `0.00% <0.00%> (ø)` | |
   | [config/reference\_config.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y29uZmlnL3JlZmVyZW5jZV9jb25maWcuZ28=) | `80.19% <ø> (ø)` | |
   | [protocol/rpc\_status.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-cHJvdG9jb2wvcnBjX3N0YXR1cy5nbw==) | `50.00% <5.26%> (-31.49%)` | :arrow_down: |
   | [config\_center/file/impl.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y29uZmlnX2NlbnRlci9maWxlL2ltcGwuZ28=) | `50.42% <42.85%> (-0.43%)` | :arrow_down: |
   | [cluster/cluster\_impl/base\_cluster\_invoker.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9jbHVzdGVyX2ltcGwvYmFzZV9jbHVzdGVyX2ludm9rZXIuZ28=) | `58.13% <50.00%> (-2.98%)` | :arrow_down: |
   | [cluster/router/condition/factory.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvY29uZGl0aW9uL2ZhY3RvcnkuZ28=) | `71.42% <50.00%> (ø)` | |
   | [cluster/router/conncheck/factory.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvY29ubmNoZWNrL2ZhY3RvcnkuZ28=) | `66.66% <66.66%> (ø)` | |
   | [cluster/router/conncheck/conn\_check\_route.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvY29ubmNoZWNrL2Nvbm5fY2hlY2tfcm91dGUuZ28=) | `68.18% <68.18%> (ø)` | |
   | ... and [20 more](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/976?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/976?src=pr&el=footer). Last update [5cb723a...4f3d161](https://codecov.io/gh/apache/dubbo-go/pull/976?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] LaurenceLiZhixin commented on a change in pull request #976: Fix/event driven chain cache

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



##########
File path: cluster/router/chain/chain_test.go
##########
@@ -148,7 +148,13 @@ conditions:
 	url := getConditionRouteUrl(applicationKey)
 	assert.NotNil(t, url)
 	factory := extension.GetRouterFactory(url.Protocol)
-	r, err := factory.NewPriorityRouter(url)
+	notify := make(chan struct{})
+	go func() {

Review comment:
       fixed~




----------------------------------------------------------------
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 edited a comment on pull request #976: Fix/event driven chain cache

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


   # [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=h1) Report
   > Merging [#976](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=desc) (f28cf2f) into [develop](https://codecov.io/gh/apache/dubbo-go/commit/8d0ccffdf632a2a74e5be20f802e8e76a44b1a84?el=desc) (8d0ccff) will **decrease** coverage by `0.08%`.
   > The diff coverage is `45.42%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/dubbo-go/pull/976/graphs/tree.svg?width=650&height=150&src=pr&token=dcPE6RyFAL)](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff             @@
   ##           develop     #976      +/-   ##
   ===========================================
   - Coverage    59.71%   59.63%   -0.09%     
   ===========================================
     Files          261      265       +4     
     Lines        12884    12994     +110     
   ===========================================
   + Hits          7694     7749      +55     
   - Misses        4239     4278      +39     
   - Partials       951      967      +16     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [cluster/router/healthcheck/default\_health\_check.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvaGVhbHRoY2hlY2svZGVmYXVsdF9oZWFsdGhfY2hlY2suZ28=) | `100.00% <ø> (+5.88%)` | :arrow_up: |
   | [cluster/router/healthcheck/factory.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvaGVhbHRoY2hlY2svZmFjdG9yeS5nbw==) | `66.66% <0.00%> (ø)` | |
   | [cluster/router/tag/router\_rule.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvdGFnL3JvdXRlcl9ydWxlLmdv) | `89.47% <ø> (+12.20%)` | :arrow_up: |
   | [common/config/environment.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y29tbW9uL2NvbmZpZy9lbnZpcm9ubWVudC5nbw==) | `51.72% <ø> (ø)` | |
   | [common/extension/conn\_checker.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y29tbW9uL2V4dGVuc2lvbi9jb25uX2NoZWNrZXIuZ28=) | `0.00% <0.00%> (ø)` | |
   | [config/base\_config.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y29uZmlnL2Jhc2VfY29uZmlnLmdv) | `64.02% <ø> (ø)` | |
   | [config/config\_center\_config.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y29uZmlnL2NvbmZpZ19jZW50ZXJfY29uZmlnLmdv) | `63.49% <ø> (ø)` | |
   | [config/reference\_config.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y29uZmlnL3JlZmVyZW5jZV9jb25maWcuZ28=) | `80.19% <ø> (ø)` | |
   | [config/service\_config.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y29uZmlnL3NlcnZpY2VfY29uZmlnLmdv) | `54.66% <0.00%> (-0.37%)` | :arrow_down: |
   | [config\_center/nacos/client.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y29uZmlnX2NlbnRlci9uYWNvcy9jbGllbnQuZ28=) | `67.36% <ø> (ø)` | |
   | ... and [74 more](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/976?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/976?src=pr&el=footer). Last update [ca71862...be89b70](https://codecov.io/gh/apache/dubbo-go/pull/976?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] LaurenceLiZhixin commented on a change in pull request #976: Fix: event driven chain cache

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



##########
File path: cluster/cluster_impl/base_cluster_invoker.go
##########
@@ -121,38 +121,45 @@ func (invoker *baseClusterInvoker) doSelect(lb cluster.LoadBalance, invocation p
 
 func (invoker *baseClusterInvoker) doSelectInvoker(lb cluster.LoadBalance, invocation protocol.Invocation, invokers []protocol.Invoker, invoked []protocol.Invoker) protocol.Invoker {
 	if len(invokers) == 0 {
-		logger.Errorf("the invokers of %s is nil. ", invocation.Invoker().GetUrl().ServiceKey())
 		return nil
 	}
+	go protocol.TryRefreshBlackList()
 	if len(invokers) == 1 {
-		return invokers[0]
+		if invokers[0].IsAvailable() {
+			return invokers[0]
+		}
+		protocol.SetInvokerUnhealthyStatus(invokers[0])
+		logger.Errorf("the invokers of %s is nil. ", invokers[0].GetUrl().ServiceKey())
+		return nil
 	}
 
 	selectedInvoker := lb.Select(invokers, invocation)
 
-	//judge to if the selectedInvoker is invoked
-
+	//judge if the selected Invoker is invoked and available
 	if (!selectedInvoker.IsAvailable() && invoker.availablecheck) || isInvoked(selectedInvoker, invoked) {
+		protocol.SetInvokerUnhealthyStatus(selectedInvoker)
+		otherInvokers := getOtherInvokers(invokers, selectedInvoker)
 		// do reselect
-		var reslectInvokers []protocol.Invoker
-
-		for _, invoker := range invokers {
-			if !invoker.IsAvailable() {
+		for i := 0; i < 3; i++ {

Review comment:
       Yes, you r right, I've fixed 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


[GitHub] [dubbo-go] codecov-io edited a comment on pull request #976: Fix/event driven chain cache

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


   # [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=h1) Report
   > Merging [#976](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=desc) (5fe6029) into [develop](https://codecov.io/gh/apache/dubbo-go/commit/8d0ccffdf632a2a74e5be20f802e8e76a44b1a84?el=desc) (8d0ccff) will **increase** coverage by `0.09%`.
   > The diff coverage is `50.00%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/dubbo-go/pull/976/graphs/tree.svg?width=650&height=150&src=pr&token=dcPE6RyFAL)](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff             @@
   ##           develop     #976      +/-   ##
   ===========================================
   + Coverage    59.71%   59.81%   +0.09%     
   ===========================================
     Files          261      265       +4     
     Lines        12884    13003     +119     
   ===========================================
   + Hits          7694     7778      +84     
   - Misses        4239     4272      +33     
   - Partials       951      953       +2     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [cluster/router/healthcheck/default\_health\_check.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvaGVhbHRoY2hlY2svZGVmYXVsdF9oZWFsdGhfY2hlY2suZ28=) | `100.00% <ø> (+5.88%)` | :arrow_up: |
   | [cluster/router/healthcheck/factory.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvaGVhbHRoY2hlY2svZmFjdG9yeS5nbw==) | `66.66% <0.00%> (ø)` | |
   | [common/extension/conn\_checker.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y29tbW9uL2V4dGVuc2lvbi9jb25uX2NoZWNrZXIuZ28=) | `0.00% <0.00%> (ø)` | |
   | [config/reference\_config.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y29uZmlnL3JlZmVyZW5jZV9jb25maWcuZ28=) | `80.19% <ø> (ø)` | |
   | [protocol/rpc\_status.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-cHJvdG9jb2wvcnBjX3N0YXR1cy5nbw==) | `50.00% <5.26%> (-31.49%)` | :arrow_down: |
   | [cluster/cluster\_impl/base\_cluster\_invoker.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9jbHVzdGVyX2ltcGwvYmFzZV9jbHVzdGVyX2ludm9rZXIuZ28=) | `58.13% <50.00%> (-2.98%)` | :arrow_down: |
   | [cluster/router/condition/factory.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvY29uZGl0aW9uL2ZhY3RvcnkuZ28=) | `71.42% <50.00%> (ø)` | |
   | [cluster/router/conncheck/factory.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvY29ubmNoZWNrL2ZhY3RvcnkuZ28=) | `66.66% <66.66%> (ø)` | |
   | [cluster/router/conncheck/conn\_check\_route.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvY29ubmNoZWNrL2Nvbm5fY2hlY2tfcm91dGUuZ28=) | `68.18% <68.18%> (ø)` | |
   | [cluster/router/chain/chain.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvY2hhaW4vY2hhaW4uZ28=) | `73.22% <81.25%> (+5.25%)` | :arrow_up: |
   | ... and [23 more](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/976?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/976?src=pr&el=footer). Last update [ca71862...84bfb9d](https://codecov.io/gh/apache/dubbo-go/pull/976?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] AlexStocks commented on a change in pull request #976: Fix/event driven chain cache

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



##########
File path: protocol/rpc_status.go
##########
@@ -181,4 +194,81 @@ func CleanAllStatus() {
 		return true
 	}
 	serviceStatistic.Range(delete2)
+	delete3 := func(key, _ interface{}) bool {

Review comment:
       delete3? can not get the meaning of this func name.




----------------------------------------------------------------
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 commented on a change in pull request #976: Fix/event driven chain cache

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



##########
File path: protocol/rpc_status.go
##########
@@ -181,4 +194,81 @@ func CleanAllStatus() {
 		return true
 	}
 	serviceStatistic.Range(delete2)
+	delete3 := func(key, _ interface{}) bool {
+		invokerBlackList.Delete(key)
+		return true
+	}
+	invokerBlackList.Range(delete3)
+}
+
+// GetInvokerHealthyStatus get invoker's conn healthy status
+func GetInvokerHealthyStatus(invoker Invoker) bool {
+	_, found := invokerBlackList.Load(invoker.GetUrl().Key())
+	return !found
+}
+
+// SetInvokerUnhealthyStatus add target invoker to black list
+func SetInvokerUnhealthyStatus(invoker Invoker) {
+	invokerBlackList.Store(invoker.GetUrl().Key(), invoker)
+	blackListCacheDirty.Store(true)
+}
+
+// RemoveInvokerUnhealthyStatus remove unhealthy status of target invoker from blacklist
+func RemoveInvokerUnhealthyStatus(invoker Invoker) {
+	invokerBlackList.Delete(invoker.GetUrl().Key())
+	blackListCacheDirty.Store(true)
+}
+
+// GetBlackListInvokers get at most size of blockSize invokers from black list
+func GetBlackListInvokers(blockSize int) []Invoker {
+	resultIvks := make([]Invoker, 0, 16)
+	invokerBlackList.Range(func(k, v interface{}) bool {
+		resultIvks = append(resultIvks, v.(Invoker))
+		return true
+	})
+	if blockSize > len(resultIvks) {
+		return resultIvks
+	}
+	return resultIvks[:blockSize]
+}
+
+// RemoveUrlKeyUnhealthyStatus called when event of provider unregister, delete from black list
+func RemoveUrlKeyUnhealthyStatus(key string) {
+	invokerBlackList.Delete(key)
+	blackListCacheDirty.Store(true)
+}
+
+func GetAndRefreshState() bool {
+	state := blackListCacheDirty.Load()
+	blackListCacheDirty.Store(false)
+	return state
+}
+
+// TryRefreshBlackList start 3 gr to check at most block=16 invokers in black list
+// if is available remove from black list

Review comment:
       can  not know what is the meaning of this sentence.




----------------------------------------------------------------
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 commented on a change in pull request #976: Fix/event driven chain cache

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



##########
File path: cluster/router/conncheck/conn_check_route_test.go
##########
@@ -0,0 +1,112 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package conncheck
+
+import (

Review comment:
       pls split 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


[GitHub] [dubbo-go] codecov-io edited a comment on pull request #976: Fix/event driven chain cache

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


   # [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=h1) Report
   > Merging [#976](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=desc) (f28cf2f) into [develop](https://codecov.io/gh/apache/dubbo-go/commit/8d0ccffdf632a2a74e5be20f802e8e76a44b1a84?el=desc) (8d0ccff) will **decrease** coverage by `0.08%`.
   > The diff coverage is `45.42%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/dubbo-go/pull/976/graphs/tree.svg?width=650&height=150&src=pr&token=dcPE6RyFAL)](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff             @@
   ##           develop     #976      +/-   ##
   ===========================================
   - Coverage    59.71%   59.63%   -0.09%     
   ===========================================
     Files          261      265       +4     
     Lines        12884    12994     +110     
   ===========================================
   + Hits          7694     7749      +55     
   - Misses        4239     4278      +39     
   - Partials       951      967      +16     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [cluster/router/healthcheck/default\_health\_check.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvaGVhbHRoY2hlY2svZGVmYXVsdF9oZWFsdGhfY2hlY2suZ28=) | `100.00% <ø> (+5.88%)` | :arrow_up: |
   | [cluster/router/healthcheck/factory.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvaGVhbHRoY2hlY2svZmFjdG9yeS5nbw==) | `66.66% <0.00%> (ø)` | |
   | [cluster/router/tag/router\_rule.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvdGFnL3JvdXRlcl9ydWxlLmdv) | `89.47% <ø> (+12.20%)` | :arrow_up: |
   | [common/config/environment.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y29tbW9uL2NvbmZpZy9lbnZpcm9ubWVudC5nbw==) | `51.72% <ø> (ø)` | |
   | [common/extension/conn\_checker.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y29tbW9uL2V4dGVuc2lvbi9jb25uX2NoZWNrZXIuZ28=) | `0.00% <0.00%> (ø)` | |
   | [config/base\_config.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y29uZmlnL2Jhc2VfY29uZmlnLmdv) | `64.02% <ø> (ø)` | |
   | [config/config\_center\_config.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y29uZmlnL2NvbmZpZ19jZW50ZXJfY29uZmlnLmdv) | `63.49% <ø> (ø)` | |
   | [config/reference\_config.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y29uZmlnL3JlZmVyZW5jZV9jb25maWcuZ28=) | `80.19% <ø> (ø)` | |
   | [config/service\_config.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y29uZmlnL3NlcnZpY2VfY29uZmlnLmdv) | `54.66% <0.00%> (-0.37%)` | :arrow_down: |
   | [config\_center/nacos/client.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y29uZmlnX2NlbnRlci9uYWNvcy9jbGllbnQuZ28=) | `67.36% <ø> (ø)` | |
   | ... and [74 more](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/976?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/976?src=pr&el=footer). Last update [ca71862...ed0b174](https://codecov.io/gh/apache/dubbo-go/pull/976?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-io edited a comment on pull request #976: Fix/event driven chain cache

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


   # [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=h1) Report
   > Merging [#976](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=desc) (f28cf2f) into [develop](https://codecov.io/gh/apache/dubbo-go/commit/cc3e8d608571c47c0e02330d3a15011b4427cf0e?el=desc) (cc3e8d6) will **decrease** coverage by `0.03%`.
   > The diff coverage is `50.00%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/dubbo-go/pull/976/graphs/tree.svg?width=650&height=150&src=pr&token=dcPE6RyFAL)](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff             @@
   ##           develop     #976      +/-   ##
   ===========================================
   - Coverage    59.66%   59.63%   -0.04%     
   ===========================================
     Files          261      265       +4     
     Lines        12920    12994      +74     
   ===========================================
   + Hits          7709     7749      +40     
   - Misses        4240     4278      +38     
   + Partials       971      967       -4     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [cluster/router/healthcheck/default\_health\_check.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvaGVhbHRoY2hlY2svZGVmYXVsdF9oZWFsdGhfY2hlY2suZ28=) | `100.00% <ø> (+5.88%)` | :arrow_up: |
   | [cluster/router/healthcheck/factory.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvaGVhbHRoY2hlY2svZmFjdG9yeS5nbw==) | `66.66% <0.00%> (ø)` | |
   | [common/extension/conn\_checker.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y29tbW9uL2V4dGVuc2lvbi9jb25uX2NoZWNrZXIuZ28=) | `0.00% <0.00%> (ø)` | |
   | [config/reference\_config.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y29uZmlnL3JlZmVyZW5jZV9jb25maWcuZ28=) | `80.19% <ø> (ø)` | |
   | [protocol/rpc\_status.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-cHJvdG9jb2wvcnBjX3N0YXR1cy5nbw==) | `50.00% <5.26%> (-31.49%)` | :arrow_down: |
   | [cluster/cluster\_impl/base\_cluster\_invoker.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9jbHVzdGVyX2ltcGwvYmFzZV9jbHVzdGVyX2ludm9rZXIuZ28=) | `58.13% <50.00%> (-2.98%)` | :arrow_down: |
   | [cluster/router/condition/factory.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvY29uZGl0aW9uL2ZhY3RvcnkuZ28=) | `71.42% <50.00%> (ø)` | |
   | [cluster/router/conncheck/factory.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvY29ubmNoZWNrL2ZhY3RvcnkuZ28=) | `66.66% <66.66%> (ø)` | |
   | [cluster/router/conncheck/conn\_check\_route.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvY29ubmNoZWNrL2Nvbm5fY2hlY2tfcm91dGUuZ28=) | `68.18% <68.18%> (ø)` | |
   | [cluster/router/chain/chain.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvY2hhaW4vY2hhaW4uZ28=) | `72.44% <81.25%> (+4.47%)` | :arrow_up: |
   | ... and [19 more](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/976?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/976?src=pr&el=footer). Last update [5cb723a...833c829](https://codecov.io/gh/apache/dubbo-go/pull/976?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-io edited a comment on pull request #976: Fix/event driven chain cache

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


   # [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=h1) Report
   > Merging [#976](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=desc) (f28cf2f) into [develop](https://codecov.io/gh/apache/dubbo-go/commit/cc3e8d608571c47c0e02330d3a15011b4427cf0e?el=desc) (cc3e8d6) will **decrease** coverage by `0.03%`.
   > The diff coverage is `50.00%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/dubbo-go/pull/976/graphs/tree.svg?width=650&height=150&src=pr&token=dcPE6RyFAL)](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff             @@
   ##           develop     #976      +/-   ##
   ===========================================
   - Coverage    59.66%   59.63%   -0.04%     
   ===========================================
     Files          261      265       +4     
     Lines        12920    12994      +74     
   ===========================================
   + Hits          7709     7749      +40     
   - Misses        4240     4278      +38     
   + Partials       971      967       -4     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [cluster/router/healthcheck/default\_health\_check.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvaGVhbHRoY2hlY2svZGVmYXVsdF9oZWFsdGhfY2hlY2suZ28=) | `100.00% <ø> (+5.88%)` | :arrow_up: |
   | [cluster/router/healthcheck/factory.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvaGVhbHRoY2hlY2svZmFjdG9yeS5nbw==) | `66.66% <0.00%> (ø)` | |
   | [common/extension/conn\_checker.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y29tbW9uL2V4dGVuc2lvbi9jb25uX2NoZWNrZXIuZ28=) | `0.00% <0.00%> (ø)` | |
   | [config/reference\_config.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y29uZmlnL3JlZmVyZW5jZV9jb25maWcuZ28=) | `80.19% <ø> (ø)` | |
   | [protocol/rpc\_status.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-cHJvdG9jb2wvcnBjX3N0YXR1cy5nbw==) | `50.00% <5.26%> (-31.49%)` | :arrow_down: |
   | [cluster/cluster\_impl/base\_cluster\_invoker.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9jbHVzdGVyX2ltcGwvYmFzZV9jbHVzdGVyX2ludm9rZXIuZ28=) | `58.13% <50.00%> (-2.98%)` | :arrow_down: |
   | [cluster/router/condition/factory.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvY29uZGl0aW9uL2ZhY3RvcnkuZ28=) | `71.42% <50.00%> (ø)` | |
   | [cluster/router/conncheck/factory.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvY29ubmNoZWNrL2ZhY3RvcnkuZ28=) | `66.66% <66.66%> (ø)` | |
   | [cluster/router/conncheck/conn\_check\_route.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvY29ubmNoZWNrL2Nvbm5fY2hlY2tfcm91dGUuZ28=) | `68.18% <68.18%> (ø)` | |
   | [cluster/router/chain/chain.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvY2hhaW4vY2hhaW4uZ28=) | `72.44% <81.25%> (+4.47%)` | :arrow_up: |
   | ... and [19 more](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/976?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/976?src=pr&el=footer). Last update [5cb723a...add1618](https://codecov.io/gh/apache/dubbo-go/pull/976?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] cityiron merged pull request #976: Fix: event driven chain cache

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


   


----------------------------------------------------------------
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] watermelo commented on a change in pull request #976: Fix/event driven chain cache

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



##########
File path: cluster/router/chain/chain_test.go
##########
@@ -148,7 +148,13 @@ conditions:
 	url := getConditionRouteUrl(applicationKey)
 	assert.NotNil(t, url)
 	factory := extension.GetRouterFactory(url.Protocol)
-	r, err := factory.NewPriorityRouter(url)
+	notify := make(chan struct{})
+	go func() {

Review comment:
       ```
   for range ch {
   }
   ```




----------------------------------------------------------------
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 commented on a change in pull request #976: Fix/event driven chain cache

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



##########
File path: common/extension/conn_checker.go
##########
@@ -0,0 +1,40 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package extension
+
+import (
+	"github.com/apache/dubbo-go/cluster/router"
+	"github.com/apache/dubbo-go/common"
+)
+
+var (
+	connCheckers = make(map[string]func(url *common.URL) router.ConnChecker)
+)
+
+// SetHealthChecker sets the HealthChecker with @name
+func SetConnChecker(name string, fcn func(_ *common.URL) router.ConnChecker) {
+	connCheckers[name] = fcn
+}
+
+// GetHealthChecker gets the HealthChecker with @name
+func GetConnChecker(name string, url *common.URL) router.ConnChecker {
+	if connCheckers[name] == nil {

Review comment:
                f, ok := connCheckers[mame]
            if !ok || f == nil {
   		panic("connCheckers for " + name + " is not existing, make sure you have import the package.")
   	}
   	return connCheckers[name](url)




----------------------------------------------------------------
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] LaurenceLiZhixin commented on a change in pull request #976: Fix: event driven chain cache

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



##########
File path: cluster/cluster_impl/base_cluster_invoker.go
##########
@@ -121,38 +121,45 @@ func (invoker *baseClusterInvoker) doSelect(lb cluster.LoadBalance, invocation p
 
 func (invoker *baseClusterInvoker) doSelectInvoker(lb cluster.LoadBalance, invocation protocol.Invocation, invokers []protocol.Invoker, invoked []protocol.Invoker) protocol.Invoker {
 	if len(invokers) == 0 {
-		logger.Errorf("the invokers of %s is nil. ", invocation.Invoker().GetUrl().ServiceKey())
 		return nil
 	}
+	go protocol.TryRefreshBlackList()
 	if len(invokers) == 1 {
-		return invokers[0]
+		if invokers[0].IsAvailable() {
+			return invokers[0]
+		}
+		protocol.SetInvokerUnhealthyStatus(invokers[0])
+		logger.Errorf("the invokers of %s is nil. ", invokers[0].GetUrl().ServiceKey())

Review comment:
       这里位置主要是针对invokers列表因为健康检查导致为空时,打印出对应失败的key。
   
   




----------------------------------------------------------------
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 edited a comment on pull request #976: Fix/event driven chain cache

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


   # [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=h1) Report
   > Merging [#976](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=desc) (30e36d0) into [develop](https://codecov.io/gh/apache/dubbo-go/commit/6c989b9d58032a4ff6c172c944921104c6c30739?el=desc) (6c989b9) will **increase** coverage by `0.05%`.
   > The diff coverage is `49.61%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/dubbo-go/pull/976/graphs/tree.svg?width=650&height=150&src=pr&token=dcPE6RyFAL)](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff             @@
   ##           develop     #976      +/-   ##
   ===========================================
   + Coverage    59.41%   59.47%   +0.05%     
   ===========================================
     Files          261      265       +4     
     Lines        12952    13043      +91     
   ===========================================
   + Hits          7696     7757      +61     
   - Misses        4284     4313      +29     
   - Partials       972      973       +1     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [cluster/router/healthcheck/default\_health\_check.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvaGVhbHRoY2hlY2svZGVmYXVsdF9oZWFsdGhfY2hlY2suZ28=) | `100.00% <ø> (+5.88%)` | :arrow_up: |
   | [cluster/router/healthcheck/factory.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvaGVhbHRoY2hlY2svZmFjdG9yeS5nbw==) | `66.66% <0.00%> (ø)` | |
   | [common/extension/conn\_checker.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y29tbW9uL2V4dGVuc2lvbi9jb25uX2NoZWNrZXIuZ28=) | `0.00% <0.00%> (ø)` | |
   | [config/reference\_config.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y29uZmlnL3JlZmVyZW5jZV9jb25maWcuZ28=) | `78.84% <ø> (ø)` | |
   | [protocol/rpc\_status.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-cHJvdG9jb2wvcnBjX3N0YXR1cy5nbw==) | `50.00% <5.26%> (-31.49%)` | :arrow_down: |
   | [cluster/cluster\_impl/base\_cluster\_invoker.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9jbHVzdGVyX2ltcGwvYmFzZV9jbHVzdGVyX2ludm9rZXIuZ28=) | `58.82% <50.00%> (-2.29%)` | :arrow_down: |
   | [cluster/router/condition/factory.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvY29uZGl0aW9uL2ZhY3RvcnkuZ28=) | `71.42% <50.00%> (ø)` | |
   | [cluster/router/conncheck/factory.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvY29ubmNoZWNrL2ZhY3RvcnkuZ28=) | `66.66% <66.66%> (ø)` | |
   | [cluster/router/conncheck/conn\_check\_route.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvY29ubmNoZWNrL2Nvbm5fY2hlY2tfcm91dGUuZ28=) | `68.18% <68.18%> (ø)` | |
   | [cluster/router/chain/chain.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvY2hhaW4vY2hhaW4uZ28=) | `72.44% <81.25%> (+4.47%)` | :arrow_up: |
   | ... and [21 more](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/976?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/976?src=pr&el=footer). Last update [6c989b9...30e36d0](https://codecov.io/gh/apache/dubbo-go/pull/976?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-io edited a comment on pull request #976: Fix: event driven chain cache

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


   # [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=h1) Report
   > Merging [#976](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=desc) (93094ed) into [1.5](https://codecov.io/gh/apache/dubbo-go/commit/6c989b9d58032a4ff6c172c944921104c6c30739?el=desc) (6c989b9) will **decrease** coverage by `0.09%`.
   > The diff coverage is `48.88%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/dubbo-go/pull/976/graphs/tree.svg?width=650&height=150&src=pr&token=dcPE6RyFAL)](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=tree)
   
   ```diff
   @@            Coverage Diff             @@
   ##              1.5     #976      +/-   ##
   ==========================================
   - Coverage   59.41%   59.32%   -0.10%     
   ==========================================
     Files         261      265       +4     
     Lines       12952    13090     +138     
   ==========================================
   + Hits         7696     7765      +69     
   - Misses       4284     4347      +63     
   - Partials      972      978       +6     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [cluster/router/healthcheck/default\_health\_check.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvaGVhbHRoY2hlY2svZGVmYXVsdF9oZWFsdGhfY2hlY2suZ28=) | `100.00% <ø> (+5.88%)` | :arrow_up: |
   | [cluster/router/healthcheck/factory.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvaGVhbHRoY2hlY2svZmFjdG9yeS5nbw==) | `66.66% <0.00%> (ø)` | |
   | [common/extension/conn\_checker.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y29tbW9uL2V4dGVuc2lvbi9jb25uX2NoZWNrZXIuZ28=) | `0.00% <0.00%> (ø)` | |
   | [config/reference\_config.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y29uZmlnL3JlZmVyZW5jZV9jb25maWcuZ28=) | `78.09% <ø> (-0.76%)` | :arrow_down: |
   | [protocol/rpc\_status.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-cHJvdG9jb2wvcnBjX3N0YXR1cy5nbw==) | `48.93% <5.00%> (-32.55%)` | :arrow_down: |
   | [cluster/cluster\_impl/base\_cluster\_invoker.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9jbHVzdGVyX2ltcGwvYmFzZV9jbHVzdGVyX2ludm9rZXIuZ28=) | `58.13% <50.00%> (-2.98%)` | :arrow_down: |
   | [cluster/router/condition/factory.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvY29uZGl0aW9uL2ZhY3RvcnkuZ28=) | `71.42% <50.00%> (ø)` | |
   | [cluster/router/conncheck/factory.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvY29ubmNoZWNrL2ZhY3RvcnkuZ28=) | `66.66% <66.66%> (ø)` | |
   | [cluster/router/conncheck/conn\_check\_route.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvY29ubmNoZWNrL2Nvbm5fY2hlY2tfcm91dGUuZ28=) | `68.18% <68.18%> (ø)` | |
   | [cluster/router/chain/chain.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvY2hhaW4vY2hhaW4uZ28=) | `72.44% <81.25%> (+4.47%)` | :arrow_up: |
   | ... and [34 more](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/976?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/976?src=pr&el=footer). Last update [6c989b9...93094ed](https://codecov.io/gh/apache/dubbo-go/pull/976?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-io commented on pull request #976: Fix/event driven chain cache

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


   # [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=h1) Report
   > Merging [#976](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=desc) (5fe6029) into [develop](https://codecov.io/gh/apache/dubbo-go/commit/e308e19ad2c0c61738cd496d834bb322b0a0e626?el=desc) (e308e19) will **decrease** coverage by `0.26%`.
   > The diff coverage is `50.00%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/dubbo-go/pull/976/graphs/tree.svg?width=650&height=150&src=pr&token=dcPE6RyFAL)](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff             @@
   ##           develop     #976      +/-   ##
   ===========================================
   - Coverage    59.91%   59.64%   -0.27%     
   ===========================================
     Files          261      265       +4     
     Lines        12912    13003      +91     
   ===========================================
   + Hits          7736     7756      +20     
   - Misses        4224     4293      +69     
   - Partials       952      954       +2     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [cluster/router/healthcheck/default\_health\_check.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvaGVhbHRoY2hlY2svZGVmYXVsdF9oZWFsdGhfY2hlY2suZ28=) | `100.00% <ø> (+5.88%)` | :arrow_up: |
   | [cluster/router/healthcheck/factory.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvaGVhbHRoY2hlY2svZmFjdG9yeS5nbw==) | `66.66% <0.00%> (ø)` | |
   | [common/extension/conn\_checker.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y29tbW9uL2V4dGVuc2lvbi9jb25uX2NoZWNrZXIuZ28=) | `0.00% <0.00%> (ø)` | |
   | [config/reference\_config.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y29uZmlnL3JlZmVyZW5jZV9jb25maWcuZ28=) | `80.19% <ø> (ø)` | |
   | [protocol/rpc\_status.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-cHJvdG9jb2wvcnBjX3N0YXR1cy5nbw==) | `50.00% <5.26%> (-31.49%)` | :arrow_down: |
   | [cluster/cluster\_impl/base\_cluster\_invoker.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9jbHVzdGVyX2ltcGwvYmFzZV9jbHVzdGVyX2ludm9rZXIuZ28=) | `58.13% <50.00%> (-2.98%)` | :arrow_down: |
   | [cluster/router/condition/factory.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvY29uZGl0aW9uL2ZhY3RvcnkuZ28=) | `71.42% <50.00%> (ø)` | |
   | [cluster/router/conncheck/factory.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvY29ubmNoZWNrL2ZhY3RvcnkuZ28=) | `66.66% <66.66%> (ø)` | |
   | [cluster/router/conncheck/conn\_check\_route.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvY29ubmNoZWNrL2Nvbm5fY2hlY2tfcm91dGUuZ28=) | `68.18% <68.18%> (ø)` | |
   | [cluster/router/chain/chain.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvY2hhaW4vY2hhaW4uZ28=) | `73.22% <81.25%> (+2.13%)` | :arrow_up: |
   | ... and [18 more](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/976?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/976?src=pr&el=footer). Last update [e308e19...5fe6029](https://codecov.io/gh/apache/dubbo-go/pull/976?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] watermelo commented on a change in pull request #976: Fix: event driven chain cache

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



##########
File path: protocol/rpc_status.go
##########
@@ -181,4 +194,84 @@ func CleanAllStatus() {
 		return true
 	}
 	serviceStatistic.Range(delete2)
+	delete3 := func(key, _ interface{}) bool {
+		invokerBlackList.Delete(key)
+		return true
+	}
+	invokerBlackList.Range(delete3)
+}
+
+// GetInvokerHealthyStatus get invoker's conn healthy status
+func GetInvokerHealthyStatus(invoker Invoker) bool {
+	_, found := invokerBlackList.Load(invoker.GetUrl().Key())
+	return !found
+}
+
+// SetInvokerUnhealthyStatus add target invoker to black list
+func SetInvokerUnhealthyStatus(invoker Invoker) {
+	invokerBlackList.Store(invoker.GetUrl().Key(), invoker)
+	logger.Info("Add invoker ip = ", invoker.GetUrl().Location, " to black list")
+	blackListCacheDirty.Store(true)
+}
+
+// RemoveInvokerUnhealthyStatus remove unhealthy status of target invoker from blacklist
+func RemoveInvokerUnhealthyStatus(invoker Invoker) {
+	invokerBlackList.Delete(invoker.GetUrl().Key())
+	logger.Info("Remove invoker ip = ", invoker.GetUrl().Location, " from black list")
+	blackListCacheDirty.Store(true)
+}
+
+// GetBlackListInvokers get at most size of blockSize invokers from black list
+func GetBlackListInvokers(blockSize int) []Invoker {
+	resultIvks := make([]Invoker, 0, 16)
+	invokerBlackList.Range(func(k, v interface{}) bool {
+		resultIvks = append(resultIvks, v.(Invoker))
+		return true
+	})
+	if blockSize > len(resultIvks) {
+		return resultIvks
+	}
+	return resultIvks[:blockSize]
+}
+
+// RemoveUrlKeyUnhealthyStatus called when event of provider unregister, delete from black list
+func RemoveUrlKeyUnhealthyStatus(key string) {
+	invokerBlackList.Delete(key)
+	logger.Info("Remove invoker key = ", key, " from black list")
+	blackListCacheDirty.Store(true)
+}
+
+func GetAndRefreshState() bool {
+	state := blackListCacheDirty.Load()
+	blackListCacheDirty.Store(false)
+	return state
+}
+
+// TryRefreshBlackList start 3 gr to check at most block=16 invokers in black list
+// if target invoker is available, then remove it from black list
+func TryRefreshBlackList() {
+	if atomic.CompareAndSwapInt32(&blackListRefreshing, 0, 1) {
+		wg := sync.WaitGroup{}
+		defer func() {
+			atomic.CompareAndSwapInt32(&blackListRefreshing, 1, 0)
+		}()
+
+		ivks := GetBlackListInvokers(constant.DEFAULT_BLACK_LIST_RECOVER_BLOCK)
+		logger.Debug("blackList len = ", len(ivks))
+
+		for i := 0; i < 3; i++ {
+			wg.Add(1)
+			go func(ivks []Invoker, i int) {
+				defer wg.Done()
+				for j, _ := range ivks {
+					if j%3-i == 0 {

Review comment:
       merge the `if`.

##########
File path: cluster/cluster_impl/base_cluster_invoker.go
##########
@@ -121,38 +121,45 @@ func (invoker *baseClusterInvoker) doSelect(lb cluster.LoadBalance, invocation p
 
 func (invoker *baseClusterInvoker) doSelectInvoker(lb cluster.LoadBalance, invocation protocol.Invocation, invokers []protocol.Invoker, invoked []protocol.Invoker) protocol.Invoker {
 	if len(invokers) == 0 {
-		logger.Errorf("the invokers of %s is nil. ", invocation.Invoker().GetUrl().ServiceKey())
 		return nil
 	}
+	go protocol.TryRefreshBlackList()
 	if len(invokers) == 1 {
-		return invokers[0]
+		if invokers[0].IsAvailable() {
+			return invokers[0]
+		}
+		protocol.SetInvokerUnhealthyStatus(invokers[0])
+		logger.Errorf("the invokers of %s is nil. ", invokers[0].GetUrl().ServiceKey())

Review comment:
       这个错误日志看起来跟上下文无关,或者是否应该放在 `SetInvokerUnhealthyStatus` 里更合适

##########
File path: cluster/cluster_impl/base_cluster_invoker.go
##########
@@ -121,38 +121,45 @@ func (invoker *baseClusterInvoker) doSelect(lb cluster.LoadBalance, invocation p
 
 func (invoker *baseClusterInvoker) doSelectInvoker(lb cluster.LoadBalance, invocation protocol.Invocation, invokers []protocol.Invoker, invoked []protocol.Invoker) protocol.Invoker {
 	if len(invokers) == 0 {
-		logger.Errorf("the invokers of %s is nil. ", invocation.Invoker().GetUrl().ServiceKey())
 		return nil
 	}
+	go protocol.TryRefreshBlackList()
 	if len(invokers) == 1 {
-		return invokers[0]
+		if invokers[0].IsAvailable() {
+			return invokers[0]
+		}
+		protocol.SetInvokerUnhealthyStatus(invokers[0])
+		logger.Errorf("the invokers of %s is nil. ", invokers[0].GetUrl().ServiceKey())
+		return nil
 	}
 
 	selectedInvoker := lb.Select(invokers, invocation)
 
-	//judge to if the selectedInvoker is invoked
-
+	//judge if the selected Invoker is invoked and available
 	if (!selectedInvoker.IsAvailable() && invoker.availablecheck) || isInvoked(selectedInvoker, invoked) {
+		protocol.SetInvokerUnhealthyStatus(selectedInvoker)
+		otherInvokers := getOtherInvokers(invokers, selectedInvoker)
 		// do reselect
-		var reslectInvokers []protocol.Invoker
-
-		for _, invoker := range invokers {
-			if !invoker.IsAvailable() {
+		for i := 0; i < 3; i++ {

Review comment:
       当整个循环次数超过 3 次,最后还是会返回最开始不可用的 `selectedInvoker `,是否符合预期




----------------------------------------------------------------
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] LaurenceLiZhixin commented on a change in pull request #976: Fix: event driven chain cache

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



##########
File path: cluster/cluster_impl/base_cluster_invoker.go
##########
@@ -121,38 +121,45 @@ func (invoker *baseClusterInvoker) doSelect(lb cluster.LoadBalance, invocation p
 
 func (invoker *baseClusterInvoker) doSelectInvoker(lb cluster.LoadBalance, invocation protocol.Invocation, invokers []protocol.Invoker, invoked []protocol.Invoker) protocol.Invoker {
 	if len(invokers) == 0 {

Review comment:
       这个地方比较有意思,是改了个已有的坑。
   invocation.Invoker()是个nil,所以一走到这一行就会panic。
   后来发现这里不会被执行到。不存在invokers列表为空的情况。所以决定删掉这行日志了。




----------------------------------------------------------------
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 edited a comment on pull request #976: Fix/event driven chain cache

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


   # [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=h1) Report
   > Merging [#976](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=desc) (569bacd) into [develop](https://codecov.io/gh/apache/dubbo-go/commit/6c989b9d58032a4ff6c172c944921104c6c30739?el=desc) (6c989b9) will **decrease** coverage by `0.09%`.
   > The diff coverage is `42.74%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/dubbo-go/pull/976/graphs/tree.svg?width=650&height=150&src=pr&token=dcPE6RyFAL)](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff             @@
   ##           develop     #976      +/-   ##
   ===========================================
   - Coverage    59.41%   59.32%   -0.10%     
   ===========================================
     Files          261      265       +4     
     Lines        12952    13043      +91     
   ===========================================
   + Hits          7696     7738      +42     
   - Misses        4284     4327      +43     
   - Partials       972      978       +6     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [cluster/router/healthcheck/default\_health\_check.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvaGVhbHRoY2hlY2svZGVmYXVsdF9oZWFsdGhfY2hlY2suZ28=) | `100.00% <ø> (+5.88%)` | :arrow_up: |
   | [cluster/router/healthcheck/factory.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvaGVhbHRoY2hlY2svZmFjdG9yeS5nbw==) | `66.66% <0.00%> (ø)` | |
   | [common/extension/conn\_checker.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y29tbW9uL2V4dGVuc2lvbi9jb25uX2NoZWNrZXIuZ28=) | `0.00% <0.00%> (ø)` | |
   | [config/reference\_config.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y29uZmlnL3JlZmVyZW5jZV9jb25maWcuZ28=) | `78.84% <ø> (ø)` | |
   | [protocol/rpc\_status.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-cHJvdG9jb2wvcnBjX3N0YXR1cy5nbw==) | `50.00% <5.26%> (-31.49%)` | :arrow_down: |
   | [cluster/cluster\_impl/base\_cluster\_invoker.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9jbHVzdGVyX2ltcGwvYmFzZV9jbHVzdGVyX2ludm9rZXIuZ28=) | `47.05% <12.50%> (-14.06%)` | :arrow_down: |
   | [cluster/router/condition/factory.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvY29uZGl0aW9uL2ZhY3RvcnkuZ28=) | `71.42% <50.00%> (ø)` | |
   | [cluster/router/conncheck/factory.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvY29ubmNoZWNrL2ZhY3RvcnkuZ28=) | `66.66% <66.66%> (ø)` | |
   | [cluster/router/conncheck/conn\_check\_route.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvY29ubmNoZWNrL2Nvbm5fY2hlY2tfcm91dGUuZ28=) | `68.18% <68.18%> (ø)` | |
   | [cluster/router/chain/chain.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvY2hhaW4vY2hhaW4uZ28=) | `72.44% <81.25%> (+4.47%)` | :arrow_up: |
   | ... and [23 more](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/976?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/976?src=pr&el=footer). Last update [6c989b9...569bacd](https://codecov.io/gh/apache/dubbo-go/pull/976?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-io edited a comment on pull request #976: Fix/event driven chain cache

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


   # [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=h1) Report
   > Merging [#976](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=desc) (30e36d0) into [develop](https://codecov.io/gh/apache/dubbo-go/commit/6c989b9d58032a4ff6c172c944921104c6c30739?el=desc) (6c989b9) will **increase** coverage by `0.05%`.
   > The diff coverage is `49.61%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/dubbo-go/pull/976/graphs/tree.svg?width=650&height=150&src=pr&token=dcPE6RyFAL)](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff             @@
   ##           develop     #976      +/-   ##
   ===========================================
   + Coverage    59.41%   59.47%   +0.05%     
   ===========================================
     Files          261      265       +4     
     Lines        12952    13043      +91     
   ===========================================
   + Hits          7696     7757      +61     
   - Misses        4284     4313      +29     
   - Partials       972      973       +1     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [cluster/router/healthcheck/default\_health\_check.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvaGVhbHRoY2hlY2svZGVmYXVsdF9oZWFsdGhfY2hlY2suZ28=) | `100.00% <ø> (+5.88%)` | :arrow_up: |
   | [cluster/router/healthcheck/factory.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvaGVhbHRoY2hlY2svZmFjdG9yeS5nbw==) | `66.66% <0.00%> (ø)` | |
   | [common/extension/conn\_checker.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y29tbW9uL2V4dGVuc2lvbi9jb25uX2NoZWNrZXIuZ28=) | `0.00% <0.00%> (ø)` | |
   | [config/reference\_config.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y29uZmlnL3JlZmVyZW5jZV9jb25maWcuZ28=) | `78.84% <ø> (ø)` | |
   | [protocol/rpc\_status.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-cHJvdG9jb2wvcnBjX3N0YXR1cy5nbw==) | `50.00% <5.26%> (-31.49%)` | :arrow_down: |
   | [cluster/cluster\_impl/base\_cluster\_invoker.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9jbHVzdGVyX2ltcGwvYmFzZV9jbHVzdGVyX2ludm9rZXIuZ28=) | `58.82% <50.00%> (-2.29%)` | :arrow_down: |
   | [cluster/router/condition/factory.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvY29uZGl0aW9uL2ZhY3RvcnkuZ28=) | `71.42% <50.00%> (ø)` | |
   | [cluster/router/conncheck/factory.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvY29ubmNoZWNrL2ZhY3RvcnkuZ28=) | `66.66% <66.66%> (ø)` | |
   | [cluster/router/conncheck/conn\_check\_route.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvY29ubmNoZWNrL2Nvbm5fY2hlY2tfcm91dGUuZ28=) | `68.18% <68.18%> (ø)` | |
   | [cluster/router/chain/chain.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvY2hhaW4vY2hhaW4uZ28=) | `72.44% <81.25%> (+4.47%)` | :arrow_up: |
   | ... and [21 more](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/976?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/976?src=pr&el=footer). Last update [6c989b9...569bacd](https://codecov.io/gh/apache/dubbo-go/pull/976?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] cityiron commented on a change in pull request #976: Fix: event driven chain cache

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



##########
File path: cluster/cluster_impl/base_cluster_invoker.go
##########
@@ -121,38 +121,45 @@ func (invoker *baseClusterInvoker) doSelect(lb cluster.LoadBalance, invocation p
 
 func (invoker *baseClusterInvoker) doSelectInvoker(lb cluster.LoadBalance, invocation protocol.Invocation, invokers []protocol.Invoker, invoked []protocol.Invoker) protocol.Invoker {
 	if len(invokers) == 0 {

Review comment:
       if need warn log ?




----------------------------------------------------------------
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 edited a comment on pull request #976: Fix/event driven chain cache

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


   # [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=h1) Report
   > Merging [#976](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=desc) (5fe6029) into [develop](https://codecov.io/gh/apache/dubbo-go/commit/e308e19ad2c0c61738cd496d834bb322b0a0e626?el=desc) (e308e19) will **decrease** coverage by `0.09%`.
   > The diff coverage is `50.00%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/dubbo-go/pull/976/graphs/tree.svg?width=650&height=150&src=pr&token=dcPE6RyFAL)](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff             @@
   ##           develop     #976      +/-   ##
   ===========================================
   - Coverage    59.91%   59.81%   -0.10%     
   ===========================================
     Files          261      265       +4     
     Lines        12912    13003      +91     
   ===========================================
   + Hits          7736     7778      +42     
   - Misses        4224     4272      +48     
   - Partials       952      953       +1     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [cluster/router/healthcheck/default\_health\_check.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvaGVhbHRoY2hlY2svZGVmYXVsdF9oZWFsdGhfY2hlY2suZ28=) | `100.00% <ø> (+5.88%)` | :arrow_up: |
   | [cluster/router/healthcheck/factory.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvaGVhbHRoY2hlY2svZmFjdG9yeS5nbw==) | `66.66% <0.00%> (ø)` | |
   | [common/extension/conn\_checker.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y29tbW9uL2V4dGVuc2lvbi9jb25uX2NoZWNrZXIuZ28=) | `0.00% <0.00%> (ø)` | |
   | [config/reference\_config.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y29uZmlnL3JlZmVyZW5jZV9jb25maWcuZ28=) | `80.19% <ø> (ø)` | |
   | [protocol/rpc\_status.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-cHJvdG9jb2wvcnBjX3N0YXR1cy5nbw==) | `50.00% <5.26%> (-31.49%)` | :arrow_down: |
   | [cluster/cluster\_impl/base\_cluster\_invoker.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9jbHVzdGVyX2ltcGwvYmFzZV9jbHVzdGVyX2ludm9rZXIuZ28=) | `58.13% <50.00%> (-2.98%)` | :arrow_down: |
   | [cluster/router/condition/factory.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvY29uZGl0aW9uL2ZhY3RvcnkuZ28=) | `71.42% <50.00%> (ø)` | |
   | [cluster/router/conncheck/factory.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvY29ubmNoZWNrL2ZhY3RvcnkuZ28=) | `66.66% <66.66%> (ø)` | |
   | [cluster/router/conncheck/conn\_check\_route.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvY29ubmNoZWNrL2Nvbm5fY2hlY2tfcm91dGUuZ28=) | `68.18% <68.18%> (ø)` | |
   | [cluster/router/chain/chain.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvY2hhaW4vY2hhaW4uZ28=) | `73.22% <81.25%> (+2.13%)` | :arrow_up: |
   | ... and [15 more](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/976?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/976?src=pr&el=footer). Last update [e308e19...5fe6029](https://codecov.io/gh/apache/dubbo-go/pull/976?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-io edited a comment on pull request #976: Fix/event driven chain cache

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


   # [Codecov](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=h1) Report
   > Merging [#976](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=desc) (5fe6029) into [develop](https://codecov.io/gh/apache/dubbo-go/commit/8d0ccffdf632a2a74e5be20f802e8e76a44b1a84?el=desc) (8d0ccff) will **increase** coverage by `0.09%`.
   > The diff coverage is `50.00%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/dubbo-go/pull/976/graphs/tree.svg?width=650&height=150&src=pr&token=dcPE6RyFAL)](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff             @@
   ##           develop     #976      +/-   ##
   ===========================================
   + Coverage    59.71%   59.81%   +0.09%     
   ===========================================
     Files          261      265       +4     
     Lines        12884    13003     +119     
   ===========================================
   + Hits          7694     7778      +84     
   - Misses        4239     4272      +33     
   - Partials       951      953       +2     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/dubbo-go/pull/976?src=pr&el=tree) | Coverage Δ | |
   |---|---|---|
   | [cluster/router/healthcheck/default\_health\_check.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvaGVhbHRoY2hlY2svZGVmYXVsdF9oZWFsdGhfY2hlY2suZ28=) | `100.00% <ø> (+5.88%)` | :arrow_up: |
   | [cluster/router/healthcheck/factory.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvaGVhbHRoY2hlY2svZmFjdG9yeS5nbw==) | `66.66% <0.00%> (ø)` | |
   | [common/extension/conn\_checker.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y29tbW9uL2V4dGVuc2lvbi9jb25uX2NoZWNrZXIuZ28=) | `0.00% <0.00%> (ø)` | |
   | [config/reference\_config.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y29uZmlnL3JlZmVyZW5jZV9jb25maWcuZ28=) | `80.19% <ø> (ø)` | |
   | [protocol/rpc\_status.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-cHJvdG9jb2wvcnBjX3N0YXR1cy5nbw==) | `50.00% <5.26%> (-31.49%)` | :arrow_down: |
   | [cluster/cluster\_impl/base\_cluster\_invoker.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9jbHVzdGVyX2ltcGwvYmFzZV9jbHVzdGVyX2ludm9rZXIuZ28=) | `58.13% <50.00%> (-2.98%)` | :arrow_down: |
   | [cluster/router/condition/factory.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvY29uZGl0aW9uL2ZhY3RvcnkuZ28=) | `71.42% <50.00%> (ø)` | |
   | [cluster/router/conncheck/factory.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvY29ubmNoZWNrL2ZhY3RvcnkuZ28=) | `66.66% <66.66%> (ø)` | |
   | [cluster/router/conncheck/conn\_check\_route.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvY29ubmNoZWNrL2Nvbm5fY2hlY2tfcm91dGUuZ28=) | `68.18% <68.18%> (ø)` | |
   | [cluster/router/chain/chain.go](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree#diff-Y2x1c3Rlci9yb3V0ZXIvY2hhaW4vY2hhaW4uZ28=) | `73.22% <81.25%> (+5.25%)` | :arrow_up: |
   | ... and [23 more](https://codecov.io/gh/apache/dubbo-go/pull/976/diff?src=pr&el=tree-more) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/dubbo-go/pull/976?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/976?src=pr&el=footer). Last update [ca71862...b5784d2](https://codecov.io/gh/apache/dubbo-go/pull/976?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] AlexStocks commented on a change in pull request #976: Fix/event driven chain cache

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



##########
File path: cluster/cluster_impl/base_cluster_invoker.go
##########
@@ -124,35 +124,43 @@ func (invoker *baseClusterInvoker) doSelectInvoker(lb cluster.LoadBalance, invoc
 		logger.Errorf("the invokers of %s is nil. ", invocation.Invoker().GetUrl().ServiceKey())
 		return nil
 	}
+	go protocol.TryRefreshBlackList()
 	if len(invokers) == 1 {
-		return invokers[0]
+		if invokers[0].IsAvailable() {
+			return invokers[0]
+		}
+		protocol.SetInvokerUnhealthyStatus(invokers[0])
+		logger.Errorf("the invokers of %s is nil. ", invocation.Invoker().GetUrl().ServiceKey())
+		return nil
 	}
 
 	selectedInvoker := lb.Select(invokers, invocation)
 
-	//judge to if the selectedInvoker is invoked
-
+	//judge to if the selectedInvoker is invoked and available

Review comment:
       can not get the meaning of this chinglish sentence




----------------------------------------------------------------
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] LaurenceLiZhixin commented on a change in pull request #976: Fix: event driven chain cache

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



##########
File path: cluster/cluster_impl/base_cluster_invoker.go
##########
@@ -121,38 +121,45 @@ func (invoker *baseClusterInvoker) doSelect(lb cluster.LoadBalance, invocation p
 
 func (invoker *baseClusterInvoker) doSelectInvoker(lb cluster.LoadBalance, invocation protocol.Invocation, invokers []protocol.Invoker, invoked []protocol.Invoker) protocol.Invoker {
 	if len(invokers) == 0 {

Review comment:
       这个地方比较有意思,是改了个已有的坑。
   invocation.Invoker()是个nil,所以一走到这一行就会panic。
   后来发现这里不会被执行到。不存在invokers列表为空的情况。所以决定删掉这行日志了。

##########
File path: cluster/cluster_impl/base_cluster_invoker.go
##########
@@ -121,38 +121,45 @@ func (invoker *baseClusterInvoker) doSelect(lb cluster.LoadBalance, invocation p
 
 func (invoker *baseClusterInvoker) doSelectInvoker(lb cluster.LoadBalance, invocation protocol.Invocation, invokers []protocol.Invoker, invoked []protocol.Invoker) protocol.Invoker {
 	if len(invokers) == 0 {
-		logger.Errorf("the invokers of %s is nil. ", invocation.Invoker().GetUrl().ServiceKey())
 		return nil
 	}
+	go protocol.TryRefreshBlackList()
 	if len(invokers) == 1 {
-		return invokers[0]
+		if invokers[0].IsAvailable() {
+			return invokers[0]
+		}
+		protocol.SetInvokerUnhealthyStatus(invokers[0])
+		logger.Errorf("the invokers of %s is nil. ", invokers[0].GetUrl().ServiceKey())

Review comment:
       这里位置主要是针对invokers列表因为健康检查导致为空时,打印出对应失败的key。
   
   

##########
File path: cluster/cluster_impl/base_cluster_invoker.go
##########
@@ -121,38 +121,45 @@ func (invoker *baseClusterInvoker) doSelect(lb cluster.LoadBalance, invocation p
 
 func (invoker *baseClusterInvoker) doSelectInvoker(lb cluster.LoadBalance, invocation protocol.Invocation, invokers []protocol.Invoker, invoked []protocol.Invoker) protocol.Invoker {
 	if len(invokers) == 0 {
-		logger.Errorf("the invokers of %s is nil. ", invocation.Invoker().GetUrl().ServiceKey())
 		return nil
 	}
+	go protocol.TryRefreshBlackList()
 	if len(invokers) == 1 {
-		return invokers[0]
+		if invokers[0].IsAvailable() {
+			return invokers[0]
+		}
+		protocol.SetInvokerUnhealthyStatus(invokers[0])
+		logger.Errorf("the invokers of %s is nil. ", invokers[0].GetUrl().ServiceKey())
+		return nil
 	}
 
 	selectedInvoker := lb.Select(invokers, invocation)
 
-	//judge to if the selectedInvoker is invoked
-
+	//judge if the selected Invoker is invoked and available
 	if (!selectedInvoker.IsAvailable() && invoker.availablecheck) || isInvoked(selectedInvoker, invoked) {
+		protocol.SetInvokerUnhealthyStatus(selectedInvoker)
+		otherInvokers := getOtherInvokers(invokers, selectedInvoker)
 		// do reselect
-		var reslectInvokers []protocol.Invoker
-
-		for _, invoker := range invokers {
-			if !invoker.IsAvailable() {
+		for i := 0; i < 3; i++ {

Review comment:
       Yes, you r right, I've fixed 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