summaryrefslogtreecommitdiff
path: root/src/mongo/db/concurrency
diff options
context:
space:
mode:
authorBilly Donahue <billy.donahue@mongodb.com>2019-09-10 19:03:36 +0000
committerevergreen <evergreen@mongodb.com>2019-09-10 19:03:36 +0000
commit5a0f718e1309a4484580d8038016d043ef3b887f (patch)
tree7a331d57ba6e33e61f96ed69b2aa387003a039ab /src/mongo/db/concurrency
parentb9e29cd56ebc9aca06f68eeeda7c523d3dfd6d41 (diff)
downloadmongo-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/concurrency')
-rw-r--r--src/mongo/db/concurrency/lock_state.cpp5
-rw-r--r--src/mongo/db/concurrency/write_conflict_exception.h5
2 files changed, 6 insertions, 4 deletions
diff --git a/src/mongo/db/concurrency/lock_state.cpp b/src/mongo/db/concurrency/lock_state.cpp
index 3a162b425b0..fd840437c89 100644
--- a/src/mongo/db/concurrency/lock_state.cpp
+++ b/src/mongo/db/concurrency/lock_state.cpp
@@ -895,7 +895,8 @@ void LockerImpl::_lockComplete(OperationContext* opCtx,
// This failpoint is used to time out non-intent locks if they cannot be granted immediately.
// Testing-only.
- if (!_uninterruptibleLocksRequested && MONGO_FAIL_POINT(failNonIntentLocksIfWaitNeeded)) {
+ if (!_uninterruptibleLocksRequested &&
+ MONGO_unlikely(failNonIntentLocksIfWaitNeeded.shouldFail())) {
uassert(ErrorCodes::LockTimeout,
str::stream() << "Cannot immediately acquire lock '" << resId.toString()
<< "'. Timing out due to failpoint.",
@@ -991,7 +992,7 @@ void LockerImpl::getFlowControlTicket(OperationContext* opCtx, LockMode lockMode
LockResult LockerImpl::lockRSTLBegin(OperationContext* opCtx, LockMode mode) {
bool testOnly = false;
- if (MONGO_FAIL_POINT(enableTestOnlyFlagforRSTL)) {
+ if (MONGO_unlikely(enableTestOnlyFlagforRSTL.shouldFail())) {
testOnly = true;
}
diff --git a/src/mongo/db/concurrency/write_conflict_exception.h b/src/mongo/db/concurrency/write_conflict_exception.h
index 71f38b34670..84089ae86f6 100644
--- a/src/mongo/db/concurrency/write_conflict_exception.h
+++ b/src/mongo/db/concurrency/write_conflict_exception.h
@@ -38,7 +38,7 @@
namespace mongo {
-MONGO_FAIL_POINT_DECLARE(skipWriteConflictRetries);
+extern FailPoint skipWriteConflictRetries;
/**
* This is thrown if during a write, two or more operations conflict with each other.
@@ -83,7 +83,8 @@ auto writeConflictRetry(OperationContext* opCtx, StringData opStr, StringData ns
invariant(opCtx->lockState());
invariant(opCtx->recoveryUnit());
- if (opCtx->lockState()->inAWriteUnitOfWork() || MONGO_FAIL_POINT(skipWriteConflictRetries)) {
+ if (opCtx->lockState()->inAWriteUnitOfWork() ||
+ MONGO_unlikely(skipWriteConflictRetries.shouldFail())) {
return f();
}