dubbo-go icon indicating copy to clipboard operation
dubbo-go copied to clipboard

Condition router v3.0 swaps enabled and force flags

Open xiaobaicai66695 opened this issue 3 months ago • 1 comments

Environment

  • dubbo-go branch: develop
  • affected code: cluster/router/condition/generateConditionsRoute
  • config center: ZooKeeper

Description

The v3.0 condition-router parser assigns the two boolean fields in reverse order:

force, enable := *routerConfig.Enabled, *routerConfig.Force

As a result, a normal rule with enabled: true and force: false is interpreted as enable=false and force=true. DynamicRouter.Route then bypasses the condition router and returns the original invoker list.

The v3.1 parser is not affected because generateMultiConditionRoute reads and returns the fields in the correct order.

Reproduction

Store the following service-level rule in the config center:

configVersion: v3.0
priority: 1
enabled: true
force: false
runtime: true
key: org.apache.dubbo.quickstart.Greeter:1.0.0:demo
scope: service
conditions:
  - method=SayHello => application=router-rule-e2e-condition-provider-hangzhou

Use two providers whose final consumer-side invoker URLs contain different application values. Calls continue to select both providers because the v3.0 router is treated as disabled.

Changing the same rule to v3.1 enters the separate multi-destination parser and routes normally.

Expected behavior

  • enabled controls whether the router executes.
  • force controls whether an empty routing result falls back to the original invokers.
  • Updating the same config-center node from v3.1 to v3.0 should replace the router state and apply the v3.0 condition immediately.

Proposed fix

Assign the fields in their declared order and add regression coverage for the asymmetric enabled: true / force: false combination, including a v3.1-to-v3.0 runtime update.

xiaobaicai66695 avatar Aug 13 '26 16:08 xiaobaicai66695

close via #3658

Alanxtl avatar Aug 14 '26 00:08 Alanxtl