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

MapReduce scope variables do not get cleaned up

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Duplicate
    • Affects Version/s: None
    • Fix Version/s: None
    • Component/s: MapReduce
    • Labels:
      None
    • Operating System:
      ALL
    • Steps To Reproduce:
      Hide

      //some random data
      db.test.insert(

      {blabla:123}

      )

      //error
      db.test.mapReduce(function()

      {foo == true}, function(){}, {out:{inline:1}})

      //success
      db.test.mapReduce(function(){foo == true}

      , function(){}, {out:

      {inline:1}

      , scope:{foo:true}})

      //succeeds
      db.test.mapReduce(function()

      {foo == true}

      , function(){}, {out:{inline:1}})

      Show
      //some random data db.test.insert( {blabla:123} ) //error db.test.mapReduce(function() {foo == true}, function(){}, {out:{inline:1}}) //success db.test.mapReduce(function(){foo == true} , function(){}, {out: {inline:1} , scope:{foo:true}}) //succeeds db.test.mapReduce(function() {foo == true} , function(){}, {out:{inline:1}})

      Description

      It looks like any variables that are passed as part of the MapReduce 'scope' argument will linger around forever on the server, potentially affecting any future MapReduce commands. Is this intended behavior?

      I was under the impression that MapReduce functions were implemented as closures around the scoped environment, which would naturally clean the variables once they go out of scope.

        Attachments

          Issue Links

            Activity

              People

              Assignee:
              Unassigned
              Reporter:
              Jeroenooms Jeroen Ooms [X] (Inactive)
              Participants:
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

                Dates

                Created:
                Updated:
                Resolved: