summaryrefslogtreecommitdiff
path: root/src/mongo/db/db.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/db.cpp')
-rw-r--r--src/mongo/db/db.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/mongo/db/db.cpp b/src/mongo/db/db.cpp
index 34d915bced6..060943b5e7c 100644
--- a/src/mongo/db/db.cpp
+++ b/src/mongo/db/db.cpp
@@ -252,6 +252,7 @@ namespace mongo {
OperationContextImpl txn;
+ ScopedTransaction transaction(&txn, MODE_X);
Lock::GlobalWrite lk(txn.lockState());
AutoGetOrCreateDb autoDb(&txn, "local", mongo::MODE_X);
Database* db = autoDb.getDb();
@@ -310,6 +311,7 @@ namespace mongo {
*/
static unsigned long long checkIfReplMissingFromCommandLine(OperationContext* txn) {
// This is helpful for the query below to work as you can't open files when readlocked
+ ScopedTransaction transaction(txn, MODE_X);
Lock::GlobalWrite lk(txn->lockState());
if (!repl::getGlobalReplicationCoordinator()->getSettings().usingReplSets()) {
DBDirectClient c(txn);
@@ -322,6 +324,7 @@ namespace mongo {
LOG(1) << "enter repairDatabases (to check pdfile version #)" << endl;
OperationContextImpl txn;
+ ScopedTransaction transaction(&txn, MODE_X);
Lock::GlobalWrite lk(txn.lockState());
vector<string> dbNames;