Skip to content

Conversation

@YoWuwuuuw
Copy link
Contributor

@YoWuwuuuw YoWuwuuuw commented Jul 13, 2025

  • I have registered the PR changes.

Ⅰ. Describe what this PR did

This PR is used to provide metadata service registration and discovery capabilities for Seata, and supports the registration type of NamingServer.

Ⅱ. Does this pull request fix one issue?

fixes #7532

Ⅲ. Why don't you add test cases (unit test/integration test)?

  • Unit Test: All affected modules have passed updated unit tests

    • Because the namingserver module lacks integration testing methods, and the test methods are annotated with @Disable, added mock test for NamingseverRegistryServiceImpl class
  • Integration Tests:

    • Server: Metadata defined in the configuration is successfully uploaded to the namingserver.
    • Namingserver: Metadata is correctly persisted and queryable.
    • Client: Metadata is successfully fetched via NamingServerRegistryServiceImpl and parsed into ServiceInstance.

Ⅳ. Describe how to verify it

Simple Test

Server-side config metadata and choose namingserver as the registration center:
image

Able to lookup the corresponding metadata information, which is included in the ServiceInstance list:
a40af841af08fd73a546dcfaa5c3348

Demo

Pull the https://github.com/YoWuwuuuw/incubator-seata/tree/gsoc-metadata-support branch locally, package the latest code, execute clean install -DskipTests, pull https://github.com/YoWuwuuuw/dubbo-samples-seata and load the Maven dependency, and import the new version code of install.
Start a namingserver, get the generated password and modify the client configuration. Start two servers(new code), use namingserver as the registration center, set registry.metadata.weight=100 for server1 and registry.metadata.weight=1 for server2.
Start the demo according to the demo's readme. Because the configured load balancing policy is WeightedRandomLoadBalance, server 1 has a load probability exceeding 99% after weight calculation. Therefore, the client will connect to server 1 for every request. Then, if server 1 is stopped, the client will reconnect to server 2, proving that the metadata is valid in the load balancing link.

Ⅴ. Special notes for reviews

Other:

  • Added UT for FileRegistryService and FileRegistryProvider.
  • Removed unused methods, configuration entries and test cases(e.g., redundant registry.conf entries).
  • Refactored code for improved readability.
  • Added Java doc for affected classes and methods.

@codecov
Copy link

codecov bot commented Jul 13, 2025

Codecov Report

Attention: Patch coverage is 52.09581% with 160 lines in your changes missing coverage. Please review.

Project coverage is 60.52%. Comparing base (f226c66) to head (1c9385d).

Files with missing lines Patch % Lines
.../namingserver/NamingserverRegistryServiceImpl.java 35.00% 38 Missing and 1 partial ⚠️
...scovery/registry/raft/RaftRegistryServiceImpl.java 7.69% 24 Missing ⚠️
...overy/registry/nacos/NacosRegistryServiceImpl.java 4.16% 23 Missing ⚠️
...scovery/loadbalance/WeightedRandomLoadBalance.java 62.50% 8 Missing and 10 partials ⚠️
...scovery/registry/sofa/SofaRegistryServiceImpl.java 0.00% 11 Missing ⚠️
...overy/registry/redis/RedisRegistryServiceImpl.java 62.50% 4 Missing and 2 partials ⚠️
.../apache/seata/common/metadata/ServiceInstance.java 88.63% 0 Missing and 5 partials ⚠️
...ta/core/rpc/netty/AbstractNettyRemotingClient.java 0.00% 5 Missing ⚠️
...eata/core/rpc/netty/NettyClientChannelManager.java 50.00% 4 Missing and 1 partial ⚠️
...che/seata/core/rpc/netty/NettyServerBootstrap.java 50.00% 5 Missing ⚠️
... and 6 more
Additional details and impacted files
@@             Coverage Diff              @@
##                2.x    #7533      +/-   ##
============================================
+ Coverage     60.50%   60.52%   +0.01%     
  Complexity      658      658              
============================================
  Files          1298     1300       +2     
  Lines         49081    49196     +115     
  Branches       5771     5791      +20     
============================================
+ Hits          29697    29775      +78     
- Misses        16750    16777      +27     
- Partials       2634     2644      +10     
Files with missing lines Coverage Δ
...scovery/loadbalance/ConsistentHashLoadBalance.java 84.61% <100.00%> (ø)
.../discovery/loadbalance/LeastActiveLoadBalance.java 100.00% <100.00%> (ø)
...eata/discovery/loadbalance/LoadBalanceFactory.java 66.66% <ø> (ø)
...seata/discovery/loadbalance/RandomLoadBalance.java 100.00% <ø> (ø)
...a/discovery/loadbalance/RoundRobinLoadBalance.java 66.66% <ø> (ø)
...he/seata/discovery/loadbalance/XIDLoadBalance.java 94.11% <100.00%> (ø)
...ta/discovery/registry/FileRegistryServiceImpl.java 86.66% <100.00%> (+28.04%) ⬆️
...e/seata/discovery/registry/RegistryHeartBeats.java 72.72% <ø> (ø)
...ache/seata/discovery/registry/RegistryService.java 100.00% <100.00%> (+36.11%) ⬆️
.../apache/seata/discovery/registry/RegistryType.java 100.00% <ø> (ø)
... and 19 more

... and 8 files with indirect coverage changes

Impacted file tree graph

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@xingfudeshi xingfudeshi changed the title Feature: Support metadata-based registration and discovery in Seata feature: Support metadata-based registration and discovery in Seata Jul 14, 2025
@xingfudeshi xingfudeshi changed the base branch from 2.x to gsoc-2025 July 14, 2025 01:01
@xingfudeshi xingfudeshi self-requested a review August 25, 2025 05:38
Copy link
Member

@xingfudeshi xingfudeshi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@xingfudeshi xingfudeshi merged commit e6c3a0e into apache:gsoc-2025-meta-registry Sep 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature: Support metadata-based registration and discovery in Seata

2 participants