AlexStocks commented on code in PR #3695:
URL: https://github.com/apache/dubbo-go/pull/3695#discussion_r3841413187
##########
registry/service_discovery.go:
##########
@@ -56,15 +55,15 @@ type ServiceDiscovery interface {
// GetInstancesByPage will return a page containing instances of
ServiceInstance
// with the serviceName the page will start at offset
- GetInstancesByPage(serviceName string, offset int, pageSize int)
gxpage.Pager
+ GetInstancesByPage(serviceName string, offset int, pageSize int) Pager
Review Comment:
[P1] 保留旧的 ServiceDiscovery 实现签名`n`n这里把已发布接口的返回类型从 `gxpage.Pager` 改成了新的
`registry.Pager`。两者方法集相同也不能让 Go 的方法签名相同:外部自定义实现如果仍声明
`GetHealthyInstancesByPage(...) gxpage.Pager`,就不再满足
`registry.ServiceDiscovery`。我用同一个外部消费者分别替换到 Base `c150ca47` 和当前 Head:Base
的三个兼容包全部编译通过,Head 在这里稳定报 `have ... gxpage.Pager; want ...
registry.Pager`。这会让现有自定义注册中心在 v3
内直接无法升级。建议在兼容窗口保留旧返回类型(例如先使用真正的类型别名或旧接口适配层),把命名类型迁移留到下一个 major,并加入外部实现编译测试。
##########
global/shutdown_config.go:
##########
@@ -76,7 +75,7 @@ type ShutdownConfig struct {
ProviderActiveCount atomic.Int32
// provider last received request timestamp
- ProviderLastReceivedRequestTime atomic.Time
+ ProviderLastReceivedRequestTime atomic.Pointer[time.Time]
Review Comment:
[P1] 不要改变已导出原子字段的静态类型`n`n`ProviderLastReceivedRequestTime` 是已发布字段,Base
的调用方可以直接执行 `.Store(time.Time)`;改成 `atomic.Pointer[time.Time]` 后同一源码必须传
`*time.Time`,新增的 helper 不能保住直接字段访问。外部 Base/Head 消费者探针在 Base 编译通过,在当前 Head 稳定报
`cannot use time.Time as *time.Time`。同一 PR 还把 `BaseClusterInvoker.Destroyed` 从
`*go.uber.org/atomic.Bool` 改成 `*sync/atomic.Bool`,旧 struct literal
同样无法编译。建议保留并弃用现有导出字段,另加内部标准库字段/兼容访问层,或在下一个 major 再改静态类型;同时补外部消费者编译测试。
--
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]