That doesn't much make sense to me at all. Also, have you tried getting the 
HEAD? Vclock comes out in the meta, but it and the entire body are read off 
disk.  

Cheers,
Alexander

Sent from my Verizon Wireless BlackBerry

-----Original Message-----
From: Andrew Berman <rexx...@gmail.com>
Sender: riak-users-boun...@lists.basho.com
Date: Fri, 22 Jul 2011 13:09:10 
To: Sean Cribbs<s...@basho.com>
Cc: riak-users<riak-users@lists.basho.com>
Subject: Re: When is Vclock generated?

Sean,

Thanks for the reply.  I am fetching before write, however, what I
want is the ability to fetch the vclock and use it as a version on the
object itself throughout my application, much how Hibernate uses a
version property.  This way I am able to tell if an object is
persistent or not based on whether it has a version or if it is
undefined.  So basically I created a version property on my record
which, in turn, gets stored in Riak but this version will never match
the actual vclock when looking at the data itself, since the version
is only ever updated to the previous vclock and not the one after the
object has been updated.  Does that make more sense?  The version I
store in Riak is pretty worthless so it's not a big deal if it doesn't
match since I update it to the current one when I load the object, but
it would certainly make things easier on me if I could always have the
version match the current vclock, so then I wouldn't have to update
the version on fetches.

--Andrew

On Fri, Jul 22, 2011 at 6:06 AM, Sean Cribbs <s...@basho.com> wrote:
> Andrew,
> Are you trying to store the vclock as part of the value? I'm
> misunderstanding something.
> Well-behaved clients should always fetch before writing, so your client
> should have the most reasonably-fresh version of the object when you write.
>  There's really no way to guarantee that some other actor won't write a new
> version between the time that you fetch the object and store it back, or
> even in the time between your client issuing the write and it actually being
> written to disk.  Vector clocks and sibling values exist in part to help
> disambiguate those race conditions.  If you're submitting the write without
> the vclock, your write could very well be ignored, so please fetch before
> storing.
>
> On Thu, Jul 21, 2011 at 6:13 PM, Andrew Berman <rexx...@gmail.com> wrote:
>>
>> I'm looking to store the vclock on my object to be used for
>> versioning.   Currently, when I get the object from Riak I fill in the
>> version with the vclock from Riak (which I use to determine if the
>> object is persistent and for passing back to Riak when putting) and
>> then when the object is saved it saves the version as the previous
>> vclock value.  I'm wondering when the vclock is actually generated.
>> Can I write a pre-commit hook that fills in the version so it has the
>> most updated value or is there no way for me to do it.  It's not a
>> huge deal because the version value in the db is immediately updated
>> upon loading the data from Riak, but I just feel like it would make
>> things more consistent if I could have the version matching the
>> updated vclock.
>>
>> Thanks for any help!
>>
>> Andrew
>>
>>_______________________________________________
>> riak-users mailing list
>> riak-users@lists.basho.com
>> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>
>
>
> --
> Sean Cribbs <s...@basho.com>
> Developer Advocate
> Basho Technologies, Inc.
> http://www.basho.com/
>

_______________________________________________
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
_______________________________________________
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to