summaryrefslogtreecommitdiff
path: root/src/mongo/scripting/engine_v8-3.25.cpp
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2014-07-24 14:44:23 -0400
committerKaloian Manassiev <kaloian.manassiev@mongodb.com>2014-07-28 17:14:17 -0400
commit78d2f38aa445ef1658300e66e1db14b9f1eceba8 (patch)
treed8503e6badb65230017c5c6a4042983283b11933 /src/mongo/scripting/engine_v8-3.25.cpp
parent5e515de16fe1eac1f7079a2a95aa9e4f716ee3ec (diff)
downloadmongo-78d2f38aa445ef1658300e66e1db14b9f1eceba8.tar.gz
SERVER-13961 Pass through OperationContext in the JS framework
The JS framework uses DBDirectClient, which requires OperationContext in order to not conflict with locks, which have already been acquired. This change also makes dbEval not use pooled scopes and create a new scope instead.
Diffstat (limited to 'src/mongo/scripting/engine_v8-3.25.cpp')
-rw-r--r--src/mongo/scripting/engine_v8-3.25.cpp17
1 files changed, 13 insertions, 4 deletions
diff --git a/src/mongo/scripting/engine_v8-3.25.cpp b/src/mongo/scripting/engine_v8-3.25.cpp
index 4bf7e34ad54..a2c57034e26 100644
--- a/src/mongo/scripting/engine_v8-3.25.cpp
+++ b/src/mongo/scripting/engine_v8-3.25.cpp
@@ -482,6 +482,10 @@ namespace mongo {
bool V8Scope::isKillPending() const {
return _pendingKill || _engine->interrupted();
}
+
+ OperationContext* V8Scope::getOpContext() const {
+ return _opCtx;
+ }
/**
* Display a list of all known ops (for verbose output)
@@ -505,7 +509,8 @@ namespace mongo {
_cpuProfiler(),
_interruptLock("ScopeInterruptLock"),
_inNativeExecution(true),
- _pendingKill(false) {
+ _pendingKill(false),
+ _opCtx(NULL) {
// create new isolate and enter it via a scope
_isolate.set(v8::Isolate::New());
@@ -1265,9 +1270,13 @@ namespace mongo {
v8::V8::LowMemoryNotification();
}
- void V8Scope::localConnect(const char * dbName) {
+ void V8Scope::localConnectForDbEval(OperationContext* txn, const char * dbName) {
{
- V8_SIMPLE_HEADER
+ V8_SIMPLE_HEADER;
+
+ invariant(_opCtx == NULL);
+ _opCtx = txn;
+
if (_connectState == EXTERNAL)
uasserted(12510, "externalSetup already called, can't call localConnect");
if (_connectState == LOCAL) {
@@ -1295,7 +1304,7 @@ namespace mongo {
_connectState = LOCAL;
_localDBName = dbName;
}
- loadStored();
+ loadStored(txn);
}
void V8Scope::externalSetup() {