AlexStocks commented on code in PR #930:
URL: https://github.com/apache/dubbo-go-pixiu/pull/930#discussion_r3254210330


##########
pkg/adapter/llmregistry/registry/nacos/listener.go:
##########
@@ -316,10 +312,21 @@ func generateEndpoint(instance nacosModel.Instance) 
*model.Endpoint {
        }
 
        ret.Metadata = instance.Metadata
+       ret.ID = nacosEndpointID(instance, ret)
 
        return ret
 }
 
+func nacosEndpointID(instance nacosModel.Instance, endpoint *model.Endpoint) 
string {
+       if id := strings.TrimSpace(instance.Metadata["id"]); id != "" {
+               return id
+       }
+       if instanceID := strings.TrimSpace(instance.InstanceId); instanceID != 
"" {
+               return instanceID
+       }
+       return model.GenerateEndpointID(instance.Metadata["cluster"], endpoint)

Review Comment:
   [P1] 这个 tier-3 fallback 只取 `metadata["cluster"]`,但 `generateInstance()` 已经把 
Nacos 原生的 `ClusterName` 带进 `instance` 了。若 registry 没把 cluster 再复制到 metadata,同时 
`InstanceId` 也为空,不同 cluster、相同 address/credential 的实例会生成同一个 
`endpoint.ID`,端点会被错误合并。建议这里至少回退到 `instance.ClusterName`,并补一条“metadata 不含 
cluster,但 ClusterName 不同”的回归测试。



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