Concurrency hazard when updating links

Kresten Krab Thorup krab at
Thu Jun 30 18:38:30 EDT 2011

I've written this little link index kit that can be used to manage external "link objects"

<>Which uses vectorclocks on individual links (they are contained in a riak_link_set) so link updates are done with a very similar logic used to handle "normal" write conflicts, but within a single riak object.

Going forward, a better option may be to use the new upcoming riak_index features (which are proper secondary indexes for riak), but that has not appeared in a release yet ... but you can check it out in basho's repo.  I don't know the details of riak_index's consistency model though.


On Jul 1, 2011, at 12:08 AM, Les Mikesell wrote:

How is this handled on requests where the the server does the link
insertion and walking for you?  That is, you have some existing links
and simultaneously add multiple new items that add themselves to the
same links, then ask the server to return the values from link walking.
 Does the client know that the link updates may have conflicted or does
the server do some kind of resolution during the walk?

 Les Mikesell
   lesmikesell at<mailto:lesmikesell at>

On 6/22/2011 10:23 AM, Mathias Meyer wrote:
And here's the link I neatly forgot to include:

Mathias Meyer
Developer Advocate, Basho Technologies

On Mittwoch, 22. Juni 2011 at 17:18, Mathias Meyer wrote:


what you're seeing is not specific to links, it's generally how concurrent updates to a single object are handled in Riak, links are no exception. If you want to handle that properly you need to enable the allow_mult property on the bucket in question.

Now, whenever two clients update the same object based on the same origin (i.e. vector clock) they'll cause siblings to be created. The next time you fetch the object you'll get both siblings and you can then reconcile the difference, e.g. merging all links together, checking if they're still valid, etc., and then store back the updated value using the vector clock you got when requesting the object including the siblings.

We have wiki page [1] dedicated to vector clocks and conflict resolution, explaining the process in more detail.

Mathias Meyer
Developer Advocate, Basho Technologies


On Mittwoch, 22. Juni 2011 at 11:14, Manuel Astudillo wrote:


Probably I have some miss understating on whats the best way to update links in Riak, but I am wondering if you know about this hazard when updating links:

client A: getLinks(X)
client B: getLinks(X)


where the update made by B is cleaned by A, and it seems like there is not even any way to get a notification about it or detect it somehow...

riak-users mailing list
riak-users at<mailto:riak-users at>

More information about the riak-users mailing list