Re: Question about link-walk results returned by erlang_pb_client
Hi Alex, Thank you for the clarify( and the warning :) ). Just out of curiosity, by using erlang_pb_client, is there a good way to retrieve *all* the Objects that have been walked in on shot( like the HTTP interface does)? And if there's not, then how is the HTTP map-reduce implemented so that it can return all the Objects alone the way? Best Regards :) fxmy 2014-03-15 0:30 GMT+08:00 Alex Moore amo...@basho.com: Hi fxmy, The return value is just Bucket/Key/link-tag pairs, without ObjectValue or other metadata. {ok,[{0,[[people,timoreilly,friend]]}, {1,[[people,dhh,friend]]}]} Is this intended or not? This is intended. You are running a map reduce job with one link stage, which does the link walking for you. Link stages only return a list of key/value/relation tuples. If so, what's the best way to get these ObjectValues through one single pass of link-walking? If you want to grab everything in one shot you would have to feed the link stage's output into a map stage to grab the actual objects: {ok, RiakObj} = riakc_pb_socket:mapred(Pid,[{people, timoreilly}], [{link, people, friend, false}, {link, people, friend, false}, {map, {modfun, riak_kv_mapreduce, map_identity}, none, true}]). This should give you the entire object for the results of the last link phase, namely Dave Thomas's. I should warn you thought that while link walking and map reduce let you do things like this in one shot, you should be cautious about using them in production since a bad query can kill performance. Thanks, Alex On Mar 14, 2014, at 6:49 AM, fxmy wang fxm...@gmail.com wrote: Hi, list, This should be a trivial question and I think I'm definitely missing something( and feeling stupid :\). So when I am doing a chained link-walking through HTTP interface like this(copied from link walking docs): curl -v localhost:8091/riak/people/davethomas/_,friend,1/_,friend,_/ The output is quite verbose, including Bucket/Key/Value etc.etc. --JCgqdOHsL4BdXPCb0cuQDnLTxOH Content-Type: multipart/mixed; boundary=LpfqXc9urbAJJNFH7aGGPBiAtnX --LpfqXc9urbAJJNFH7aGGPBiAtnX X-Riak-Vclock: a85hYGBgzGDKBVIcc+04TgWFOj/NYEpkzGNlyNCadoYvCwA= Location: /riak/people/timoreilly Content-Type: text/plain Link: /riak/people/dhh; riaktag=friend, /riak/people; rel=up Etag: 3DmGNeyDj2hUlLR2UhJvMr Last-Modified: Thu, 13 Mar 2014 13:11:04 GMT I am an excellent public speaker. --LpfqXc9urbAJJNFH7aGGPBiAtnX-- --JCgqdOHsL4BdXPCb0cuQDnLTxOH Content-Type: multipart/mixed; boundary=IcBLyeIFObvJlJGyXuhTty5cRSs --IcBLyeIFObvJlJGyXuhTty5cRSs X-Riak-Vclock: a85hYGBgzGDKBVIcR4M2cgeFOkdkMCUy5rEyzNSadoYvCwA= Location: /riak/people/dhh Content-Type: text/plain Link: /riak/people; rel=up Etag: 4qbA2ZufXNgzFRb8PlSLUO Last-Modified: Thu, 13 Mar 2014 13:11:53 GMT I drive a Zonda. --IcBLyeIFObvJlJGyXuhTty5cRSs-- --JCgqdOHsL4BdXPCb0cuQDnLTxOH-- But when I retried it through the erlang_pb_client riakc_pb_socket:mapred(Pid,[{people, davethomas}],[{link, people, friend, true},{link, people, friend, true}]). The return value is just Bucket/Key/link-tag pairs, without ObjectValue or other metadata. {ok,[{0,[[people,timoreilly,friend]]}, {1,[[people,dhh,friend]]}]} Is this intended or not? If so, what's the best way to get these ObjectValues through one single pass of link-walking? Cheers, ___ 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
Question about link-walk results returned by erlang_pb_client
Hi, list, This should be a trivial question and I think I'm definitely missing something( and feeling stupid :\). So when I am doing a chained link-walking through HTTP interface like this(copied from link walking docshttp://docs.basho.com/riak/latest/dev/using/link-walking/ ): curl -v localhost:8091/riak/people/davethomas/_,friend,1/_,friend,_/ The output is quite verbose, including Bucket/Key/Value etc.etc. --JCgqdOHsL4BdXPCb0cuQDnLTxOH Content-Type: multipart/mixed; boundary=LpfqXc9urbAJJNFH7aGGPBiAtnX --LpfqXc9urbAJJNFH7aGGPBiAtnX X-Riak-Vclock: a85hYGBgzGDKBVIcc+04TgWFOj/NYEpkzGNlyNCadoYvCwA= Location: /riak/people/timoreilly Content-Type: text/plain Link: /riak/people/dhh; riaktag=friend, /riak/people; rel=up Etag: 3DmGNeyDj2hUlLR2UhJvMr Last-Modified: Thu, 13 Mar 2014 13:11:04 GMT I am an excellent public speaker. --LpfqXc9urbAJJNFH7aGGPBiAtnX-- --JCgqdOHsL4BdXPCb0cuQDnLTxOH Content-Type: multipart/mixed; boundary=IcBLyeIFObvJlJGyXuhTty5cRSs --IcBLyeIFObvJlJGyXuhTty5cRSs X-Riak-Vclock: a85hYGBgzGDKBVIcR4M2cgeFOkdkMCUy5rEyzNSadoYvCwA= Location: /riak/people/dhh Content-Type: text/plain Link: /riak/people; rel=up Etag: 4qbA2ZufXNgzFRb8PlSLUO Last-Modified: Thu, 13 Mar 2014 13:11:53 GMT I drive a Zonda. --IcBLyeIFObvJlJGyXuhTty5cRSs-- --JCgqdOHsL4BdXPCb0cuQDnLTxOH-- But when I retried it through the erlang_pb_client riakc_pb_socket:mapred(Pid,[{people, davethomas}],[{link, people, friend, true},{link, people, friend, true}]). The return value is just Bucket/Key/link-tag pairs, without ObjectValue or other metadata. {ok,[{0,[[people,timoreilly,friend]]}, {1,[[people,dhh,friend]]}]} Is this intended or not? If so, what's the best way to get these ObjectValues through one single pass of link-walking? Cheers, ___ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
Re: Question about link-walk results returned by erlang_pb_client
Hi fxmy, The return value is just Bucket/Key/link-tag pairs, without ObjectValue or other metadata. {ok,[{0,[[people,timoreilly,friend]]}, {1,[[people,dhh,friend]]}]} Is this intended or not? This is intended. You are running a map reduce job with one “link” stage, which does the link walking for you. Link stages only return a list of key/value/relation tuples. If so, what's the best way to get these ObjectValues through one single pass of link-walking? If you want to grab everything in one shot you would have to feed the link stage’s output into a map stage to grab the actual objects: {ok, RiakObj} = riakc_pb_socket:mapred(Pid,[{people, timoreilly}], [{link, people, friend, false}, {link, people, friend, false}, {map, {modfun, riak_kv_mapreduce, map_identity}, none, true}]). This should give you the entire object for the results of the last link phase, namely Dave Thomas’s. I should warn you thought that while link walking and map reduce let you do things like this in one shot, you should be cautious about using them in production since a bad query can kill performance. Thanks, Alex On Mar 14, 2014, at 6:49 AM, fxmy wang fxm...@gmail.com wrote: Hi, list, This should be a trivial question and I think I'm definitely missing something( and feeling stupid :\). So when I am doing a chained link-walking through HTTP interface like this(copied from link walking docs): curl -v localhost:8091/riak/people/davethomas/_,friend,1/_,friend,_/ The output is quite verbose, including Bucket/Key/Value etc.etc. --JCgqdOHsL4BdXPCb0cuQDnLTxOH Content-Type: multipart/mixed; boundary=LpfqXc9urbAJJNFH7aGGPBiAtnX --LpfqXc9urbAJJNFH7aGGPBiAtnX X-Riak-Vclock: a85hYGBgzGDKBVIcc+04TgWFOj/NYEpkzGNlyNCadoYvCwA= Location: /riak/people/timoreilly Content-Type: text/plain Link: /riak/people/dhh; riaktag=friend, /riak/people; rel=up Etag: 3DmGNeyDj2hUlLR2UhJvMr Last-Modified: Thu, 13 Mar 2014 13:11:04 GMT I am an excellent public speaker. --LpfqXc9urbAJJNFH7aGGPBiAtnX-- --JCgqdOHsL4BdXPCb0cuQDnLTxOH Content-Type: multipart/mixed; boundary=IcBLyeIFObvJlJGyXuhTty5cRSs --IcBLyeIFObvJlJGyXuhTty5cRSs X-Riak-Vclock: a85hYGBgzGDKBVIcR4M2cgeFOkdkMCUy5rEyzNSadoYvCwA= Location: /riak/people/dhh Content-Type: text/plain Link: /riak/people; rel=up Etag: 4qbA2ZufXNgzFRb8PlSLUO Last-Modified: Thu, 13 Mar 2014 13:11:53 GMT I drive a Zonda. --IcBLyeIFObvJlJGyXuhTty5cRSs-- --JCgqdOHsL4BdXPCb0cuQDnLTxOH-- But when I retried it through the erlang_pb_client riakc_pb_socket:mapred(Pid,[{people, davethomas}],[{link, people, friend, true},{link, people, friend, true}]). The return value is just Bucket/Key/link-tag pairs, without ObjectValue or other metadata. {ok,[{0,[[people,timoreilly,friend]]}, {1,[[people,dhh,friend]]}]} Is this intended or not? If so, what's the best way to get these ObjectValues through one single pass of link-walking? Cheers, ___ 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