xiaobaicai66695 commented on issue #1625: URL: https://github.com/apache/dubbo-admin/issues/1625#issuecomment-6878865629
@robocanic 结论是3.2 和 3.3版本的zk写入路径是一致的,以下是原因
目前dubbo官网上显示的是dubbo 3.3的版本,zk的路径是/dubbo/config/{groupId}/{具体的流量治理的规则名}
<img width="1424" height="982" alt="image"
src="https://github.com/user-attachments/assets/ddacff0c-388b-4854-897f-eb451e239cc0"
/>
在github 中dubbo 3.2版本下,
3.2.0 源码分三步拼接:
1. [第 147–158
行](https://github.com/apache/dubbo/blob/dubbo-3.2.0/dubbo-common/src/main/java/org/apache/dubbo/common/config/configcenter/TreePathDynamicConfiguration.java#L147-L158)
用 "/" + namespace + basePath 生成根路径;basePath 的默认值在[第 57
行](https://github.com/apache/dubbo/blob/dubbo-3.2.0/dubbo-common/src/main/java/org/apache/dubbo/common/config/configcenter/TreePathDynamicConfiguration.java#L57)是
/config,namespace 默认是 dubbo,所以得到 /dubbo/config。
2. [第 118–123
行](https://github.com/apache/dubbo/blob/dubbo-3.2.0/dubbo-common/src/main/java/org/apache/dubbo/common/config/configcenter/TreePathDynamicConfiguration.java#L118-L123)
依次把 group、key 接到根路径后;[buildPath 用 /
连接各段](https://github.com/apache/dubbo/blob/dubbo-3.2.0/dubbo-common/src/main/java/org/apache/dubbo/common/utils/PathUtils.java#L36-L44)。
3. [第 83–85
行](https://github.com/apache/dubbo/blob/dubbo-3.2.0/dubbo-common/src/main/java/org/apache/dubbo/common/config/configcenter/TreePathDynamicConfiguration.java#L83-L85)
把拼好的路径交给写入方法,Zookeeper
实现在[这里](https://github.com/apache/dubbo/blob/dubbo-3.2.0/dubbo-configcenter/dubbo-configcenter-zookeeper/src/main/java/org/apache/dubbo/configcenter/support/zookeeper/ZookeeperDynamicConfiguration.java#L107-L110)调用
createOrUpdate。
因此,当传入的 group 是 dubbo([默认 group
定义](https://github.com/apache/dubbo/blob/dubbo-3.2.0/dubbo-common/src/main/java/org/apache/dubbo/common/config/configcenter/DynamicConfiguration.java#L39))、key
是 demo.tag-router 时,结果才是 /dubbo/config/dubbo/demo.tag-router。这个文件负责拼路径;
--
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]
