Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-2409

Error attempting to use "reduce" MapReduce Output Mode

    • Type: Icon: Bug Bug
    • Resolution: Done
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 1.7.4
    • Component/s: None
    • Labels:
      None
    • Environment:
      1.7.4, 64 bit Mac OS X with Durability enabled
    • ALL

      I'm running a series of tests (See casbah-core/src/test/scala/MapReduceSpec.scala in Casbah for some of the test routines I'm running) and unable to successfully run a MapReduce with a 'reduce' output.

      'merge' works fine.

      I'm attempting to create a "final" map_reduce collection by having multiple MapReduce jobs on different identical datasets run with 'reduce' output.

      The collections I'm reading from are 'yield_historical.out.nineties' and 'yield_historical.out.aughts'. They contain data like such:

      { "_id" : 100, "value" :

      { "count" : 231, "sum" : 1380.3799999999985 }

      }
      { "_id" : 101, "value" :

      { "count" : 248, "sum" : 1245.1300000000003 }

      }
      { "_id" : 102, "value" :

      { "count" : 250, "sum" : 1153.27 }

      }
      { "_id" : 103, "value" :

      { "count" : 250, "sum" : 1003.4699999999997 }

      }
      { "_id" : 104, "value" :

      { "count" : 250, "sum" : 1067.8300000000008 }

      }
      { "_id" : 105, "value" :

      { "count" : 250, "sum" : 1072.2200000000003 }

      }
      { "_id" : 106, "value" :

      { "count" : 250, "sum" : 1198.7499999999989 }

      }
      { "_id" : 107, "value" :

      { "count" : 251, "sum" : 1163.3000000000002 }

      }
      { "_id" : 108, "value" :

      { "count" : 251, "sum" : 919.73 }

      }
      { "_id" : 109, "value" :

      { "count" : 250, "sum" : 816.0300000000009 }

      }
      { "_id" : 110, "value" :

      { "count" : 189, "sum" : 628.5199999999996 }

      }

      These collections were produced by running a normal mapReduce job with the same Map and Reduce function.

      When I attempt to run the job however, I get the error:

      { "assertion" : "Not an index cursor" , "assertionCode" : 9011 , "errmsg" : "db assertion failure" , "ok" : 0.0}

      The command being run is:

      { "mapreduce" : "yield_historical.out.aughts" ,
      "map" : "function m() { emit( typeof(this._id) == \"number\" ? this._id : this._id.getYear(),

      { count: 1, sum: this.bc10Year }

      ) }" ,
      "reduce" : " function r( year, values ) {
      var n =

      { count: 0, sum: 0 }

      for ( var i = 0; i < values.length; i++ )

      { n.sum += values[i].sum; n.count += values[i].count; }

      return n;
      }",
      "verbose" : true , "out" :

      { "reduce" : "yield_historical.out.all"}

      }

        1. reproduceMRReduceOutIssue.js
          1 kB
        2. yield_historical_in.json
          1.34 MB

            Assignee:
            Unassigned Unassigned
            Reporter:
            brendan Brendan W. McAdams
            Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

              Created:
              Updated:
              Resolved: