[SERVER-18505] MapReduce scope variables do not get cleaned up Created: 16/May/15  Updated: 17/May/15  Resolved: 17/May/15

Status: Closed
Project: Core Server
Component/s: MapReduce
Affects Version/s: None
Fix Version/s: None

Type: Bug Priority: Major - P3
Reporter: Jeroen Ooms [X] Assignee: Unassigned
Resolution: Duplicate Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Duplicate
duplicates SERVER-1912 Scope is retained across mapReduce jo... Closed
Operating System: ALL
Steps To Reproduce:

//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}})

Participants:

 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.



 Comments   
Comment by J Rassi [ 17/May/15 ]

Hi,

Thanks for the report. This is a known issue, described in SERVER-1912. Feel free to add yourself as a watcher to SERVER-1912 for updates, or to add any comments there that you see fit.

I'm closing this ticket as duplicate.

~ Jason Rassi

Comment by Jeroen Ooms [X] [ 16/May/15 ]

Jira messed up the markup. Below the example:

//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}})

Generated at Thu Feb 08 03:47:53 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.