summaryrefslogtreecommitdiff
path: root/src/mongo/db/repl
diff options
context:
space:
mode:
authorMatthew Saltz <matthew.saltz@mongodb.com>2019-01-18 15:40:07 -0500
committerMatthew Saltz <matthew.saltz@mongodb.com>2019-02-25 17:48:14 -0500
commit35372c0918d1e6e15cc95ecc2883c080c1b198dc (patch)
tree8d1446cb4ac9ff3a4e0d916862a14613357d830c /src/mongo/db/repl
parentbacb6b67706a2c057fcd0f76a38f416b225aa69a (diff)
downloadmongo-35372c0918d1e6e15cc95ecc2883c080c1b198dc.tar.gz
SERVER-37348 Make replication applier batches uninterruptible
Diffstat (limited to 'src/mongo/db/repl')
-rw-r--r--src/mongo/db/repl/apply_ops.cpp11
-rw-r--r--src/mongo/db/repl/sync_tail.cpp3
2 files changed, 13 insertions, 1 deletions
diff --git a/src/mongo/db/repl/apply_ops.cpp b/src/mongo/db/repl/apply_ops.cpp
index dcfcc233bcc..8c3bea492b3 100644
--- a/src/mongo/db/repl/apply_ops.cpp
+++ b/src/mongo/db/repl/apply_ops.cpp
@@ -68,6 +68,9 @@ namespace {
// If enabled, causes loop in _applyOps() to hang after applying current operation.
MONGO_FAIL_POINT_DEFINE(applyOpsPauseBetweenOperations);
+// If enabled, causes _applyPrepareTransaction to hang before preparing the transaction participant.
+MONGO_FAIL_POINT_DEFINE(applyOpsHangBeforePreparingTransaction);
+
/**
* Return true iff the applyOpsCmd can be executed in a single WriteUnitOfWork.
*/
@@ -315,8 +318,16 @@ Status _applyPrepareTransaction(OperationContext* opCtx,
return status;
}
invariant(!entry.getOpTime().isNull());
+
+ if (MONGO_FAIL_POINT(applyOpsHangBeforePreparingTransaction)) {
+ LOG(0) << "Hit applyOpsHangBeforePreparingTransaction failpoint";
+ MONGO_FAIL_POINT_PAUSE_WHILE_SET_OR_INTERRUPTED(opCtx,
+ applyOpsHangBeforePreparingTransaction);
+ }
+
transaction.prepareTransaction(opCtx, entry.getOpTime());
transaction.stashTransactionResources(opCtx);
+
return Status::OK();
}
diff --git a/src/mongo/db/repl/sync_tail.cpp b/src/mongo/db/repl/sync_tail.cpp
index 5644975352a..f06f635d7fd 100644
--- a/src/mongo/db/repl/sync_tail.cpp
+++ b/src/mongo/db/repl/sync_tail.cpp
@@ -434,7 +434,8 @@ void applyOps(std::vector<MultiApplier::OperationPtrs>& writerVectors,
&workerMultikeyPathInfo = workerMultikeyPathInfo->at(i)
] {
auto opCtx = cc().makeOperationContext();
- status = func(opCtx.get(), &writer, st, &workerMultikeyPathInfo);
+ status = opCtx->runWithoutInterruption(
+ [&] { return func(opCtx.get(), &writer, st, &workerMultikeyPathInfo); });
}));
}
}