summaryrefslogtreecommitdiff
path: root/src/mongo/db/storage/kv/kv_catalog.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo/db/storage/kv/kv_catalog.cpp')
-rw-r--r--src/mongo/db/storage/kv/kv_catalog.cpp8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/mongo/db/storage/kv/kv_catalog.cpp b/src/mongo/db/storage/kv/kv_catalog.cpp
index 8df05d06f0f..ced31ab93ac 100644
--- a/src/mongo/db/storage/kv/kv_catalog.cpp
+++ b/src/mongo/db/storage/kv/kv_catalog.cpp
@@ -410,7 +410,13 @@ Status KVCatalog::newCollection(OperationContext* opCtx,
const NamespaceString& nss,
const CollectionOptions& options,
KVPrefix prefix) {
- invariant(opCtx->lockState()->isDbLockedForMode(nss.db(), MODE_X));
+ // TODO(SERVER-39520): Once createCollection does not need database IX lock, 'system.views' will
+ // be no longer a special case.
+ if (nss.coll().startsWith("system.views")) {
+ invariant(opCtx->lockState()->isDbLockedForMode(nss.db(), MODE_IX));
+ } else {
+ invariant(opCtx->lockState()->isDbLockedForMode(nss.db(), MODE_X));
+ }
const string ident = _newUniqueIdent(nss.ns(), "collection");