Kevin,

This means the code which creates the anonymous functions needs to be on the
> server-side codepath so the VM receiving the pointer can resolve it to
> runnable code.
>

ok


> If you're just experimenting with the map/reduce API AND you have a single
> Riak server (no cluster)


yes


> then you can get this to work by following these steps:
>
> 1) Start riak via 'bin/riak console'
> 2) Inside the console, obtain a Riak client instance like so: {ok, Client}
> = riak:local_client()
> 3) Build and execute your map/reduce job inside the riak console
>

i tried the above, so mostly replacing client_connect with local_client and
i still get the same type or err :

::./bin/riak console
Exec: /Users/bensix/FromFtp/riak/riak-0.9.1/erts-5.7.5/bin/erlexec -boot
/Users/bensix/FromFtp/riak/riak-0.9.1/releases/0.9.1/riak -embedded -config
/Users/bensix/FromFtp/riak/riak-0.9.1/etc/app.config -args_file
/Users/bensix/FromFtp/riak/riak-0.9.1/etc/vm.args -- console
Root: /Users/bensix/FromFtp/riak/riak-0.9.1
Erlang R13B04 (erts-5.7.5) [source] [smp:2:2] [rq:2] [async-threads:5]
[hipe] [kernel-poll:true]


=INFO REPORT==== 15-Apr-2010::11:07:21 ===
    alarm_handler: {set,{{disk_almost_full,"/"},[]}}

=INFO REPORT==== 15-Apr-2010::11:07:21 ===
Spidermonkey VM host starting (<0.105.0>)

=INFO REPORT==== 15-Apr-2010::11:07:21 ===
    alarm_handler: {set,{system_memory_high_watermark,[]}}

=INFO REPORT==== 15-Apr-2010::11:07:21 ===
Spidermonkey VM host starting (<0.106.0>)

=INFO REPORT==== 15-Apr-2010::11:07:21 ===
Spidermonkey VM host starting (<0.107.0>)

=INFO REPORT==== 15-Apr-2010::11:07:21 ===
Spidermonkey VM host starting (<0.108.0>)

=INFO REPORT==== 15-Apr-2010::11:07:21 ===
Spidermonkey VM host starting (<0.109.0>)

=INFO REPORT==== 15-Apr-2010::11:07:21 ===
Spidermonkey VM host starting (<0.110.0>)

=INFO REPORT==== 15-Apr-2010::11:07:21 ===
Spidermonkey VM host starting (<0.111.0>)

=INFO REPORT==== 15-Apr-2010::11:07:21 ===
Spidermonkey VM host starting (<0.112.0>)
Eshell V5.7.5  (abort with ^G)
([email protected])1> {ok, Client} = riak:local_client().
{ok,{riak_client,'[email protected]',<<4,211,148,124>>}}
([email protected])2> Count = fun(G, undefined, none) ->
([email protected])2>              [dict:from_list([{I, 1} || I <-
riak_object:get_value(G)])]
([email protected])2>            end.
#Fun<erl_eval.18.105910772>
([email protected])3> Merge = fun(Gcounts, none) ->
([email protected])3>              [lists:foldl(fun(G, Acc) ->
([email protected])3>                             dict:merge(fun(_, X, Y) ->
X+Y end,
([email protected])3>                                        G, Acc)
([email protected])3>                           end,
([email protected])3>                           dict:new(),
([email protected])3>                           Gcounts)]
([email protected])3>            end.
#Fun<erl_eval.12.113037538>
([email protected])4>  {ok, [R]} = Client:mapred([{<<"groceries">>,
<<"mine">>},
([email protected])4>                               {<<"groceries">>,
<<"yours">>}],
([email protected])4>                              [{map, {qfun, Count}, none,
false},
([email protected])4>                               {reduce, {qfun, Merge},
none, true}]).

