AlbumenJ commented on a change in pull request #9577:
URL: https://github.com/apache/dubbo/pull/9577#discussion_r800124568



##########
File path: 
dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/migration/MigrationInvoker.java
##########
@@ -334,15 +335,23 @@ public void destroy() {
 
     @Override
     public URL getUrl() {
+        URL getUrl;
         if (currentAvailableInvoker != null) {
-            return currentAvailableInvoker.getUrl();
+            getUrl = currentAvailableInvoker.getUrl();
         } else if (invoker != null) {
-            return invoker.getUrl();
+            getUrl = invoker.getUrl();
         } else if (serviceDiscoveryInvoker != null) {
-            return serviceDiscoveryInvoker.getUrl();
+            getUrl = serviceDiscoveryInvoker.getUrl();
+        } else {
+            getUrl = consumerUrl;
         }
 
-        return consumerUrl;
+        // set parameter weight if needed.
+        if (getUrl != null && getUrl.getUrlParam() != null && 
StringUtils.isEmpty(getUrl.getParameter(WEIGHT_KEY))
+                && url != null && url.getUrlParam() != null && 
!StringUtils.isEmpty(url.getParameter(WEIGHT_KEY))) {
+            getUrl = getUrl.addParameter(WEIGHT_KEY, 
url.getParameter(WEIGHT_KEY));
+        }
+        return getUrl;

Review comment:
       I think it would be more proper to move these to somewhere real registry 
invoker created.

##########
File path: 
dubbo-cluster/src/main/java/org/apache/dubbo/rpc/cluster/loadbalance/AbstractLoadBalance.java
##########
@@ -75,22 +73,17 @@ static int calculateWarmupWeight(int uptime, int warmup, 
int weight) {
     protected int getWeight(Invoker<?> invoker, Invocation invocation) {
         int weight;
         URL url = invoker.getUrl();
-        // Multiple registry scenario, load balance among multiple registries.
-        if (REGISTRY_SERVICE_REFERENCE_PATH.equals(url.getServiceInterface())) 
{

Review comment:
       `REGISTRY_KEY + "." + WEIGHT_KEY` needs to be reserved.
   Registry's weight is not equals with provider's weight. Also, registry's 
weight should no override provider's weight.




-- 
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]

Reply via email to