ZooKeeper does not guarantee that you will get every event. There are myriad 
ways that a client can miss events. If you are writing an application that 
depends on getting every event then ZooKeeper is not a good solution for you.

In your example, are the create of "/test1" and the delete of "/test1" done by 
the same client? Is the PathChildrenCache started when the create of "/test1" 
is done? I can envision this scenario:

* At T1 PathChildrenCache is started
* At T2 your test code creates "/test1"
* At T3 PathChildrenCache's watcher gets the called
* At T4 your test code deletes "/test1"
* At T5 PathChildrenCache tries to read "/test1" and it's no longer there so it 
ignores it - no events are reported

-Jordan

> On Nov 10, 2017, at 11:57 PM, Jihoon Son <jihoon...@apache.org> wrote:
> 
> Hi,
> 
> I'm using Curator 4.0.0 and Curator-testing 2.12.0 for the Zookeeper 
> compatibility.
> 
> Recently, one of our unit tests keeps failing, and I found an weird case 
> while looking into it. The unit test essentially does followings.
> 
> - Makes a PathChildrenCache for '/' and writes something on a '/test1' in 
> background. The PathChildrenCache has an event listener for the 
> 'CHILD_REMOVED' event.
> - Deletes '/test1' transactionally.
> - Expects PathChildrenCache does something on 'CHILD_REMOVED' event.
> 
> This test works well in local, but mostly fails on travis. The problems is, 
> if the delete in the second step is performed before the actual write on 
> '/test1' is done in the first step, PathChildrenCache never receives the 
> 'CHILD_REMOVED' event. 
> 
> I'm not sure this is a bug or not. Is there any way to guarantee for 
> PathChildrenCache to receive 'CHILD_REMOVED' event properly?
> 
> Thanks,
> Jihoon

Reply via email to