summaryrefslogtreecommitdiff
path: root/src/mongo/db/commands/create_indexes.cpp
diff options
context:
space:
mode:
authorMatthew Russotto <matthew.russotto@10gen.com>2017-03-03 11:25:44 -0500
committerMatthew Russotto <matthew.russotto@10gen.com>2017-03-06 09:57:40 -0500
commitbefb3ab22daa1f6e0db54af4caa426cfca1b7cd2 (patch)
treed2c205c6a4a7dc9e85d47de281d35a3098ffc5b5 /src/mongo/db/commands/create_indexes.cpp
parent02501866c2fbccf5cec59c8103686972e8e7bb15 (diff)
downloadmongo-befb3ab22daa1f6e0db54af4caa426cfca1b7cd2.tar.gz
SERVER-26965 Use RAII type for turning off replicated writes.
Diffstat (limited to 'src/mongo/db/commands/create_indexes.cpp')
-rw-r--r--src/mongo/db/commands/create_indexes.cpp8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/mongo/db/commands/create_indexes.cpp b/src/mongo/db/commands/create_indexes.cpp
index 4a1707b9124..681370348ce 100644
--- a/src/mongo/db/commands/create_indexes.cpp
+++ b/src/mongo/db/commands/create_indexes.cpp
@@ -248,7 +248,7 @@ public:
// Note: createIndexes command does not currently respect shard versioning.
ScopedTransaction transaction(txn, MODE_IX);
Lock::DBLock dbLock(txn->lockState(), ns.db(), MODE_X);
- if (!repl::getGlobalReplicationCoordinator()->canAcceptWritesFor(ns)) {
+ if (!repl::getGlobalReplicationCoordinator()->canAcceptWritesFor(txn, ns)) {
return appendCommandStatus(
result,
Status(ErrorCodes::NotMaster,
@@ -334,7 +334,7 @@ public:
if (indexer.getBuildInBackground()) {
txn->recoveryUnit()->abandonSnapshot();
dbLock.relockWithMode(MODE_IX);
- if (!repl::getGlobalReplicationCoordinator()->canAcceptWritesFor(ns)) {
+ if (!repl::getGlobalReplicationCoordinator()->canAcceptWritesFor(txn, ns)) {
return appendCommandStatus(
result,
Status(ErrorCodes::NotMaster,
@@ -356,7 +356,7 @@ public:
// that day, to avoid data corruption due to lack of index cleanup.
txn->recoveryUnit()->abandonSnapshot();
dbLock.relockWithMode(MODE_X);
- if (!repl::getGlobalReplicationCoordinator()->canAcceptWritesFor(ns)) {
+ if (!repl::getGlobalReplicationCoordinator()->canAcceptWritesFor(txn, ns)) {
return appendCommandStatus(
result,
Status(ErrorCodes::NotMaster,
@@ -378,7 +378,7 @@ public:
dbLock.relockWithMode(MODE_X);
uassert(ErrorCodes::NotMaster,
str::stream() << "Not primary while completing index build in " << dbname,
- repl::getGlobalReplicationCoordinator()->canAcceptWritesFor(ns));
+ repl::getGlobalReplicationCoordinator()->canAcceptWritesFor(txn, ns));
Database* db = dbHolder().get(txn, ns.db());
uassert(28551, "database dropped during index build", db);