From 19abeae803ece9c84b6b979b9b22504c05e4a5bb Mon Sep 17 00:00:00 2001 From: Lamont Nelson Date: Tue, 25 Feb 2020 17:54:42 -0500 Subject: Revert "fix topology_state_mach_test; uassertStatusOk in server_is_master_monitor" This reverts commit aceacb6f5d1c6226cc3102516be9f14c5096cdeb. --- src/mongo/client/disable_streamable_rsm_flag_test.cpp | 12 ++++++------ src/mongo/client/sdam/topology_state_machine_test.cpp | 9 +++------ src/mongo/client/server_is_master_monitor.cpp | 15 +++++++-------- 3 files changed, 16 insertions(+), 20 deletions(-) diff --git a/src/mongo/client/disable_streamable_rsm_flag_test.cpp b/src/mongo/client/disable_streamable_rsm_flag_test.cpp index c2fc271a949..1ceda7ce401 100644 --- a/src/mongo/client/disable_streamable_rsm_flag_test.cpp +++ b/src/mongo/client/disable_streamable_rsm_flag_test.cpp @@ -36,11 +36,11 @@ //#include "mongo/unittest/unittest.h" //#include "mongo/util/assert_util.h" // -// namespace mongo { -// namespace { +//namespace mongo { +//namespace { // -// class RSMDisableStreamableFlagTestFixture : public unittest::Test { -// protected: +//class RSMDisableStreamableFlagTestFixture : public unittest::Test { +//protected: // void setUp() { // setGlobalServiceContext(ServiceContext::make()); // ReplicaSetMonitor::cleanup(); @@ -96,7 +96,7 @@ // * Checks that a StreamableReplicaSetMonitor is created when the the // * disableStreamableReplicaSetMonitor flag is set to false. // */ -// TEST_F(RSMDisableStreamableFlagTestFixture, checkIsStreamableIfDisableStreamableIsFalse) { +//TEST_F(RSMDisableStreamableFlagTestFixture, checkIsStreamableIfDisableStreamableIsFalse) { // setParameter(false); // auto uri = MongoURI::parse("mongodb://a,b,c/?replicaSet=name"); // ASSERT_OK(uri.getStatus()); @@ -115,7 +115,7 @@ // * Checks that a ScanningReplicaSetMonitor is created when the disableStreamableReplicaSetMonitor // * flag is set to true. // */ -// TEST_F(RSMDisableStreamableFlagTestFixture, checkIsScanningIfDisableStreamableIsTrue) { +//TEST_F(RSMDisableStreamableFlagTestFixture, checkIsScanningIfDisableStreamableIsTrue) { // setParameter(true); // auto uri = MongoURI::parse("mongodb://a,b,c/?replicaSet=name"); // ASSERT_OK(uri.getStatus()); diff --git a/src/mongo/client/sdam/topology_state_machine_test.cpp b/src/mongo/client/sdam/topology_state_machine_test.cpp index cf2036d70fc..0ed51ce4b6c 100644 --- a/src/mongo/client/sdam/topology_state_machine_test.cpp +++ b/src/mongo/client/sdam/topology_state_machine_test.cpp @@ -167,8 +167,7 @@ TEST_F(TopologyStateMachineTestFixture, const auto serverAddress = (*kTwoSeedReplicaSetNoPrimaryConfig.getSeedList()).front(); TopologyStateMachine stateMachine(kTwoSeedReplicaSetNoPrimaryConfig); - auto topologyDescription = - std::make_shared(kTwoSeedReplicaSetNoPrimaryConfig); + auto topologyDescription = std::make_shared(kTwoSeedReplicaSetNoPrimaryConfig); auto serverDescription = ServerDescriptionBuilder() .withAddress(serverAddress) @@ -193,8 +192,7 @@ TEST_F(TopologyStateMachineTestFixture, const auto primaryAddress = (*kTwoSeedReplicaSetNoPrimaryConfig.getSeedList()).back(); TopologyStateMachine stateMachine(kTwoSeedReplicaSetNoPrimaryConfig); - auto topologyDescription = - std::make_shared(kTwoSeedReplicaSetNoPrimaryConfig); + auto topologyDescription = std::make_shared(kTwoSeedReplicaSetNoPrimaryConfig); auto primaryDescription = ServerDescriptionBuilder() .withAddress(primaryAddress) @@ -235,8 +233,7 @@ TEST_F(TopologyStateMachineTestFixture, const auto me = std::string("foo") + serverAddress; TopologyStateMachine stateMachine(kTwoSeedReplicaSetNoPrimaryConfig); - auto topologyDescription = - std::make_shared(kTwoSeedReplicaSetNoPrimaryConfig); + auto topologyDescription = std::make_shared(kTwoSeedReplicaSetNoPrimaryConfig); auto serverDescription = ServerDescriptionBuilder() .withAddress(serverAddress) diff --git a/src/mongo/client/server_is_master_monitor.cpp b/src/mongo/client/server_is_master_monitor.cpp index 24abc7b857d..9a960722651 100644 --- a/src/mongo/client/server_is_master_monitor.cpp +++ b/src/mongo/client/server_is_master_monitor.cpp @@ -132,12 +132,11 @@ void SingleServerIsMasterMonitor::_scheduleNextIsMaster(WithLock, Milliseconds d Timer timer; auto swCbHandle = _executor->scheduleWorkAt( _executor->now() + delay, - [self = shared_from_this()](const executor::TaskExecutor::CallbackArgs& cbData) noexcept { - try { - uassertStatusOK(cbData.status); - self->_doRemoteCommand(); - } catch (ExceptionForCat&) { + [self = shared_from_this()](const executor::TaskExecutor::CallbackArgs& cbData) { + if (!cbData.status.isOK()) { + return; } + self->_doRemoteCommand(); }); if (!swCbHandle.isOK()) { @@ -192,7 +191,7 @@ void SingleServerIsMasterMonitor::_doRemoteCommand() { if (!swCbHandle.isOK()) { Microseconds latency(timer.micros()); _onIsMasterFailure(latency, swCbHandle.getStatus(), BSONObj()); - uassertStatusOK(swCbHandle); + uasserted(31448, swCbHandle.getStatus().toString()); } _isMasterOutstanding = true; @@ -201,8 +200,8 @@ void SingleServerIsMasterMonitor::_doRemoteCommand() { void SingleServerIsMasterMonitor::shutdown() { stdx::lock_guard lock(_mutex); - if (std::exchange(_isShutdown, true)) - return; + if (std::exchange(_isShutdown, true)) + return; LOG(kLogLevel.lessSevere()) << "Closing Replica Set SingleServerIsMasterMonitor for host " << _host; -- cgit v1.2.1