Skip to content

Conversation

@redoom
Copy link
Contributor

@redoom redoom commented Dec 2, 2025

Problem

Previously, Dubbo's cluster fault-tolerance strategy could only be configured on the consumer side via @DubboReference(cluster = "..."). Provider-side configuration via @DubboService(cluster = "...") was ignored.

Solution

Modified RegistryProtocol to support provider-side cluster configuration with consumer-side override capability:

  • Check if consumer has explicitly configured cluster parameter
  • If not, fetch cluster configuration from provider's URL metadata
  • Consumer config takes precedence over provider config

Usage Example

Provider side

@DubboService(cluster = "failsafe")
public class GreetingServiceImpl implements GreetingService {
    @Override
    public String sayHello(String name) {
        return "Hello " + name;
    }
}

Consumer side (will use provider's failsafe strategy)

@DubboReference
private GreetingService greetingService;

Consumer override (explicit config takes precedence)

@DubboReference(cluster = "failover")
private GreetingService greetingService;

Priority Order

  1. Consumer-side explicit configuration (highest priority)
  2. Provider-side configuration (fallback)
  3. Default strategy: failover

Related Issues

#15668

@codecov-commenter
Copy link

codecov-commenter commented Dec 2, 2025

Codecov Report

❌ Patch coverage is 69.23077% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 60.77%. Comparing base (7b48706) to head (f1047d6).
⚠️ Report is 3 commits behind head on 3.3.

Files with missing lines Patch % Lines
...e/dubbo/registry/integration/RegistryProtocol.java 69.23% 2 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##                3.3   #15821      +/-   ##
============================================
+ Coverage     60.75%   60.77%   +0.02%     
- Complexity    11695    11704       +9     
============================================
  Files          1938     1938              
  Lines         88679    88692      +13     
  Branches      13386    13391       +5     
============================================
+ Hits          53877    53904      +27     
+ Misses        29270    29256      -14     
  Partials       5532     5532              
Flag Coverage Δ
integration-tests-java21 32.44% <61.53%> (+0.07%) ⬆️
integration-tests-java8 32.45% <61.53%> (+<0.01%) ⬆️
samples-tests-java21 32.04% <69.23%> (-0.03%) ⬇️
samples-tests-java8 29.69% <69.23%> (+0.04%) ⬆️
unit-tests-java11 59.06% <61.53%> (+<0.01%) ⬆️
unit-tests-java17 58.53% <61.53%> (+<0.01%) ⬆️
unit-tests-java21 58.56% <61.53%> (-0.01%) ⬇️
unit-tests-java25 58.51% <61.53%> (-0.01%) ⬇️
unit-tests-java8 59.06% <61.53%> (+0.01%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

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

@zrlw
Copy link
Contributor

zrlw commented Dec 3, 2025

it might be better to add new test cases for this PR.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants