summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/mongo/db/commands/SConscript1
-rw-r--r--src/mongo/db/commands/create_indexes.cpp4
2 files changed, 5 insertions, 0 deletions
diff --git a/src/mongo/db/commands/SConscript b/src/mongo/db/commands/SConscript
index 7464bc5b2b0..bbc0780edb6 100644
--- a/src/mongo/db/commands/SConscript
+++ b/src/mongo/db/commands/SConscript
@@ -280,6 +280,7 @@ env.Library(
],
LIBDEPS_PRIVATE=[
'$BUILD_DIR/mongo/base',
+ '$BUILD_DIR/mongo/db/background',
'$BUILD_DIR/mongo/db/catalog/catalog_helpers',
'$BUILD_DIR/mongo/db/catalog/collection_catalog_helper',
'$BUILD_DIR/mongo/db/catalog/collection_query_info',
diff --git a/src/mongo/db/commands/create_indexes.cpp b/src/mongo/db/commands/create_indexes.cpp
index 94636ac0247..ada7fa43a7f 100644
--- a/src/mongo/db/commands/create_indexes.cpp
+++ b/src/mongo/db/commands/create_indexes.cpp
@@ -666,6 +666,10 @@ bool runCreateIndexesWithCoordinator(OperationContext* opCtx,
std::string& errmsg,
BSONObjBuilder& result) {
const NamespaceString ns(CommandHelpers::parseNsCollectionRequired(dbname, cmdObj));
+
+ // Disallows drops and renames on this namespace.
+ BackgroundOperation backgroundOp(ns.ns());
+
uassertStatusOK(userAllowedWriteNS(ns));
// Disallow users from creating new indexes on config.transactions since the sessions code