diff options
Diffstat (limited to 'src/mongo/db/index_builder.cpp')
-rw-r--r-- | src/mongo/db/index_builder.cpp | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/mongo/db/index_builder.cpp b/src/mongo/db/index_builder.cpp index ba2cbd6d6ef..0ed860c5dea 100644 --- a/src/mongo/db/index_builder.cpp +++ b/src/mongo/db/index_builder.cpp @@ -175,7 +175,9 @@ Status IndexBuilder::_build(OperationContext* txn, dbLock->relockWithMode(MODE_IX); } - Lock::CollectionLock colLock(txn->lockState(), ns.ns(), MODE_IX); + // We need an X lock and not an IX lock for background index building. See the + // createIndexes command for a detailed example. + Lock::CollectionLock colLock(txn->lockState(), ns.ns(), MODE_X); status = indexer.insertAllDocumentsInCollection(); } |