summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Nelson <lamont.nelson@mongodb.com>2020-02-25 15:00:14 -0500
committerLamont Nelson <lamont.nelson@mongodb.com>2020-02-25 15:00:14 -0500
commitaceacb6f5d1c6226cc3102516be9f14c5096cdeb (patch)
treed46781f5396123285eba6a0b65f0ce04b55b1ad3
parent27b75ad516a9b499ed8336075dc1babc4349e790 (diff)
downloadmongo-aceacb6f5d1c6226cc3102516be9f14c5096cdeb.tar.gz
fix topology_state_mach_test; uassertStatusOk in server_is_master_monitor
-rw-r--r--src/mongo/client/disable_streamable_rsm_flag_test.cpp12
-rw-r--r--src/mongo/client/sdam/topology_state_machine_test.cpp9
-rw-r--r--src/mongo/client/server_is_master_monitor.cpp15
3 files changed, 20 insertions, 16 deletions
diff --git a/src/mongo/client/disable_streamable_rsm_flag_test.cpp b/src/mongo/client/disable_streamable_rsm_flag_test.cpp
index 1ceda7ce401..c2fc271a949 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 0ed51ce4b6c..cf2036d70fc 100644
--- a/src/mongo/client/sdam/topology_state_machine_test.cpp
+++ b/src/mongo/client/sdam/topology_state_machine_test.cpp
@@ -167,7 +167,8 @@ TEST_F(TopologyStateMachineTestFixture,
const auto serverAddress = (*kTwoSeedReplicaSetNoPrimaryConfig.getSeedList()).front();
TopologyStateMachine stateMachine(kTwoSeedReplicaSetNoPrimaryConfig);
- auto topologyDescription = std::make_shared<TopologyDescription>(kTwoSeedReplicaSetNoPrimaryConfig);
+ auto topologyDescription =
+ std::make_shared<TopologyDescription>(kTwoSeedReplicaSetNoPrimaryConfig);
auto serverDescription = ServerDescriptionBuilder()
.withAddress(serverAddress)
@@ -192,7 +193,8 @@ TEST_F(TopologyStateMachineTestFixture,
const auto primaryAddress = (*kTwoSeedReplicaSetNoPrimaryConfig.getSeedList()).back();
TopologyStateMachine stateMachine(kTwoSeedReplicaSetNoPrimaryConfig);
- auto topologyDescription = std::make_shared<TopologyDescription>(kTwoSeedReplicaSetNoPrimaryConfig);
+ auto topologyDescription =
+ std::make_shared<TopologyDescription>(kTwoSeedReplicaSetNoPrimaryConfig);
auto primaryDescription = ServerDescriptionBuilder()
.withAddress(primaryAddress)
@@ -233,7 +235,8 @@ TEST_F(TopologyStateMachineTestFixture,
const auto me = std::string("foo") + serverAddress;
TopologyStateMachine stateMachine(kTwoSeedReplicaSetNoPrimaryConfig);
- auto topologyDescription = std::make_shared<TopologyDescription>(kTwoSeedReplicaSetNoPrimaryConfig);
+ auto topologyDescription =
+ std::make_shared<TopologyDescription>(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 9a960722651..24abc7b857d 100644
--- a/src/mongo/client/server_is_master_monitor.cpp
+++ b/src/mongo/client/server_is_master_monitor.cpp
@@ -132,11 +132,12 @@ void SingleServerIsMasterMonitor::_scheduleNextIsMaster(WithLock, Milliseconds d
Timer timer;
auto swCbHandle = _executor->scheduleWorkAt(
_executor->now() + delay,
- [self = shared_from_this()](const executor::TaskExecutor::CallbackArgs& cbData) {
- if (!cbData.status.isOK()) {
- return;
+ [self = shared_from_this()](const executor::TaskExecutor::CallbackArgs& cbData) noexcept {
+ try {
+ uassertStatusOK(cbData.status);
+ self->_doRemoteCommand();
+ } catch (ExceptionForCat<ErrorCategory::ShutdownError>&) {
}
- self->_doRemoteCommand();
});
if (!swCbHandle.isOK()) {
@@ -191,7 +192,7 @@ void SingleServerIsMasterMonitor::_doRemoteCommand() {
if (!swCbHandle.isOK()) {
Microseconds latency(timer.micros());
_onIsMasterFailure(latency, swCbHandle.getStatus(), BSONObj());
- uasserted(31448, swCbHandle.getStatus().toString());
+ uassertStatusOK(swCbHandle);
}
_isMasterOutstanding = true;
@@ -200,8 +201,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;