summaryrefslogtreecommitdiff
path: root/src/mongo/db/ops
diff options
context:
space:
mode:
authorKaloian Manassiev <kaloian.manassiev@mongodb.com>2021-03-11 06:39:06 -0500
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2021-03-17 18:59:18 +0000
commite3b9f422e0977417f97821e53e436b3692d6037f (patch)
treef638ff90af4c91270d7d07be7d71a086798711ca /src/mongo/db/ops
parent0afd76f0c80b7e33de15fd2bce7e409dd88318bc (diff)
downloadmongo-e3b9f422e0977417f97821e53e436b3692d6037f.tar.gz
SERVER-52778 Mark all places where collections are implicitly created in sharding
Diffstat (limited to 'src/mongo/db/ops')
-rw-r--r--src/mongo/db/ops/write_ops_exec.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/src/mongo/db/ops/write_ops_exec.cpp b/src/mongo/db/ops/write_ops_exec.cpp
index e6738ae32ce..120df62843a 100644
--- a/src/mongo/db/ops/write_ops_exec.cpp
+++ b/src/mongo/db/ops/write_ops_exec.cpp
@@ -213,6 +213,7 @@ void assertCanWrite_inlock(OperationContext* opCtx, const NamespaceString& ns) {
str::stream() << "Not primary while writing to " << ns.ns(),
repl::ReplicationCoordinator::get(opCtx->getServiceContext())
->canAcceptWritesFor(opCtx, ns));
+
CollectionShardingState::get(opCtx, ns)->checkShardVersionOrThrow(opCtx);
}
@@ -226,6 +227,8 @@ void makeCollection(OperationContext* opCtx, const NamespaceString& ns) {
opCtx,
ns)) { // someone else may have beat us to it.
uassertStatusOK(userAllowedCreateNS(ns));
+ OperationShardingState::ScopedAllowImplicitCollectionCreate_UNSAFE
+ unsafeCreateCollection(opCtx);
WriteUnitOfWork wuow(opCtx);
CollectionOptions defaultCollectionOptions;
uassertStatusOK(db.getDb()->userCreateNS(opCtx, ns, defaultCollectionOptions));