=ERROR REPORT==== 15-Apr-2010::11:09:24 ===
** State machine <0.325.0> terminating
** Last event in was {mapexec_error,<0.326.0>,"all nodes failed"}
** When State == executing
**      Data  == {state,0,riak_map_phase,
                     {state,true,
                         {erlang,
                             {map,
                                 {qfun,#Fun<erl_eval.18.105910772>},
                                 none,false}},
                         [],
                         {chstate,'[email protected]',[],
                             {64,
                              [{0,'[email protected]'},

{22835963083295358096932575511191922182123945984,
                                '[email protected]'},

{45671926166590716193865151022383844364247891968,
                                '[email protected]'},

{68507889249886074290797726533575766546371837952,
                                '[email protected]'},

{91343852333181432387730302044767688728495783936,
                                '[email protected]'},

{114179815416476790484662877555959610910619729920,
                                '[email protected]'},

{137015778499772148581595453067151533092743675904,
                                '[email protected]'},

{159851741583067506678528028578343455274867621888,
                                '[email protected]'},

{182687704666362864775460604089535377456991567872,
                                '[email protected]'},

{205523667749658222872393179600727299639115513856,
                                '[email protected]'},

{228359630832953580969325755111919221821239459840,
                                '[email protected]'},

{251195593916248939066258330623111144003363405824,
                                '[email protected]'},

{274031556999544297163190906134303066185487351808,
                                '[email protected]'},

{296867520082839655260123481645494988367611297792,
                                '[email protected]'},

{319703483166135013357056057156686910549735243776,
                                '[email protected]'},

{342539446249430371453988632667878832731859189760,
                                '[email protected]'},

{365375409332725729550921208179070754913983135744,
                                '[email protected]'},

{388211372416021087647853783690262677096107081728,
                                '[email protected]'},

{411047335499316445744786359201454599278231027712,
                                '[email protected]'},

{433883298582611803841718934712646521460354973696,
                                '[email protected]'},

{456719261665907161938651510223838443642478919680,
                                '[email protected]'},

{479555224749202520035584085735030365824602865664,
                                '[email protected]'},

{502391187832497878132516661246222288006726811648,
                                '[email protected]'},

{525227150915793236229449236757414210188850757632,
                                '[email protected]'},

{548063113999088594326381812268606132370974703616,
                                '[email protected]'},

{570899077082383952423314387779798054553098649600,
                                '[email protected]'},

{593735040165679310520246963290989976735222595584,
                                '[email protected]'},

{616571003248974668617179538802181898917346541568,
                                '[email protected]'},

{639406966332270026714112114313373821099470487552,
                                '[email protected]'},

{662242929415565384811044689824565743281594433536,
                                '[email protected]'},

{685078892498860742907977265335757665463718379520,
                                '[email protected]'},

{707914855582156101004909840846949587645842325504,
                                '[email protected]'},

{730750818665451459101842416358141509827966271488,
                                '[email protected]'},

{753586781748746817198774991869333432010090217472,
                                '[email protected]'},

{776422744832042175295707567380525354192214163456,
                                '[email protected]'},

{799258707915337533392640142891717276374338109440,
                                '[email protected]'},

{822094670998632891489572718402909198556462055424,
                                '[email protected]'},

{844930634081928249586505293914101120738586001408,
                                '[email protected]'},

{867766597165223607683437869425293042920709947392,
                                '[email protected]'},

{890602560248518965780370444936484965102833893376,
                                '[email protected]'},

{913438523331814323877303020447676887284957839360,
                                '[email protected]'},

{936274486415109681974235595958868809467081785344,
                                '[email protected]'},

{959110449498405040071168171470060731649205731328,
                                '[email protected]'},

{981946412581700398168100746981252653831329677312,
                                '[email protected]'},

{1004782375664995756265033322492444576013453623296,
                                '[email protected]'},

{1027618338748291114361965898003636498195577569280,
                                '[email protected]'},

{1050454301831586472458898473514828420377701515264,
                                '[email protected]'},

{1073290264914881830555831049026020342559825461248,
                                '[email protected]'},

{1096126227998177188652763624537212264741949407232,
                                '[email protected]'},

{1118962191081472546749696200048404186924073353216,
                                '[email protected]'},

{1141798154164767904846628775559596109106197299200,
                                '[email protected]'},

{1164634117248063262943561351070788031288321245184,
                                '[email protected]'},

{1187470080331358621040493926581979953470445191168,
                                '[email protected]'},

{1210306043414653979137426502093171875652569137152,
                                '[email protected]'},

{1233142006497949337234359077604363797834693083136,
                                '[email protected]'},

{1255977969581244695331291653115555720016817029120,
                                '[email protected]'},

{1278813932664540053428224228626747642198940975104,
                                '[email protected]'},

{1301649895747835411525156804137939564381064921088,
                                '[email protected]'},

{1324485858831130769622089379649131486563188867072,
                                '[email protected]'},

{1347321821914426127719021955160323408745312813056,
                                '[email protected]'},

{1370157784997721485815954530671515330927436759040,
                                '[email protected]'},

{1392993748081016843912887106182707253109560705024,
                                '[email protected]'},

{1415829711164312202009819681693899175291684651008,
                                '[email protected]'},

{1438665674247607560106752257205091097473808596992,
                                '[email protected]'}]},
                             {dict,0,16,16,8,80,48,
                                 {[],[],[],[],[],[],[],[],[],[],[],[],[],[],
                                  [],[]},

{{[],[],[],[],[],[],[],[],[],[],[],[],[],[],
                                   [],[]}}}},
                         [<0.326.0>,<0.327.0>]},
                     false,false,undefined,undefined,
                     [<0.324.0>,<0.323.0>],
                     0,<0.322.0>,66000}
** Reason for termination =
** "all nodes failed"
** exception error: no match of right hand side value "all nodes failed"

but earlier :
([email protected])5> riak:client_test(node()).
ok
([email protected])6>
=INFO REPORT==== 15-Apr-2010::13:15:52 ===
Successfully completed 1 read/write cycle to '[email protected]'



>
> Alternatively, you'll need to define your map/reduce functions in a proper
> Erlang module and distribute it to all the Riak nodes and insure it's on the
> codepath. If you decide to go this route you can use Erlang's hot code
> loading to load updated versions of the functions without needing to reboot
> the Riak nodes.
>
> --Kevin
> On Apr 13, 2010, at 11:58 PM, ben six wrote:
>
> >
> > on macos 10.6.3 using riak-0.9.1 following instructions at
> https://wiki.basho.com/display/RIAK/Installing+on+Mac+OS+X
> > install and test passed without issue.
> > then tried the erland mapreduce example at
> https://wiki.basho.com/display/RIAK/MapReduce#MapReduce-MapReduceviatheErlangAPI
> >
> > ~/FromFtp/riak/riak-0.9.1/erts-5.7.5/bin/erl -name 
> > [email protected] riak -pa 
> > `pwd`/lib/riak-0.9.1.ez/riak-0.9.1/ebin
> > Erlang R13B04 (erts-5.7.5) [source] [smp:2:2] [rq:2] [async-threads:0]
> [hipe] [kernel-poll:false]
> >
> > Eshell V5.7.5  (abort with ^G)
> > ([email protected])1> code:which(riak).
> > "~/FromFtp/riak/riak-0.9.1/lib/riak-0.9.1.ez/riak-0.9.1/ebin/riak.beam"
> > ([email protected])2> {ok, Client} = riak:client_connect('
> [email protected]').
> > {ok,{riak_client,'[email protected]',<<6,202,197,138>>}}
> > ([email protected])4> Count = fun(G, undefined, none) ->
> > ([email protected])4>              [dict:from_list([{I, 1} || I <-
> riak_object:get_value(G)])]
> > ([email protected])4>            end.
> > #Fun<erl_eval.18.105910772>
> > ([email protected])5> Merge = fun(Gcounts, none) ->
> > ([email protected])5>              [lists:foldl(fun(G, Acc) ->
> > ([email protected])5>                             dict:merge(fun(_,
> X, Y) -> X+Y end,
> > ([email protected])5>                                        G, Acc)
> > ([email protected])5>                           end,
> > ([email protected])5>                           dict:new(),
> > ([email protected])5>                           Gcounts)]
> > ([email protected])5>            end.
> > #Fun<erl_eval.12.113037538>
> > ([email protected])6> {ok, [R]} = Client:mapred([{<<"groceries">>,
> <<"mine">>},
> > ([email protected])6>                               {<<"groceries">>,
> <<"yours">>}],
> > ([email protected])6>                              [{map, {qfun,
> Count}, none, false},
> > ([email protected])6>                               {reduce, {qfun,
> Merge}, none, true}]).
> > ** exception error: no match of right hand side value "all nodes failed"
> >
> > above happened when starting riak with console or plain ./bin/riak start
> (riak's erl shell : Erlang R13B04 (erts-5.7.5) [source] [smp:2:2] [rq:2]
> [async-threads:0] [hipe] [kernel-poll:false])
> >
> > also error when using erlang shell (from port : Erlang R13B03
> (erts-5.7.4) [source] [64-bit] [smp:2:2] [rq:2] [async-threads:0] [hipe]
> [kernel-poll:false]) :
> > ::erl -name [email protected] -setcookie riak -pa
> `pwd`/lib/riak-0.9.1.ez/riak-0.9.1/ebin
> > Erlang R13B03 (erts-5.7.4) [source] [64-bit] [smp:2:2] [rq:2]
> [async-threads:0] [hipe] [kernel-poll:false]
> >
> > Eshell V5.7.4  (abort with ^G)
> > ([email protected])1> code:which(riak).
> > "~/FromFtp/riak/riak-0.9.1/lib/riak-0.9.1.ez/riak-0.9.1/ebin/riak.beam"
> > ([email protected])2> {ok, Client} = riak:client_connect('
> [email protected]').
> > {ok,{riak_client,'[email protected]',<<4,181,78,207>>}}
> > ([email protected])4> Count = fun(G, undefined, none) ->
> > ([email protected])4>              [dict:from_list([{I, 1} || I <-
> riak_object:get_value(G)])]
> > ([email protected])4>            end.
> > #Fun<erl_eval.18.105910772>
> > ([email protected])5> Merge = fun(Gcounts, none) ->
> > ([email protected])5>              [lists:foldl(fun(G, Acc) ->
> > ([email protected])5>                             dict:merge(fun(_,
> X, Y) -> X+Y end,
> > ([email protected])5>                                        G, Acc)
> > ([email protected])5>                           end,
> > ([email protected])5>                           dict:new(),
> > ([email protected])5>                           Gcounts)]
> > ([email protected])5>            end.
> > #Fun<erl_eval.12.113037538>
> > ([email protected])6> {ok, [R]} = Client:mapred([{<<"groceries">>,
> <<"mine">>},
> > ([email protected])6>                               {<<"groceries">>,
> <<"yours">>}],
> > ([email protected])6>                              [{map, {qfun,
> Count}, none, false},
> > ([email protected])6>                               {reduce, {qfun,
> Merge}, none, true}]).
> > ** exception error: undefined function luke:new_flow/5
> >      in function  riak_client:mapred_stream/4
> >      in call from riak_client:mapred/4
> >
> > i used the default config files so the cookie is also consistant.
> > new to this so not sure where to get from there.
> > _______________________________________________
> > riak-users mailing list
> > [email protected]
> > http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com
>
>
_______________________________________________
riak-users mailing list
[email protected]
http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

Reply via email to