hadoop-zookeeper-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Patrick Hunt <ph...@apache.org>
Subject Re: zoo_set() version question
Date Fri, 12 Dec 2008 19:53:56 GMT
Could you explain your use case? There is no way to get the version as 
part of a zoo_set, however there may be some alternative that we can 
suggest if we knew more about the problem you are trying to solve.

Patrick

Avery Ching wrote:
> Patrick,
> 
> Thanks for responding.
> 
> I agree that I can use zoo_exists and zoo_get to get the version of the
> znode as it exists currently.
> 
> The problem I am trying to solve is that getting the version from struct
> Stat in either zoo_exists or zoo_get may not be the same version that my
> last successful zoo_set used.  I would like to get the version that denotes
> my last successful zoo_set() operation to a particular znode.
> 
> I understand that the data and version to the znode may change immediately
> one or multiple times after my zoo_set() and this is fine, but I would still
> like to know the znode's versions of the data I set.
> 
> Avery
> 
> On 12/12/08 11:11 AM, "Patrick Hunt" <phunt@apache.org> wrote:
> 
>> Avery Ching wrote:
>>> If zoo_set() completes successfully with version != -1, can we assume that
>>> version -> version + 1 for this znode?  If not, is there a way for the user
>>> to get the version of the successfully completed zoo_set() operation?
>> You shouldn't rely on this, it may work, but it's not part of the
>> contract. Also, nothing says that some other client won't change the
>> node immediately after you change it.
>>
>> You can access the version using zoo_exists or zoo_get - specifically
>> the "struct Stat stat" argument of either of those methods contains a
>> "version" member.
>>
>> Patrick
> 

Mime
View raw message