In my last couple of projects, I have heavily used zookeeper watches. However, ZK watch is a one time event.

I strongly feel that zookeeper should have a way to set a watch permanently (unless removed by the user through an API or the znode is deleted). This would guarantee that no data change event is missed by the client. Otherwise, we can miss data change event that occurs between receiving the call back from previous watch and resetting the new watch again. This problem is also stated in documentation.

I am sure even others might have felt this need sometime or the other. This missing capability makes ZK watcher functionality best effort and not full proof. Consequently, clients who can not afford to miss any event, can not use ZooKeeper reliably.

I think we should have these APIs unless there is some theoretical or practical problem with these.

1. API to set a watch permanently. 2. Removing a watch when not needed. Looking forward for a discussion.ThanksMudit

I don’t think your solution will work. For example, somebody might change the data between you reading the data again for comparision and you setting the watch. You just can not gaurantee no operation will occur between reading and setting the watch, unless you use transactions (so that reading and setting the watch both go atomically).

Also, in your solution, I will have to keep the previous data for all znodes (where I want watches). That’s like replicated everything locally as well.