diff options
author | Gregory Wlodarek <gregory.wlodarek@mongodb.com> | 2020-04-01 18:06:25 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2020-04-02 18:30:02 +0000 |
commit | 003a965a09beeb1e84b61094095cdd13ba738e32 (patch) | |
tree | f103322448b8201436617957e73c0f0faaef7ce6 /src | |
parent | df7ad9a3574142866fc1f604d2b47b9ca91ae437 (diff) | |
download | mongo-003a965a09beeb1e84b61094095cdd13ba738e32.tar.gz |
SERVER-47155 MultiIndexBlock::init() should invariant the collection is held with an exclusive lock
(cherry picked from commit 2f23989e4e0f51e1248d978fa8d8229102ac3019)
Diffstat (limited to 'src')
-rw-r--r-- | src/mongo/db/catalog/multi_index_block.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/catalog/multi_index_block.h | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/src/mongo/db/catalog/multi_index_block.cpp b/src/mongo/db/catalog/multi_index_block.cpp index d1064939b34..e6e8c96b01c 100644 --- a/src/mongo/db/catalog/multi_index_block.cpp +++ b/src/mongo/db/catalog/multi_index_block.cpp @@ -201,7 +201,7 @@ StatusWith<std::vector<BSONObj>> MultiIndexBlock::init(OperationContext* opCtx, Collection* collection, const std::vector<BSONObj>& indexSpecs, OnInitFn onInit) { - invariant(opCtx->lockState()->isCollectionLockedForMode(collection->ns(), MODE_IX), + invariant(opCtx->lockState()->isCollectionLockedForMode(collection->ns(), MODE_X), str::stream() << "Collection " << collection->ns() << " with UUID " << collection->uuid() << " is holding the incorrect lock"); if (State::kAborted == _getState()) { diff --git a/src/mongo/db/catalog/multi_index_block.h b/src/mongo/db/catalog/multi_index_block.h index dba00abe71f..4230b1f069b 100644 --- a/src/mongo/db/catalog/multi_index_block.h +++ b/src/mongo/db/catalog/multi_index_block.h @@ -128,7 +128,7 @@ public: * * Does not need to be called inside of a WriteUnitOfWork (but can be due to nesting). * - * Requires holding an intent lock on the collection. + * Requires holding an exclusive lock on the collection. */ using OnInitFn = std::function<Status(std::vector<BSONObj>& specs)>; StatusWith<std::vector<BSONObj>> init(OperationContext* opCtx, |