DataWatch allow_missing_node=True fails after seeing a deletion #58

Closed
eestolano opened this Issue Mar 7, 2013 · 1 comment

Projects

None yet

2 participants

@eestolano

If I create a DataWatch with allow_missing_node=True on a nonexistent node, then create and delete the node once, it works fine; but if I create the node yet again, the watch is not triggered.

Code:

#!/usr/bin/env python                                                                                                                                                                                                                                                                                                         

import time

from kazoo.client import KazooClient
from kazoo.recipe.watchers import DataWatch

client = KazooClient("localhost:2181")
client.start()

path = '/foo'
data = 'DATA'

@client.DataWatch(path, allow_missing_node=True)
def dwatch(data, stat):
    print data, stat

# The watch sees these...                                                                                                                                                                                                                                                                                                     
client.create(path, data)
time.sleep(1)
client.delete(path)

# then doesn't see these                                                                                                                                                                                                                                                                                                      
time.sleep(1)
client.create(path, data)
time.sleep(1)
client.delete(path)

Output:

None None
DATA2 ZnodeStat(czxid=193, mzxid=193, ctime=1362687003891, mtime=1362687003891, version=0, cversion=0, aversion=0, ephemeralOwner=0, dataLength=5, numChildren=0, pzxid=193)
None None
@bbangert
Python Zookeeper High-Level Libraries member

Found the problem, upon node deletion it wasn't accurately tracking that there was no longer prior data, so it would fail to properly handle the creation and re-register.

@bbangert bbangert added a commit that referenced this issue Apr 28, 2013
@bbangert bbangert Fixes Issue #58.
Datawatcher properly re-registers after multiple delete/create.
We also enforce some basic retry settings to avoid endless waits in testing.
318f073
@bbangert bbangert closed this Apr 28, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment