From 67b68b5f094d88753ae2fe14f6d708c9e5b4bfbd Mon Sep 17 00:00:00 2001 From: Kaloian Manassiev Date: Fri, 6 Nov 2015 12:13:11 -0500 Subject: SERVER-21272 Make replica set monitor retry finding hosts This change makes the replica set monitor retry more than once to find hosts suitable for a given read preference and fail quickly if none of the hosts for a given replica set can be reached. --- src/mongo/dbtests/replica_set_monitor_test.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'src/mongo/dbtests/replica_set_monitor_test.cpp') diff --git a/src/mongo/dbtests/replica_set_monitor_test.cpp b/src/mongo/dbtests/replica_set_monitor_test.cpp index 188a85ce966..1e5a7699bea 100644 --- a/src/mongo/dbtests/replica_set_monitor_test.cpp +++ b/src/mongo/dbtests/replica_set_monitor_test.cpp @@ -47,6 +47,7 @@ using std::vector; using std::set; using std::string; using std::unique_ptr; +using unittest::assertGet; // TODO: Port these existing tests here: replmonitor_bad_seed.js, repl_monitor_refresh.js @@ -265,8 +266,8 @@ TEST_F(TwoNodeWithTags, SecDownRetryNoTag) { replSet->restore(secHost); - HostAndPort node = monitor->getHostOrRefresh( - ReadPreferenceSetting(mongo::ReadPreference::SecondaryOnly, TagSet())); + HostAndPort node = assertGet(monitor->getHostOrRefresh( + ReadPreferenceSetting(mongo::ReadPreference::SecondaryOnly, TagSet()), Milliseconds(0))); ASSERT_FALSE(monitor->isPrimary(node)); ASSERT_EQUALS(secHost, node.toString()); @@ -293,8 +294,8 @@ TEST_F(TwoNodeWithTags, SecDownRetryWithTag) { TagSet tags(BSON_ARRAY(BSON("dc" << "ny"))); - HostAndPort node = monitor->getHostOrRefresh( - ReadPreferenceSetting(mongo::ReadPreference::SecondaryOnly, tags)); + HostAndPort node = assertGet(monitor->getHostOrRefresh( + ReadPreferenceSetting(mongo::ReadPreference::SecondaryOnly, tags), Milliseconds(0))); ASSERT_FALSE(monitor->isPrimary(node)); ASSERT_EQUALS(secHost, node.toString()); -- cgit v1.2.1