dubbo-go icon indicating copy to clipboard operation
dubbo-go copied to clipboard

[FEATURE] Clarify metadata report selection for multi-registry and multi-instance scenarios / 明确多注册中心和多实例下的 metadata report 选择语义

Open Alanxtl opened this issue 6 months ago • 2 comments

上下文请参考 https://github.com/apache/dubbo-go/issues/3188#issuecomment-4582464870

Background

The #2534 refactor centralized metadata logic and kept the application-level metadata path. In this path, metadata report selection is important for multi-registry and multi-instance deployments. This issue only focuses on application-level metadata report selection semantics.

Related code:

  • metadata/report_instance.go
  • metadata/mapping/metadata/service_name_mapping.go
  • registry/servicediscovery/customizer/metadata_service_url_params_customizer.go

Current Problems

The read/write selection semantics are not clear enough in multi-registry / multi-metadata-report scenarios.

Specific problems:

  • GetMetadataReport() may return an arbitrary report from a map.
  • Mapping writes to all metadata reports, but reads from only one.
  • Some remote metadata loading does not select metadata report by registry id.
  • Multi-instance metadata service URL alignment still has a TODO.

Suggestions

  • Define the binding between metadata report and registry id / cluster.
  • Avoid choosing default report through unordered map iteration.
  • Use consistent report selection rules for mapping write, read, listen, and remove.
  • Clarify metadata service URL selection and exposure rules in multi-instance scenarios.
  • Add tests for multiple registries and metadata reports.

背景

#2534 重构将 metadata 逻辑集中化,并保留应用级 metadata 主链路。在这条链路里,多注册中心和多实例部署下的 metadata report 选择语义非常关键。本 issue 只关注应用级 metadata report 选择语义。

相关代码:

  • metadata/report_instance.go
  • metadata/mapping/metadata/service_name_mapping.go
  • registry/servicediscovery/customizer/metadata_service_url_params_customizer.go

当前问题

当前多 registry / metadata report 场景下,读写路径的选择语义不够清晰。

具体问题:

  • GetMetadataReport() 会返回 map 中任意一个 report。
  • mapping 写入会写所有 metadata report,但读取只取一个 report。
  • 部分远端 metadata 读取没有按 registry id 精确选择 metadata report。
  • 多实例 metadata service URL 对齐仍有 TODO。

建议

  • 明确 metadata report 与 registry id / cluster 的绑定关系。
  • 避免无序 map 遍历决定默认 report。
  • mapping 的写入、读取、监听、移除使用一致的 report 选择规则。
  • 明确多实例场景下 metadata service URL 的选择与暴露规则。
  • 补充多 registry、多 metadata report 的单测。

Alanxtl avatar May 30 '26 10:05 Alanxtl

assign me pls 想尝试一下owo

XnLemon avatar Jun 03 '26 07:06 XnLemon

close via #3369

Alanxtl avatar Jun 25 '26 08:06 Alanxtl