On Tue, Nov 27, 2012 at 11:41 AM, Alex Rønne Petersen
<xtzgzo...@gmail.com> wrote:
>> In short, the proper way to replace an object is to first fetch the
>> existing object, then update the value of what you fetched, then use
>> riakc_pb_socket:put to write the new value. The reason for doing this
>> is to comply with Riak's consistency system (the vector clocks) - it
>> needs to know what value you were starting from in order to overwrite
>> it correctly.
>
> OK, makes sense. Just out of curiosity, though, is updating values via
> put without an update a supported scenario in some way or is it
> generally considered a Bad Idea (tm)?

This depends on each bucket's configuration of allow_mult. In the
default setup, with allow_mult=false, writing without fetching first
causes Riak to simply store the new value instead of the old value,
with conflict resolution (during read-repair/etc.) done simply by
comparing modification timestamps. With allow_mult=true, writing
without fetching first causes Riak to store sibling objects.

> Does Riak figure out based on the name of the index what type it is?
> That is, *_int = integer, *_bin = string?
>
> Is there any physical limit to how many secondary indexes can be
> created for an object? Or perhaps a recommended limit?

Answers to both of these are on the poorly-named "Configuring
Secondary Indexes" page:

http://docs.basho.com/riak/latest/cookbooks/Secondary-Indexes---Configuration/

> When if_none_match is enabled, will riakc_pb_socket:put/3 return ok
> regardless of whether the value was stored?

No, it looks like it returns an error in that case:

    6> O = riakc_obj:new(<<"one">>, <<"two">>, <<"three">>).
    {riakc_obj,<<"one">>,<<"two">>,undefined,[],undefined,
               <<"three">>}
    7> riakc_pb_socket:put(S, O, [if_none_match]).
    ok
    8> riakc_pb_socket:put(S, O, [if_none_match]).
    {error,<<"match_found">>}

-Bryan

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

Reply via email to