Alanxtl opened a new issue, #3354:
URL: https://github.com/apache/dubbo-go/issues/3354

   ### 背景
   
   `#2534` 之后,应用级 metadata 主链路保留了 service-app mapping:provider 
注册时写入接口到应用名的映射,consumer 订阅时根据接口找到应用。这个 issue 只聚焦应用级 service-app mapping 的可靠性。
   
   相关代码:
   - `metadata/mapping/metadata/service_name_mapping.go`
   - `metadata/report/nacos/report.go`
   - `metadata/report/zookeeper/report.go`
   - `metadata/report/etcd/report.go`
   
   ### 当前问题
   
   当前 mapping 写入整体比较薄:
   - `retryTimes = 10` 为硬编码,且没有 sleep / backoff
   - Nacos / Etcd / Zookeeper 基本都是读旧值、拼逗号、写回
   - 并发写入时可能发生覆盖
   - Etcd / Zookeeper 使用 `strings.Contains` 判断 app 是否存在,可能对子串误判
   - 部分实现的 listener remove 为空实现
   
   这些问题会导致 service-app mapping 不稳定,consumer 可能找不到正确应用,或者监听无法正确清理。
   
   ### 建议
   
   - 引入可配置 retry times / retry interval / backoff
   - 对 mapping 写入使用 CAS 或版本号机制
   - 使用精确的 app set 去重,避免 `strings.Contains` 子串误判
   - 明确 listener remove 语义,并补齐 Etcd / Zookeeper 实现
   - 增加并发 mapping 写入、重复 app、listener remove 的测试
   


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

Reply via email to