riak mapreduce failure

Mathias Meyer mathias at basho.com
Thu Jul 7 08:33:17 EDT 2011


Matt,

in your JS function, you return value, where instead you must return a list of values, so changing it to

return [value];

fixes the problem.

Mathias Meyer
Developer Advocate, Basho Technologies


On Donnerstag, 7. Juli 2011 at 05:53, Matt Graham wrote:

> Hi,
> I'm trying to test out riak's mapreduce for just a simple case but I
> can't get it to work. Maybe someone can help with what I'm doing
> wrong. I have the latest build of Riak available for Ubuntu
> installed.
> 
> I add an object to riak, that works. I can then fetch it. Then I try
> to run a mapreduce on that bucket and it fails.
> 
> mdg at maple:~/tmp$ curl -i -d 6 http://127.0.0.1:8098/riak/test/2
> HTTP/1.1 204 No Content
> Vary: Accept-Encoding
> Server: MochiWeb/1.1 WebMachine/1.7.3 (participate in the frantic)
> Date: Thu, 07 Jul 2011 03:47:00 GMT
> Content-Type: application/x-www-form-urlencoded
> Content-Length: 0
> 
> mdg at maple:~/tmp$ curl -i http://127.0.0.1:8098/riak/test/2
> HTTP/1.1 200 OK
> X-Riak-Vclock: a85hYGBgzGDKBVIs7JvMrDOYEhnzWBlMVnQe58sCAA==
> Vary: Accept-Encoding
> Server: MochiWeb/1.1 WebMachine/1.7.3 (participate in the frantic)
> Link: </riak/test>; rel="up"
> Last-Modified: Tue, 05 Jul 2011 09:33:16 GMT
> ETag: "4fhdlMvPAPNw4SegwaTNMv"
> Date: Thu, 07 Jul 2011 03:47:09 GMT
> Content-Type: application/x-www-form-urlencoded
> Content-Length: 1
> 
> 6
> mdg at maple:~/tmp$curl -i -d
> '{"inputs":"test","query":[{"map":{"language":"javascript","source":"function(value)
> { return value; }","keep":true}}]}' -H "Content-Type:
> application/json" http://127.0.0.1:8098/mapred
> HTTP/1.1 500 Internal Server Error
> Server: MochiWeb/1.1 WebMachine/1.7.3 (participate in the frantic)
> Date: Thu, 07 Jul 2011 03:47:22 GMT
> Content-Type: text/html
> Content-Length: 692
> 
> <html><head><title>500 Internal Server
> Error</title></head><body><h1>Internal Server Error</h1>The server
> encountered an error while processing this
> request:<br><pre>{error,{exit,{json_encode,{bad_term,{<<"bucket">>,<<"test">>}}},
>  [{mochijson2,json_encode,2},
>  {mochijson2,'-json_encode_array/2-fun-0-',3},
>  {lists,foldl,3},
>  {mochijson2,json_encode_array,2},
>  {riak_kv_wm_mapred,process_post,2},
>  {webmachine_resource,resource_call,3},
>  {webmachine_resource,do,3},
>  {webmachine_decision_core,resource_call,1}]}}</pre><P><HR><ADDRESS>mochiweb+webmachine
> web server</ADDRESS></body></html>
> 
> 
> I get that json_encode error every time. Any ideas on how to not get
> that or how to work around it?
> 
> Thanks,
> Matt
> 
> _______________________________________________
> riak-users mailing list
> riak-users at lists.basho.com (mailto:riak-users at lists.basho.com)
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com






More information about the riak-users mailing list