Skip to content

[FEATURE] Complete local lifecycle for application-level metadata / 完善应用级 metadata 本地生命周期 #3349

Description

@Alanxtl

上下文请参考 #3188 (comment)

Background

Historically, #2534 significantly simplified the dubbo-go metadata module and kept the main path focused on application-level metadata: MetadataInfo, revision, service-app mapping, and MetadataService. This issue only focuses on the local lifecycle of application-level metadata. It does not propose restoring provider/consumer service-level metadata or ServiceDefinition.

Related code:

  • metadata/metadata.go: AddService, AddSubscribeURL
  • metadata/info/metadata_info.go: RemoveService, RemoveSubscribeURL
  • registry/servicediscovery/service_discovery_registry.go: UnRegister, UnSubscribe

Current Problems

The top-level metadata package only exposes add operations, while unregister and unsubscribe paths do not wire RemoveService / RemoveSubscribeURL into the lifecycle.

This may cause:

  • Stale service URLs remaining in local MetadataInfo.
  • Revision still being calculated from old URLs.
  • MetadataService.GetMetadataInfo returning stale service metadata.
  • Unreliable metadata during dynamic register/unregister and subscribe/unsubscribe flows.

Suggestions

  • Add top-level remove APIs in the metadata package, such as RemoveService(registryId, url) and RemoveSubscribeURL(registryId, url).
  • Call the remove APIs from UnRegister / UnSubscribe paths.
  • Recalculate and publish application-level metadata revision after removal.
  • Add tests for dynamic register, unregister, subscribe, and unsubscribe lifecycle.

背景

历史上,#2534 对 dubbo-go metadata 模块做了大幅瘦身,并将主链路聚焦到应用级 metadata:MetadataInfo、revision、service-app mapping 和 MetadataService。本 issue 只关注应用级 metadata 的本地生命周期,不讨论恢复 provider/consumer 服务级 metadata 或 ServiceDefinition。

相关代码:

  • metadata/metadata.go: AddService, AddSubscribeURL
  • metadata/info/metadata_info.go: RemoveService, RemoveSubscribeURL
  • registry/servicediscovery/service_discovery_registry.go: UnRegister, UnSubscribe

当前问题

顶层 metadata 包只暴露了新增能力,registry 注销和取消订阅链路没有把 RemoveService / RemoveSubscribeURL 接入生命周期。

这会导致:

  • 本地 MetadataInfo 残留已下线 service URL。
  • revision 继续基于旧 URL 计算。
  • MetadataService.GetMetadataInfo 返回过期服务信息。
  • 动态注册/注销、订阅/取消订阅场景下 metadata 不可信。

建议

  • 在 metadata 包补充顶层 remove API,例如 RemoveService(registryId, url) 和 RemoveSubscribeURL(registryId, url)。
  • 在 UnRegister / UnSubscribe 链路调用对应 remove API。
  • 删除后重新计算并发布应用级 metadata revision。
  • 补充动态注册、注销、订阅、取消订阅相关单测。

Activity

  1. added theissue type on May 30, 2026
  2. changed the title [-][metadata] 完善应用级 metadata 的本地删除生命周期[/-] [+][FEATURE] Complete local lifecycle for application-level metadata / 完善应用级 metadata 本地生命周期[/+] on May 30, 2026
  3. AsperforMias commented on May 30, 2026

    @AsperforMias
    Contributor

    hi,may i have a try for it?

  4. linked a pull request that will close this issuefeat: complete local app metadata lifecycle #3357on May 30, 2026
  5. Alanxtl commented on May 31, 2026

    @Alanxtl
    MemberAuthor

    close via #3357

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