Repository navigation
feature #16577 add dubbo.backup.tag - #16601
javaofferss wants to merge 7 commits into
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 3.3 #16601 +/- ##
============================================
+ Coverage 61.24% 63.03% +1.79%
- Complexity 11763 12038 +275
============================================
Files 1953 2045 +92
Lines 89411 98086 +8675
Branches 13502 15249 +1747
============================================
+ Hits 54757 61828 +7071
- Misses 29031 29881 +850
- Partials 5623 6377 +754
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
This is a feature PR, so please update the title accordingly. I’ll review it later. |
EarthChen
left a comment
There was a problem hiding this comment.
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=tag2against providers{dubbo.backup.tag=tag2, no-tag}— base falls back to all providers without a primarydubbo.tagand returns both invokers; no code path consultsdubbo.backup.tag. - On the PR head,
TagStateRouterTest(15, incl. the 7 new cases),DefaultProviderURLMergeProcessorTest(2) andAbstractInterfaceConfigTest(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 orRpcContextattachment).TagStateRoutersplits the value and iterates: the first tag value whose primary match is non-empty wins. Fallback to no-tag providers anddubbo.force.tagsemantics stay exactly as today. - Swimlanes become explicit ordering (
[b, prod]) instead of the lexicographicceilingEntrylookup —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:
dubbo.recent.backup.tagceiling semantics need a documented concrete example, or should be dropped (see above).- The backup-tag fallback is unconditional (no flag gates it) — intended? If so, document it.
- 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 = ...). isRecentUserBackupTag— typo? (isRecentUseBackupTag?)- User-facing feature — docs on the website (tag routing page) should follow.
|
@EarthChen Thank you for your advice. All Things Considered, we prefer to use dubbo.backup.tag on the provider side. The code has been optimized. done. |
|
pr dubbo-website apache/dubbo-website#3236 . I have done. please check & mr |
Thanks for the update. Could you share what led you to choose dubbo.backup.tag on the provider side? I think allowing providers to have multiple tags would fit better with the existing tag semantics. |
|
@RainYuY If
|
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