The description of if_not_modified is lacking in the documentation.  What
guarantees if_not_modified provides  is a question that has been asked in
the list a few times, but for which no satisfactory answer has been given.
 Its something I've been wanted answered as well, so I did a bit of digging
into the code.

I gather from reading the code that whatever node receives the INM request
perform an internal get to retrieve the object to get its vclock to compare
to the incoming object.  The get appears to use the R value that is the
default for the bucket.  The default value of R for a bucket is "quorum",
unless changed, although the default for PR is 0.  Thus, INM can strongly
guarantee no stale writes, but only if no primary replica nodes have failed
or have become partitioned.  That also assumes that you are using at least
an W of "quorum", and ideally a PR of the same.

Correct me if I am wrong, but there appears no way to set the R and PR
values to be used by the internal get during a INM put request, except for
changing the bucket default R and PR values.

The INM only guarantees no stale writes, and only does so when R, PR, W,
and WR are such to to guarantee strong consistency.  It does not guard
against concurrent writes.  Multiple writers can succeed even when using
INM if they write at the same time.

If you have allow_mult set to true in the bucket, that means the client
must handle sibling resolution.  If allow_mult is set to false and
last_write_wins is set to true, concurrent writes will succeed, but the
value with the latest timestamp will win.  If last_write_wins is set to
false while allow_multi is also false, Riak will keep siblings internally,
but use vector clocks to only return a single value.

Its unclear from the documentation what it does in the case of conflicts to
resolve the siblings into the single value.  The docs say you'll receive
the "latest" value, but does not say how latest is determined in the case
of a conflict.

Elias Levy
_______________________________________________
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to