You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@dubbo.apache.org by "Qiao-yq (via GitHub)" <gi...@apache.org> on 2026/06/04 09:37:18 UTC

[PR] Feat/revision canonical metadata [dubbo-go]

Qiao-yq opened a new pull request, #3370:
URL: https://github.com/apache/dubbo-go/pull/3370

   ### Description
   
   Fixes #3350
   
   ### Summary
   
   Replace the CRC32-based revision calculation with a canonical MD5-based approach aligned with Java dubbo's `MetadataInfo.calAndGetRevision()`.
   
   The existing `resolveRevision` builds revision from a few raw URL fields (`app + path + version + port + method`) and sums CRC32 values — missing `group`, `protocol`, and `params` (`timeout/loadbalance/cluster/serialization`, etc.), with weak collision resistance and no binding to the actual serialized metadata content.
   
   ### Changes
   
   **`metadata/info/metadata_info.go`**  
   Three new methods:
   
   - `ServiceInfo.toDescString()` — deterministic string representation in format `name|group|version|protocol|port|path|params|methods`, with sorted params keys and sorted methods for stable output.
   - `CalRevision(app, services)` — computes MD5 hex digest from `app` concatenated with sorted `ServiceInfo.toDescString()` outputs. Returns `"0"` for empty services (matches Java `EMPTY_REVISION`).
   - `MetadataInfo.CalAndGetRevision()` — updates `info.Revision` in-place from its own canonical services map.
   
   **`registry/servicediscovery/customizer/service_revision_customizer.go`**  
   - `resolveRevision` — rewrites the core logic: instead of CRC32‑summing `app+path+version+port+method`, it converts each URL to a canonical `ServiceInfo` via `NewServiceInfoWithURL`, groups by `MatchKey`, and delegates to `info.CalRevision`.
   - URL source — customizers now obtain URLs from `instance.GetServiceMetadata()` (instance‑scoped) rather than `GetMetadataService().GetExportedServiceURLs()` (global aggregation). Each instance's revision now correctly reflects only its own app's metadata, matching Java's `this.services` semantics.
   
   **`registry/servicediscovery/customizer/service_revision_customizer_test.go` (new)**  
   10 test cases covering: `group`/`protocol`/`params`/`methods`/`version` change detection, deterministic output, empty input, URL ordering independence, param key ordering independence, and non‑`IncludeKeys` filtering.
   
   ### Compatibility
   
   - **Revision algorithm change** is a one‑time switch on upgrade — all providers compute new revision values on first startup.
   - **Provider:** new revision is published to the remote metadata center, naturally overwriting the old entry (revision is the storage key). No manual migration needed.
   - **Consumer:** cached revision no longer matches after provider upgrade → cache miss at remote → transparent fallback to fetching latest `MetadataInfo` from the provider instance directly. Cached under new revision for subsequent calls.
   - **Rolling upgrade:** old providers keep publishing old‑style revisions alongside new ones. Consumer caches both independently. Phases out as old providers are decommissioned.
   - Revision is a cache signal, **not persistent state** — no data migration or config changes required.
   
   ### Checklist
   
   - [x] I confirm the target branch is `develop`
   - [x] Code has passed local testing
   - [x] I have added tests that prove my fix is effective or that my feature works


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [PR] Feat/revision canonical metadata [dubbo-go]

Posted by "AlexStocks (via GitHub)" <gi...@apache.org>.
AlexStocks commented on code in PR #3370:
URL: https://github.com/apache/dubbo-go/pull/3370#discussion_r3385616685


##########
metadata/info/metadata_info.go:
##########
@@ -174,6 +176,15 @@ func (info *MetadataInfo) ReplaceExportedServices(urls []*common.URL) {
 	}
 }
 
