Hello Xiangying, This indeed is a cumbersome task to delete a filled namespace or tenant. We face this challenge in our organization where we use the multi-tenancy feature of pulsar heavily.
I would like to suggest a different command to do this though.. Similar to how you cannot delete a topic without deleting its subscribers/producers/consumers, unless we use the `boolean force` flag. Why not extend this to namespace and tenant as well and let the force param do the cleanup (which your suggested `clear` command would do). As of today, using force to delete a namespace just returns 405 saying broker doesn't allow force delete of namespace containing topics. Any thoughts? On Sat, Apr 15, 2023 at 3:07 PM Xiangying Meng <xiangy...@apache.org> wrote: > Dear Apache Pulsar Community, > > I hope this email finds you well.I am writing to suggest a potential > improvement to the Pulsar-admin tool, > which I believe could simplify the process of cleaning up tenants and > namespaces in Apache Pulsar. > > Currently, cleaning up all the namespaces and topics within a tenant or > cleaning up all the topics within a namespace requires several manual > steps, > such as listing the namespaces, listing the topics, and then deleting each > topic individually. > This process can be time-consuming and error-prone for users. > > To address this issue, I propose the addition of a "clear" parameter to the > Pulsar-admin tool, > which would automate the cleanup process for tenants and namespaces. Here's > a conceptual implementation: > > 1. To clean up all namespaces and topics within a tenant: > ``` bash > pulsar-admin tenants clear <tenant-name> > ``` > 2. To clean up all topics within a namespace: > ```bash > pulsar-admin namespaces clear <tenant-name>/<namespace-name> > ``` > > By implementing these new parameters, users would be able to perform > cleanup operations more efficiently and with fewer manual steps. > I believe this improvement would greatly enhance the user experience when > working with Apache Pulsar. > > I'd like to discuss the feasibility of this suggestion and gather feedback > from the community. > If everyone agrees, I can work on implementing this feature and submit a > pull request for review. > > Looking forward to hearing your thoughts on this. > > Best regards, > Xiangying > -- Girish Sharma