understanding optimistic concurrency in Riak

Alex Rice alex at mindlube.com
Fri Oct 4 00:19:47 EDT 2013


Just trying to paraphrase how I understand it from the Riak docs, plus
helpful feedback from Jeremiah :) Please correct if I'm not really
groking it!

with allow_multi = false, the default setting

- To achieve CAS* -ish behavior for updates, you can always send the
vector clock with a Put. If it fails with a modified message, then you
can retry on the client side. This is the  basic optimistic
concurrency usage.
- If you also set w = all on Puts then this is *almost* guaranteed to
be a true global CAS operation.
- The big exception mainly being extremely frequent writes for that
key, plus some other edge cases.

with allow_multi = true

- You can still use the vector clock to get CAS-ish behavior as above.
- You also have to resolve Sibings through client side logic each time you Get
- It's *still* not guaranteed to be global CAS , there are special
cases like hinted handoff, clock skew, gnarly stuff involving the
speed of light etc.

* CAS = check and set




More information about the riak-users mailing list