You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am sure that all the content I provide is in English.
Search before asking
I had searched in the issues and found no similar issues.
Apache Dubbo Component
Java SDK (apache/dubbo)
Dubbo Version
dubbo3.2.12 , jdk17
Steps to reproduce this issue
We have a Dubbo 3.2 service provider that is also a Dubbo Consumer. With application-level Service Discovery enabled, the same registryId creates two ServiceDiscoveryRegistry after ServiceConfig #doExportUrl and RefrenceConfig#refer.
I created a reproducible Dubbo application, the configuration of application-level Service Discovery is as follows:
Our application supports dynamically adjusting instance weights, warm-up duration, and other service discovery metadata through the Http Endpoint runtime.
When the instance metadata changes, it triggers instance re-registration or update. In the underlying implementation, all discovery registries are obtained through RegistryManager#getServiceDiscoveries and its API is called.
Now the same registryId creates two ServiceDiscoveryRegistry, which means that we need to update the metadata once and send two requests to the same service discovery registry.
ServiceDiscoveryRegistry created twice because ServiceDiscoveryRegistryFactory registry cache key contains the full url parameter.
However, when using ReferenceConfig#createInvoker, there is no parameter register = false in the Registry URL, resulting in two cache keys.
What you expected to happen
Is it possible to adjust the registry cache key to the following code to ensure that the same registryId always returns the same ServiceDiscoveryRegistry?
protectedStringcreateRegistryCacheKey(URLurl) {
StringregistryCluster=url.getParameter(RegistryConstants.REGISTRY_CLUSTER_KEY);
if (StringUtils.hasText(registryCluster)){
returnregistryCluster;
}
returnurl.toFullString();
}
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!
Pre-check
Search before asking
Apache Dubbo Component
Java SDK (apache/dubbo)
Dubbo Version
dubbo3.2.12 , jdk17
Steps to reproduce this issue
We have a Dubbo 3.2 service provider that is also a Dubbo Consumer. With application-level Service Discovery enabled, the same registryId creates two ServiceDiscoveryRegistry after ServiceConfig #doExportUrl and RefrenceConfig#refer.
I created a reproducible Dubbo application, the configuration of application-level Service Discovery is as follows:
Our application supports dynamically adjusting instance weights, warm-up duration, and other service discovery metadata through the Http Endpoint runtime.
When the instance metadata changes, it triggers instance re-registration or update. In the underlying implementation, all discovery registries are obtained through RegistryManager#getServiceDiscoveries and its API is called.
Now the same registryId creates two ServiceDiscoveryRegistry, which means that we need to update the metadata once and send two requests to the same service discovery registry.
ServiceDiscoveryRegistry created twice because ServiceDiscoveryRegistryFactory registry cache key contains the full url parameter.
When ServiceConfig exports the service, it adds a URL parameter register = false.
However, when using ReferenceConfig#createInvoker, there is no parameter register = false in the Registry URL, resulting in two cache keys.
What you expected to happen
Is it possible to adjust the registry cache key to the following code to ensure that the same registryId always returns the same ServiceDiscoveryRegistry?
Anything else
No response
Are you willing to submit a pull request to fix on your own?
Code of Conduct
The text was updated successfully, but these errors were encountered: