Skip to content

[FEATURE] Improve application-level metadata revision calculation / 改进应用级 metadata revision 计算 #3350

Description

@Alanxtl

上下文请参考 #3188 (comment)

Background

After #2534, dubbo-go's metadata main path focuses on application-level metadata. Revision is the key signal used by consumers to determine whether remote MetadataInfo has changed. This issue only focuses on application-level metadata revision and does not cover service-level ServiceDefinition.

Related code:

  • registry/servicediscovery/customizer/service_revision_customizer.go
  • metadata/info/metadata_info.go

Current Problems

The current revision calculation mainly uses application, path, version, port, and method, then sums CRC32 values. This rule is relatively coarse and may not cover all metadata fields that affect service discovery behavior.

Potential problems:

  • Revision may not change when group, protocol, or selected URL params change.
  • Different URL combinations may have weak collision risks.
  • Revision is not strongly bound to the serialized MetadataInfo content.
  • Consumers may continue using stale metadata cache when revision does not change.

Suggestions

  • Define the input fields for application-level metadata revision.
  • Prefer calculating revision from a canonical representation of MetadataInfo.
  • Make ordering, serialization, and hash rules deterministic.
  • Add tests proving revision changes when group, protocol, params, or methods change.
  • Provide compatibility or migration strategy if the algorithm changes.

背景

#2534 之后,dubbo-go 的 metadata 主链路聚焦于应用级 metadata。revision 是 consumer 判断远端 MetadataInfo 是否变化的关键信号。本 issue 只关注应用级 metadata revision,不涉及服务级 ServiceDefinition。

相关代码:

  • registry/servicediscovery/customizer/service_revision_customizer.go
  • metadata/info/metadata_info.go

当前问题

当前 revision 计算主要基于 application、path、version、port、method,并通过 CRC32 累加得到结果。这个规则偏粗,可能无法覆盖所有影响服务发现行为的 metadata 字段。

潜在问题:

  • group、protocol、部分 URL params 等重要字段变化时 revision 可能不变。
  • 不同 URL 组合存在弱碰撞风险。
  • revision 与实际序列化后的 MetadataInfo 内容不是强绑定。
  • consumer 端可能因为 revision 未变化而继续使用旧 metadata cache。

建议

  • 明确定义应用级 metadata revision 的输入字段。
  • 尽量基于规范化后的 MetadataInfo 内容计算 revision。
  • 保证排序、序列化、hash 规则稳定。
  • 补充 group/protocol/params/method 变化导致 revision 变化的测试。
  • 如算法变化,提供兼容或迁移策略。

Activity

  1. added theissue type on May 30, 2026
  2. changed the title [-][metadata] 改进应用级 metadata revision 计算规则[/-] [+][FEATURE] Improve application-level metadata revision calculation / 改进应用级 metadata revision 计算[/+] on May 30, 2026
  3. Qiao-yq commented on May 30, 2026

    @Qiao-yq
    Contributor

    Can I take this up?

  4. linked a pull request that will close this issueFeat/revision canonical metadata #3370on Jun 4, 2026
  5. Alanxtl commented on Jun 25, 2026

    @Alanxtl
    MemberAuthor

    close via #3370

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions