Hi Valter,

I've made some more comments in-line but the tl;dr is you are making
requests to a *bucket* named "bucket" which is a member of the "default"
*bucket type* instead of making requests to a *bucket* which is a member of
the *bucket type* you created: "bucket". I'm not surprised given we don't
have much documentation on either of these features yet. You can find a
detailed description of bucket types (which will be part of the Riak 2.0
release notes) here:
http://lists.basho.com/pipermail/riak-users_lists.basho.com/2013-November/013847.html.
I, unfortunately, do not have a link for client documentation and using
strong consistency at this time.

On Wed, Nov 20, 2013 at 1:04 PM, Valter Balegas <bale...@gmail.com> wrote:

>
> f(Pid), {ok, Pid} = riakc_pb_socket:start_link("localhost", 8087).
> NewA = riakc_obj:new(<<"bucket">>, <<"key">>, <<"my binary data">>).
> NewB = riakc_obj:new(<<"bucket">>, <<"key">>, <<"my other binary data">>).
> riakc_pb_socket:put(Pid, NewA, [return_body]).
>
>
>
The requests you are making here are to a bucket under the default type,
not the bucket type you created. Keys in Riak 2.0 are now fully qualified
by BucketType/BucketName/Key. If the bucket type is omitted the default
type is assumed.  With riak-erlang-client you pass the bucket-type as part
of the first argument to riakc_obj:new:

riakc_obj:new({BucketType, BucketName}, Key, Data)

In your case BucketType = <<"bucket">> and BucketName can be whatever you
please. I would suggest using a name other than "bucket" for the type, just
to help clarify things.

Hope that helps get you past the issue.

Cheers,

Jordan

No dia 20/11/2013, às 17:23, Jordan West <jw...@basho.com> escreveu:
>
> Hi Valter,
>
> Could you provide the code you are using to generate the concurrent
> requests in addition to the output of `riak-admin bucket-type list` and
> `riak-admin bucket-type status <buckettype>` where <buckettype> is the name
> of the strongly consistent bucket you created (from one node should be
> sufficient)? I've been using this feature in a personal project and just
> tested on a local cluster using curl and was unable to reproduce (the
> cluster was a bit behind develop but there have been no recent changes to
> the feature).
>
> Cheers,
> Jordan
>
>
> On Wed, Nov 20, 2013 at 5:30 AM, Valter Balegas <bale...@gmail.com> wrote:
>
>> Hello,
>>
>> I was able to activate strong consistency, but the node keeps generating
>> siblings, when i execute two concurrent writes (Store two objects without
>> vector clock).
>> I tried with the Riak 2.0.0.5pre package and the latest version on the
>> repository. Am i missing anything? i was expecting operations to fail, in
>> this case.
>>
>> It seems that the error was caused by my Erlang version. The creation of
>> the bucket type didn’t fail with R16B02.
>>
>> Valter
>>
>> No dia 20/11/2013, às 03:13, Jordan West <jw...@basho.com> escreveu:
>>
>> Valter,
>>
>> You mentioned you are using a recent develop. Would you be able to pull
>> down any recent changes and update-deps (or build a fresh devrel)? I just
>> tried a fresh clone of develop and was unable to reproduce the same error.
>> I, also, tried with R15B01 (Riak 2.0 is slated to use R16B02 right now).
>>
>> Alternatively, you should be able to workaround this by doing a `riak
>> attach-direct` and defining the atom at the erlang shell:
>>
>> 1> consistent.
>> consistent
>>
>> Jordan
>>
>>
>> On Tue, Nov 19, 2013 at 3:06 PM, Valter Balegas <bale...@gmail.com>wrote:
>>
>>> I can’t create the bucket type:
>>>
>>> RPC to 'riak@127.0.0.1' failed: {'EXIT',
>>>                                  {badarg,
>>>                                   [{erlang,list_to_existing_atom,
>>>                                     ["consistent"],
>>>                                     []},
>>>
>>>  {riak_kv_wm_utils,erlify_bucket_prop,1,
>>>                                     [{file,"src/riak_kv_wm_utils.erl"},
>>>                                      {line,393}]},
>>>                                    {riak_kv_console,
>>>                                     '-bucket_type_create/2-lc$^0/1-0-',1,
>>>                                     [{file,"src/riak_kv_console.erl"},
>>>                                      {line,483}]},
>>>                                    {riak_kv_console,bucket_type_create,2,
>>>                                     [{file,"src/riak_kv_console.erl"},
>>>                                      {line,483}]},
>>>                                    {rpc,'-handle_call_call/6-fun-0-',5,
>>>                                     [{file,"rpc.erl"},{line,203}]}]}}
>>>
>>> I activated the consensus in riak.conf in the etc dir (find command
>>> seems not to find the pattern anywhere else).
>>> Is there any other way to create the bucket?
>>>
>>> Valter
>>>
>>> No dia 19/11/2013, às 18:10, Jordan West <jw...@basho.com> escreveu:
>>>
>>> On Tue, Nov 19, 2013 at 7:33 AM, Valter Balegas <bale...@gmail.com>wrote:
>>>
>>>>
>>>> Strong consistency:
>>>> How does one activate this? As i understand, either the pb or the http
>>>> clients do not accept the consistent property.
>>>>
>>>>
>>> Using strong consistency in the Tech Preview is a two-step process.
>>> First, turn on the feature in your riak.conf (the following command assumes
>>> you are using a devrel):
>>>
>>> for d in dev/dev*; do sed -e 's/## enable_consensus =
>>> true/enable_consensus = true/' -i $d/etc/riak.conf; done
>>>
>>> Then re(start) the cluster.
>>>
>>> With the enable_consensus=true un-commented and the cluster running
>>> create a strongly consistent bucket type:
>>>
>>> riak-admin bucket-type create <type name> '{"props": {"consistent":
>>> true}}'
>>> riak-admin bucket-type activate <type name>
>>>
>>> You can create and activate the bucket type without having
>>> enabled_consensus=true but  both must be done to work with strongly
>>> consistent data.
>>>
>>> Once that is done you can make requests, just like you would to
>>> eventually consistent data in Riak, but the semantics will be different.
>>> For example, if you make two PUT requests to the same key, w/ no vector
>>> clock*, the second request will fail because the data already exists. More
>>> details on semantics of strongly consistent requests can be found in this
>>> PR: https://github.com/basho/riak_kv/pull/710
>>>
>>> Hope that helps get you started,
>>>
>>> Jordan
>>>
>>> * in strong consistency, the "vector clock" is not really a vector
>>> clock. its called such for familiarity, but like any real vector clock
>>> exposed to the client, should be treated like an opaque context.
>>>
>>>
>>>> Details about my environment:
>>>> -I’m running Mac OSX 10.9
>>>> -Erlang R15B01
>>>> -Compiling riak “develop” branch, from basho github
>>>> -Compiling riak-erlang-client “master” branch, from basho github.
>>>> -recompiled the latest versions of the branches just before writing
>>>> this email.
>>>>
>>>>
>>>> Thank you for your help,
>>>> Valter
>>>>
>>>>
>>>>
>>>> _______________________________________________
>>>> riak-users mailing list
>>>> riak-users@lists.basho.com
>>>> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>>>>
>>>
>>>
>>>
>>
>>
>
>
_______________________________________________
riak-users mailing list
riak-users@lists.basho.com
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to