summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/mr.cpp
diff options
context:
space:
mode:
authorAndrew Morrow <acm@mongodb.com>2015-10-07 13:50:46 -0400
committerAndrew Morrow <acm@mongodb.com>2015-10-12 12:25:23 -0400
commit644e0a886850763603de5c40498c26f78c1f4751 (patch)
tree10183e54ab450ee4175200cbf1cda65229d9fa25 /src/mongo/db/commands/mr.cpp
parent86df469d26ef8482ffcf5753929b8a5102086b90 (diff)
downloadmongo-644e0a886850763603de5c40498c26f78c1f4751.tar.gz
SERVER-20678 Create a new JS scope for each mapreduce
Diffstat (limited to 'src/mongo/db/commands/mr.cpp')
-rw-r--r--src/mongo/db/commands/mr.cpp6
1 files changed, 4 insertions, 2 deletions
diff --git a/src/mongo/db/commands/mr.cpp b/src/mongo/db/commands/mr.cpp
index b786cb033a8..ddac287ba86 100644
--- a/src/mongo/db/commands/mr.cpp
+++ b/src/mongo/db/commands/mr.cpp
@@ -762,8 +762,10 @@ void State::init() {
// setup js
const string userToken =
AuthorizationSession::get(ClientBasic::getCurrent())->getAuthenticatedUserNamesToken();
- _scope.reset(globalScriptEngine->getPooledScope(_txn, _config.dbname, "mapreduce" + userToken)
- .release());
+ _scope.reset(globalScriptEngine->newScopeForCurrentThread());
+ _scope->registerOperation(_txn);
+ _scope->setLocalDB(_config.dbname);
+ _scope->loadStored(_txn, true);
if (!_config.scopeSetup.isEmpty())
_scope->init(&_config.scopeSetup);