diff options
author | Benety Goh <benety@mongodb.com> | 2017-03-23 13:30:31 -0400 |
---|---|---|
committer | Benety Goh <benety@mongodb.com> | 2017-03-24 15:45:15 -0400 |
commit | fd46b39bd957df28fa2273bf5e4dcbb1765e4026 (patch) | |
tree | 698ce6bb075c373a689ced2f539a495b0c194113 | |
parent | 9bc30836f60a888c44de09c55a45c278b215a02b (diff) | |
download | mongo-fd46b39bd957df28fa2273bf5e4dcbb1765e4026.tar.gz |
SERVER-27834 disable implicit collection creation in IndexBuilder
-rw-r--r-- | src/mongo/db/index_builder.cpp | 19 |
1 files changed, 3 insertions, 16 deletions
diff --git a/src/mongo/db/index_builder.cpp b/src/mongo/db/index_builder.cpp index 599f81bac74..db567073a8c 100644 --- a/src/mongo/db/index_builder.cpp +++ b/src/mongo/db/index_builder.cpp @@ -126,22 +126,9 @@ Status IndexBuilder::_build(OperationContext* opCtx, const NamespaceString ns(_index["ns"].String()); Collection* c = db->getCollection(ns.ns()); - if (!c) { - while (true) { - try { - WriteUnitOfWork wunit(opCtx); - c = db->getOrCreateCollection(opCtx, ns.ns()); - verify(c); - wunit.commit(); - break; - } catch (const WriteConflictException& wce) { - LOG(2) << "WriteConflictException while creating collection in IndexBuilder" - << ", retrying."; - opCtx->recoveryUnit()->abandonSnapshot(); - continue; - } - } - } + + // Collections should not be implicitly created by the index builder. + fassert(40409, c); { stdx::lock_guard<Client> lk(*opCtx->getClient()); |