diff options
author | A. Jesse Jiryu Davis <jesse@mongodb.com> | 2019-10-05 02:49:43 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-10-05 02:49:43 +0000 |
commit | 2664c92b226bf94bb9da85c58b8820771c79c434 (patch) | |
tree | f360c29fbb425911067acab58bbb304f5e8a6ea1 | |
parent | ef04738ab1e3a0a5c8ad7f915a401f2e754d5126 (diff) | |
download | mongo-2664c92b226bf94bb9da85c58b8820771c79c434.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.
-rw-r--r-- | buildscripts/resmokeconfig/suites/replica_sets_kill_secondaries_jscore_passthrough.yml | 2 | ||||
-rw-r--r-- | src/mongo/db/repl/oplog_applier.cpp | 6 | ||||
-rw-r--r-- | src/mongo/db/repl/oplog_applier_impl.cpp | 10 |
3 files changed, 8 insertions, 10 deletions
diff --git a/buildscripts/resmokeconfig/suites/replica_sets_kill_secondaries_jscore_passthrough.yml b/buildscripts/resmokeconfig/suites/replica_sets_kill_secondaries_jscore_passthrough.yml index 33797491909..a063492cc12 100644 --- a/buildscripts/resmokeconfig/suites/replica_sets_kill_secondaries_jscore_passthrough.yml +++ b/buildscripts/resmokeconfig/suites/replica_sets_kill_secondaries_jscore_passthrough.yml @@ -11,7 +11,7 @@ selector: - jstests/core/read_after_optime.js - jstests/core/capped_update.js # The following tests perform a write with a writeConcern of w=2 when 'testingReplication' is - # true. This causes the test to hang because the secondary is running with the "rsSyncStopApply" + # true. This causes the test to hang because the secondary is running with the "rsSyncApplyStop" # failpoint enabled. - jstests/core/geo_update_btree.js # The following tests create large oplog entries, which can cause the secondary to fall off the diff --git a/src/mongo/db/repl/oplog_applier.cpp b/src/mongo/db/repl/oplog_applier.cpp index 6906a0897e7..b7535383aea 100644 --- a/src/mongo/db/repl/oplog_applier.cpp +++ b/src/mongo/db/repl/oplog_applier.cpp @@ -72,6 +72,12 @@ Future<void> OplogApplier::startup() { } void OplogApplier::shutdown() { + // Shutdown will hang if this failpoint is enabled. + if (globalFailPointRegistry().find("rsSyncApplyStop")->shouldFail()) { + severe() << "Turn off rsSyncApplyStop before attempting clean shutdown"; + fassertFailedNoTrace(40304); + } + stdx::lock_guard<Latch> lock(_mutex); _inShutdown = true; } diff --git a/src/mongo/db/repl/oplog_applier_impl.cpp b/src/mongo/db/repl/oplog_applier_impl.cpp index 5f9e9a5093d..899bae5683d 100644 --- a/src/mongo/db/repl/oplog_applier_impl.cpp +++ b/src/mongo/db/repl/oplog_applier_impl.cpp @@ -393,15 +393,7 @@ void OplogApplierImpl::_run(OplogBuffer* oplogBuffer) { if (MONGO_unlikely(rsSyncApplyStop.shouldFail())) { log() << "Oplog Applier - rsSyncApplyStop fail point enabled. Blocking until fail " "point is disabled."; - while (MONGO_unlikely(rsSyncApplyStop.shouldFail())) { - // 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); - } + rsSyncApplyStop.pauseWhileSet(&opCtx); } // Transition to SECONDARY state, if possible. |