wolfstudy opened a new issue #12710:
URL: https://github.com/apache/pulsar/issues/12710


   **Describe the bug**
   
   Currently, when we run namespace or tenant delete command, we will not 
delete the corresponding znode node in zk. 
   
   For example:
   
   
![image](https://user-images.githubusercontent.com/20965307/141059668-6a21afe9-e137-4d55-8a6d-0582f1efa25b.png)
   
   When we run namespace and tenant delete cmd, and the `/namespace` znode 
still contains the znode information of the tenant and ns originally created. 
This will cause all the created tenant and ns resource information to be stored 
in the zk cluster, which will eventually reduce the overall external service 
capability of the zk cluster until it collapses.
   
   We have monitored the number of znode nodes in zk, which also confirms this 
phenomenon. The number of znodes has been increasing linearly, and in version 
272, the znodes in the `manager-ledgers` and `namespace` will never be 
released, even if these resources have been removed from the cluster. 
   
   
![image](https://user-images.githubusercontent.com/20965307/141059978-514793f7-028b-4231-a078-930f69b9959f.png)
   
   
   **To Reproduce**
   Steps to reproduce the behavior:
   1. Build the nar from master
   
   ```
   mvn clean install -DskipTests
   ```
   2. start standalone
   
   ```
   bin/pulsar standalone -nss -nfw
   ```
   
   3. create resource
   
   ```
   bin/pulsar-admin tenants create test2
   bin/pulsar-admin namespaces create test2/ns-2
   bin/pulsar-admin topics create test2/ns-2/topic-2
   ```
   
   then send message to topic
   
   ```
   bin/pulsar-client produce -m "test-messages-`date`" -n 999 test2/ns-2/topic-2
   ```
   
   4. login zk-shell
   
   ```
   bin/pulsar zookeeper-shell -server localhost:2181
   ```
   
   5. get namespace and admin/policies znode
   
   ```
   [zk: localhost:2181(CONNECTED) 3] ls /namespace
   [pulsar, test2]
   
   [zk: localhost:2181(CONNECTED) 5] ls /admin/policies
   [public, pulsar, sample, test2]
   ```
   
   6. delete resource
   
   ```
   bin/pulsar-admin topics delete test2/ns-2/topic-2
   bin/pulsar-admin namespaces delete test2/ns-2
   bin/pulsar-admin tenants delete test2
   ```
   
   7. get namespace and admin/policies znode again
   
   ```
   [zk: localhost:2181(CONNECTED) 3] ls /namespace
   [pulsar, test2]
   
   [zk: localhost:2181(CONNECTED) 5] ls /admin/policies
   [public, pulsar, sample]
   ```
   
   **Expected behavior**
   
   When we delete ns and tenant resource, we should delete znode from zk.
   
   **Screenshots**
   If applicable, add screenshots to help explain your problem.
   
   **Desktop (please complete the following information):**
    - OS: Master
   
   


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


Reply via email to