diff options
author | A. Jesse Jiryu Davis <jesse@mongodb.com> | 2019-10-23 11:28:00 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-10-23 11:28:00 +0000 |
commit | 460f931088439551bc7a3af2366ac5a7397391e6 (patch) | |
tree | 8c79d59928cb5126edd5688d312972ef72746dd6 /src/mongo | |
parent | 709995ad2875f5e290563a8145e3bdb46fd0d5dd (diff) | |
download | mongo-460f931088439551bc7a3af2366ac5a7397391e6.tar.gz |
SERVER-43703 On shutdown check rsSyncApplyStop is disabled
The previous code had a race: if the test disables the rsSyncApplyStop
failpoint and immediately kills mongod, then mongod could fassert. Now
it fasserts only if the failpoint is still enabled on shutdown.
Diffstat (limited to 'src/mongo')
-rw-r--r-- | src/mongo/db/repl/sync_tail.cpp | 16 |
1 files changed, 7 insertions, 9 deletions
diff --git a/src/mongo/db/repl/sync_tail.cpp b/src/mongo/db/repl/sync_tail.cpp index 50d648a5790..1fced6c80f0 100644 --- a/src/mongo/db/repl/sync_tail.cpp +++ b/src/mongo/db/repl/sync_tail.cpp @@ -778,15 +778,7 @@ void SyncTail::_oplogApplication(ReplicationCoordinator* replCoord, if (MONGO_FAIL_POINT(rsSyncApplyStop)) { log() << "sync tail - rsSyncApplyStop fail point enabled. Blocking until fail point is " "disabled."; - while (MONGO_FAIL_POINT(rsSyncApplyStop)) { - // Tests should not trigger clean shutdown while that failpoint is active. If we - // think we need this, we need to think hard about what the behavior should be. - if (inShutdown()) { - severe() << "Turn off rsSyncApplyStop before attempting clean shutdown"; - fassertFailedNoTrace(40304); - } - sleepmillis(10); - } + MONGO_FAIL_POINT_PAUSE_WHILE_SET_OR_INTERRUPTED(&opCtx, rsSyncApplyStop); } // Get the current value of 'minValid'. @@ -883,6 +875,12 @@ void SyncTail::_oplogApplication(ReplicationCoordinator* replCoord, } void SyncTail::shutdown() { + // Shutdown will hang if this failpoint is enabled. + if (MONGO_FAIL_POINT(rsSyncApplyStop)) { + severe() << "Turn off rsSyncApplyStop before attempting clean shutdown"; + fassertFailedNoTrace(40304); + } + stdx::lock_guard<stdx::mutex> lock(_mutex); _inShutdown = true; } |