Alanxtl commented on issue #3188:
URL: https://github.com/apache/dubbo-go/issues/3188#issuecomment-4582464870

   复盘下来,删减的直接原因很明确:**#2534 是按 #2432 的方案做的一次主动瘦身,不是误删**。
   
   时间线大概是这样:
   
   1. 2023-09 的 [#2432](https://github.com/apache/dubbo-go/issues/2432) 先把当时 
metadata 模块梳理了一遍,指出 metadata 逻辑散在 
`common/extension`、`config/instance`、`metadata/definition`、`metadata/identifier`、`metadata/service`、`registry/event`
 等很多地方。
   2. #2432 的评论里给了“优化 draft”:目标是简化 metadata center 处理逻辑,把 metadata 逻辑集中到 
`metadata` 模块。
   3. 2024-03 的 [#2534](https://github.com/apache/dubbo-go/pull/2534) 
落地了这个方案,commit 是 `d6464e40 Refactor metadata`,一次性 `1703 insertions / 5227 
deletions`。
   4. 后面 [#2760](https://github.com/apache/dubbo-go/pull/2760) 合 `dev-3.3` 
时,又把这套删减后的形态带进开发线,所以现在看起来就是 metadata 被“大幅删了”。
   
   它当时的设计假设是:**dubbo-go 3.x 主要服务发现路径已经转向应用级服务发现,所以 metadata center 不再重点存 
provider/consumer/service-definition 级元数据,只保留应用级 MetadataInfo、service-app 
mapping、MetadataService。**
   
   所以被删的核心东西是:
   
   - `metadata/definition`:provider service definition / method definition 
这套被判断为“不再需要”
   - `metadata/identifier`:老的 service/provider/consumer identifier 被判断为“不再需要”
   - `metadata/service/local|remote|exporter`:拆开的 MetadataService 
本地/远程/exporter 抽象被压扁到 
[metadata_service.go](/dubbo-go/metadata/metadata_service.go:51)
   - `metadata/report/delegate`:带失败重试、周期上报、provider/consumer metadata 上报的 
delegate 层被删
   - 
`common/extension/metadata_*`、`config/instance/metadata_report*`:扩展点和全局实例缓存被认为太分散,迁到/收缩到
 metadata 包内部
   
   保留下来的新模型就是现在这套:`MetadataInfo` 作为应用级服务发现元数据容器,见 
[metadata_info.go](/dubbo-go/metadata/info/metadata_info.go:58);`MetadataReport`
 只负责 app metadata 和 mapping,见 
[report.go](/dubbo-go/metadata/report/report.go:29);服务发现过程通过 revision 拿远端 app 
metadata。
   
   我觉得当时这个删减有它的工程动机:老 metadata 模块确实重、散、和 config/registry/server lifecycle 
纠缠很深,而且很多能力对 dubbo-go 
当时的应用级服务发现主路径不是必需的。但问题也很明显:**他们把“当前主路径不需要”处理成了“能力可以删除”**。这就导致现在如果目标变成“和 Dubbo 
Java metadata 完全对齐”,这些被删掉的 identifier、ServiceDefinition、完整 
MetadataReport、retry/exporter 生命周期就又变成缺口了。


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