Hi, 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 scenario. 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- ifNotModified public StoreObject <http://www.jarvana.com/jarvana/view/com/basho/riak/riak-client/1.0rc1/riak- client-1.0rc1-javadoc.jar%21/com/basho/riak/client/operations/StoreObject.ht ml> <T <http://www.jarvana.com/jarvana/view/com/basho/riak/riak-client/1.0rc1/riak- client-1.0rc1-javadoc.jar%21/com/basho/riak/client/operations/StoreObject.ht 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 Pavan From: qaspar <[email protected]> Date: Thursday, January 3, 2013 8:46 AM To: <[email protected]> Subject: Re: Atomicity of if_not_modified? Hi, Can someone confirm this? If it's true, what exactly is the purpose of offering the if_not_modified flag? Kaspar 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 [0][1] > [0] https://github.com/basho/riak_dt > [1] https://github.com/mochi/statebox_riak > > > If you reply to this email, your message will be added to the discussion > below: > http://riak-users.197444.n3.nabble.com/Atomicity-of-if-not-modified-tp4026430p > 4026431.html > To unsubscribe from Atomicity of if_not_modified?, click here. > NAML > <http://riak-users.197444.n3.nabble.com/template/NamlServlet.jtp?macro=macro_v > iewer&id=instant_html%21nabble%3Aemail.naml&base=nabble.naml.namespaces.BasicN > amespace-nabble.view.web.template.NabbleNamespace-nabble.view.web.template.Nod > eNamespace&breadcrumbs=notify_subscribers%21nabble%3Aemail.naml-instant_emails > %21nabble%3Aemail.naml-send_instant_email%21nabble%3Aemail.naml> View this message in context: Re: Atomicity of if_not_modified? <http://riak-users.197444.n3.nabble.com/Atomicity-of-if-not-modified-tp40264 30p4026465.html> Sent from the Riak Users mailing list archive <http://riak-users.197444.n3.nabble.com/> at Nabble.com. _______________________________________________ riak-users mailing list [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
