diff options
author | Benety Goh <benety@mongodb.com> | 2015-03-13 13:11:39 -0400 |
---|---|---|
committer | Benety Goh <benety@mongodb.com> | 2015-03-13 21:47:54 -0400 |
commit | 629eb083a2094b7a096b29d66504a8f34e1a1d60 (patch) | |
tree | d9adfa8a56ee82167b9ec9cfeaa38fa79d5bc1a2 /src | |
parent | 83ae47b5780cddca30fd09b40fa4d897895a595f (diff) | |
download | mongo-629eb083a2094b7a096b29d66504a8f34e1a1d60.tar.gz |
SERVER-17330 cleaned up receivedInsert - index build not possible in this code path
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/instance.cpp | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/src/mongo/db/instance.cpp b/src/mongo/db/instance.cpp index cdb1ee82116..edbc7e458a3 100644 --- a/src/mongo/db/instance.cpp +++ b/src/mongo/db/instance.cpp @@ -1033,11 +1033,9 @@ namespace mongo { const int notMasterCodeForInsert = 10058; // This is different from ErrorCodes::NotMaster { - const bool isIndexBuild = (nsToCollectionSubstring(ns) == "system.indexes"); - const LockMode mode = isIndexBuild ? MODE_X : MODE_IX; ScopedTransaction transaction(txn, MODE_IX); - Lock::DBLock dbLock(txn->lockState(), nsString.db(), mode); - Lock::CollectionLock collLock(txn->lockState(), nsString.ns(), mode); + Lock::DBLock dbLock(txn->lockState(), nsString.db(), MODE_IX); + Lock::CollectionLock collLock(txn->lockState(), nsString.ns(), MODE_IX); // CONCURRENCY TODO: is being read locked in big log sufficient here? // writelock is used to synchronize stepdowns w/ writes @@ -1047,7 +1045,7 @@ namespace mongo { // Client::Context may implicitly create a database, so check existence if (dbHolder().get(txn, nsString.db()) != NULL) { Client::Context ctx(txn, ns); - if (mode == MODE_X || ctx.db()->getCollection(nsString)) { + if (ctx.db()->getCollection(nsString)) { if (multi.size() > 1) { const bool keepGoing = d.reservedField() & InsertOption_ContinueOnError; insertMulti(txn, ctx, keepGoing, ns, multi, op); |