summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl/replication_coordinator_impl_test.cpp
diff options
context:
space:
mode:
authorSiyuan Zhou <siyuan.zhou@mongodb.com>2016-03-08 19:40:54 -0500
committerSiyuan Zhou <siyuan.zhou@mongodb.com>2016-04-12 16:54:42 -0400
commitded60f5d4254f08d76ccdf0d3a694d473bd14100 (patch)
tree585cd96ce9dbfc9d23e6a66911e33f464e87edf1 /src/mongo/db/repl/replication_coordinator_impl_test.cpp
parent51abe7d21b799a3758ce71d18ac7d6a088f71e2c (diff)
downloadmongo-ded60f5d4254f08d76ccdf0d3a694d473bd14100.tar.gz
SERVER-22995 Protect TopoCoord with mutex rather than single thread executor.
Move scatter gather runner out of executor and protect the runner with its own mutex. Replace onComplete with callbacks scheduled on finish event.
Diffstat (limited to 'src/mongo/db/repl/replication_coordinator_impl_test.cpp')
-rw-r--r--src/mongo/db/repl/replication_coordinator_impl_test.cpp14
1 files changed, 8 insertions, 6 deletions
diff --git a/src/mongo/db/repl/replication_coordinator_impl_test.cpp b/src/mongo/db/repl/replication_coordinator_impl_test.cpp
index de8a175d01c..960987a5b46 100644
--- a/src/mongo/db/repl/replication_coordinator_impl_test.cpp
+++ b/src/mongo/db/repl/replication_coordinator_impl_test.cpp
@@ -1692,6 +1692,7 @@ TEST_F(StepDownTest,
// Make a secondary actually catch up
enterNetwork();
+ getNet()->runUntil(getNet()->now() + Milliseconds(1000));
ASSERT(getNet()->hasReadyRequests());
NetworkInterfaceMock::NetworkOperationIterator noi = getNet()->getNextReadyRequest();
RemoteCommandRequest request = noi->getRequest();
@@ -1750,6 +1751,7 @@ TEST_F(StepDownTest,
// Secondary has not caught up on first round of heartbeats.
enterNetwork();
+ getNet()->runUntil(getNet()->now() + Milliseconds(1000));
ASSERT(getNet()->hasReadyRequests());
NetworkInterfaceMock::NetworkOperationIterator noi = getNet()->getNextReadyRequest();
RemoteCommandRequest request = noi->getRequest();
@@ -4218,12 +4220,12 @@ TEST_F(ReplCoordTest, WaitForMemberState) {
replCoord->setMyLastDurableOpTime(OpTime(Timestamp(1, 0), 0));
ASSERT_TRUE(replCoord->setFollowerMode(MemberState::RS_SECONDARY));
- // Successful dry run election increases term.
- ASSERT_EQUALS(initialTerm + 1, replCoord->getTerm());
-
// Single node cluster - this node should start election on setFollowerMode() completion.
replCoord->waitForElectionFinish_forTest();
+ // Successful dry run election increases term.
+ ASSERT_EQUALS(initialTerm + 1, replCoord->getTerm());
+
auto timeout = Milliseconds(1);
ASSERT_OK(replCoord->waitForMemberState(MemberState::RS_PRIMARY, timeout));
ASSERT_EQUALS(ErrorCodes::ExceededTimeLimit,
@@ -4253,12 +4255,12 @@ TEST_F(ReplCoordTest, WaitForDrainFinish) {
replCoord->setMyLastDurableOpTime(OpTime(Timestamp(1, 0), 0));
ASSERT_TRUE(replCoord->setFollowerMode(MemberState::RS_SECONDARY));
- // Successful dry run election increases term.
- ASSERT_EQUALS(initialTerm + 1, replCoord->getTerm());
-
// Single node cluster - this node should start election on setFollowerMode() completion.
replCoord->waitForElectionFinish_forTest();
+ // Successful dry run election increases term.
+ ASSERT_EQUALS(initialTerm + 1, replCoord->getTerm());
+
auto timeout = Milliseconds(1);
ASSERT_OK(replCoord->waitForMemberState(MemberState::RS_PRIMARY, timeout));