summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/compact.cpp
diff options
context:
space:
mode:
authorGeert Bosch <geert@mongodb.com>2014-09-30 09:56:21 -0400
committerGeert Bosch <geert@mongodb.com>2014-09-30 22:02:04 -0400
commitda599844c97ef6d290c03e073a9bafe41c1a914e (patch)
tree4b942aba73479a433b371db0dd713b3f0bd375f8 /src/mongo/db/commands/compact.cpp
parent068b1d23bb513bfc819de61514262a12cb75bcbb (diff)
downloadmongo-da599844c97ef6d290c03e073a9bafe41c1a914e.tar.gz
SERVER-14668: Replace uses of DBWrite lock with DBLock
This reverts commit 8e83e72512fcb8eb8f06987927766c0b77cea23e. This reinstates commit ae333bc94a7d89d3220dcae9579fcaf68aa2e290 and commit 962f959a09b63aa0482d7e0c9bad89363d1e1194, and fixes three cases where the wrong database name was locked.
Diffstat (limited to 'src/mongo/db/commands/compact.cpp')
-rw-r--r--src/mongo/db/commands/compact.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mongo/db/commands/compact.cpp b/src/mongo/db/commands/compact.cpp
index 5ed0ac16aca..8ffac0bff38 100644
--- a/src/mongo/db/commands/compact.cpp
+++ b/src/mongo/db/commands/compact.cpp
@@ -97,7 +97,7 @@ namespace mongo {
return false;
}
- NamespaceString ns(db,coll);
+ NamespaceString ns(db, coll);
if ( !ns.isNormal() ) {
errmsg = "bad namespace name";
return false;
@@ -144,7 +144,7 @@ namespace mongo {
compactOptions.validateDocuments = cmdObj["validate"].trueValue();
- Lock::DBWrite lk(txn->lockState(), ns.ns());
+ Lock::DBLock lk(txn->lockState(), db, newlm::MODE_X);
BackgroundOperation::assertNoBgOpInProgForNs(ns.ns());
Client::Context ctx(txn, ns);