zonghaishang opened a new issue, #14075: URL: https://github.com/apache/dubbo/issues/14075
### Pre-check - [X] I am sure that all the content I provide is in English. ### Search before asking - [X] I had searched in the [issues](https://github.com/apache/dubbo/issues?q=is%3Aissue) and found no similar issues. ### Apache Dubbo Component Java SDK (apache/dubbo) ### Dubbo Version (-, 2.6.x ] not compatile with [2.7.x, +] ### Steps to reproduce this issue (-, 2.6.x ] not compatile with [2.7.x, +] 2.6.x dubbo + nacos interface export: nacos service key -> ${interface}:${version}:${group}, if version or group is empty, nothing append with ":" https://github.com/apache/dubbo/blob/0aee8101665262c64122e5fa2c683ef834faff10/dubbo-registry/dubbo-registry-nacos/src/main/java/com/alibaba/dubbo/registry/nacos/NacosRegistry.java#L456 ``` private void appendIfPresent(StringBuilder target, URL url, String parameterName) { String parameterValue = url.getParameter(parameterName); // nothing append if empty !!!! if (!StringUtils.isBlank(parameterValue)) { target.append(SERVICE_NAME_SEPARATOR).append(parameterValue); } } ``` but 2.7.x or 3.x dubbo + nacos interface export: nacos service key -> ${interface}:${version}:${group}, if version or group is empty, **must append with ":"** https://github.com/apache/dubbo/blob/6b3f54383f4b6102215e33ea879a389dff0fd1eb/dubbo-registry/dubbo-registry-nacos/src/main/java/org/apache/dubbo/registry/nacos/NacosServiceName.java#L202 ``` private String toValue() { return new StringBuilder(category) .append(NAME_SEPARATOR) .append(serviceInterface) .append(NAME_SEPARATOR) .append(version) // append ':' if empty !!!! .append(NAME_SEPARATOR) .append(group) .toString(); } ``` 2.6.x dubbo + nacos invoke higher dubbo version , no providers received because of service key is not same. May be higher dubbo version [2.7.x, +] should export two nacos service name( assume the group is empty ): - with ':' suffix , eg: ${interface}:${version}: - noting suffix, eg: ${interface}:${version} But this will result in twice the amount of data in the registry. However, higher dubbo version invoke <= 2.6.x will success, because higher dubbo subscribe to both the ':' suffix and the service without the suffix, here is code implemention: https://github.com/apache/dubbo/blob/6b3f54383f4b6102215e33ea879a389dff0fd1eb/dubbo-registry/dubbo-registry-nacos/src/main/java/org/apache/dubbo/registry/nacos/NacosRegistry.java#L360 ``` private Set<String> getServiceNames0(URL url) { NacosServiceName serviceName = createServiceName(url); final Set<String> serviceNames; if (serviceName.isConcrete()) { // is the concrete service name serviceNames = new LinkedHashSet<>(); serviceNames.add(serviceName.toString()); if (supportLegacyServiceName) { // Add the legacy service name since 2.7.6 String legacySubscribedServiceName = getLegacySubscribedServiceName(url); if (!serviceName.toString().equals(legacySubscribedServiceName)) { // avoid duplicated service names serviceNames.add(legacySubscribedServiceName); } } } else { serviceNames = filterServiceNames(serviceName); } return serviceNames; } ``` ### What you expected to happen 2.6.x dubbo + nacos invoke higher dubbo version , no providers received because of service key is not same. May be higher dubbo version [2.7.x, +] should export two nacos service name( assume the group is empty ): - with ':' suffix , eg: ${interface}:${version}: - noting suffix, eg: ${interface}:${version} ### Anything else _No response_ ### Are you willing to submit a pull request to fix on your own? - [ ] Yes I am willing to submit a pull request on my own! ### Code of Conduct - [X] I agree to follow this project's [Code of Conduct](https://www.apache.org/foundation/policies/conduct) -- 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]
