Indexing conflicts (feature)

Erik Søe Sørensen ess at
Thu Jul 4 08:12:43 EDT 2013

Hi all -
I'm not sure whether this has been discussed here before, but I've at 
times felt that Riak - while having a great way of supporting resolution 
of write conflicts - is missing a good way of *detecting* such conflicts.
(Unless of course some feature has been added which I have missed...)
And recently, when trying to reason about whether our Riak-based 
algorithm gave the guarantees it was supposed to, and what to do about 
it when it didn't, one of the conclusions was "either this goes well, or 
else we get a conflict, in which case all is well if we find and handle 
that conflict in a timely manner".

Now, I'm as much for periodic jobs reviewing nontrivial parts of the 
database as the next man (and also fudge factors such as "upper bound on 
consistency delay"), but I think we can do better. :-)

Thus, I give to you, for your consideration and discussion, a mechanism 
for indexing conflicts in 2i as they arise:

I think 2i is a quite appropriate vehicle for this. The implementation 
doesn't have much rocket science in it, either. As for the special names 
involved (and the extent to which the mechanism should be configurable), 
I'll leave that to the naming (and configurability) experts.
As far as I know, the code would also handle conflicts created at 
replication time.

Enough talk - demo time:

    # First, setup bucket to support conflicts:
    $ curl -XPUT -H'content-type: application/json' -d'{"props":
    {"allow_mult": true}}' http://localhost:8098/buckets/somebucket/props

    # Create an object, marking it as something we'd like to monitor for
    $ curl -XPUT -d'Value 1' -H'X-Riak-Meta-X-Index-Siblings: true'

    # Then create a conflict:
    $ curl -XPUT -d'Value 2'

    # Are there any conflicts?
    $ curl -XGET

    # The value of the index is the number of siblings.
    $ curl -XGET

What do you think?

Erik Søe Sørensen
Mobile: + 45 26 36 17 55 | Skype: eriksoesorensen | Twitter: @eriksoe
Trifork A/S  |  Margrethepladsen 4  |  DK-8000 Aarhus C | <>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the riak-users mailing list