summaryrefslogtreecommitdiff
path: root/src/mongo/db/s/transaction_coordinator_util.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/s/transaction_coordinator_util.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/s/transaction_coordinator_util.cpp')
-rw-r--r--src/mongo/db/s/transaction_coordinator_util.cpp33
1 files changed, 16 insertions, 17 deletions
diff --git a/src/mongo/db/s/transaction_coordinator_util.cpp b/src/mongo/db/s/transaction_coordinator_util.cpp
index 9e6b78c445a..c98a1c25775 100644
--- a/src/mongo/db/s/transaction_coordinator_util.cpp
+++ b/src/mongo/db/s/transaction_coordinator_util.cpp
@@ -107,9 +107,9 @@ repl::OpTime persistParticipantListBlocking(OperationContext* opCtx,
const std::vector<ShardId>& participantList) {
LOG(3) << txnIdToString(lsid, txnNumber) << " Going to write participant list";
- if (MONGO_FAIL_POINT(hangBeforeWritingParticipantList)) {
+ if (MONGO_unlikely(hangBeforeWritingParticipantList.shouldFail())) {
LOG(0) << "Hit hangBeforeWritingParticipantList failpoint";
- MONGO_FAIL_POINT_PAUSE_WHILE_SET_OR_INTERRUPTED(opCtx, hangBeforeWritingParticipantList);
+ hangBeforeWritingParticipantList.pauseWhileSet(opCtx);
}
OperationSessionInfo sessionInfo;
@@ -239,9 +239,9 @@ Future<PrepareVoteConsensus> sendPrepare(ServiceContext* service,
getTransactionCoordinatorWorkerCurOpRepository()->set(
opCtx, lsid, txnNumber, CoordinatorAction::kSendingPrepare);
- if (MONGO_FAIL_POINT(hangBeforeSendingPrepare)) {
+ if (MONGO_unlikely(hangBeforeSendingPrepare.shouldFail())) {
LOG(0) << "Hit hangBeforeSendingPrepare failpoint";
- MONGO_FAIL_POINT_PAUSE_WHILE_SET_OR_INTERRUPTED(opCtx, hangBeforeSendingPrepare);
+ hangBeforeSendingPrepare.pauseWhileSet(opCtx);
}
};
@@ -292,9 +292,9 @@ repl::OpTime persistDecisionBlocking(OperationContext* opCtx,
LOG(3) << txnIdToString(lsid, txnNumber) << " Going to write decision "
<< (isCommit ? "commit" : "abort");
- if (MONGO_FAIL_POINT(hangBeforeWritingDecision)) {
+ if (MONGO_unlikely(hangBeforeWritingDecision.shouldFail())) {
LOG(0) << "Hit hangBeforeWritingDecision failpoint";
- MONGO_FAIL_POINT_PAUSE_WHILE_SET_OR_INTERRUPTED(opCtx, hangBeforeWritingDecision);
+ hangBeforeWritingDecision.pauseWhileSet(opCtx);
}
OperationSessionInfo sessionInfo;
@@ -401,9 +401,9 @@ Future<void> sendCommit(ServiceContext* service,
getTransactionCoordinatorWorkerCurOpRepository()->set(
opCtx, lsid, txnNumber, CoordinatorAction::kSendingCommit);
- if (MONGO_FAIL_POINT(hangBeforeSendingCommit)) {
+ if (MONGO_unlikely(hangBeforeSendingCommit.shouldFail())) {
LOG(0) << "Hit hangBeforeSendingCommit failpoint";
- MONGO_FAIL_POINT_PAUSE_WHILE_SET_OR_INTERRUPTED(opCtx, hangBeforeSendingCommit);
+ hangBeforeSendingCommit.pauseWhileSet(opCtx);
}
};
@@ -431,9 +431,9 @@ Future<void> sendAbort(ServiceContext* service,
getTransactionCoordinatorWorkerCurOpRepository()->set(
opCtx, lsid, txnNumber, CoordinatorAction::kSendingAbort);
- if (MONGO_FAIL_POINT(hangBeforeSendingAbort)) {
+ if (MONGO_unlikely(hangBeforeSendingAbort.shouldFail())) {
LOG(0) << "Hit hangBeforeSendingAbort failpoint";
- MONGO_FAIL_POINT_PAUSE_WHILE_SET_OR_INTERRUPTED(opCtx, hangBeforeSendingAbort);
+ hangBeforeSendingAbort.pauseWhileSet(opCtx);
}
};
@@ -451,9 +451,9 @@ void deleteCoordinatorDocBlocking(OperationContext* opCtx,
TxnNumber txnNumber) {
LOG(3) << txnIdToString(lsid, txnNumber) << " Going to delete coordinator doc";
- if (MONGO_FAIL_POINT(hangBeforeDeletingCoordinatorDoc)) {
+ if (MONGO_unlikely(hangBeforeDeletingCoordinatorDoc.shouldFail())) {
LOG(0) << "Hit hangBeforeDeletingCoordinatorDoc failpoint";
- MONGO_FAIL_POINT_PAUSE_WHILE_SET_OR_INTERRUPTED(opCtx, hangBeforeDeletingCoordinatorDoc);
+ hangBeforeDeletingCoordinatorDoc.pauseWhileSet(opCtx);
}
OperationSessionInfo sessionInfo;
@@ -506,15 +506,14 @@ void deleteCoordinatorDocBlocking(OperationContext* opCtx,
LOG(3) << txnIdToString(lsid, txnNumber) << " Deleted coordinator doc";
- MONGO_FAIL_POINT_BLOCK(hangAfterDeletingCoordinatorDoc, fp) {
+ hangAfterDeletingCoordinatorDoc.execute([&](const BSONObj& data) {
LOG(0) << "Hit hangAfterDeletingCoordinatorDoc failpoint";
- const BSONObj& data = fp.getData();
if (!data["useUninterruptibleSleep"].eoo()) {
- MONGO_FAIL_POINT_PAUSE_WHILE_SET(hangAfterDeletingCoordinatorDoc);
+ hangAfterDeletingCoordinatorDoc.pauseWhileSet();
} else {
- MONGO_FAIL_POINT_PAUSE_WHILE_SET_OR_INTERRUPTED(opCtx, hangAfterDeletingCoordinatorDoc);
+ hangAfterDeletingCoordinatorDoc.pauseWhileSet(opCtx);
}
- }
+ });
}
} // namespace