On Fri, Jan 6, 2012 at 10:18 AM, Alin Popa <alin.p...@gmail.com> wrote: > and this is the code that I'm using for this: > > -module(simple_mapreduce). > > -compile(export_all). > > main(Pid) -> > {ok, Pid} = riakc_pb_socket:start_link("127.0.0.1", 8087), > Fun = fun(Object, _KeyData, none) -> [Object] end, > riakc_pb_socket:mapred(Pid, {<<"small-bucket">>,[]}, [{map, {qfun, Count}, > none, true}]). > > > It's a very simple usage, and according to the documentation, I haven't > missed anything here (I know I can use the modfun instead of qfun for > exactly this functionality, but it's just an example which throws). > > Also, for the master version of riak, I'm getting error as return value of > calling mapred function on riakc_pb_socket: > > {error,<<"{\"phase\":0,\"error\":\"undef\",\"input\":\"{ok,{r_object,<<\\\"small-bucket\\\">>,<<\\\"some-magnific-key-44\\\">>,[{r_cont"...>>} > > Is there a way that I can understand what these logs means ?
The clue is the "error:'undef'" field in the error message JSON you received. Just like any undef error in an erlang program, it's telling you the query tried to call a function that does not exist. The reason the function does not exist is that the Riak cluster does not have access to your 'simple_mapreduce' module. Since the anonymous function you are submitting was created in that module, Riak needs to be able to load the same version of it in order to evaluate the function. If you had used modfun instead, you would have received an error complaining that the module was unavailable. To make your module available to Riak, point the 'add_paths' setting in the riak_kv section of your app.config to the directory containing your module's compiled beam file. http://wiki.basho.com/Configuration-Files.html#add_paths Also, be sure to reload the module on each riak cluster node (using 'riak-admin erl_reload' on the command line) after making changes and recompiling your module. Hope that helps, Bryan _______________________________________________ riak-users mailing list riak-users@lists.basho.com http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com