Repository: apache/dubbo (Java)
Date: 2019-05-27 02:22:58+00:00
Task type: Bug Fix

Issue:
[Bug]Metadata Store Key was changed so that it is not compatible with 2.7.1
Metadata Store Key was changed so that it is not compatible with 2.7.1.

The code is in org.apache.dubbo.metadata.identifier.MetadataIdentifier


Issue discussion:
I am working on the fix.

Solution patch:
diff --git a/dubbo-metadata-report/dubbo-metadata-report-api/src/main/java/org/apache/dubbo/metadata/identifier/MetadataIdentifier.java b/dubbo-metadata-report/dubbo-metadata-report-api/src/main/java/org/apache/dubbo/metadata/identifier/MetadataIdentifier.java
--- a/dubbo-metadata-report/dubbo-metadata-report-api/src/main/java/org/apache/dubbo/metadata/identifier/MetadataIdentifier.java
+++ b/dubbo-metadata-report/dubbo-metadata-report-api/src/main/java/org/apache/dubbo/metadata/identifier/MetadataIdentifier.java
@@ -61,9 +61,9 @@ public MetadataIdentifier(URL url) {
 
     public String getUniqueKey(KeyTypeEnum keyType) {
         if (keyType == KeyTypeEnum.PATH) {
-            return getFilePathKey() + PATH_SEPARATOR + DEFAULT_PATH_TAG;
+            return getFilePathKey();
         }
-        return getIdentifierKey() + META_DATA_STORE_TAG;
+        return getIdentifierKey();
     }
 
     public String getIdentifierKey() {


Test patch:
diff --git a/dubbo-metadata-report/dubbo-metadata-report-api/src/test/java/org/apache/dubbo/metadata/identifier/MetadataIdentifierTest.java b/dubbo-metadata-report/dubbo-metadata-report-api/src/test/java/org/apache/dubbo/metadata/identifier/MetadataIdentifierTest.java
--- a/dubbo-metadata-report/dubbo-metadata-report-api/src/test/java/org/apache/dubbo/metadata/identifier/MetadataIdentifierTest.java
+++ b/dubbo-metadata-report/dubbo-metadata-report-api/src/test/java/org/apache/dubbo/metadata/identifier/MetadataIdentifierTest.java
@@ -35,17 +35,15 @@ public void testGetUniqueKey() {
         String group = null;
         String application = "vic.zk.md";
         MetadataIdentifier providerMetadataIdentifier = new MetadataIdentifier(interfaceName, version, group, PROVIDER_SIDE, application);
-        System.out.println(providerMetadataIdentifier.getUniqueKey(MetadataIdentifier.KeyTypeEnum.PATH));
         Assertions.assertEquals(providerMetadataIdentifier.getUniqueKey(MetadataIdentifier.KeyTypeEnum.PATH),
                 "metadata" + PATH_SEPARATOR + interfaceName + PATH_SEPARATOR +
                         (version == null ? "" : (version + PATH_SEPARATOR))
                 + (group == null ? "" : (group + PATH_SEPARATOR)) + PROVIDER_SIDE
-                        + PATH_SEPARATOR + application + PATH_SEPARATOR + "metadata");
-        System.out.println(providerMetadataIdentifier.getUniqueKey(MetadataIdentifier.KeyTypeEnum.UNIQUE_KEY));
+                        + PATH_SEPARATOR + application);
         Assertions.assertEquals(providerMetadataIdentifier.getUniqueKey(MetadataIdentifier.KeyTypeEnum.UNIQUE_KEY),
                 interfaceName + MetadataIdentifier.SEPARATOR +
                         (version == null ? "" : version + MetadataIdentifier.SEPARATOR)
                         + (group == null ? "" : group + MetadataIdentifier.SEPARATOR)
-                        + PROVIDER_SIDE + MetadataIdentifier.SEPARATOR + application + META_DATA_STORE_TAG);
+                        + PROVIDER_SIDE + MetadataIdentifier.SEPARATOR + application);
     }
 }