diff options
author | Xiangyu Yao <xiangyu.yao@mongodb.com> | 2019-03-22 17:17:21 -0400 |
---|---|---|
committer | Xiangyu Yao <xiangyu.yao@mongodb.com> | 2019-03-28 14:15:11 -0400 |
commit | b5f78884606ba87e5a1742e8dd19bbe2e03f709d (patch) | |
tree | 2678ce8730ccefb31ff756065bf79ade9cb6ecf7 /src/mongo/db/storage/kv/kv_catalog.cpp | |
parent | 00afe420f0eccb4204c5a235049385a1189e9c78 (diff) | |
download | mongo-b5f78884606ba87e5a1742e8dd19bbe2e03f709d.tar.gz |
SERVER-39519 Create/drop view now only takes database IX lock
Diffstat (limited to 'src/mongo/db/storage/kv/kv_catalog.cpp')
-rw-r--r-- | src/mongo/db/storage/kv/kv_catalog.cpp | 8 |
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"); |