summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--jstests/replsets/maintenance_non-blocking.js51
-rw-r--r--src/mongo/db/commands/compact.cpp3
-rw-r--r--src/mongo/db/repl/bgsync.cpp6
-rw-r--r--src/mongo/db/repl/repl_set_commands.cpp2
-rw-r--r--src/mongo/db/repl/replication_coordinator.h7
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl.cpp10
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl.h2
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl_test.cpp55
-rw-r--r--src/mongo/db/repl/replication_coordinator_mock.cpp2
-rw-r--r--src/mongo/db/repl/replication_coordinator_mock.h2
-rw-r--r--src/mongo/db/repl/replication_coordinator_noop.cpp2
-rw-r--r--src/mongo/db/repl/replication_coordinator_noop.h2
-rw-r--r--src/mongo/db/repl/topology_coordinator.cpp5
-rw-r--r--src/mongo/db/repl/topology_coordinator.h5
-rw-r--r--src/mongo/db/service_entry_point_common.cpp40
-rw-r--r--src/mongo/embedded/replication_coordinator_embedded.cpp2
-rw-r--r--src/mongo/embedded/replication_coordinator_embedded.h2
17 files changed, 63 insertions, 135 deletions
diff --git a/jstests/replsets/maintenance_non-blocking.js b/jstests/replsets/maintenance_non-blocking.js
deleted file mode 100644
index aa57be0cf64..00000000000
--- a/jstests/replsets/maintenance_non-blocking.js
+++ /dev/null
@@ -1,51 +0,0 @@
-// This test ensures that the replSetMaintenance command will not block, nor block-on, a db write
-doTest = function() {
- "use strict";
- var replTest = new ReplSetTest({name: 'testSet', nodes: 2});
- var nodes = replTest.startSet();
- replTest.initiate();
-
- var m = replTest.getPrimary();
- var mColl = m.getDB("test").maint;
- var s = replTest.getSecondary();
- var sDB = s.getDB("test");
- var sColl = sDB.maint;
-
- var status = assert.commandWorked(sDB.adminCommand("replSetGetStatus"));
- printjson(status);
-
- print("******* fsyncLock'n secondary ************* ");
- s.getDB("admin").fsyncLock();
-
- // save some records
- var len = 100;
- for (var i = 0; i < len; ++i) {
- assert.writeOK(mColl.save({a: i}));
- }
-
- print("******* replSetMaintenance called on secondary ************* ");
- assert.commandWorked(sDB.adminCommand("replSetMaintenance"));
-
- var ismaster = assert.commandWorked(sColl.runCommand("ismaster"));
- assert.eq(false, ismaster.ismaster);
- assert.eq(false, ismaster.secondary);
-
- print("******* writing to primary ************* ");
- assert.writeOK(mColl.save({_id: -1}));
- printjson(sDB.currentOp());
- assert.neq(null, mColl.findOne());
-
- var ismaster = assert.commandWorked(sColl.runCommand("ismaster"));
- assert.eq(false, ismaster.ismaster);
- assert.eq(false, ismaster.secondary);
-
- print("******* fsyncUnlock'n secondary ************* ");
- sDB.fsyncUnlock();
-
- print("******* unset replSetMaintenance on secondary ************* ");
- assert.commandWorked(sDB.adminCommand({replSetMaintenance: 0}));
- replTest.stopSet();
-};
-
-doTest();
-print("SUCCESS");
diff --git a/src/mongo/db/commands/compact.cpp b/src/mongo/db/commands/compact.cpp
index c97db6c58c5..cf1e4bede6f 100644
--- a/src/mongo/db/commands/compact.cpp
+++ b/src/mongo/db/commands/compact.cpp
@@ -65,9 +65,6 @@ public:
AllowedOnSecondary secondaryAllowed(ServiceContext*) const override {
return AllowedOnSecondary::kAlways;
}
- virtual bool maintenanceMode() const {
- return true;
- }
virtual void addRequiredPrivileges(const std::string& dbname,
const BSONObj& cmdObj,
std::vector<Privilege>* out) const {
diff --git a/src/mongo/db/repl/bgsync.cpp b/src/mongo/db/repl/bgsync.cpp
index 9555db6f95b..93cd829c620 100644
--- a/src/mongo/db/repl/bgsync.cpp
+++ b/src/mongo/db/repl/bgsync.cpp
@@ -359,7 +359,7 @@ void BackgroundSync::_produce() {
log() << "See http://dochub.mongodb.org/core/resyncingaverystalereplicasetmember";
// Activate maintenance mode and transition to RECOVERING.
- auto status = _replCoord->setMaintenanceMode(true);
+ auto status = _replCoord->setMaintenanceMode(opCtx.get(), true);
if (!status.isOK()) {
warning() << "Failed to transition into maintenance mode: " << status;
// Do not mark ourselves too stale on errors so we can try again next time.
@@ -413,11 +413,13 @@ void BackgroundSync::_produce() {
// transition to SECONDARY.
if (_tooStale) {
+
_tooStale = false;
log() << "No longer too stale. Able to sync from " << source;
- auto status = _replCoord->setMaintenanceMode(false);
+ auto opCtx = cc().makeOperationContext();
+ auto status = _replCoord->setMaintenanceMode(opCtx.get(), false);
if (!status.isOK()) {
warning() << "Failed to leave maintenance mode: " << status;
}
diff --git a/src/mongo/db/repl/repl_set_commands.cpp b/src/mongo/db/repl/repl_set_commands.cpp
index 63b2a23ff36..88a4f1cf493 100644
--- a/src/mongo/db/repl/repl_set_commands.cpp
+++ b/src/mongo/db/repl/repl_set_commands.cpp
@@ -549,7 +549,7 @@ public:
uassertStatusOK(status);
uassertStatusOK(ReplicationCoordinator::get(opCtx)->setMaintenanceMode(
- cmdObj["replSetMaintenance"].trueValue()));
+ opCtx, cmdObj["replSetMaintenance"].trueValue()));
return true;
}
diff --git a/src/mongo/db/repl/replication_coordinator.h b/src/mongo/db/repl/replication_coordinator.h
index 42ead8e2519..5aa5813e2bf 100644
--- a/src/mongo/db/repl/replication_coordinator.h
+++ b/src/mongo/db/repl/replication_coordinator.h
@@ -645,9 +645,12 @@ public:
/**
* Toggles maintenanceMode to the value expressed by 'activate'
* return Status::OK if the change worked, NotSecondary if it failed because we are
- * PRIMARY, and OperationFailed if we are not currently in maintenance mode
+ * PRIMARY, and OperationFailed if we are not currently in maintenance mode.
+ *
+ * Takes the ReplicationStateTransitionLock (RSTL) in X mode, since the state can potentially
+ * change to and from RECOVERING.
*/
- virtual Status setMaintenanceMode(bool activate) = 0;
+ virtual Status setMaintenanceMode(OperationContext* opCtx, bool activate) = 0;
/**
* Retrieves the current count of maintenanceMode and returns 'true' if greater than 0.
diff --git a/src/mongo/db/repl/replication_coordinator_impl.cpp b/src/mongo/db/repl/replication_coordinator_impl.cpp
index 1cad14b0682..357d461c64f 100644
--- a/src/mongo/db/repl/replication_coordinator_impl.cpp
+++ b/src/mongo/db/repl/replication_coordinator_impl.cpp
@@ -737,11 +737,8 @@ void ReplicationCoordinatorImpl::_startDataReplication(OperationContext* opCtx,
const auto lastApplied = opTimeStatus.getValue();
_setMyLastAppliedOpTimeAndWallTime(
lock, lastApplied, false, DataConsistency::Consistent);
- }
- // Clear maint. mode.
- while (getMaintenanceMode()) {
- setMaintenanceMode(false).transitional_ignore();
+ _topCoord->resetMaintenanceCount();
}
if (startCompleted) {
@@ -2570,12 +2567,15 @@ bool ReplicationCoordinatorImpl::getMaintenanceMode() {
return _topCoord->getMaintenanceCount() > 0;
}
-Status ReplicationCoordinatorImpl::setMaintenanceMode(bool activate) {
+Status ReplicationCoordinatorImpl::setMaintenanceMode(OperationContext* opCtx, bool activate) {
if (getReplicationMode() != modeReplSet) {
return Status(ErrorCodes::NoReplicationEnabled,
"can only set maintenance mode on replica set members");
}
+ // It is possible that we change state to or from RECOVERING. Thus, we need the RSTL in X mode.
+ ReplicationStateTransitionLockGuard transitionGuard(opCtx, MODE_X);
+
stdx::unique_lock<Latch> lk(_mutex);
if (_topCoord->getRole() == TopologyCoordinator::Role::kCandidate ||
MONGO_unlikely(setMaintenanceModeFailsWithNotSecondary.shouldFail())) {
diff --git a/src/mongo/db/repl/replication_coordinator_impl.h b/src/mongo/db/repl/replication_coordinator_impl.h
index b0babd327a5..77064f724f1 100644
--- a/src/mongo/db/repl/replication_coordinator_impl.h
+++ b/src/mongo/db/repl/replication_coordinator_impl.h
@@ -228,7 +228,7 @@ public:
virtual void cancelAndRescheduleElectionTimeout() override;
- virtual Status setMaintenanceMode(bool activate) override;
+ virtual Status setMaintenanceMode(OperationContext* opCtx, bool activate) override;
virtual bool getMaintenanceMode() override;
diff --git a/src/mongo/db/repl/replication_coordinator_impl_test.cpp b/src/mongo/db/repl/replication_coordinator_impl_test.cpp
index a072a500a08..b7d3ae55417 100644
--- a/src/mongo/db/repl/replication_coordinator_impl_test.cpp
+++ b/src/mongo/db/repl/replication_coordinator_impl_test.cpp
@@ -2291,7 +2291,7 @@ TEST_F(
// Go into maintenance mode.
ASSERT_EQUALS(0, getTopoCoord().getMaintenanceCount());
ASSERT_FALSE(getReplCoord()->getMaintenanceMode());
- ASSERT_OK(getReplCoord()->setMaintenanceMode(true));
+ ASSERT_OK(getReplCoord()->setMaintenanceMode(opCtx.get(), true));
ASSERT_EQUALS(1, getTopoCoord().getMaintenanceCount());
ASSERT_TRUE(getReplCoord()->getMaintenanceMode());
@@ -2728,8 +2728,10 @@ TEST_F(ReplCoordTest,
replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100));
replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100));
+ const auto opCtx = makeOperationContext();
+
// Can't unset maintenance mode if it was never set to begin with.
- Status status = getReplCoord()->setMaintenanceMode(false);
+ Status status = getReplCoord()->setMaintenanceMode(opCtx.get(), false);
ASSERT_EQUALS(ErrorCodes::OperationFailed, status);
ASSERT_TRUE(getReplCoord()->getMemberState().secondary());
}
@@ -2750,12 +2752,14 @@ TEST_F(ReplCoordTest,
ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY));
replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100));
replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100));
+
+ const auto opCtx = makeOperationContext();
+
// valid set
- ASSERT_OK(getReplCoord()->setMaintenanceMode(true));
+ ASSERT_OK(getReplCoord()->setMaintenanceMode(opCtx.get(), true));
ASSERT_TRUE(getReplCoord()->getMemberState().recovering());
// We must take the RSTL in mode X before transitioning to RS_ROLLBACK.
- const auto opCtx = makeOperationContext();
ReplicationStateTransitionLockGuard transitionGuard(opCtx.get(), MODE_X);
// If we go into rollback while in maintenance mode, our state changes to RS_ROLLBACK.
@@ -2779,17 +2783,21 @@ TEST_F(ReplCoordTest, AllowAsManyUnsetMaintenanceModesAsThereHaveBeenSetMaintena
<< BSON("_id" << 2 << "host"
<< "test3:1234"))),
HostAndPort("test2", 1234));
+
ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY));
replCoordSetMyLastAppliedOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100));
replCoordSetMyLastDurableOpTime(OpTimeWithTermOne(100, 1), Date_t() + Seconds(100));
+
+ const auto opCtx = makeOperationContext();
+
// Can set multiple times
- ASSERT_OK(getReplCoord()->setMaintenanceMode(true));
- ASSERT_OK(getReplCoord()->setMaintenanceMode(true));
+ ASSERT_OK(getReplCoord()->setMaintenanceMode(opCtx.get(), true));
+ ASSERT_OK(getReplCoord()->setMaintenanceMode(opCtx.get(), true));
// Need to unset the number of times you set.
- ASSERT_OK(getReplCoord()->setMaintenanceMode(false));
- ASSERT_OK(getReplCoord()->setMaintenanceMode(false));
- Status status = getReplCoord()->setMaintenanceMode(false);
+ ASSERT_OK(getReplCoord()->setMaintenanceMode(opCtx.get(), false));
+ ASSERT_OK(getReplCoord()->setMaintenanceMode(opCtx.get(), false));
+ Status status = getReplCoord()->setMaintenanceMode(opCtx.get(), false);
// third one fails b/c we only set two times.
ASSERT_EQUALS(ErrorCodes::OperationFailed, status);
// Unsetting maintenance mode changes our state to secondary if maintenance mode was
@@ -2821,19 +2829,19 @@ TEST_F(ReplCoordTest, SettingAndUnsettingMaintenanceModeShouldNotAffectRollbackS
// state.
ASSERT_OK(getReplCoord()->setFollowerModeStrict(opCtx.get(), MemberState::RS_ROLLBACK));
ASSERT_TRUE(getReplCoord()->getMemberState().rollback());
- ASSERT_OK(getReplCoord()->setMaintenanceMode(true));
+ ASSERT_OK(getReplCoord()->setMaintenanceMode(opCtx.get(), true));
ASSERT_TRUE(getReplCoord()->getMemberState().rollback());
- ASSERT_OK(getReplCoord()->setMaintenanceMode(false));
+ ASSERT_OK(getReplCoord()->setMaintenanceMode(opCtx.get(), false));
ASSERT_TRUE(getReplCoord()->getMemberState().rollback());
// Rollback is sticky even if entered while in maintenance mode.
ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY));
ASSERT_TRUE(getReplCoord()->getMemberState().secondary());
- ASSERT_OK(getReplCoord()->setMaintenanceMode(true));
+ ASSERT_OK(getReplCoord()->setMaintenanceMode(opCtx.get(), true));
ASSERT_TRUE(getReplCoord()->getMemberState().recovering());
ASSERT_OK(getReplCoord()->setFollowerModeStrict(opCtx.get(), MemberState::RS_ROLLBACK));
ASSERT_TRUE(getReplCoord()->getMemberState().rollback());
- ASSERT_OK(getReplCoord()->setMaintenanceMode(false));
+ ASSERT_OK(getReplCoord()->setMaintenanceMode(opCtx.get(), false));
ASSERT_TRUE(getReplCoord()->getMemberState().rollback());
ASSERT_OK(getReplCoord()->setFollowerMode(MemberState::RS_SECONDARY));
ASSERT_TRUE(getReplCoord()->getMemberState().secondary());
@@ -2857,21 +2865,20 @@ TEST_F(ReplCoordTest, DoNotAllowMaintenanceModeWhilePrimary) {
// Can't modify maintenance mode when PRIMARY
simulateSuccessfulV1Election();
- Status status = getReplCoord()->setMaintenanceMode(true);
- ASSERT_EQUALS(ErrorCodes::NotSecondary, status);
- ASSERT_TRUE(getReplCoord()->getMemberState().primary());
-
auto opCtx = makeOperationContext();
+ Status status = getReplCoord()->setMaintenanceMode(opCtx.get(), true);
+ ASSERT_EQUALS(ErrorCodes::NotSecondary, status);
+ ASSERT_TRUE(getReplCoord()->getMemberState().primary());
// Step down from primary.
getReplCoord()->updateTerm(opCtx.get(), getReplCoord()->getTerm() + 1).transitional_ignore();
ASSERT_OK(getReplCoord()->waitForMemberState(MemberState::RS_SECONDARY, Seconds(1)));
- status = getReplCoord()->setMaintenanceMode(false);
+ status = getReplCoord()->setMaintenanceMode(opCtx.get(), false);
ASSERT_EQUALS(ErrorCodes::OperationFailed, status);
- ASSERT_OK(getReplCoord()->setMaintenanceMode(true));
- ASSERT_OK(getReplCoord()->setMaintenanceMode(false));
+ ASSERT_OK(getReplCoord()->setMaintenanceMode(opCtx.get(), true));
+ ASSERT_OK(getReplCoord()->setMaintenanceMode(opCtx.get(), false));
}
TEST_F(ReplCoordTest, DoNotAllowSettingMaintenanceModeWhileConductingAnElection) {
@@ -2917,16 +2924,16 @@ TEST_F(ReplCoordTest, DoNotAllowSettingMaintenanceModeWhileConductingAnElection)
ASSERT_EQUALS(when, net->now());
net->exitNetwork();
ASSERT_EQUALS(TopologyCoordinator::Role::kCandidate, getTopoCoord().getRole());
- Status status = getReplCoord()->setMaintenanceMode(false);
+ Status status = getReplCoord()->setMaintenanceMode(opCtx.get(), false);
ASSERT_EQUALS(ErrorCodes::NotSecondary, status);
- status = getReplCoord()->setMaintenanceMode(true);
+ status = getReplCoord()->setMaintenanceMode(opCtx.get(), true);
ASSERT_EQUALS(ErrorCodes::NotSecondary, status);
simulateSuccessfulDryRun();
ASSERT_EQUALS(TopologyCoordinator::Role::kCandidate, getTopoCoord().getRole());
- status = getReplCoord()->setMaintenanceMode(false);
+ status = getReplCoord()->setMaintenanceMode(opCtx.get(), false);
ASSERT_EQUALS(ErrorCodes::NotSecondary, status);
- status = getReplCoord()->setMaintenanceMode(true);
+ status = getReplCoord()->setMaintenanceMode(opCtx.get(), true);
ASSERT_EQUALS(ErrorCodes::NotSecondary, status);
// We must take the RSTL in mode X before transitioning to RS_ROLLBACK.
diff --git a/src/mongo/db/repl/replication_coordinator_mock.cpp b/src/mongo/db/repl/replication_coordinator_mock.cpp
index 8ce36495bd7..eff26a86f1a 100644
--- a/src/mongo/db/repl/replication_coordinator_mock.cpp
+++ b/src/mongo/db/repl/replication_coordinator_mock.cpp
@@ -357,7 +357,7 @@ void ReplicationCoordinatorMock::appendSlaveInfoData(BSONObjBuilder* result) {}
void ReplicationCoordinatorMock::appendConnectionStats(executor::ConnectionPoolStats* stats) const {
}
-Status ReplicationCoordinatorMock::setMaintenanceMode(bool activate) {
+Status ReplicationCoordinatorMock::setMaintenanceMode(OperationContext* opCtx, bool activate) {
return Status::OK();
}
diff --git a/src/mongo/db/repl/replication_coordinator_mock.h b/src/mongo/db/repl/replication_coordinator_mock.h
index 3c11e41c523..977ed7d3215 100644
--- a/src/mongo/db/repl/replication_coordinator_mock.h
+++ b/src/mongo/db/repl/replication_coordinator_mock.h
@@ -197,7 +197,7 @@ public:
virtual void cancelAndRescheduleElectionTimeout() override;
- virtual Status setMaintenanceMode(bool activate);
+ virtual Status setMaintenanceMode(OperationContext* opCtx, bool activate);
virtual bool getMaintenanceMode();
diff --git a/src/mongo/db/repl/replication_coordinator_noop.cpp b/src/mongo/db/repl/replication_coordinator_noop.cpp
index 0478a4a7418..c197a0e2f73 100644
--- a/src/mongo/db/repl/replication_coordinator_noop.cpp
+++ b/src/mongo/db/repl/replication_coordinator_noop.cpp
@@ -304,7 +304,7 @@ void ReplicationCoordinatorNoOp::cancelAndRescheduleElectionTimeout() {
MONGO_UNREACHABLE;
}
-Status ReplicationCoordinatorNoOp::setMaintenanceMode(bool) {
+Status ReplicationCoordinatorNoOp::setMaintenanceMode(OperationContext*, bool) {
MONGO_UNREACHABLE;
}
diff --git a/src/mongo/db/repl/replication_coordinator_noop.h b/src/mongo/db/repl/replication_coordinator_noop.h
index 55c72793ee6..e71fb5d5047 100644
--- a/src/mongo/db/repl/replication_coordinator_noop.h
+++ b/src/mongo/db/repl/replication_coordinator_noop.h
@@ -176,7 +176,7 @@ public:
void cancelAndRescheduleElectionTimeout() final;
- Status setMaintenanceMode(bool) final;
+ Status setMaintenanceMode(OperationContext*, bool) final;
Status processReplSetSyncFrom(OperationContext*, const HostAndPort&, BSONObjBuilder*) final;
diff --git a/src/mongo/db/repl/topology_coordinator.cpp b/src/mongo/db/repl/topology_coordinator.cpp
index d5ef30ecea8..c0e19bac3a3 100644
--- a/src/mongo/db/repl/topology_coordinator.cpp
+++ b/src/mongo/db/repl/topology_coordinator.cpp
@@ -2590,6 +2590,11 @@ void TopologyCoordinator::adjustMaintenanceCountBy(int inc) {
invariant(_maintenanceModeCalls >= 0);
}
+void TopologyCoordinator::resetMaintenanceCount() {
+ invariant(_role == Role::kFollower);
+ _maintenanceModeCalls = 0;
+}
+
int TopologyCoordinator::getMaintenanceCount() const {
return _maintenanceModeCalls;
}
diff --git a/src/mongo/db/repl/topology_coordinator.h b/src/mongo/db/repl/topology_coordinator.h
index 3bce7611c92..c58ad05e90c 100644
--- a/src/mongo/db/repl/topology_coordinator.h
+++ b/src/mongo/db/repl/topology_coordinator.h
@@ -288,6 +288,11 @@ public:
*/
void adjustMaintenanceCountBy(int inc);
+ /**
+ * Sets the value of the maintenance mode counter to 0.
+ */
+ void resetMaintenanceCount();
+
////////////////////////////////////////////////////////////
//
// Methods that prepare responses to command requests.
diff --git a/src/mongo/db/service_entry_point_common.cpp b/src/mongo/db/service_entry_point_common.cpp
index c41811582a6..0b01b2533fd 100644
--- a/src/mongo/db/service_entry_point_common.cpp
+++ b/src/mongo/db/service_entry_point_common.cpp
@@ -192,40 +192,6 @@ void generateErrorResponse(OperationContext* opCtx,
}
/**
- * Guard object for making a good-faith effort to enter maintenance mode and leave it when it
- * goes out of scope.
- *
- * Sometimes we cannot set maintenance mode, in which case the call to setMaintenanceMode will
- * return a non-OK status. This class does not treat that case as an error which means that
- * anybody using it is assuming it is ok to continue execution without maintenance mode.
- *
- * TODO: This assumption needs to be audited and documented, or this behavior should be moved
- * elsewhere.
- */
-class MaintenanceModeSetter {
- MaintenanceModeSetter(const MaintenanceModeSetter&) = delete;
- MaintenanceModeSetter& operator=(const MaintenanceModeSetter&) = delete;
-
-public:
- MaintenanceModeSetter(OperationContext* opCtx)
- : _opCtx(opCtx),
- _maintenanceModeSet(
- repl::ReplicationCoordinator::get(_opCtx)->setMaintenanceMode(true).isOK()) {}
-
- ~MaintenanceModeSetter() {
- if (_maintenanceModeSet) {
- repl::ReplicationCoordinator::get(_opCtx)
- ->setMaintenanceMode(false)
- .transitional_ignore();
- }
- }
-
-private:
- OperationContext* const _opCtx;
- const bool _maintenanceModeSet;
-};
-
-/**
* Given the specified command, returns an effective read concern which should be used or an error
* if the read concern is not valid for the command.
*/
@@ -734,8 +700,6 @@ void execCommandDatabase(OperationContext* opCtx,
validateSessionOptions(sessionOptions, command->getName(), dbname);
- std::unique_ptr<MaintenanceModeSetter> mmSetter;
-
BSONElement cmdOptionMaxTimeMSField;
BSONElement allowImplicitCollectionCreationField;
BSONElement helpField;
@@ -829,10 +793,6 @@ void execCommandDatabase(OperationContext* opCtx,
LOG(2) << "command: " << request.getCommandName();
}
- if (command->maintenanceMode()) {
- mmSetter.reset(new MaintenanceModeSetter(opCtx));
- }
-
if (command->shouldAffectCommandCounter()) {
OpCounters* opCounters = &globalOpCounters;
opCounters->gotCommand();
diff --git a/src/mongo/embedded/replication_coordinator_embedded.cpp b/src/mongo/embedded/replication_coordinator_embedded.cpp
index 62a60c2bad6..e4465070662 100644
--- a/src/mongo/embedded/replication_coordinator_embedded.cpp
+++ b/src/mongo/embedded/replication_coordinator_embedded.cpp
@@ -329,7 +329,7 @@ void ReplicationCoordinatorEmbedded::cancelAndRescheduleElectionTimeout() {
UASSERT_NOT_IMPLEMENTED;
}
-Status ReplicationCoordinatorEmbedded::setMaintenanceMode(bool) {
+Status ReplicationCoordinatorEmbedded::setMaintenanceMode(OperationContext*, bool) {
UASSERT_NOT_IMPLEMENTED;
}
diff --git a/src/mongo/embedded/replication_coordinator_embedded.h b/src/mongo/embedded/replication_coordinator_embedded.h
index 8b208e09f4d..b73650d6c7d 100644
--- a/src/mongo/embedded/replication_coordinator_embedded.h
+++ b/src/mongo/embedded/replication_coordinator_embedded.h
@@ -183,7 +183,7 @@ public:
void cancelAndRescheduleElectionTimeout() override;
- Status setMaintenanceMode(bool) override;
+ Status setMaintenanceMode(OperationContext*, bool) override;
Status processReplSetSyncFrom(OperationContext*, const HostAndPort&, BSONObjBuilder*) override;