Atomicity of if_not_modified?
pvenkatesh at basho.com
Thu Jan 3 15:35:47 EST 2013
If its through http, "ifnotmodified" will only store if there has been no
modification since the provided timestamp (conditional store).
With your example of N=3, R=2 and W=2, if two clients are updating at the
same time to the same object, then it actually depends on the "allow_mult"
and "last_write_wins" variable.
Case 1-- If allow_mult is true and last_write_wins is false, then siblings
are created and replicated among the nodes. It has to be resolved on the
client side. Client will have to issue a "put" request later along with the
vector clock and with the relevant value in order to resolve the sibling
Case 2 If allow_mult is false and last write_wins is true, then the client
with the latest time stamp wins. Siblings might occur here, but is not
exposed to the client.
Case 3 If allow_mult is false and last write_wins is false, then resolve
differences using vector clock(this happens internally). The latest one is
returned if siblings still exists.
Case 4 If allow_mult is true and last write_wins is true, then the client
with the latest time stamp wins.
More Details on "IfnotModified" below-
ml> > ifNotModified(boolean ifNotModified)
Default is false (i.e. NOT a conditional store).
NOTE: This has different meanings depending on the underlying transport.
In the case of the PB interface it means: Only store if the vclock provided
with the store is the same as the one in Riak for this object (i.e. the
object has not been modified since you last got it), of course, since this
StoreObject does a fetch before a store the window for concurrent
modification is minimized, but this is an extra guard, still.
For the HTTP API it means: Only store if there has been no modification
since the provided timestamp.
To make this transparent the StoreOperation will pull the last modified
date from the object returned in the pre-store fetch, and use that as
supplementary data to the HTTP Store request.
Parameters:ifNotModified - true if you want a conditional store, false
otherwise, defaults to false. Returns:This
From: qaspar <snooper77 at gmail.com>
Date: Thursday, January 3, 2013 8:46 AM
To: <riak-users at lists.basho.com>
Subject: Re: Atomicity of if_not_modified?
Can someone confirm this? If it's true, what exactly is the purpose of
offering the if_not_modified flag?
On Dec 28, 2012 1:51 PM, "Daniil Churikov [via Riak Users]" <[hidden email]
</user/SendEmail.jtp?type=node&node=4026465&i=0> > wrote:
> Riak doesn't have atomic updates. This if_not_modified does not gives you any
> guaranties. Best way to handle with simultaneously updates is try to engineer
> scheme so that only one client makes concurrent updates and in case of
> conflict any sibling will be good for you. Another option is try to use
> convergent data types 
>  https://github.com/basho/riak_dt
>  https://github.com/mochi/statebox_riak
> If you reply to this email, your message will be added to the discussion
> To unsubscribe from Atomicity of if_not_modified?, click here.
View this message in context: Re: Atomicity of if_not_modified?
Sent from the Riak Users mailing list archive
<http://riak-users.197444.n3.nabble.com/> at Nabble.com.
_______________________________________________ riak-users mailing list
riak-users at lists.basho.com
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the riak-users