Skip to content

Instantly share code, notes, and snippets.

@PharkMillups
Created October 15, 2010 17:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save PharkMillups/628596 to your computer and use it in GitHub Desktop.
Save PharkMillups/628596 to your computer and use it in GitHub Desktop.
09:24 <nfo> Hi again, I've just read articles mentioned in
http://nosql.mypopescu.com/post/524128219/learn-about-conflict-resolution-and-vector-clocks .
But I'm still struggling with this conflict resolution scenario:
09:25 <nfo> is it possible to concurrently increment the integer value of an object ?
09:25 <bingeldac> no
09:25 <bingeldac> not in the way you're thinking I think
09:26 <seancribbs> nfo: no, better to write new objects and count them with mapreduce
09:26 <nfo> bingeldac: ok :) I tried implementing conflict resolution , but I figured
out that I could not know who incremented the value and by how many clients
09:26 dysinger joined
09:28 <pharkmillups> nfo: sidenote - you're best to read the actual posts is you haven't already
09:28 <pharkmillups> http://blog.basho.com/2010/01/29/why-vector-clocks-are-easy/
09:28 <pharkmillups> http://blog.basho.com/2010/04/05/why-vector-clocks-are-hard/
09:28 <nfo> pharkmillups: yep, read them. "Automatic" resolution could also work with an
array of values, not a counter.
09:30 <nfo> seancribbs: the thing with creating multiple objects, is that I have to find them afterward
09:31 <nfo> s/with/about
09:33 <seancribbs> nfo: true
09:33 <nfo> ok, so with arrays, here is a scenario. Each client adds an element to the array.
My concern is that I just need to see if the size of the array is equal to a value:
09:34 <nfo> client "c" updates the array => [a, b, c]
09:34 <nfo> client "d" updates the array simultaneously => [a, b, d]
09:35 <nfo> client x gets the object and sees a conflict, it can just fix it by merging
the arrays, right ? => [a, b, c, d]
09:37 <nfo> does it seem to be a correct solution ?
09:42 <seancribbs> set-union is pretty common way to do that, yes
09:43 <seancribbs> a, b, c, d could be uuids
09:43 <seancribbs> then for most cases, conflicts are easy to resolve
09:44 <seancribbs> as long as you're never removing items, heh
<nfo> seancribbs: ok for the set-union, it will work perfectly for my use case. Thanks!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment