Similarityoung commented on PR #932:
URL: https://github.com/apache/dubbo-go-pixiu/pull/932#issuecomment-4566120689
## 动态注册的 SetEndpoint 语义被修改
### 旧逻辑
```
SetEndpoint(cluster, endpoint)
-> 如果已有 endpoint.ID == incoming.ID
更新原 endpoint
-> 否则 append
```
### 新逻辑
```
resolveSetEndpointSlot(...)
-> 同 ID 且内容相同:幂等 return
-> 同 ID 但内容不同:生成 foo-2,然后 append
```
### 现象
这个规则对“静态配置里写了两个重复 ID 的 endpoint”是合理的:两个配置项都应该保留,所以第二个变成 foo-2。
但对“注册中心 update 事件”不合理。因为 update 不是“新增一个 endpoint”,而是“同一个 endpoint 的地址或元数据变了”。
### 个人观点
动态 SetEndpoint 仍保持“同 ID 更新原 slot”;如果确实需要动态路径支持“同 ID 多 endpoint 共存”,应该单独设计
AddEndpoint / append 语义,而不是改变 SetEndpoint。
或者我觉得,ID 是身份,不是名字;身份冲突应该失败,不应该自动改名。静态配置与动态注册都不应该支持 ID 重复,因为我没有想到 ID 重复的场景?
--
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]