iJIAJIA opened a new issue, #13184: URL: https://github.com/apache/dubbo/issues/13184
<!-- If you need to report a security issue please visit https://github.com/apache/dubbo/security/policy --> - [x] I have searched the [issues](https://github.com/apache/dubbo/issues) of this repository and believe that this is not a duplicate. ### Environment * Dubbo version: 3.2.3 * Operating System version: win10 * Java version: 1.8 ### Steps to reproduce this issue 1. 使用nacos作为注册中心 2. provider使用interface register-mode 3. consumer 配置 dubbo.consumer.tag=foo Pls. provide [GitHub address] to reproduce this issue. ### Expected Behavior consumer侧报no provider ### Actual Behavior consumer 请求到了 provider节点 ### Reason 实际场景业务场景发生在dubbo3x 服务请求 dubbo2x. 接口级别服务发现时, NacosRegistry有个buildUrl逻辑, 构建的URL实例为org.apache.dubbo.common.url.component.DubboServiceAddressURL 其中getParameter方法为 ``` @Override public String getParameter(String key) { ... String value = null; if (consumerURL != null) {' // consumerURL不为空时优先使用consumer parameter value = consumerURL.getParameter(key); } if (StringUtils.isEmpty(value)) { value = super.getParameter(key); } return value; } ``` 导致 org.apache.dubbo.rpc.cluster.router.tag.TagStateRouter#filterUsingStaticTag 静态tag过滤失效. ``` private <T> BitList<Invoker<T>> filterUsingStaticTag(BitList<Invoker<T>> invokers, URL url, Invocation invocation) { BitList<Invoker<T>> result; // Dynamic param String tag = StringUtils.isEmpty(invocation.getAttachment(TAG_KEY)) ? url.getParameter(TAG_KEY) : invocation.getAttachment(TAG_KEY); // Tag request if (!StringUtils.isEmpty(tag)) { // 这里进行tag过滤,由于DubboServiceAddressURL#getParameter获取的是consumerURL的tag, 导致过滤失效. result = filterInvoker(invokers, invoker -> tag.equals(invoker.getUrl().getParameter(TAG_KEY))); if (CollectionUtils.isEmpty(result) && !isForceUseTag(invocation)) { result = filterInvoker(invokers, invoker -> StringUtils.isEmpty(invoker.getUrl().getParameter(TAG_KEY))); } } else { result = filterInvoker(invokers, invoker -> StringUtils.isEmpty(invoker.getUrl().getParameter(TAG_KEY))); } return result; } ``` 对于应用级别的InstanceAddressURL, 由于有org.apache.dubbo.registry.ProviderFirstParams机制, 可以避免这个情况的发生. 这里想讨论下, 是否可以对DubboServiceAddressURL引入相同的机制. 之前不做修复是有其他的考虑么? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
