Aias00 commented on code in PR #3439:
URL: https://github.com/apache/dubbo-go/pull/3439#discussion_r3650392291
##########
cluster/cluster/base/cluster_invoker.go:
##########
@@ -42,15 +43,15 @@ import (
type BaseClusterInvoker struct {
Directory directory.Directory
AvailableCheck bool
- Destroyed *atomic.Bool
- StickyInvoker base.Invoker
+ Destroyed *uberatomic.Bool
+ StickyInvoker atomic.Pointer[base.Invoker]
Review Comment:
[P1] 已按建议保留原签名、用内部状态修竞态:
- `StickyInvoker` 仍是导出的 `base.Invoker` 字段(未改类型);
- `NewBaseClusterInvoker` 仍返回值 `BaseClusterInvoker`(未改为指针);
- 各 cluster invoker 的 embed 改回值嵌入 `base.BaseClusterInvoker`;
- 竞态由 unexported `stickyLock sync.RWMutex` +
`getStickyInvoker`/`setStickyInvoker` accessor 保护 `IsAvailable`/`DoSelect`
中的读写,不改变任何导出符号。
`TestStickyConcurrent*` 在 `-race` 下通过,`go vet ./cluster/...` 无 copylocks
告警。见 commit ddf000d0。
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]