diff options
author | Billy Donahue <billy.donahue@mongodb.com> | 2019-09-10 19:03:36 +0000 |
---|---|---|
committer | evergreen <evergreen@mongodb.com> | 2019-09-10 19:03:36 +0000 |
commit | 5a0f718e1309a4484580d8038016d043ef3b887f (patch) | |
tree | 7a331d57ba6e33e61f96ed69b2aa387003a039ab /src/mongo/db/repl/sync_tail.cpp | |
parent | b9e29cd56ebc9aca06f68eeeda7c523d3dfd6d41 (diff) | |
download | mongo-5a0f718e1309a4484580d8038016d043ef3b887f.tar.gz |
SERVER-43119 FailPoint cleanup
- Don't use MONGO_INITIALIZER to declare each fail point.
We only need one init task in total: freeze and iterate the registry.
- remove MONGO_FAIL_POINT_DECLARE macro (extern)
- remove MONGO_FAIL_POINT_SHOULD_FAIL macro (FailPoint::shouldFail)
- remove MONGO_FAIL_POINT_BLOCK_IF (FailPoint::executeIf)
- remove MONGO_FAIL_POINT_BLOCK (FailPoint::execute)
- clean up FailPointRegistry and fail_point_service implementation.
Diffstat (limited to 'src/mongo/db/repl/sync_tail.cpp')
-rw-r--r-- | src/mongo/db/repl/sync_tail.cpp | 21 |
1 files changed, 10 insertions, 11 deletions
diff --git a/src/mongo/db/repl/sync_tail.cpp b/src/mongo/db/repl/sync_tail.cpp index ec30792335f..165ab31c7a3 100644 --- a/src/mongo/db/repl/sync_tail.cpp +++ b/src/mongo/db/repl/sync_tail.cpp @@ -530,7 +530,7 @@ private: BatchLimits batchLimits; while (true) { - MONGO_FAIL_POINT_PAUSE_WHILE_SET(rsSyncApplyStop); + rsSyncApplyStop.pauseWhileSet(); batchLimits.slaveDelayLatestTimestamp = _calculateSlaveDelayLatestTimestamp(); @@ -661,10 +661,10 @@ void SyncTail::_oplogApplication(ReplicationCoordinator* replCoord, opCtx.setShouldParticipateInFlowControl(false); // For pausing replication in tests. - if (MONGO_FAIL_POINT(rsSyncApplyStop)) { + if (MONGO_unlikely(rsSyncApplyStop.shouldFail())) { log() << "sync tail - rsSyncApplyStop fail point enabled. Blocking until fail point is " "disabled."; - while (MONGO_FAIL_POINT(rsSyncApplyStop)) { + 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()) { @@ -689,7 +689,7 @@ void SyncTail::_oplogApplication(ReplicationCoordinator* replCoord, // Shut down and exit oplog application loop. return; } - if (MONGO_FAIL_POINT(rsSyncApplyStop)) { + if (MONGO_unlikely(rsSyncApplyStop.shouldFail())) { continue; } if (ops.termWhenExhausted()) { @@ -814,10 +814,10 @@ Status syncApply(OperationContext* opCtx, auto clockSource = opCtx->getServiceContext()->getFastClockSource(); auto applyStartTime = clockSource->now(); - if (MONGO_FAIL_POINT(hangAfterRecordingOpApplicationStartTime)) { + if (MONGO_unlikely(hangAfterRecordingOpApplicationStartTime.shouldFail())) { log() << "syncApply - fail point hangAfterRecordingOpApplicationStartTime enabled. " << "Blocking until fail point is disabled. "; - MONGO_FAIL_POINT_PAUSE_WHILE_SET(hangAfterRecordingOpApplicationStartTime); + hangAfterRecordingOpApplicationStartTime.pauseWhileSet(); } auto opType = op.getOpType(); @@ -1198,11 +1198,10 @@ StatusWith<OpTime> SyncTail::multiApply(OperationContext* opCtx, MultiApplier::O // Use this fail point to hold the PBWM lock after we have written the oplog entries but // before we have applied them. - if (MONGO_FAIL_POINT(pauseBatchApplicationAfterWritingOplogEntries)) { + if (MONGO_unlikely(pauseBatchApplicationAfterWritingOplogEntries.shouldFail())) { log() << "pauseBatchApplicationAfterWritingOplogEntries fail point enabled. Blocking " "until fail point is disabled."; - MONGO_FAIL_POINT_PAUSE_WHILE_SET_OR_INTERRUPTED( - opCtx, pauseBatchApplicationAfterWritingOplogEntries); + pauseBatchApplicationAfterWritingOplogEntries.pauseWhileSet(opCtx); } // Reset consistency markers in case the node fails while applying ops. @@ -1239,10 +1238,10 @@ StatusWith<OpTime> SyncTail::multiApply(OperationContext* opCtx, MultiApplier::O storageEngine->replicationBatchIsComplete(); // Use this fail point to hold the PBWM lock and prevent the batch from completing. - if (MONGO_FAIL_POINT(pauseBatchApplicationBeforeCompletion)) { + if (MONGO_unlikely(pauseBatchApplicationBeforeCompletion.shouldFail())) { log() << "pauseBatchApplicationBeforeCompletion fail point enabled. Blocking until fail " "point is disabled."; - while (MONGO_FAIL_POINT(pauseBatchApplicationBeforeCompletion)) { + while (MONGO_unlikely(pauseBatchApplicationBeforeCompletion.shouldFail())) { if (inShutdown()) { severe() << "Turn off pauseBatchApplicationBeforeCompletion before attempting " "clean shutdown"; |