+// CalAndGetRevision calculates and updates the revision for this MetadataInfo.
+// The revision is derived from the canonical ServiceInfo representation,
+// ensuring strong binding between revision and serialized metadata content.
+// Aligned with Java dubbo MetadataInfo.calAndGetRevision().
+func (info *MetadataInfo) CalAndGetRevision() string {
+	info.Revision = CalRevision(info.App, info.Services)

Review Comment:
   这是你写的还是 AI 辅助写的 &^_^&



-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [PR] Feat/revision canonical metadata [dubbo-go]

Posted by "Alanxtl (via GitHub)" <gi...@apache.org>.
Alanxtl commented on PR #3370:
URL: https://github.com/apache/dubbo-go/pull/3370#issuecomment-4627723103

   另外pr描述里面改一下 我们没有align with java


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [PR] Feat/revision canonical metadata [dubbo-go]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3370:
URL: https://github.com/apache/dubbo-go/pull/3370#issuecomment-4677898292

   ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3370) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [1 New issue](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3370&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3370&issueStatuses=ACCEPTED)
   
   Measures  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3370&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3370&metric=new_coverage&view=list)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3370&metric=new_duplicated_lines_density&view=list)  
     
   <!-- sqra-placement-anchor -->
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3370)
   
   


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [PR] Feat/revision canonical metadata [dubbo-go]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3370:
URL: https://github.com/apache/dubbo-go/pull/3370#issuecomment-4620903252

   ## [![Quality Gate Failed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-failed-20px.png 'Quality Gate Failed')](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3370) **Quality Gate failed**  
   Failed conditions  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/failed-16px.png '') [1 Security Hotspot](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3370&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
     
   <!-- sqra:qg_revision=199702fe34ec03ae1078a18ddb74899c90e98409e7eac67f5251a2a9886276ca -->
   <!-- sqra-placement-anchor -->
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3370)
   
   


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [PR] Feat/revision canonical metadata [dubbo-go]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3370:
URL: https://github.com/apache/dubbo-go/pull/3370#issuecomment-4631747391

   ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3370) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [1 New issue](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3370&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3370&issueStatuses=ACCEPTED)
   
   Measures  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3370&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3370&metric=new_coverage&view=list)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3370&metric=new_duplicated_lines_density&view=list)  
     
   <!-- sqra-placement-anchor -->
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3370)
   
   


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [PR] Feat/revision canonical metadata [dubbo-go]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3370:
URL: https://github.com/apache/dubbo-go/pull/3370#issuecomment-4628905996

   ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3370) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [1 New issue](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3370&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3370&issueStatuses=ACCEPTED)
   
   Measures  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3370&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3370&metric=new_coverage&view=list)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3370&metric=new_duplicated_lines_density&view=list)  
     
   <!-- sqra-placement-anchor -->
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3370)
   
   


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [PR] Feat/revision canonical metadata [dubbo-go]

Posted by "Alanxtl (via GitHub)" <gi...@apache.org>.
Alanxtl commented on code in PR #3370:
URL: https://github.com/apache/dubbo-go/pull/3370#discussion_r3362634402


##########
metadata/info/metadata_info.go:
##########
@@ -55,9 +55,15 @@ var IncludeKeys = gxset.NewSet(
 	constant.VersionKey,
 	constant.WarmupKey,
 	constant.WeightKey,
-	constant.EnvironmentKey,
 	constant.ReleaseKey)
 
+// EnvironmentKey is intentionally excluded from IncludeKeys because
+// environment is instance-level routing metadata, not service-level.
+// Consumer code in service_instances_changed_listener_impl.go overrides
+// environment from the current instance metadata, so including it in
+// the revision would cause unnecessary revision changes between
+// instances with different environment tags.
+

Review Comment:
   这种一看就是ai生成的comment不用加



-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [PR] Feat/revision canonical metadata [dubbo-go]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3370:
URL: https://github.com/apache/dubbo-go/pull/3370#issuecomment-4638094050

   ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3370) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [1 New issue](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3370&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3370&issueStatuses=ACCEPTED)
   
   Measures  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3370&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3370&metric=new_coverage&view=list)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3370&metric=new_duplicated_lines_density&view=list)  
     
   <!-- sqra-placement-anchor -->
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3370)
   
   


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [PR] Feat/revision canonical metadata [dubbo-go]

