diff options
author | Benety Goh <benety@mongodb.com> | 2017-02-08 14:12:51 -0500 |
---|---|---|
committer | Benety Goh <benety@mongodb.com> | 2017-02-08 16:26:12 -0500 |
commit | add23651e74f09a71f48736ad3880d5cad03dfcb (patch) | |
tree | 56e4a2ab8ccc9cec5351130f0afafdfcc14cc76f | |
parent | 437352cd7dbc158343e2929888d265928b6ca8b7 (diff) | |
download | mongo-add23651e74f09a71f48736ad3880d5cad03dfcb.tar.gz |
SERVER-27905 fixed race in DataReplicatorTest::DataReplicatorReturnsCallbackCanceledIfShutdownImmediatelyAfterStartup
-rw-r--r-- | src/mongo/db/repl/data_replicator_test.cpp | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/mongo/db/repl/data_replicator_test.cpp b/src/mongo/db/repl/data_replicator_test.cpp index 5e5388be760..4f841f2f2b7 100644 --- a/src/mongo/db/repl/data_replicator_test.cpp +++ b/src/mongo/db/repl/data_replicator_test.cpp @@ -590,6 +590,8 @@ TEST_F(DataReplicatorTest, StartupReturnsShutdownInProgressIfDataReplicatorIsShu ASSERT_FALSE(dr->isActive()); ASSERT_OK(dr->startup(txn.get(), maxAttempts)); ASSERT_TRUE(dr->isActive()); + // SyncSourceSelector returns an invalid sync source so DataReplicator is stuck waiting for + // another sync source in 'Options::syncSourceRetryWait' ms. ASSERT_OK(dr->shutdown()); ASSERT_EQUALS(ErrorCodes::ShutdownInProgress, dr->startup(txn.get(), maxAttempts)); } @@ -638,6 +640,12 @@ TEST_F(DataReplicatorTest, DataReplicatorReturnsCallbackCanceledIfShutdownImmedi // This will cancel the _startInitialSyncAttemptCallback() task scheduled by startup(). ASSERT_OK(dr->shutdown()); + // Depending on which DataReplicator stage (_chooseSyncSource or _rollbackCheckerResetCallback) + // was interrupted by shutdown(), we may have to request the network interface to deliver + // cancellation signals to the DataReplicator callbacks in for DataReplicator to run to + // completion. + executor::NetworkInterfaceMock::InNetworkGuard(getNet())->runReadyNetworkOperations(); + dr->join(); ASSERT_EQUALS(ErrorCodes::CallbackCanceled, _lastApplied); |