summaryrefslogtreecommitdiff
path: root/src/mongo/db/matcher/expression_where.cpp
diff options
context:
space:
mode:
authorMathias Stearn <mathias@10gen.com>2013-08-22 15:11:53 -0400
committerMathias Stearn <mathias@10gen.com>2013-08-26 17:22:39 -0400
commit73841f7a1ec1322d96179eb2712ab438f56add00 (patch)
tree8f3eec6b3a9daf3c3ed7f69360b8db90f6bc79fc /src/mongo/db/matcher/expression_where.cpp
parentd0502e5bd74203d50ce5b4c8341de3ed01c6c508 (diff)
downloadmongo-73841f7a1ec1322d96179eb2712ab438f56add00.tar.gz
SERVER-10596 Globalize formerly per-thread Pool of JS Scopes
This ensures that the limit of 10 pooled scopes is actually enforced. With a per-thread Pool, long-lived connections could cause very high memory usage (both real and virtual) even if they haven't used JS in a long time.
Diffstat (limited to 'src/mongo/db/matcher/expression_where.cpp')
-rw-r--r--src/mongo/db/matcher/expression_where.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/mongo/db/matcher/expression_where.cpp b/src/mongo/db/matcher/expression_where.cpp
index 4ebf5343dc4..1e784ec8fb7 100644
--- a/src/mongo/db/matcher/expression_where.cpp
+++ b/src/mongo/db/matcher/expression_where.cpp
@@ -18,6 +18,7 @@
#include "mongo/pch.h"
#include "mongo/base/init.h"
+#include "mongo/db/auth/authorization_session.h"
#include "mongo/db/namespace_string.h"
#include "mongo/db/client.h"
#include "mongo/db/jsobj.h"
@@ -67,7 +68,10 @@ namespace mongo {
_userScope = scope.getOwned();
NamespaceString nswrapper( _ns );
- _scope = globalScriptEngine->getPooledScope( nswrapper.db().toString(), "where" );
+ const string userToken = ClientBasic::getCurrent()->getAuthorizationSession()
+ ->getAuthenticatedUserNamesToken();
+ _scope = globalScriptEngine->getPooledScope( nswrapper.db().toString(),
+ "where" + userToken );
_func = _scope->createFunction( _code.c_str() );
if ( !_func )