You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@zookeeper.apache.org by Ted Yu <yu...@gmail.com> on 2011/12/23 03:09:27 UTC

order of async requests to zookeeper

Hi,
The following originated from discussion on a feature in HBase which relies
on zookeeper for coordination.

A task is removed from the tasks map. An async ZK request is pending to
remove the task's zk node.

 Another request arrives for this to-be-deleted task. A new in-memory task
structure is created. A ZK request is scheduled to create the same task
node.

 Problem will only occur if create-node executes before delete-node in ZK.
(If create-node returns NODEEXISTS then we treat that as success).

Does ZK re-order async requests?

Thanks

Re: order of async requests to zookeeper

Posted by Patrick Hunt <ph...@apache.org>.
On Mon, Dec 26, 2011 at 5:53 PM, Ted Yu <yu...@gmail.com> wrote:
> Can I assume that async requests from different zk handles don't have
> guaranteed order of execution ?

Not sure what you mean. There will be _an_ order, and you're
guaranteed that all sessions will see the same order. The order will
be the order in which the ZK Leader sees the requests. Subsequent to
that everything is strongly ordered, regardless if it's the same
session or not.

Patrick

Re: order of async requests to zookeeper

Posted by Ted Dunning <te...@gmail.com>.
Well, you have a constraint on the ordering from the ordering for requests
from each separate handle.

Other than that, it is hard to see how you could get a stronger ordering.

On Mon, Dec 26, 2011 at 5:53 PM, Ted Yu <yu...@gmail.com> wrote:

> Sure.
> That helps, Mahadev.
>
> Can I assume that async requests from different zk handles don't have
> guaranteed order of execution ?
>
> On Mon, Dec 26, 2011 at 4:23 PM, Mahadev Konar <mahadev@hortonworks.com
> >wrote:
>
> > Ted,
> >  ZK does not re order async requests. They will be executed in the
> > same order as you call them from the same zk handle. Does that help?
> >
> > thanks
> > mahadev
> >
> > On Fri, Dec 23, 2011 at 10:43 AM, Ted Yu <yu...@gmail.com> wrote:
> > > The requests come from same zhandle.
> > >
> > > Cheers
> > >
> > > On Thu, Dec 22, 2011 at 6:09 PM, Ted Yu <yu...@gmail.com> wrote:
> > >
> > >> Hi,
> > >> The following originated from discussion on a feature in HBase which
> > >> relies on zookeeper for coordination.
> > >>
> > >> A task is removed from the tasks map. An async ZK request is pending
> to
> > >> remove the task's zk node.
> > >>
> > >>  Another request arrives for this to-be-deleted task. A new in-memory
> > >> task structure is created. A ZK request is scheduled to create the
> same
> > >> task node.
> > >>
> > >>  Problem will only occur if create-node executes before delete-node in
> > >> ZK. (If create-node returns NODEEXISTS then we treat that as success).
> > >>
> > >> Does ZK re-order async requests?
> > >>
> > >> Thanks
> > >>
> >
>

Re: order of async requests to zookeeper

Posted by Ted Yu <yu...@gmail.com>.
Sure.
That helps, Mahadev.

Can I assume that async requests from different zk handles don't have
guaranteed order of execution ?

On Mon, Dec 26, 2011 at 4:23 PM, Mahadev Konar <ma...@hortonworks.com>wrote:

> Ted,
>  ZK does not re order async requests. They will be executed in the
> same order as you call them from the same zk handle. Does that help?
>
> thanks
> mahadev
>
> On Fri, Dec 23, 2011 at 10:43 AM, Ted Yu <yu...@gmail.com> wrote:
> > The requests come from same zhandle.
> >
> > Cheers
> >
> > On Thu, Dec 22, 2011 at 6:09 PM, Ted Yu <yu...@gmail.com> wrote:
> >
> >> Hi,
> >> The following originated from discussion on a feature in HBase which
> >> relies on zookeeper for coordination.
> >>
> >> A task is removed from the tasks map. An async ZK request is pending to
> >> remove the task's zk node.
> >>
> >>  Another request arrives for this to-be-deleted task. A new in-memory
> >> task structure is created. A ZK request is scheduled to create the same
> >> task node.
> >>
> >>  Problem will only occur if create-node executes before delete-node in
> >> ZK. (If create-node returns NODEEXISTS then we treat that as success).
> >>
> >> Does ZK re-order async requests?
> >>
> >> Thanks
> >>
>

Re: order of async requests to zookeeper

Posted by Mahadev Konar <ma...@hortonworks.com>.
Ted,
 ZK does not re order async requests. They will be executed in the
same order as you call them from the same zk handle. Does that help?

thanks
mahadev

On Fri, Dec 23, 2011 at 10:43 AM, Ted Yu <yu...@gmail.com> wrote:
> The requests come from same zhandle.
>
> Cheers
>
> On Thu, Dec 22, 2011 at 6:09 PM, Ted Yu <yu...@gmail.com> wrote:
>
>> Hi,
>> The following originated from discussion on a feature in HBase which
>> relies on zookeeper for coordination.
>>
>> A task is removed from the tasks map. An async ZK request is pending to
>> remove the task's zk node.
>>
>>  Another request arrives for this to-be-deleted task. A new in-memory
>> task structure is created. A ZK request is scheduled to create the same
>> task node.
>>
>>  Problem will only occur if create-node executes before delete-node in
>> ZK. (If create-node returns NODEEXISTS then we treat that as success).
>>
>> Does ZK re-order async requests?
>>
>> Thanks
>>

Re: order of async requests to zookeeper

Posted by Ted Yu <yu...@gmail.com>.
The requests come from same zhandle.

Cheers

On Thu, Dec 22, 2011 at 6:09 PM, Ted Yu <yu...@gmail.com> wrote:

> Hi,
> The following originated from discussion on a feature in HBase which
> relies on zookeeper for coordination.
>
> A task is removed from the tasks map. An async ZK request is pending to
> remove the task's zk node.
>
>  Another request arrives for this to-be-deleted task. A new in-memory
> task structure is created. A ZK request is scheduled to create the same
> task node.
>
>  Problem will only occur if create-node executes before delete-node in
> ZK. (If create-node returns NODEEXISTS then we treat that as success).
>
> Does ZK re-order async requests?
>
> Thanks
>

Re: order of async requests to zookeeper

Posted by Benjamin Reed <br...@apache.org>.
are all of these requests being issued from the same zookeeper handle?

ben

On Thu, Dec 22, 2011 at 6:09 PM, Ted Yu <yu...@gmail.com> wrote:
> Hi,
> The following originated from discussion on a feature in HBase which relies
> on zookeeper for coordination.
>
> A task is removed from the tasks map. An async ZK request is pending to
> remove the task's zk node.
>
>  Another request arrives for this to-be-deleted task. A new in-memory task
> structure is created. A ZK request is scheduled to create the same task
> node.
>
>  Problem will only occur if create-node executes before delete-node in ZK.
> (If create-node returns NODEEXISTS then we treat that as success).
>
> Does ZK re-order async requests?
>
> Thanks