summaryrefslogtreecommitdiff
path: root/src/mongo/db/introspect.cpp
diff options
context:
space:
mode:
authorGeert Bosch <geert@mongodb.com>2014-09-25 14:41:01 -0400
committerGeert Bosch <geert@mongodb.com>2014-09-25 18:12:34 -0400
commit962f959a09b63aa0482d7e0c9bad89363d1e1194 (patch)
tree975a9ff722ec19992c15feb9d3fd1587278afc3c /src/mongo/db/introspect.cpp
parent77b00970997d13d0758c745e5a94fc79982d4401 (diff)
downloadmongo-962f959a09b63aa0482d7e0c9bad89363d1e1194.tar.gz
SERVER-14668: Replace uses of DBWrite lock with DBLock
Make the lock mode explicit as preparation to move some to intent locks, and use proper database name instead of full namespace string to lock databases.
Diffstat (limited to 'src/mongo/db/introspect.cpp')
-rw-r--r--src/mongo/db/introspect.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/mongo/db/introspect.cpp b/src/mongo/db/introspect.cpp
index c2f11b34e6d..c84a1caafa0 100644
--- a/src/mongo/db/introspect.cpp
+++ b/src/mongo/db/introspect.cpp
@@ -135,10 +135,11 @@ namespace {
BufBuilder profileBufBuilder(1024);
try {
- // NOTE: It's kind of weird that we lock the op's namespace, but have to for now since
- // we're sometimes inside the lock already
- Lock::DBWrite lk(txn->lockState(), currentOp.getNS() );
- if (dbHolder().get(txn, nsToDatabase(currentOp.getNS())) != NULL) {
+ // NOTE: It's kind of weird that we lock the op's namespace, but have to for now
+ // since we're sometimes inside the lock already
+ const string dbname(nsToDatabase(currentOp.getNS()));
+ Lock::DBLock lk(txn->lockState(), dbname, newlm::MODE_X);
+ if (dbHolder().get(txn, dbname) != NULL) {
// We are ok with the profiling happening in a different WUOW from the actual op.
WriteUnitOfWork wunit(txn);
Client::Context cx(txn, currentOp.getNS(), false);