You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@dubbo.apache.org by li...@apache.org on 2021/11/05 06:13:17 UTC

[dubbo] branch 3.0-migration-logs created (now dd9cfcb)

This is an automated email from the ASF dual-hosted git repository.

liujun pushed a change to branch 3.0-migration-logs
in repository https://gitbox.apache.org/repos/asf/dubbo.git.


      at dd9cfcb  enhance logs

This branch includes the following new commits:

     new dd9cfcb  enhance logs

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


[dubbo] 01/01: enhance logs

Posted by li...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

liujun pushed a commit to branch 3.0-migration-logs
in repository https://gitbox.apache.org/repos/asf/dubbo.git

commit dd9cfcbb78b46509e98563fcad78a0cbdb5d29b6
Author: ken.lj <ke...@gmail.com>
AuthorDate: Fri Nov 5 14:12:59 2021 +0800

    enhance logs
---
 .../migration/DefaultMigrationAddressComparator.java | 20 ++++++++++++++------
 1 file changed, 14 insertions(+), 6 deletions(-)

diff --git a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/migration/DefaultMigrationAddressComparator.java b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/migration/DefaultMigrationAddressComparator.java
index 9daf71d..40a5d78 100644
--- a/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/migration/DefaultMigrationAddressComparator.java
+++ b/dubbo-registry/dubbo-registry-api/src/main/java/org/apache/dubbo/registry/client/migration/DefaultMigrationAddressComparator.java
@@ -47,13 +47,13 @@ public class DefaultMigrationAddressComparator implements MigrationAddressCompar
         if (!newInvoker.hasProxyInvokers()) {
             migrationData.put(OLD_ADDRESS_SIZE, getAddressSize(oldInvoker));
             migrationData.put(NEW_ADDRESS_SIZE, -1);
-            logger.info("No instance address available, stop compare.");
+            logger.info("No " + getInvokerType(newInvoker) + " address available, stop compare.");
             return false;
         }
         if (!oldInvoker.hasProxyInvokers()) {
             migrationData.put(OLD_ADDRESS_SIZE, -1);
             migrationData.put(NEW_ADDRESS_SIZE, getAddressSize(newInvoker));
-            logger.info("No interface address available, stop compare.");
+            logger.info("No " + getInvokerType(oldInvoker) + " address available, stop compare.");
             return true;
         }
 
@@ -64,11 +64,11 @@ public class DefaultMigrationAddressComparator implements MigrationAddressCompar
         migrationData.put(NEW_ADDRESS_SIZE, newAddressSize);
 
         String rawThreshold = null;
-        Float configuredThreshold = rule == null ? null : rule.getThreshold(oldInvoker.getUrl());
-        if (configuredThreshold != null && configuredThreshold >= 0) {
-            rawThreshold = String.valueOf(configuredThreshold);
+        Float configedThreshold = rule == null ? null : rule.getThreshold(oldInvoker.getUrl());
+        if (configedThreshold != null && configedThreshold >= 0) {
+            rawThreshold = String.valueOf(configedThreshold);
         }
-        rawThreshold = StringUtils.isNotEmpty(rawThreshold) ? rawThreshold : ConfigurationUtils.getCachedDynamicProperty(newInvoker.getUrl().getScopeModel(), MIGRATION_THRESHOLD, DEFAULT_THRESHOLD_STRING);
+        rawThreshold = StringUtils.isNotEmpty(rawThreshold) ? rawThreshold : ConfigurationUtils.getCachedDynamicProperty(MIGRATION_THRESHOLD, DEFAULT_THRESHOLD_STRING);
         float threshold;
         try {
             threshold = Float.parseFloat(rawThreshold);
@@ -104,4 +104,12 @@ public class DefaultMigrationAddressComparator implements MigrationAddressCompar
         return serviceMigrationData.get(displayServiceKey);
     }
 
+    private String getInvokerType(ClusterInvoker<?> invoker) {
+        if (invoker.isServiceDiscovery()) {
+            return "instance";
+        }
+        return "interface";
+    }
+
+
 }