Posted by "Qiao-yq (via GitHub)" <gi...@apache.org>.
Qiao-yq commented on code in PR #3370:
URL: https://github.com/apache/dubbo-go/pull/3370#discussion_r3385653326


##########
metadata/info/metadata_info.go:
##########
@@ -174,6 +176,15 @@ func (info *MetadataInfo) ReplaceExportedServices(urls []*common.URL) {
 	}
 }
 
+// CalAndGetRevision calculates and updates the revision for this MetadataInfo.
+// The revision is derived from the canonical ServiceInfo representation,
+// ensuring strong binding between revision and serialized metadata content.
+// Aligned with Java dubbo MetadataInfo.calAndGetRevision().
+func (info *MetadataInfo) CalAndGetRevision() string {
+	info.Revision = CalRevision(info.App, info.Services)

Review Comment:
   这段代码是AI辅助写的,当时我参考了java的接口设计



-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [PR] Feat/revision canonical metadata [dubbo-go]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3370:
URL: https://github.com/apache/dubbo-go/pull/3370#issuecomment-4621881587

   ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3370) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [1 New issue](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3370&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3370&issueStatuses=ACCEPTED)
   
   Measures  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3370&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3370&metric=new_coverage&view=list)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3370&metric=new_duplicated_lines_density&view=list)  
     
   <!-- sqra-placement-anchor -->
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3370)
   
   


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [PR] Feat/revision canonical metadata [dubbo-go]

Posted by "Alanxtl (via GitHub)" <gi...@apache.org>.
Alanxtl commented on code in PR #3370:
URL: https://github.com/apache/dubbo-go/pull/3370#discussion_r3360087883


##########
metadata/info/metadata_info.go:
##########


Review Comment:
   `metadata/info/metadata_info.go:50-59` 的 `IncludeKeys` 里包含 `environment`,PR 新逻辑会把它纳入 revision;但 consumer 侧 `registry/servicediscovery/service_instances_changed_listener_impl.go:181-200` 明确把 environment 当 instance-level routing metadata,用 instance 当前值覆盖,不该依赖 revision cache。这会让 revision 因实例级字段变化而变化,和现有设计注释冲突,最好把 instance-level 字段排除或明确改设计。
   



-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [PR] Feat/revision canonical metadata [dubbo-go]

Posted by "Qiao-yq (via GitHub)" <gi...@apache.org>.
Qiao-yq commented on code in PR #3370:
URL: https://github.com/apache/dubbo-go/pull/3370#discussion_r3385115924


##########
metadata/info/metadata_info.go:
##########
@@ -174,6 +176,15 @@ func (info *MetadataInfo) ReplaceExportedServices(urls []*common.URL) {
 	}
 }
 
+// CalAndGetRevision calculates and updates the revision for this MetadataInfo.
+// The revision is derived from the canonical ServiceInfo representation,
+// ensuring strong binding between revision and serialized metadata content.
+// Aligned with Java dubbo MetadataInfo.calAndGetRevision().
+func (info *MetadataInfo) CalAndGetRevision() string {
+	info.Revision = CalRevision(info.App, info.Services)

Review Comment:
   我确认了一下,这个方法只有测试函数调用,两者都不必要,可以删除方法和对应测试



-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [PR] Feat/revision canonical metadata [dubbo-go]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3370:
URL: https://github.com/apache/dubbo-go/pull/3370#issuecomment-4631655036

   ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3370) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [1 New issue](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3370&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3370&issueStatuses=ACCEPTED)
   
   Measures  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3370&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3370&metric=new_coverage&view=list)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3370&metric=new_duplicated_lines_density&view=list)  
     
   <!-- sqra-placement-anchor -->
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3370)
   
   


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [PR] Feat/revision canonical metadata [dubbo-go]

