AsperforMias opened a new pull request, #3798:
URL: https://github.com/apache/dubbo-go/pull/3798

   ### Description
   Fixes #3797
   
   **Merge order:** please merge after #3796. The two PRs touch no common files 
and apply cleanly in either order, so the order is not needed for correctness. 
Without #3796, ZooKeeper still receives definitions for Dubbo and non-IDL 
Triple services, but Triple IDL services only appear in Admin once both are 
merged.
   
   **What changes**
   - `metadata/report/zookeeper/report.go`: `zookeeperMetadataReport` now 
implements `report.ServiceDefinitionPublisher`. `DelegateMetadataReport` 
discovers it through the existing type assertion, the same way it discovers the 
Nacos report, so no call site changes.
   - `metadata/report_instance.go` (comment only): the comment that listed 
ZooKeeper as a backend without this capability is updated.
   
   **Design choices**
   - *Path layout.* The node path is the one Admin parses, with `provider` as 
the second-to-last segment. An empty version or group is omitted instead of 
written as an empty segment, which would not match what Admin and Java expect. 
If the configured root already ends in `/metadata`, it is not appended twice. 
The interface name is escaped the way Java's report does it, so a definition 
written by Go and one written by Java for the same interface land on the same 
node.
   - *Overwrite semantics.* The report creates the node and, if it already 
exists, overwrites it with version `-1` (last writer wins). A definition is 
derived deterministically from the interface and application, so every instance 
of an app writes identical content. A compare-and-set on the node version would 
add retries without changing the result. Any other ZooKeeper error is returned 
to the caller rather than swallowed.
   - *Scope.* Only ZooKeeper is added. etcd has the same gap and is left for a 
follow-up to keep this change small.
   
   ### Checklist
   - [ ] I confirm the target branch is `develop`
   - [x] I have run `make fmt` to format my code
   - [x] I have run `make test` to run local tests
   - [x] I have added tests that prove my fix is effective or that my feature 
works
   
   Tests: `TestPublishServiceDefinition` covers 9 path cases (empty 
version/group, root already ending in `/metadata`, escaping). 
`TestPublishServiceDefinitionUpdateAndErrors` covers overwrite and error 
propagation. `TestPublishServiceDefinitionLiveZooKeeper` runs against a real 
ZooKeeper when `DUBBO_GO_METADATA_ZK` is set. End to end, Admin showed the 
service list and method detail of an IDL sample registered through ZooKeeper 
with this change on top of #3796.
   


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