diff options
author | Vishnu Kaushik <vishnu.kaushik@mongodb.com> | 2021-06-22 21:52:00 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2021-08-12 15:37:39 +0000 |
commit | 62494948db7c6476536081f6ac40cf2d0ef223fe (patch) | |
tree | 0f8727b794d7c05cd17099f6c45f14087e47f1f4 | |
parent | 3825ab7a0302edf0717dd9222df50ac8f86609b8 (diff) | |
download | mongo-62494948db7c6476536081f6ac40cf2d0ef223fe.tar.gz |
SERVER-55589 setMaintenanceMode should take RSTL in X mode
-rw-r--r-- | jstests/replsets/maintenance_non-blocking.js | 51 | ||||
-rw-r--r-- | src/mongo/db/commands/compact.cpp | 3 | ||||
-rw-r--r-- | src/mongo/db/repl/bgsync.cpp | 6 | ||||
-rw-r--r-- | src/mongo/db/repl/repl_set_commands.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/repl/replication_coordinator.h | 7 | ||||
-rw-r--r-- | src/mongo/db/repl/replication_coordinator_impl.cpp | 10 | ||||
-rw-r--r-- | src/mongo/db/repl/replication_coordinator_impl.h | 2 | ||||
-rw-r--r-- | src/mongo/db/repl/replication_coordinator_impl_test.cpp | 55 | ||||
-rw-r--r-- | src/mongo/db/repl/replication_coordinator_mock.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/repl/replication_coordinator_mock.h | 2 | ||||
-rw-r--r-- | src/mongo/db/repl/replication_coordinator_noop.cpp | 2 | ||||
-rw-r--r-- | src/mongo/db/repl/replication_coordinator_noop.h | 2 | ||||
-rw-r--r-- | src/mongo/db/repl/topology_coordinator.cpp | 5 | ||||
-rw-r--r-- | src/mongo/db/repl/topology_coordinator.h | 5 | ||||
-rw-r--r-- | src/mongo/db/service_entry_point_common.cpp | 40 | ||||
-rw-r--r-- | src/mongo/embedded/replication_coordinator_embedded.cpp | 2 | ||||
-rw-r--r-- | src/mongo/embedded/replication_coordinator_embedded.h | 2 |
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 497bae360c2..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.commandWorked(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.commandWorked(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 088a5af0840..b2c42d155a8 100644 --- a/src/mongo/db/commands/compact.cpp +++ b/src/mongo/db/commands/compact.cpp @@ -60,9 +60,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 6867269f138..f7de957f48d 100644 --- a/src/mongo/db/repl/bgsync.cpp +++ b/src/mongo/db/repl/bgsync.cpp @@ -373,7 +373,7 @@ void BackgroundSync::_produce() { "earliestOpTimeSeen"_attr = syncSourceResp.earliestOpTimeSeen); // Activate maintenance mode and transition to RECOVERING. - auto status = _replCoord->setMaintenanceMode(true); + auto status = _replCoord->setMaintenanceMode(opCtx.get(), true); if (!status.isOK()) { LOGV2_WARNING(21116, "Failed to transition into maintenance mode: {error}", @@ -461,7 +461,9 @@ void BackgroundSync::_produce() { "No longer too stale. Able to sync from {syncSource}", "No longer too stale. Able to start syncing", "syncSource"_attr = source); - auto status = _replCoord->setMaintenanceMode(false); + + auto opCtx = cc().makeOperationContext(); + auto status = _replCoord->setMaintenanceMode(opCtx.get(), false); if (!status.isOK()) { LOGV2_WARNING(21118, "Failed to leave maintenance mode: {error}", diff --git a/src/mongo/db/repl/repl_set_commands.cpp b/src/mongo/db/repl/repl_set_commands.cpp index b7af7c37627..1844e5a5915 100644 --- a/src/mongo/db/repl/repl_set_commands.cpp +++ b/src/mongo/db/repl/repl_set_commands.cpp @@ -584,7 +584,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 61230b7fd1a..43c7aaa0642 100644 --- a/src/mongo/db/repl/replication_coordinator.h +++ b/src/mongo/db/repl/replication_coordinator.h @@ -642,9 +642,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 d37f370a72e..2a947cfe819 100644 --- a/src/mongo/db/repl/replication_coordinator_impl.cpp +++ b/src/mongo/db/repl/replication_coordinator_impl.cpp @@ -775,11 +775,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) { @@ -3083,12 +3080,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 56122bfea4b..fd56e878ccc 100644 --- a/src/mongo/db/repl/replication_coordinator_impl.h +++ b/src/mongo/db/repl/replication_coordinator_impl.h @@ -230,7 +230,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 4fd00274f8f..0694d237625 100644 --- a/src/mongo/db/repl/replication_coordinator_impl_test.cpp +++ b/src/mongo/db/repl/replication_coordinator_impl_test.cpp @@ -2288,7 +2288,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()); @@ -2729,8 +2729,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()); } @@ -2751,12 +2753,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. @@ -2780,17 +2784,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 @@ -2822,19 +2830,19 @@ TEST_F(ReplCoordTest, SettingAndUnsettingMaintenanceModeShouldNotAffectRollbackS // state. ASSERT_OK(getReplCoord()->setFollowerModeRollback(opCtx.get())); 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()->setFollowerModeRollback(opCtx.get())); 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()); @@ -2858,21 +2866,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) { @@ -2918,16 +2925,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 f598ba1c273..a7e39554509 100644 --- a/src/mongo/db/repl/replication_coordinator_mock.cpp +++ b/src/mongo/db/repl/replication_coordinator_mock.cpp @@ -349,7 +349,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 77435c6b1bf..569f211bf22 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 84727c19b04..36a87f70672 100644 --- a/src/mongo/db/repl/replication_coordinator_noop.cpp +++ b/src/mongo/db/repl/replication_coordinator_noop.cpp @@ -298,7 +298,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 91f49315f74..f1cc41b5aa9 100644 --- a/src/mongo/db/repl/replication_coordinator_noop.h +++ b/src/mongo/db/repl/replication_coordinator_noop.h @@ -175,7 +175,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 869de681227..6513448deb9 100644 --- a/src/mongo/db/repl/topology_coordinator.cpp +++ b/src/mongo/db/repl/topology_coordinator.cpp @@ -2867,6 +2867,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 f8196b690cf..933268bdbc5 100644 --- a/src/mongo/db/repl/topology_coordinator.h +++ b/src/mongo/db/repl/topology_coordinator.h @@ -302,6 +302,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 054cc70a47f..9eb7d3137a3 100644 --- a/src/mongo/db/service_entry_point_common.cpp +++ b/src/mongo/db/service_entry_point_common.cpp @@ -219,40 +219,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. * Note that the validation performed is not necessarily exhaustive. @@ -990,8 +956,6 @@ void execCommandDatabase(OperationContext* opCtx, invocation->ns(), allowTransactionsOnConfigDatabase); - std::unique_ptr<MaintenanceModeSetter> mmSetter; - BSONElement cmdOptionMaxTimeMSField; BSONElement maxTimeMSOpOnlyField; BSONElement allowImplicitCollectionCreationField; @@ -1097,10 +1061,6 @@ void execCommandDatabase(OperationContext* opCtx, "command"_attr = 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 5b93a2c1fb5..6c27a90af46 100644 --- a/src/mongo/embedded/replication_coordinator_embedded.cpp +++ b/src/mongo/embedded/replication_coordinator_embedded.cpp @@ -323,7 +323,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 8d96e050617..6cef575f822 100644 --- a/src/mongo/embedded/replication_coordinator_embedded.h +++ b/src/mongo/embedded/replication_coordinator_embedded.h @@ -182,7 +182,7 @@ public: void cancelAndRescheduleElectionTimeout() override; - Status setMaintenanceMode(bool) override; + Status setMaintenanceMode(OperationContext*, bool) override; Status processReplSetSyncFrom(OperationContext*, const HostAndPort&, BSONObjBuilder*) override; |