summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Gottlieb <daniel.gottlieb@mongodb.com>2019-10-10 18:35:39 +0000
committerevergreen <evergreen@mongodb.com>2019-10-10 18:35:39 +0000
commit458987d4184fc6e5995b91980b5ea79c83cb86b3 (patch)
tree52be9e061484c98e725e0c29386a57275ab40505
parentbc9b3c12cc1f2a400f3f1834db8f03487063e658 (diff)
downloadmongo-458987d4184fc6e5995b91980b5ea79c83cb86b3.tar.gz
SERVER-43403: Check index creation namespace after reacquiring locks.
-rw-r--r--src/mongo/db/SConscript13
-rw-r--r--src/mongo/db/index_builds_coordinator.cpp5
2 files changed, 12 insertions, 6 deletions
diff --git a/src/mongo/db/SConscript b/src/mongo/db/SConscript
index 0170303b829..bd2d8c9885b 100644
--- a/src/mongo/db/SConscript
+++ b/src/mongo/db/SConscript
@@ -778,24 +778,25 @@ env.Library(
],
LIBDEPS=[
"$BUILD_DIR/mongo/base",
- '$BUILD_DIR/mongo/db/catalog_raii',
"$BUILD_DIR/mongo/db/catalog/commit_quorum_options",
"$BUILD_DIR/mongo/db/catalog/index_builds_manager",
+ '$BUILD_DIR/mongo/db/catalog_raii',
],
LIBDEPS_PRIVATE=[
- 'catalog/database_holder',
- 'db_raii',
- 'index_build_entry_helpers',
- 'server_options_core',
- '$BUILD_DIR/mongo/db/catalog/index_build_entry_idl',
'$BUILD_DIR/mongo/db/catalog/collection',
'$BUILD_DIR/mongo/db/catalog/collection_catalog',
+ '$BUILD_DIR/mongo/db/catalog/index_build_entry_idl',
'$BUILD_DIR/mongo/db/concurrency/lock_manager',
'$BUILD_DIR/mongo/db/repl/repl_coordinator_interface',
'$BUILD_DIR/mongo/db/repl/timestamp_block',
'$BUILD_DIR/mongo/db/s/sharding_api_d',
+ '$BUILD_DIR/mongo/db/write_ops',
'$BUILD_DIR/mongo/idl/server_parameter',
'$BUILD_DIR/mongo/util/fail_point',
+ 'catalog/database_holder',
+ 'db_raii',
+ 'index_build_entry_helpers',
+ 'server_options_core',
],
)
diff --git a/src/mongo/db/index_builds_coordinator.cpp b/src/mongo/db/index_builds_coordinator.cpp
index 5f356c81111..c76153d01bf 100644
--- a/src/mongo/db/index_builds_coordinator.cpp
+++ b/src/mongo/db/index_builds_coordinator.cpp
@@ -46,6 +46,7 @@
#include "mongo/db/index_build_entry_helpers.h"
#include "mongo/db/op_observer.h"
#include "mongo/db/operation_context.h"
+#include "mongo/db/ops/insert.h"
#include "mongo/db/repl/member_state.h"
#include "mongo/db/repl/replication_coordinator.h"
#include "mongo/db/repl/timestamp_block.h"
@@ -644,6 +645,10 @@ IndexBuildsCoordinator::_registerAndSetUpIndexBuild(
auto collection = autoColl.getCollection();
const auto& nss = collection->ns();
+ if (auto status = userAllowedWriteNS(nss); !status.isOK()) {
+ return status;
+ }
+
// TODO (SERVER-40807): disabling the following code for the v4.2 release so it does not have
// downstream impact.
/*