summaryrefslogtreecommitdiff
path: root/src/mongo/db/dbcommands.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/dbcommands.cpp')
-rw-r--r--src/mongo/db/dbcommands.cpp30
1 files changed, 16 insertions, 14 deletions
diff --git a/src/mongo/db/dbcommands.cpp b/src/mongo/db/dbcommands.cpp
index 3fa6918ad50..e751dbaeebb 100644
--- a/src/mongo/db/dbcommands.cpp
+++ b/src/mongo/db/dbcommands.cpp
@@ -353,7 +353,7 @@ namespace mongo {
// Needs to be locked exclusively, because creates the system.profile collection
// in the local database.
//
- Lock::DBWrite dbXLock(dbname);
+ Lock::DBWrite dbXLock(txn->lockState(), dbname);
Client::Context ctx(dbname);
BSONElement e = cmdObj.firstElement();
@@ -403,7 +403,7 @@ namespace mongo {
// This doesn't look like it requires exclusive DB lock, because it uses its own diag
// locking, but originally the lock was set to be WRITE, so preserving the behaviour.
//
- Lock::DBWrite dbXLock(dbname);
+ Lock::DBWrite dbXLock(txn->lockState(), dbname);
Client::Context ctx(dbname);
int was = _diaglog.setLevel( cmdObj.firstElement().numberInt() );
@@ -457,7 +457,7 @@ namespace mongo {
return false;
}
- Lock::DBWrite dbXLock(dbname);
+ Lock::DBWrite dbXLock(txn->lockState(), dbname);
Client::Context ctx(nsToDrop);
Database* db = ctx.db();
@@ -528,7 +528,7 @@ namespace mongo {
// This acquires the DB read lock
//
- Client::ReadContext ctx(ns);
+ Client::ReadContext ctx(txn, ns);
string err;
int errCode;
@@ -621,7 +621,7 @@ namespace mongo {
!options["capped"].trueValue() || options["size"].isNumber() ||
options.hasField("$nExtents"));
- Lock::DBWrite dbXLock(dbname);
+ Lock::DBWrite dbXLock(txn->lockState(), dbname);
Client::Context ctx(ns);
// Create collection.
@@ -667,7 +667,7 @@ namespace mongo {
totalSize += size;
{
- Client::ReadContext rc( *i + ".system.namespaces" );
+ Client::ReadContext rc(txn, *i + ".system.namespaces");
b.appendBool( "empty", rc.ctx().db()->isEmpty() );
}
@@ -695,7 +695,7 @@ namespace mongo {
b.append( "sizeOnDisk" , (double)1.0 );
{
- Client::ReadContext ctx( name );
+ Client::ReadContext ctx(txn, name);
b.appendBool( "empty", ctx.ctx().db()->isEmpty() );
}
@@ -812,7 +812,7 @@ namespace mongo {
// Check shard version at startup.
// This will throw before we've done any work if shard version is outdated
- Client::ReadContext ctx(ns);
+ Client::ReadContext ctx(txn, ns);
Collection* coll = ctx.ctx().db()->getCollection(ns);
CanonicalQuery* cq;
@@ -920,7 +920,7 @@ namespace mongo {
BSONObj keyPattern = jsobj.getObjectField( "keyPattern" );
bool estimate = jsobj["estimate"].trueValue();
- Client::ReadContext ctx(ns);
+ Client::ReadContext ctx(txn, ns);
Collection* collection = ctx.ctx().db()->getCollection( ns );
@@ -1037,7 +1037,7 @@ namespace mongo {
bool run(OperationContext* txn, const string& dbname, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) {
const string ns = dbname + "." + jsobj.firstElement().valuestr();
- Client::ReadContext cx( ns );
+ Client::ReadContext cx(txn, ns);
Database* db = cx.ctx().db();
Collection* collection = db->getCollection( ns );
if ( !collection ) {
@@ -1114,7 +1114,7 @@ namespace mongo {
bool run(OperationContext* txn, const string& dbname, BSONObj& jsobj, int, string& errmsg, BSONObjBuilder& result, bool fromRepl ) {
const string ns = dbname + "." + jsobj.firstElement().valuestr();
- Lock::DBWrite dbXLock(dbname);
+ Lock::DBWrite dbXLock(txn->lockState(), dbname);
Client::Context ctx( ns );
Collection* coll = ctx.db()->getCollection( ns );
@@ -1244,7 +1244,7 @@ namespace mongo {
const string ns = parseNs(dbname, jsobj);
- Client::ReadContext ctx(ns);
+ Client::ReadContext ctx(txn, ns);
Database* d = ctx.ctx().db();
d->getStats( &result, scale );
@@ -1395,8 +1395,10 @@ namespace mongo {
std::vector<UserName> parsedUserNames;
AuthorizationSession* authSession = client.getAuthorizationSession();
bool fieldIsPresent = false;
- audit::parseAndRemoveImpersonatedUserField(cmdObj, authSession,
- &parsedUserNames, &fieldIsPresent);
+ audit::parseAndRemoveImpersonatedUserField(cmdObj,
+ authSession,
+ &parsedUserNames,
+ &fieldIsPresent);
ImpersonationSessionGuard impersonationSession(authSession,
fieldIsPresent,
parsedUserNames);