You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@zookeeper.apache.org by Jamie Johnson <je...@gmail.com> on 2011/11/30 15:25:53 UTC

setData question

When a call is made to setData is the operation done atomically?  I.e.
is it guaranteed that the node and its data are done in one shot such
that any clients trying to read this data do not need to be aware of
the fact that the node could be empty or is it possible that the node
will exist with no data for a short period of time?

Re: setData question

Posted by André Oriani <ra...@students.ic.unicamp.br>.
setData should only change the data stored on the node.  Bot setData and
getData returns a Stat object for the node. Stat.getVersion returns the
version of the node and the version is incremented each time the node is
modified. You may use that to track the order in which the operations are
executed.


On Wed, Nov 30, 2011 at 13:20, Jamie Johnson <je...@gmail.com> wrote:

> Yeah talking about through a create, sorry not setData.  If the node
> already exists and you call setData is it a delete and then a set?  I
> ask because I'm trying to track down an issue where the data on the
> node is null.  It's hard to reproduce but it appears that if the node
> exists and I call setData I sometimes see a node with no information.
> My guess is that if client 1 calls setData on a node that exists it
> first deletes, then if client 2 comes in and tries to read the data he
> sees nothing, then the set actually happens for client 1.  I'm just
> guessing though so trying to figure out if that is how it should work
> or not.
>
> On Wed, Nov 30, 2011 at 10:10 AM, André Oriani
> <ra...@students.ic.unicamp.br> wrote:
> > Not sure if I understood your question. All operations on  Zookeeper at
> > done atomically. So if you meant ZooKeeper.create(path, data,. ...)  the
> > creation of the node and the set of data are done in single shot.  Now if
> > do ZooKeeper.create and then ZooKeeper.setData, other operation from
> other
> > client can happen between the create and the setData.
> > I heard something of transactions on Zookeeper, but as I have not been
> > following the maillist  I do not know if the support exists or will
> exist.
> >
> >
> > Regards,
> > Andr[e
> >
> >
> > n Wed, Nov 30, 2011 at 12:25, Jamie Johnson <je...@gmail.com> wrote:
> >
> >> When a call is made to setData is the operation done atomically?  I.e.
> >> is it guaranteed that the node and its data are done in one shot such
> >> that any clients trying to read this data do not need to be aware of
> >> the fact that the node could be empty or is it possible that the node
> >> will exist with no data for a short period of time?
> >>
> >
>

Re: setData question

Posted by Jamie Johnson <je...@gmail.com>.
Yeah talking about through a create, sorry not setData.  If the node
already exists and you call setData is it a delete and then a set?  I
ask because I'm trying to track down an issue where the data on the
node is null.  It's hard to reproduce but it appears that if the node
exists and I call setData I sometimes see a node with no information.
My guess is that if client 1 calls setData on a node that exists it
first deletes, then if client 2 comes in and tries to read the data he
sees nothing, then the set actually happens for client 1.  I'm just
guessing though so trying to figure out if that is how it should work
or not.

On Wed, Nov 30, 2011 at 10:10 AM, André Oriani
<ra...@students.ic.unicamp.br> wrote:
> Not sure if I understood your question. All operations on  Zookeeper at
> done atomically. So if you meant ZooKeeper.create(path, data,. ...)  the
> creation of the node and the set of data are done in single shot.  Now if
> do ZooKeeper.create and then ZooKeeper.setData, other operation from other
> client can happen between the create and the setData.
> I heard something of transactions on Zookeeper, but as I have not been
> following the maillist  I do not know if the support exists or will exist.
>
>
> Regards,
> Andr[e
>
>
> n Wed, Nov 30, 2011 at 12:25, Jamie Johnson <je...@gmail.com> wrote:
>
>> When a call is made to setData is the operation done atomically?  I.e.
>> is it guaranteed that the node and its data are done in one shot such
>> that any clients trying to read this data do not need to be aware of
>> the fact that the node could be empty or is it possible that the node
>> will exist with no data for a short period of time?
>>
>

Re: setData question

Posted by André Oriani <ra...@students.ic.unicamp.br>.
Not sure if I understood your question. All operations on  Zookeeper at
done atomically. So if you meant ZooKeeper.create(path, data,. ...)  the
creation of the node and the set of data are done in single shot.  Now if
do ZooKeeper.create and then ZooKeeper.setData, other operation from other
client can happen between the create and the setData.
I heard something of transactions on Zookeeper, but as I have not been
following the maillist  I do not know if the support exists or will exist.


Regards,
Andr[e


n Wed, Nov 30, 2011 at 12:25, Jamie Johnson <je...@gmail.com> wrote:

> When a call is made to setData is the operation done atomically?  I.e.
> is it guaranteed that the node and its data are done in one shot such
> that any clients trying to read this data do not need to be aware of
> the fact that the node could be empty or is it possible that the node
> will exist with no data for a short period of time?
>