Posted by "Alanxtl (via GitHub)" <gi...@apache.org>.
Alanxtl commented on PR #3370:
URL: https://github.com/apache/dubbo-go/pull/3370#issuecomment-4655881906

   合并顺序
   
   #3360、#3362 先合,低耦合。
   #3367 作为并发安全底座。
   #3369 合入,建立 registryId/report/cache 作用域。
   #3370 rebase 到 #3367 + #3369 之后,特别检查 revision 计算不要绕开锁。
   #3371 再合,接受 MetadataReport 接口扩展,并补确认 Snapshot() 与 #3367 锁语义一致。
   #3373 最后 rebase,因为它和 #3371 同改 report backends;语义不重复,但文件冲突概率高。


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [PR] Feat/revision canonical metadata [dubbo-go]

Posted by "AlexStocks (via GitHub)" <gi...@apache.org>.
AlexStocks merged PR #3370:
URL: https://github.com/apache/dubbo-go/pull/3370


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [PR] Feat/revision canonical metadata [dubbo-go]

Posted by "codecov-commenter (via GitHub)" <gi...@apache.org>.
codecov-commenter commented on PR #3370:
URL: https://github.com/apache/dubbo-go/pull/3370#issuecomment-4621968540

   ## [Codecov](https://app.codecov.io/gh/apache/dubbo-go/pull/3370?dropdown=coverage&src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) Report
   :x: Patch coverage is `10.60606%` with `59 lines` in your changes missing coverage. Please review.
   :white_check_mark: Project coverage is 52.50%. Comparing base ([`60d1c2a`](https://app.codecov.io/gh/apache/dubbo-go/commit/60d1c2a949f0ee0da4be3fe09fb79d295491e040?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)) to head ([`a279983`](https://app.codecov.io/gh/apache/dubbo-go/commit/a279983ac7bda0ecfbc290f295fd690838547ad1?dropdown=coverage&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache)).
   :warning: Report is 816 commits behind head on develop.
   
   | [Files with missing lines](https://app.codecov.io/gh/apache/dubbo-go/pull/3370?dropdown=coverage&src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) | Patch % | Lines |
   |---|---|---|
   | [metadata/info/metadata\_info.go](https://app.codecov.io/gh/apache/dubbo-go/pull/3370?src=pr&el=tree&filepath=metadata%2Finfo%2Fmetadata_info.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-bWV0YWRhdGEvaW5mby9tZXRhZGF0YV9pbmZvLmdv) | 0.00% | [51 Missing :warning: ](https://app.codecov.io/gh/apache/dubbo-go/pull/3370?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   | [...iscovery/customizer/service\_revision\_customizer.go](https://app.codecov.io/gh/apache/dubbo-go/pull/3370?src=pr&el=tree&filepath=registry%2Fservicediscovery%2Fcustomizer%2Fservice_revision_customizer.go&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache#diff-cmVnaXN0cnkvc2VydmljZWRpc2NvdmVyeS9jdXN0b21pemVyL3NlcnZpY2VfcmV2aXNpb25fY3VzdG9taXplci5nbw==) | 46.66% | [8 Missing :warning: ](https://app.codecov.io/gh/apache/dubbo-go/pull/3370?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache) |
   
   <details><summary>Additional details and impacted files</summary>
   
   
   
   ```diff
   @@             Coverage Diff             @@
   ##           develop    #3370      +/-   ##
   ===========================================
   + Coverage    46.76%   52.50%   +5.74%     
   ===========================================
     Files          295      492     +197     
     Lines        17172    37917   +20745     
   ===========================================
   + Hits          8031    19910   +11879     
   - Misses        8287    16402    +8115     
   - Partials       854     1605     +751     
   ```
   </details>
   
   [:umbrella: View full report in Codecov by Harness](https://app.codecov.io/gh/apache/dubbo-go/pull/3370?dropdown=coverage&src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).   
   :loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=apache).
   <details><summary> :rocket: New features to boost your workflow: </summary>
   
   - :snowflake: [Test Analytics](https://docs.codecov.com/docs/test-analytics): Detect flaky tests, report on failures, and find test suite problems.
   </details>


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [PR] Feat/revision canonical metadata [dubbo-go]

Posted by "Alanxtl (via GitHub)" <gi...@apache.org>.
Alanxtl commented on PR #3370:
URL: https://github.com/apache/dubbo-go/pull/3370#issuecomment-4655858841

   这个 PR 最好 rebase 到 #3367 和 #3369 之后再最终确认。#3367 会给 MetadataInfo.Services 加锁;这里新增的 CalRevision / CalAndGetRevision 不能绕开锁直接读裸 map。合并后建议走 snapshot/GetServices 或等价的锁保护路径。
   
   另外 service_revision_customizer.go 和 #3369 有重叠,最终版本需要同时保留 registryId 作用域和 canonical revision 计算。


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [PR] Feat/revision canonical metadata [dubbo-go]

Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #3370:
URL: https://github.com/apache/dubbo-go/pull/3370#discussion_r3367022950


##########
metadata/info/metadata_info.go:
##########
@@ -174,6 +176,15 @@ func (info *MetadataInfo) ReplaceExportedServices(urls []*common.URL) {
 	}
 }
 
+// CalAndGetRevision calculates and updates the revision for this MetadataInfo.
+// The revision is derived from the canonical ServiceInfo representation,
+// ensuring strong binding between revision and serialized metadata content.
+// Aligned with Java dubbo MetadataInfo.calAndGetRevision().
+func (info *MetadataInfo) CalAndGetRevision() string {

Review Comment:
   CalAndGetRevision is a new public method (on MetadataInfo) but there isn't a unit test asserting that it both (1) updates info.Revision in-place and (2) matches CalRevision() for the same Services/App input. Adding a focused test would help prevent accidental divergence during future refactors of revision logic.



##########
metadata/info/metadata_info.go:
##########
@@ -283,3 +294,90 @@ func (si *ServiceInfo) GetServiceKey() string {
 	si.ServiceKey = common.ServiceKey(si.Name, si.Group, si.Version)
 	return si.ServiceKey
 }
+
+// toDescString returns a deterministic string representation of ServiceInfo
+// for revision calculation. Aligned with Java dubbo ServiceInfo.toDescString().
+//
+// Format: name|group|version|protocol|port|path|params|methods
+//
+// Empty fields use "" as placeholder to keep separator count stable.
+// Params are sorted by key alphabetically, joined as k=v&k=v.
+// The "methods" key is excluded from params and appended separately.
+// Methods are sorted alphabetically and comma-joined.
+// No escaping is performed on param values (aligned with Java behavior).
+func (si *ServiceInfo) toDescString() string {
+	var b strings.Builder
+
+	b.WriteString(si.Name)
+	b.WriteByte('|')
+	b.WriteString(si.Group)
+	b.WriteByte('|')
+	b.WriteString(si.Version)
+	b.WriteByte('|')
+	b.WriteString(si.Protocol)
+	b.WriteByte('|')
+	b.WriteString(strconv.Itoa(si.Port))
+	b.WriteByte('|')
+	b.WriteString(si.Path)
+	b.WriteByte('|')
+
+	// params: sorted keys, exclude methods key
+	keys := make([]string, 0, len(si.Params))
+	for k := range si.Params {
+		if k == constant.MethodsKey {
+			continue
+		}
+		keys = append(keys, k)
+	}
+	sort.Strings(keys)
+	for i, k := range keys {
+		if i > 0 {
+			b.WriteByte('&')
+		}
+		b.WriteString(k)
+		b.WriteByte('=')
+		b.WriteString(si.Params[k])
+	}
+
+	b.WriteByte('|')
+
+	// methods: sorted alphabetically, comma-joined
+	if methodsStr, ok := si.Params[constant.MethodsKey]; ok && len(methodsStr) > 0 {
+		methods := strings.Split(methodsStr, ",")
+		sort.Strings(methods)
+		for i, m := range methods {
+			if i > 0 {
+				b.WriteByte(',')
+			}
+			b.WriteString(m)
+		}
+	}
+
+	return b.String()
+}
+
+// CalRevision calculates a deterministic revision string from canonical ServiceInfo objects.
+// Returns "0" if services is empty (aligned with Java EMPTY_REVISION).
+// Services are sorted by matchKey before serialization to ensure deterministic output.
+// The revision is a SHA-512 hex digest of: app + sorted toDescString of each ServiceInfo.
+func CalRevision(app string, services map[string]*ServiceInfo) string {
+	if len(services) == 0 {
+		return "0"
+	}
+
+	// collect and sort matchKeys for deterministic iteration
+	matchKeys := make([]string, 0, len(services))
+	for mk := range services {
+		matchKeys = append(matchKeys, mk)
+	}
+	sort.Strings(matchKeys)
+
+	var b strings.Builder
+	b.WriteString(app)
+	for _, mk := range matchKeys {
+		b.WriteString(services[mk].toDescString())
+	}
+
+	sum := sha512.Sum512([]byte(b.String()))
+	return fmt.Sprintf("%x", sum)

Review Comment:
   CalRevision currently concatenates the full canonical metadata into a single in-memory string and then hashes it. For large applications (many services / many params), this does extra allocations proportional to total metadata size; you can hash incrementally instead (same output, lower memory).



-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [PR] Feat/revision canonical metadata [dubbo-go]

Posted by "AlexStocks (via GitHub)" <gi...@apache.org>.
AlexStocks commented on code in PR #3370:
URL: https://github.com/apache/dubbo-go/pull/3370#discussion_r3384849905


##########
metadata/info/metadata_info.go:
##########
@@ -174,6 +176,15 @@ func (info *MetadataInfo) ReplaceExportedServices(urls []*common.URL) {
 	}
 }
 
+// CalAndGetRevision calculates and updates the revision for this MetadataInfo.
+// The revision is derived from the canonical ServiceInfo representation,
+// ensuring strong binding between revision and serialized metadata content.
+// Aligned with Java dubbo MetadataInfo.calAndGetRevision().
+func (info *MetadataInfo) CalAndGetRevision() string {
+	info.Revision = CalRevision(info.App, info.Services)

Review Comment:
   可以写成一行直接return



-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org


Re: [PR] Feat/revision canonical metadata [dubbo-go]

Posted by "sonarqubecloud[bot] (via GitHub)" <gi...@apache.org>.
sonarqubecloud[bot] commented on PR #3370:
URL: https://github.com/apache/dubbo-go/pull/3370#issuecomment-4680083883

   ## [![Quality Gate Passed](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/checks/QualityGateBadge/qg-passed-20px.png 'Quality Gate Passed')](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3370) **Quality Gate passed**  
   Issues  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [1 New issue](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3370&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/accepted-16px.png '') [0 Accepted issues](https://sonarcloud.io/project/issues?id=apache_dubbo-go&pullRequest=3370&issueStatuses=ACCEPTED)
   
   Measures  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0 Security Hotspots](https://sonarcloud.io/project/security_hotspots?id=apache_dubbo-go&pullRequest=3370&issueStatuses=OPEN,CONFIRMED&sinceLeakPeriod=true)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Coverage on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3370&metric=new_coverage&view=list)  
   ![](https://sonarsource.github.io/sonarcloud-github-static-resources/v2/common/passed-16px.png '') [0.0% Duplication on New Code](https://sonarcloud.io/component_measures?id=apache_dubbo-go&pullRequest=3370&metric=new_duplicated_lines_density&view=list)  
     
   <!-- sqra-placement-anchor -->
   [See analysis details on SonarQube Cloud](https://sonarcloud.io/dashboard?id=apache_dubbo-go&pullRequest=3370)
   
   


-- 
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: notifications-unsubscribe@dubbo.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: notifications-unsubscribe@dubbo.apache.org
For additional commands, e-mail: notifications-help@dubbo.apache.org