Re: riakc doesn't save metadata properly?
Hello Metin - Sorry for the delay. At the moment, all metadata needs to be stored under the <<"X-Riak-Meta">> dict key. The following example illustrates how this works: %% To store metadata: Object = riakc_obj:new(<<"groceries">>, <<"mine">>, <<"eggs & bacon">>). MetaData = dict:from_list([{<<"X-Riak-Meta">>, [{"Foo", "Bar"}]}]), Object2 = riakc_obj:update_metadata(Object, MetaData). riakc_pb_socket:put(Pid, Object2). %% To retrieve metadata: {ok, O} = riakc_pb_socket:get(Pid, <<"groceries">>, <<"mine">>). {ok, MD} = dict:find(<<"X-Riak-Meta">>, riakc_obj:get_metadata(O)). We're kicking around ways to improve this in the future. Cheers - Dave On Fri, Oct 19, 2012 at 8:31 AM, Metin Akat wrote: > I am trying to do something like: > > Meta1 = dict:store(<<"ver">>, Ver, Meta0), > Obj1 = riakc_obj:update_metadata(Obj, Meta1), > > and then save the object. But on a subsequent read, the metadata k/v pair is > not there. > > Is there anything special that needs to be done for this to work, or is this > illegal way to use Riak? > > ___ > 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
Re: riakc doesn't save metadata properly?
Hello Metin - I'm trying to get that into the docs right now. Will italics do? :-) https://github.com/basho/riak-erlang-client/pull/74 Cheers - Dave On Mon, Oct 22, 2012 at 5:22 PM, Metin Akat wrote: > Oh, I see, thanks for this clarification, much appreciated. > I think this should be written somewhere in bold, as 3 days later, I still > wasn't able to find anything on google. > > > On Tue, Oct 23, 2012 at 12:08 AM, David Parfitt wrote: >> >> Hello Metin - >> >> Sorry for the delay. At the moment, all metadata needs to be stored >> under the <<"X-Riak-Meta">> dict key. The following example >> illustrates how this works: >> >> %% To store metadata: >> Object = riakc_obj:new(<<"groceries">>, <<"mine">>, <<"eggs & bacon">>). >> MetaData = dict:from_list([{<<"X-Riak-Meta">>, [{"Foo", "Bar"}]}]), >> Object2 = riakc_obj:update_metadata(Object, MetaData). >> riakc_pb_socket:put(Pid, Object2). >> >> %% To retrieve metadata: >> {ok, O} = riakc_pb_socket:get(Pid, <<"groceries">>, <<"mine">>). >> {ok, MD} = dict:find(<<"X-Riak-Meta">>, riakc_obj:get_metadata(O)). >> >> We're kicking around ways to improve this in the future. >> >> Cheers - >> Dave >> >> On Fri, Oct 19, 2012 at 8:31 AM, Metin Akat wrote: >> > I am trying to do something like: >> > >> > Meta1 = dict:store(<<"ver">>, Ver, Meta0), >> > Obj1 = riakc_obj:update_metadata(Obj, Meta1), >> > >> > and then save the object. But on a subsequent read, the metadata k/v >> > pair is >> > not there. >> > >> > Is there anything special that needs to be done for this to work, or is >> > this >> > illegal way to use Riak? >> > >> > ___ >> > 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
Re: Building riak-erlang-client
Hello Martin - Yes, riak-erlang-client 1.3.1 is the latest tag that you should be using to build from Github. The protobuffs implementation produces several warnings during compilation. I attached the output of 'make' and 'rebar eunit' using Erlang R15B01 to the gist [1] referenced below. I haven't tried R15B02, however there is an open issue reported [2] when building Riak against it. I would recommend sticking with R15B01 for now if possible. Cheers - Dave [1] https://gist.github.com/3952217 [2] https://github.com/basho/riak/issues/227 On Thu, Oct 25, 2012 at 4:36 AM, Martin Woods wrote: > Hi > > We're in the process of upgrading Riak to 1.2.1 and have a question > regarding the correct stable version of the riak-erlang-client to use within > our Erlang app against this version of Riak. It seems that we should be > cloning riak-erlang-client from github and using the state of the code as > tagged at version 1.3.1. Is this correct? > > If we checkout this tag and make (we're using R15B02 on Ubuntu 12.04), then > it dutifully pulls down riak_pb and protobuffs - but from the master branch > for both of these. Compilation then generates a series of warnings, which > seem harmless enough as they're warning about missing specifications and > unused variables. (Apart from the one that reads: > "src/protobuffs_compile.erl:478: Warning: variable 'Acc' shadowed in 'fun'" > - is this anything to worry about?). > > Is all of this to be expected? > > Thanks and regards, > Martin. > > > ___ > 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
Re: 1.2.1 not starting up on osx
Hello Alexander - I received the same issue. I'll see what I can do to get this resolved. Cheers - Dave On Wed, Oct 24, 2012 at 4:47 PM, Alexander Sicular wrote: > first time i've seen this. simply untar and start. any thoughts? > > npiabf100:r121 siculars$ tar xf riak-1.2.1-osx-x86_64.tar.gz > npiabf100:r121 siculars$ cd riak-1.2.1 > npiabf100:riak-1.2.1 siculars$ bin/riak start > Error reading /Users/siculars/dev/r121/riak-1.2.1/etc/app.config > > npiabf100:riak-1.2.1 siculars$ uname -a > Darwin npiabf100.cpmc.columbia.edu 11.4.2 Darwin Kernel Version 11.4.2: Thu > Aug 23 16:25:48 PDT 2012; root:xnu-1699.32.7~1/RELEASE_X86_64 x86_64 > npiabf100:riak-1.2.1 siculars$ > > > Thanks, > -Alexander Sicular > > @siculars > > > ___ > 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
Re: riakc doesn't save metadata properly?
Hello Christian - I believe this is an inconsistency in the HTTP vs PB custom metadata APIs. We'll be revisiting this code at some point to clean things up. In the meantime, would you mind filing an issue at [1] so we don't lose track of this? Cheers - Dave [1] https://github.com/basho/riak-erlang-client On Tue, Oct 23, 2012 at 12:48 AM, Christian Dahlqvist wrote: > On 22/10/2012 22:25, David Parfitt wrote: > > Hello Metin - > > I'm trying to get that into the docs right now. Will italics do? :-) > https://github.com/basho/riak-erlang-client/pull/74 > > Cheers - > Dave > > On Mon, Oct 22, 2012 at 5:22 PM, Metin Akat wrote: > > Oh, I see, thanks for this clarification, much appreciated. > I think this should be written somewhere in bold, as 3 days later, I still > wasn't able to find anything on google. > > > On Tue, Oct 23, 2012 at 12:08 AM, David Parfitt wrote: > > Hello Metin - > > Sorry for the delay. At the moment, all metadata needs to be stored > under the <<"X-Riak-Meta">> dict key. The following example > illustrates how this works: > > %% To store metadata: > Object = riakc_obj:new(<<"groceries">>, <<"mine">>, <<"eggs & bacon">>). > MetaData = dict:from_list([{<<"X-Riak-Meta">>, [{"Foo", "Bar"}]}]), > Object2 = riakc_obj:update_metadata(Object, MetaData). > riakc_pb_socket:put(Pid, Object2). > > %% To retrieve metadata: > {ok, O} = riakc_pb_socket:get(Pid, <<"groceries">>, <<"mine">>). > {ok, MD} = dict:find(<<"X-Riak-Meta">>, riakc_obj:get_metadata(O)). > > We're kicking around ways to improve this in the future. > > Cheers - > Dave > > On Fri, Oct 19, 2012 at 8:31 AM, Metin Akat wrote: > > I am trying to do something like: > > Meta1 = dict:store(<<"ver">>, Ver, Meta0), > Obj1 = riakc_obj:update_metadata(Obj, Meta1), > > and then save the object. But on a subsequent read, the metadata k/v > pair is > not there. > > Is there anything special that needs to be done for this to work, or is > this > illegal way to use Riak? > > ___ > 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 > > > Hi, > > As far as I can see there seems to be an inconsistency between the Erlang > and HTTP APIs with respect to how metadata is handled. > > When I query the record created in the example through the Erlang API > (attached to console) I, as expected, get the following: > > {ok, RO} = C:get(<<"groceries">>, <<"mine">>). > {ok, MD} = dict:find(<<"X-Riak-Meta">>, riak_object:get_metadata(RO)). > {ok,[{"Foo","Bar"}]} > > The metadata parameter is stored in the dictionary exactly as created, which > is expected. > > When I query this record through the HTTP interface the same metadata is > returned as a header: > > curl -v -X HEAD http://localhost:8098/riak/groceries/mine > > HEAD /riak/groceries/mine HTTP/1.1 > > User-Agent: curl/7.21.4 (universal-apple-darwin11.0) libcurl/7.21.4 > OpenSSL/0.9.8r zlib/1.2.5 > > Host: localhost:8098 > > Accept: */* > > > < HTTP/1.1 200 OK > < X-Riak-Vclock: a85hYGBgzGDKBVIcypz/fga0yrzJYEpkzGNlEG36dZIvCwA= > < Vary: Accept-Encoding > < Server: MochiWeb/1.1 WebMachine/1.9.2 (someone had painted it blue) > < Link: ; rel="up" > < Foo: Bar > < ETag: "5hdCr8ayy5j9orqA6nDJfs" > < Content-Type: application/octet-stream > < Content-Length: 12 > < > > When I tried to create another record with the same metadata as the first > one through the HTTP interface, I had to prefix the metadata with > "X-Riak-Meta-" in order for it to be saved on the record. When I did this > the interface did however not seem to strip the "X-Riak-Meta-" prefix from > the parameter, and when I query the record through the Erlang API, the > parameter is stored in the metadata dict as "X-Riak-Meta-Foo" instead of > just "Foo". > > I was expecting the parameter to be stored as "Foo" internally in Riak and > represented as "X-Riak-Meta-Foo" when getting or setting through the HTTP > API, but that does not seem to be the case. > > Is this an inconsistency or is there something I am doing wrong or have > missed here? > > Best regards, > > Christian > > > > > ___ > 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