Skip to content

Conversation

@wcy666103
Copy link
Contributor

What is the purpose of the change

Added multi-address and priority support

Brief changelog

Detailed design documentation is available here #14344

Verifying this change

Checklist

  • Make sure there is a GitHub_issue field for the change (usually before you start working on it). Trivial changes like typos do not require a GitHub issue. Your pull request should address just this issue, without pulling in other changes - one PR resolves one issue.
  • Each commit in the pull request should have a meaningful subject line and body.
  • Write a pull request description that is detailed enough to understand what the pull request does, how, and why.
  • Check if is necessary to patch to Dubbo 3 if you are work on Dubbo 2.7
  • Write necessary unit-test to verify your logic correction, more mock a little better when cross module dependency exist. If the new feature or significant change is committed, please remember to add sample in dubbo samples project.
  • Add some description to dubbo-website project if you are requesting to add a feature.
  • GitHub Actions works fine on your own branch.
  • If this contribution is large, please follow the Software Donation Guide.

@wcy666103 wcy666103 mentioned this pull request Jun 21, 2024
8 tasks
routeResult = doRoute(invokers, url, invocation, needToPrintMessage, nodeHolder, messageHolder);
if (routeResult != invokers) {
routeResult = invokers.and(routeResult);
routeResult = routeResult.and(invokers);
Copy link
Member

Choose a reason for hiding this comment

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

Do not change it.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

In the new route rule, I will determine if the invoker object's memory address has changed to determine if it is a valid route. So this order change is necessary.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

replace with invokers.clone().and(routeResult)

Comment on lines 155 to 161
if (needToPrintMessage) {
resultMessage.append(messageHolder.get());
}

if (needToPrintMessage) {
messageHolder.set(resultMessage.toString());
}
Copy link
Member

Choose a reason for hiding this comment

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

Is it correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I've changed it here.

|| routerRule.getVersion() != null && routerRule.getVersion().startsWith(RULE_VERSION_V31)) {
boolean trafficDisable = false;
for (MultiDestConditionRouter<T> multiDestConditionRouter : multiDestConditionRouters) {
routeResult = multiDestConditionRouter.route(invokers, url, invocation, needToPrintMessage, nodeHolder);
Copy link
Member

Choose a reason for hiding this comment

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

Should clone invokers here first

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know if cloning is necessary here; the v3.0 logic just passes the filtering on invokers itself.

Copy link
Contributor Author

@wcy666103 wcy666103 Jun 25, 2024

Choose a reason for hiding this comment

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

In the route method, the value in invokers is not modified directly, and there are three cases:
1.Return invokers directly
2. return BItlist.empty
3. The invokers will be cloned and modified then return

so I don't think it is necessary to clone first here, just keep the same with v3.0

Comment on lines +180 to +182
return moduleModel
.getExtensionLoader(ConditionMatcherFactory.class)
.getExtension("param")
Copy link
Member

Choose a reason for hiding this comment

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

Hard code here. If there only exist one implementation, use it directly

Copy link
Contributor Author

@wcy666103 wcy666103 Jun 25, 2024

Choose a reason for hiding this comment

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

Here I just kept the same code with v3.0.Let me think about whether there's room for optimization.

"Invalid condition config version number.",
"",
"Ignore this configuration. Only " + RULE_VERSION_V31 + " and below are supported in this release");
rule = ConditionRouterRule.parseFromMap(map);
Copy link
Contributor

Choose a reason for hiding this comment

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

Should we continue with parsing when found configVersion not match?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

An alternative is to simply create a new ConditionRouterRule object.Otherwise, the rule property is null. Even though there may be a null test, I think it's best to try not to generate null.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Just set it to null and add a unit test

@sonarqubecloud
Copy link

@zrlw zrlw added type/proposal Everything you want Dubbo have type/discussion Everything related with code discussion or question labels Jun 24, 2025
@wcy666103 wcy666103 closed this Jun 26, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

type/discussion Everything related with code discussion or question type/proposal Everything you want Dubbo have

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants