Thanks Reid, we have that implementation for Read Your Writes already. We'd 
like to implement Monotonic Read Consistency as well. For Monotonic Read 
Consistency, we were hoping to do Vector Clock comparison but we don't know how 
to convert the byte[] into different client's timestamps.

Here's a work around we've thought of for now to implement Monotonic Read 
Consistency:

1. We'll just add another field in our object to track which client wrote it 
and a version number (so sort of implementing our own vector clock)
2. Then we'll just do last write wins (no siblings)
3. We'll cache our writes and reads
4. If we do a read and it has a vector clock less than what's in our cache, 
we'll use the one in our cache
5. If we do a read and it has a vector clock greater than what's in our cache, 
we'll update our cache and use that latest version

If you know of a way how a client can interpret the vector clock returned by 
Riak API, then  we don't have to implement our own poor man's vector clock.

Also, what's the timestamp returned as part of the Riak API? Is that the 
timestamp when the response was created? Or is that the timestamp of the record 
inside each instance of Riak DB where that data came from -- is that timestamp 
consistent across all replicas?

________________________________
From: Reid Draper [[email protected]]
Sent: Wednesday, December 12, 2012 11:21 AM
To: Vergara, Jeaneth Aguilar
Cc: [email protected]
Subject: Re: Monotonic Read Consistency

If your writes and reads are written with PR+PW > N (note PR/PW and not R/W), 
then you should get read-your-writes consistency. There is unfortunately a bug 
with PR/PW [1] that means this is not a 100% guarantee at the moment. I'm 
hoping for it to be fixed by Riak 1.4, if not earlier. I don't have JavaDoc 
handy, but setting PR and PW should be the same as setting any other 
per-request parameter. For an N value of 3 (the default), I'd likely recommend 
setting PR and PW to 2. You can get around the aforementioned bug by setting 
PR=PW=N, which will lower your availability, but gaurantee read-your-writes 
consistency.

Note that read-your-writes is slightly different than just monotonic read 
consistency, but I'm guessing it's closer to what you had in mind.

[1] https://github.com/basho/riak_kv/issues/388

Reid


On Dec 5, 2012, at 11:13 PM, "Vergara, Jeaneth Aguilar" 
<[email protected]<mailto:[email protected]>> wrote:

Hi there,

We're trying to implement monotonic read consistency at the client side using 
Riak's Java client. We're kind of stumped on how to do vector clock comparison 
so we can ensure that we're always getting the latest version.

Any tips would be appreciated.

Thanks,
Jing
_______________________________________________
riak-users mailing list
[email protected]<mailto:[email protected]>
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to