Skip to content

feature #16577 add dubbo.backup.tag - #16601

Open
javaofferss wants to merge 6 commits into
apache:3.3from
javaofferss:feature-16577
Open

javaofferss wants to merge 6 commits into
apache:3.3from
javaofferss:feature-16577

Conversation

@javaofferss

@javaofferss javaofferss commented Nov 24, 2026 •

Copy link
Copy Markdown

What is the purpose of the change?

我在dubbo上提出了一个功能性的建议 #16577,我实现了它. 并且已在公司内部定制的dubbo版本上稳定运行
I made a functional recommendation #16577 on Dubbo, and I implemented it.And it is running stably on a customized Dubbo version within the company.

Checklist

  • Make sure there is a GitHub_issue field for the change.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Write necessary unit-test to verify your logic correction. If the new feature or significant change is committed, please remember to add sample in dubbo samples project.
  • Make sure gitHub actions can pass. Why the workflow is failing and how to fix it?

@codecov-commenter

codecov-commenter commented Nov 24, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 90.00000% with 3 lines in your changes missing coverage. Please review.
✅ Project coverage is 59.30%. Comparing base (09a5747) to head (252a3a8).

Files with missing lines Patch % Lines
...e/dubbo/rpc/cluster/router/tag/TagStateRouter.java 88.46% 1 Missing and 2 partials ⚠️
Additional details and impacted files
@@             Coverage Diff              @@
##                3.3   #16601      +/-   ##
============================================
- Coverage     61.24%   59.30%   -1.94%     
+ Complexity    11763       15   -11748     
============================================
  Files          1953     1953              
  Lines         89411    89441      +30     
  Branches      13502    13508       +6     
============================================
- Hits          54757    53041    -1716     
- Misses        29031    30653    +1622     
- Partials       5623     5747     +124     
Flag Coverage Δ
integration-tests-java21 ?
integration-tests-java8 ?
samples-tests-java21 ?
samples-tests-java8 ?
unit-tests-java11 59.51% <90.00%> (-0.04%) ⬇️
unit-tests-java17 59.01% <90.00%> (+0.04%) ⬆️
unit-tests-java21 58.94% <90.00%> (-0.04%) ⬇️
unit-tests-java25 58.94% <90.00%> (-0.01%) ⬇️
unit-tests-java8 59.54% <90.00%> (+0.01%) ⬆️

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

☔ View full report in Codecov by Harness.
📢 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.

@RainYuY
RainYuY requested review from EarthChen and oxsean November 25, 2026 12:22
@RainYuY

RainYuY commented Nov 25, 2026

Copy link
Copy Markdown
Member

This is a feature PR, so please update the title accordingly. I’ll review it later.

@javaofferss javaofferss changed the title fix #16577 feature #16577 add dubbo.backup.tag Nov 27, 2026

@EarthChen EarthChen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks for the PR and the tests. I verified the behavior on 3.3 (base 5553cb7, head a1f935374c):

  • Reproduced the gap on base with a minimal test: request dubbo.tag=tag2 against providers {dubbo.backup.tag=tag2, no-tag} — base falls back to all providers without a primary dubbo.tag and returns both invokers; no code path consults dubbo.backup.tag.
  • On the PR head, TagStateRouterTest (15, incl. the 7 new cases), DefaultProviderURLMergeProcessorTest (2) and AbstractInterfaceConfigTest (26) all pass.

The implementation is functionally correct as written, but I'd like to request a change of design direction before this lands:

Proposal: ordered tag list on the consumer side instead of dubbo.backup.tag

Rather than introducing a second provider-side tag concept (dubbo.backup.tag + dubbo.recent.backup.tag + the AbstractInterfaceConfig field + the mergeUrl exception), treat the requested tag as an ordered list and match it in priority order:

  • Provider side stays unchanged: the 2 backup machines in the issue's scenario simply carry a dedicated dubbo.tag (e.g. b-backup). No new URL parameter, no merge-processor change, no new config field.
  • Consumer side: dubbo.tag=b,b-backup (reference config or RpcContext attachment). TagStateRouter splits the value and iterates: the first tag value whose primary match is non-empty wins. Fallback to no-tag providers and dubbo.force.tag semantics stay exactly as today.
  • Swimlanes become explicit ordering ([b, prod]) instead of the lexicographic ceilingEntry lookup — dubbo.recent.backup.tag ("nearest dictionary entry >= request") is hard to predict and to document, and an ordered list expresses the same intent more clearly.

This matches the multi-tag model direction suggested in #16577, is a much smaller diff, and keeps the fallback policy where the degradation decision belongs (the caller). The main trade-off to acknowledge: the fallback chain lives in consumer config, so the provider-side declaration (this PR's approach) is operationally simpler when one service backs many consumers. If maintainers prefer the provider-side model, the comments below still apply.

Regardless of the chosen direction, on the current patch:

  1. dubbo.recent.backup.tag ceiling semantics need a documented concrete example, or should be dropped (see above).
  2. The backup-tag fallback is unconditional (no flag gates it) — intended? If so, document it.
  3. Comments need cleanup: "Start by looking at the dubbo.tags. Start by looking at the dubbo tag." (duplicated), "swimlane support is supported for this route", "Reassigned local variable". Prefer not to hide an assignment inside CollectionUtils.isNotEmpty(choseResult = ...).
  4. isRecentUserBackupTag — typo? (isRecentUseBackupTag?)
  5. User-facing feature — docs on the website (tag routing page) should follow.

@javaofferss

javaofferss commented Nov 27, 2026 •

Copy link
Copy Markdown
Author

@EarthChen Thank you for your advice. I've been tweaking and optimizing. done

This branch has not been deployed

No deployments
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.

4 participants