summaryrefslogtreecommitdiff
path: root/src/mongo/db/operation_context.cpp
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/operation_context.cpp
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/operation_context.cpp')
-rw-r--r--src/mongo/db/operation_context.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/src/mongo/db/operation_context.cpp b/src/mongo/db/operation_context.cpp
index c3fef5535ae..6c21a7b58a1 100644
--- a/src/mongo/db/operation_context.cpp
+++ b/src/mongo/db/operation_context.cpp
@@ -139,10 +139,10 @@ bool OperationContext::hasDeadlineExpired() const {
if (!hasDeadline()) {
return false;
}
- if (MONGO_FAIL_POINT(maxTimeNeverTimeOut)) {
+ if (MONGO_unlikely(maxTimeNeverTimeOut.shouldFail())) {
return false;
}
- if (MONGO_FAIL_POINT(maxTimeAlwaysTimeOut)) {
+ if (MONGO_unlikely(maxTimeAlwaysTimeOut.shouldFail())) {
return true;
}
@@ -216,12 +216,12 @@ Status OperationContext::checkForInterruptNoAssert() noexcept {
return Status::OK();
}
- MONGO_FAIL_POINT_BLOCK(checkForInterruptFail, scopedFailPoint) {
- if (opShouldFail(getClient(), scopedFailPoint.getData())) {
+ checkForInterruptFail.executeIf(
+ [&](auto&&) {
log() << "set pending kill on op " << getOpID() << ", for checkForInterruptFail";
markKilled();
- }
- }
+ },
+ [&](auto&& data) { return opShouldFail(getClient(), data); });
const auto killStatus = getKillStatus();
if (killStatus != ErrorCodes::OK) {
@@ -281,7 +281,7 @@ StatusWith<stdx::cv_status> OperationContext::waitForConditionOrInterruptNoAsser
// maxTimeNeverTimeOut is set) then we assume that the incongruity is due to a clock mismatch
// and return _timeoutError regardless. To prevent this behaviour, only consider the op's
// deadline in the event that the maxTimeNeverTimeOut failpoint is not set.
- bool opHasDeadline = (hasDeadline() && !MONGO_FAIL_POINT(maxTimeNeverTimeOut));
+ bool opHasDeadline = (hasDeadline() && !MONGO_unlikely(maxTimeNeverTimeOut.shouldFail()));
if (opHasDeadline) {
deadline = std::min(deadline, getDeadline());