Skip to content
Permalink
Browse files
Add 'timestamp' as the default key of the instance url (#10022)
  • Loading branch information
chickenlj committed May 10, 2022
1 parent b4bc7aa commit c1c9aa80f51cf1aa2b50989014387c2151bbd653
Showing 2 changed files with 4 additions and 3 deletions.
@@ -37,9 +37,9 @@ public class DefaultMetadataParamsFilter implements MetadataParamsFilter {
private final String[] includedInstanceParams;

public DefaultMetadataParamsFilter() {
this.includedInstanceParams = new String[]{HEARTBEAT_TIMEOUT_KEY};
this.includedInstanceParams = new String[]{HEARTBEAT_TIMEOUT_KEY, TIMESTAMP_KEY};
this.excludedServiceParams = new String[]{MONITOR_KEY, BIND_IP_KEY, BIND_PORT_KEY, QOS_ENABLE,
QOS_HOST, QOS_PORT, ACCEPT_FOREIGN_IP, VALIDATION_KEY, INTERFACES, PID_KEY, TIMESTAMP_KEY};
QOS_HOST, QOS_PORT, ACCEPT_FOREIGN_IP, VALIDATION_KEY, INTERFACES, PID_KEY, TIMESTAMP_KEY, HEARTBEAT_TIMEOUT_KEY};
}

@Override
@@ -47,6 +47,7 @@
import static org.apache.dubbo.common.constants.CommonConstants.DOT_SEPARATOR;
import static org.apache.dubbo.common.constants.CommonConstants.GROUP_CHAR_SEPARATOR;
import static org.apache.dubbo.common.constants.CommonConstants.METHODS_KEY;
import static org.apache.dubbo.common.constants.CommonConstants.TIMESTAMP_KEY;
import static org.apache.dubbo.metadata.RevisionResolver.EMPTY_REVISION;

public class MetadataInfo implements Serializable {
@@ -394,7 +395,7 @@ private void extractInstanceParams(URL url, List<MetadataParamsFilter> filters)

tmpInstanceParams.forEach((key, value) -> {
String oldValue = instanceParams.put(key, value);
if (oldValue != null && !oldValue.equals(value)) {
if (!TIMESTAMP_KEY.equals(key) && oldValue != null && !oldValue.equals(value)) {
throw new IllegalStateException(String.format("Inconsistent instance metadata found in different services: %s, %s", oldValue, value));
}
});

0 comments on commit c1c9aa8

Please sign in to comment.