safely resolving conflicts on read

Justin Karneges justin at affinix.com
Tue Nov 1 16:34:02 EDT 2011


Hi,

http://wiki.basho.com/Vector-Clocks.html contains this text:

"It should be noted that if you are trying to resolve conflicts automatically, 
you can end up in a condition with which two clients are simultaneously 
resolving and creating new conflicts."

If conflict resolution is moved to the reader, I'm curious what strategies 
people use to avoid this kind of feet stomping.

Some ideas that have come to mind:

1) Have a deterministic way of deriving a correct/unified/winner value from 
multiple siblings, such that any reading client would always arrive at the 
same answer.  Simply use this derived answer as the value read, but don't 
attempt to write a corrected value into Riak.  The value could eventually be 
corrected at the time of a necessary write as opposed to a read reaction.

2) Determine a correct value per #1 above, but then attempt to write this 
value back into Riak in such a way that if multiple nodes were to write the 
same value simultaneously then they don't create siblings.  I'm not sure if 
this is possible in Riak?

3) Determine a correct value per #1 above, and allow exactly one node to ever 
immediately write corrected values after a read.  Something like "if hash(key) 
% node_count == current_node then do_correction".  Since value correction is 
not vital to availability, there's no harm if the owning node is down.  I just 
figure this would allow for self-healing over time.

Maybe there are other ways.  What do people really do?

Thanks,
Justin




More information about the riak-users mailing list