You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@zookeeper.apache.org by Martin Kou <bi...@gmail.com> on 2012/04/18 04:45:05 UTC

Consistency of ctime of znodes?

Hi folks,

There're a couple of timestamp values attached to znodes - are there any
guarantees about the consistency of those timestamps? e.g. if a set
operation have changed a znode's version from 2 to 3... is it guaranteed
that the mtime of the znode can only increase?

Best Regards,
Martin Kou

Re: Consistency of ctime of znodes?

Posted by Hartmut Lang <ha...@googlemail.com>.
Hi,

i agree with Michi.
The documentation contains this statement:
"ZooKeeper doesn't use real time, or clock time, at all except to put
timestamps into the stat structure on znode creation and znode
modification."
So i would say the mtime is just there do give some more human-readable
information.

But you can not use mtime to get a "happened-before" info.
For "happend-before" you should use the mzxid.
Again from docu:
"Every change to the ZooKeeper state receives a stamp in the form of a *zxid
* (ZooKeeper Transaction Id). This exposes the total ordering of all
changes to ZooKeeper. Each change will have a unique zxid and if zxid1 is
smaller than zxid2 then zxid1 happened before zxid2."

-- Hartmut

Am 18. April 2012 08:34 schrieb Michi Mutsuzaki <mi...@cs.stanford.edu>:

> Hi Martin,
>
> The leader calls System.currentTimeMillis() and use that value as the
> mtime of znode. So if the leader changes and the new leader's time is
> set differently, mtime can go down.
>
> --Michi
>
> On Tue, Apr 17, 2012 at 7:45 PM, Martin Kou <bi...@gmail.com> wrote:
> > Hi folks,
> >
> > There're a couple of timestamp values attached to znodes - are there any
> > guarantees about the consistency of those timestamps? e.g. if a set
> > operation have changed a znode's version from 2 to 3... is it guaranteed
> > that the mtime of the znode can only increase?
> >
> > Best Regards,
> > Martin Kou
>

Re: Consistency of ctime of znodes?

Posted by Michi Mutsuzaki <mi...@cs.stanford.edu>.
Hi Martin,

The leader calls System.currentTimeMillis() and use that value as the
mtime of znode. So if the leader changes and the new leader's time is
set differently, mtime can go down.

--Michi

On Tue, Apr 17, 2012 at 7:45 PM, Martin Kou <bi...@gmail.com> wrote:
> Hi folks,
>
> There're a couple of timestamp values attached to znodes - are there any
> guarantees about the consistency of those timestamps? e.g. if a set
> operation have changed a znode's version from 2 to 3... is it guaranteed
> that the mtime of the znode can only increase?
>
> Best Regards,
> Martin Kou