So roughly what I have is a function which queries a range of indexes from one bucket, and moves stuff to a different bucket (by creating new objects and deleting the old).
In testing this it seems if a map-reduce is performed on a bucket immediately after deleting items in the bucket then mapreduce crashes.
The map function is simply function(v){ var data = JSON.parse(v.values[0].data); return [[v.key, data]]; }
which raises
exceptions.Exception: Error running map/reduce job. Error: {"phase":0,"error":"[{<<"lineno">>,466},{<<"message">>,<<"SyntaxError: syntax error">>},{<<"source">>,<<"()">>}]","input":"{ok,{r_object,<<"83c51667a80570be3398d1b3df1d809c">>,<<"f500d39cd4c811e1907de8393525dd84">>,[{r_content,{dict,4,16,16,8,80,48,{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]},{{[],[],[],[],[],[],[],[],[],[],[[<<"X-Riak-VTag">>,53,56,112,104,89,76,97,100,86,97,83,57,106,56,107,67,56,74,75,49,101,113]],[[<<"index">>]],[[<<"X-Riak-Deleted">>,116,114,117,101]],[[<<"X-Riak-Last-Modified">>|{1343,49536,881595}]],[],[]}}},<<>>}],[{<<35,9,254,249,79,206,43,166>>,{2,63510268736}}],{dict,1,16,16,8,80,...},...},...}"}
The Riak installation has 1 node only running 1.1.2
The MapReduce works any other time, except immediately after deleting items.
==> console.log <==
2012-07-23 15:18:56.999 [error] <0.27369.1> gen_fsm <0.27369.1> in state wait_pipeline_shutdown terminated with reason: {sink_died,shutdown}
2012-07-23 15:18:57.001 [error] <0.301.0>@riak_pipe_vnode:new_worker:766 Pipe worker startup failed:fitting was gone before startup
2012-07-23 15:18:57.002 [error] <0.269.0>@riak_pipe_vnode:new_worker:766 Pipe worker startup failed:fitting was gone before startup
2012-07-23 15:18:57.001 [error] <0.329.0>@riak_pipe_vnode:new_worker:766 Pipe worker startup failed:fitting was gone before startup
2012-07-23 15:18:57.019 [error] <0.27369.1> CRASH REPORT Process <0.27369.1> with 0 neighbours crashed with reason: {sink_died,shutdown}
2012-07-23 15:18:57.087 [error] <0.154.0> Supervisor riak_pipe_builder_sup had child undefined started with {riak_pipe_builder,start_link,undefined} at <0.27369.1> exit with reason {sink_died,shutdown} in context child_terminated
==> crash.log <==
2012-07-23 15:18:56 =ERROR REPORT====
** State machine <0.27369.1> terminating
** Last message in was {'DOWN',#Ref<0.0.0.258924>,process,<0.27367.1>,shutdown}
** When State == wait_pipeline_shutdown
** Data == {state,[{sink,{fitting,<0.27367.1>,#Ref<0.0.0.258911>,{riak_kv_pipe_get,bkey_chash},{riak_kv_pipe_get,bkey_nval}}},{trace,{set,1,16,16,8,80,48,{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]},{{[],[],[error],[],[],[],[],[],[],[],[],[],[],[],[],[]}}}},{log,{sink,{fitting,<0.27185.1>,#Ref<0.0.0.258911>,sink,undefined}}}],{pipe,<0.27369.1>,[{listkeys,{fitting,<0.27370.1>,#Ref<0.0.0.258911>,{chash,key_of},1}}],{fitting,<0.27367.1>,#Ref<0.0.0.258911>,{riak_kv_pipe_get,bkey_chash},{riak_kv_pipe_get,bkey_nval}}},[{{fitting,<0.27370.1>,#Ref<0.0.0.258911>,{chash,key_of},1},#Ref<0.0.0.258927>}],#Ref<0.0.0.258924>}
** Reason for termination =
** {sink_died,shutdown}
==> crash.log <==
2012-07-23 15:18:57 =CRASH REPORT====
crasher:
initial call: riak_pipe_builder:init/1
pid: <0.27369.1>
registered_name: []
exception exit: {sink_died,shutdown}
in function gen_fsm:terminate/7
in call from proc_lib:init_p_do_apply/3
ancestors: [riak_pipe_builder_sup,riak_pipe_sup,<0.151.0>]
messages: [{'DOWN',#Ref<0.0.0.258927>,process,<0.27370.1>,shutdown}]
links: [<0.154.0>]
dictionary: [{eunit,[{module,riak_pipe_builder},{ref,#Ref<0.0.0.258911>},{spec,[{fitting_spec,listkeys,riak_kv_pipe_listkeys,undefined,{chash,key_of},1,64}]},{options,[{sink,{fitting,<0.27367.1>,#Ref<0.0.0.258911>,{riak_kv_pipe_get,bkey_chash},{riak_kv_pipe_get,bkey_nval}}},{trace,{set,1,16,16,8,80,48,{[],[],[],[],[],[],[],[],[],[],[],[],[],[],[],[]},{{[],[],[error],[],[],[],[],[],[],[],[],[],[],[],[],[]}}}},{log,{sink,{fitting,<0.27185.1>,#Ref<0.0.0.258911>,sink,undefined}}}]},{fittings,[{{fitting,<0.27370.1>,#Ref<0.0.0.258911>,{chash,key_of},1},#Ref<0.0.0.258927>}]}]}]
trap_exit: false
status: running
heap_size: 987
stack_size: 24
reductions: 251
neighbours:
2012-07-23 15:18:57 =SUPERVISOR REPORT====
Supervisor: {local,riak_pipe_builder_sup}
Context: child_terminated
Reason: {sink_died,shutdown}
Offender: [{pid,<0.27369.1>},{name,undefined},{mfargs,{riak_pipe_builder,start_link,undefined}},{restart_type,temporary},{shutdown,brutal_kill},{child_type,worker}]
==> error.log <==
2012-07-23 15:18:56.999 [error] <0.27369.1> gen_fsm <0.27369.1> in state wait_pipeline_shutdown terminated with reason: {sink_died,shutdown}
2012-07-23 15:18:57.001 [error] <0.301.0>@riak_pipe_vnode:new_worker:766 Pipe worker startup failed:fitting was gone before startup
2012-07-23 15:18:57.001 [error] <0.329.0>@riak_pipe_vnode:new_worker:766 Pipe worker startup failed:fitting was gone before startup
2012-07-23 15:18:57.002 [error] <0.269.0>@riak_pipe_vnode:new_worker:766 Pipe worker startup failed:fitting was gone before startup
2012-07-23 15:18:57.019 [error] <0.27369.1> CRASH REPORT Process <0.27369.1> with 0 neighbours crashed with reason: {sink_died,shutdown}
2012-07-23 15:18:57.087 [error] <0.154.0> Supervisor riak_pipe_builder_sup had child undefined started with {riak_pipe_builder,start_link,undefined} at <0.27369.1> exit with reason {sink_died,shutdown} in context child_terminated