curator-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Benjamin Jaton <bja...@radiantlogic.com>
Subject Re: PathChildrenCache and event order
Date Tue, 24 Sep 2013 16:50:53 GMT
In the test I attached, the nodes are created in a single threaded FOR loop
using *client.create().forPath(..)*, so the ZooKeeper service sees them in
order,
but apparently the events I receive from PathChildrenCache are not in order.

About "you cannot reliably see every change that happens to a node in
ZooKeeper", in my case I only use create events which I believe ZooKeeper
guarantees me to see every single one of them.

Thanks,
Ben


On Fri, Sep 20, 2013 at 6:04 PM, Jordan Zimmerman <
jordan@jordanzimmerman.com> wrote:

> Assuming events come in order from ZK (which I believe they're supposed
> to), then PathChildrenCache will report them in order.
> However, PathChildrenCache makes no guarantee of this. A deeper point,
> though, is that you cannot get every event from ZooKeeper. As that same
> wiki says, "you cannot reliably see every change that happens to a node in
> ZooKeeper". So, I think you'd need to reconsider your algorithm regardless.
>
> -JZ
>
>
> On Sep 20, 2013, at 11:27 AM, Benjamin Jaton <bjaton@radiantlogic.com>
> wrote:
>
> Some configuration is stored in ZooKeeper and we are trying to keep a
> local copy on disk, updated through events.
>
> I think ZooKeeper guarantees some kind of ordering<http://zookeeper.apache.org/doc/trunk/zookeeperProgrammers.html#sc_WatchGuarantees>,
> especially this one:
> "The order of watch events from ZooKeeper corresponds to the order of the
> updates as seen by the ZooKeeper service."
> Which I thought was my use case.
>
> Thanks,
> Benjamin
>
>
>
> On Thu, Sep 19, 2013 at 4:26 PM, Eric Tschetter <echeddar@gmail.com>wrote:
>
>> Can you give some more insight into what end goal you are trying to
>> achieve?
>> --Eric
>>
>>
>> On Thursday, September 19, 2013, Eric Tschetter wrote:
>>
>>> Benjamin,
>>>
>>> That's not really possible.  Also, any protocol built around requiring
>>> them in order is most likely going to have nasty corner cases in the face
>>> of network partitions and server failures.
>>>
>>> --Eric
>>>
>>> On Thursday, September 19, 2013, Benjamin Jaton wrote:
>>>
>>>> Hello,
>>>>
>>>> I am trying to have PathChildrenCache send me create events in the same
>>>> order the nodes were created.
>>>> Is that possible?
>>>>
>>>> Attached is a simple example where I create node0, node1, node2, etc
>>>> and I often get the notification for node2 before node1, or the like.
>>>> Note: PathChildrenCache is created
>>>> with Executors.newSingleThreadExecutor().
>>>>
>>>> Thanks!
>>>> Benjamin
>>>>
>>>
>
>

Mime
View raw message