I have a problem with map/reduce functions in JavaScript

Grant Schofield grant at basho.com
Thu Feb 24 19:47:55 EST 2011


This looks to be an issue with the cache used for map reduce. This is a known bug and can be mitigated by setting map_cache_size to 0 in the riak_kv section of your app.config. Add the following:
{map_cache_size, 0},

Grant Schofield
Developer Advocate 
Basho Technologies


On Jan 30, 2011, at 5:44 PM, Constantin Teodorescu wrote:

> Using Riak 0.14.0-1_i386 on a 7 node cluster (mixed 686 & x86_64 Ubuntu and CentOS Linuxes)
> 
> Filled a "person" bucket with more than 100.000 persons with simple "ID" -> "NAME" document
> 
> Tried to query some data through HTTP API like that:
> 
> curl -X POST -H "content-type: application/json" http://172.16.0.251:8098/mapred --data @findPerson.json
> having the file findPerson.json like that:
> {    "inputs":{
>         "bucket":"persoane",
>         "key_filters":[["starts_with","26"]]
>     } ,
>     "query":[
>         {
>             "map":{
>                 "language":"javascript",
>                 "source":"function(v) {return [v.values[[0]].data+' - '+v.key];}"
>             }
>         },
>         {
>             "reduce":{
>                 "language":"javascript",
>                 "name":"Riak.reduceSort"
>             }
>         }
>     ]
> }
> 
> Everything worked ok, then I tried to query the database for counting persons, changing the query with :
> {    "inputs":{
>         "bucket":"orase",
>         "key_filters":[["starts_with","26"]]
>     } ,
>     "timeout": 900000,
>     "query":[
>         {
>             "map":{
>                 "language":"javascript",
>                 "source":"function(v) {return [1];}"
>             }
>         },
>         {
>             "reduce":{
>                 "language":"javascript",
>                 "name":"Riak.reduceSum"
>             }
>         }
>     ]
> }
> 
> The problem I got is that the answer is a mixed result from answers computed with the first JSON query and other computed with the second one.
> It's just like a couple of servers within the cluster have done the map/reduce functions USING the old javascript functions , remembering them ...
> 
> How could that be possible?
> Constantin Teodorescu
> 
> _______________________________________________
> riak-users mailing list
> riak-users at lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.basho.com/pipermail/riak-users_lists.basho.com/attachments/20110224/515e0191/attachment.html>


More information about the riak-users mailing list