python-zk / kazoo

Kazoo is a high-level Python library that makes it easier to use Apache Zookeeper.
https://kazoo.readthedocs.io
Apache License 2.0
1.3k stars 387 forks source link

recursive delete failed #608

Closed Laurel-rao closed 4 years ago

Laurel-rao commented 4 years ago

微信图片_20200508182314 why i used the recursive, it still raise NotEmptyError

ceache commented 4 years ago

Hi,

Please provide the version of Kazoo you are using when you are encountering this issue.

Also, is the environment you are using "live" i.e. could other users, program or threads be modifying Zookeeper while you are running?

If so, it could be that someone created a child node in one of the path you are trying to delete. In a distributed system you have to handle these situations in your client code either by retrying or using some coordination (locks)

Laurel-rao commented 4 years ago

yes, i found the problem that i try to delete a node while other thread added a new child node. But zookeeper-cli has ‘rmr’, then why you guys didn't use rmr .

ceache commented 4 years ago

This is expected.

You are supposed to handle it. Either use locks to ensure no other thread is using that node or handle the exception and retry. It is up to you to choose what best fits your use case.

On Sat, May 9, 2020, 03:07 Laurel-rao notifications@github.com wrote:

Reopened #608 https://github.com/python-zk/kazoo/issues/608.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/python-zk/kazoo/issues/608#event-3319083948, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAIFTHTNB2LX56SXZ4JKVJTRQT6JRANCNFSM4M4CBQGQ .