summaryrefslogtreecommitdiff
path: root/src/mongo/db/transaction_history_iterator.cpp
diff options
context:
space:
mode:
authorJustin Seyster <justin.seyster@mongodb.com>2019-05-24 17:12:24 -0400
committerJustin Seyster <justin.seyster@mongodb.com>2019-05-24 17:12:24 -0400
commit12ecabd2e68d04d67d1d0e392df4add40b9e99b4 (patch)
tree40d7859b31fa43f2c4fa5e6716a05988a39da361 /src/mongo/db/transaction_history_iterator.cpp
parentd5c24b8b78428fa30db8e19a6741cb57f74a8684 (diff)
downloadmongo-12ecabd2e68d04d67d1d0e392df4add40b9e99b4.tar.gz
SERVER-41222 TransactionHistoryIterator should not yield PBWM lock
Diffstat (limited to 'src/mongo/db/transaction_history_iterator.cpp')
-rw-r--r--src/mongo/db/transaction_history_iterator.cpp12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/mongo/db/transaction_history_iterator.cpp b/src/mongo/db/transaction_history_iterator.cpp
index 5358e3ab6c9..8d4e40cc87b 100644
--- a/src/mongo/db/transaction_history_iterator.cpp
+++ b/src/mongo/db/transaction_history_iterator.cpp
@@ -47,7 +47,7 @@ namespace {
/**
* Query the oplog for an entry with the given timestamp.
*/
-BSONObj findOneOplogEntry(OperationContext* opCtx, const repl::OpTime& opTime) {
+BSONObj findOneOplogEntry(OperationContext* opCtx, const repl::OpTime& opTime, bool permitYield) {
BSONObj oplogBSON;
invariant(!opTime.isNull());
@@ -73,7 +73,8 @@ BSONObj findOneOplogEntry(OperationContext* opCtx, const repl::OpTime& opTime) {
Date_t::max(),
AutoStatsTracker::LogMode::kUpdateTop);
- auto exec = uassertStatusOK(getExecutorFind(opCtx, ctx.getCollection(), std::move(cq)));
+ auto exec =
+ uassertStatusOK(getExecutorFind(opCtx, ctx.getCollection(), std::move(cq), permitYield));
auto getNextResult = exec->getNext(&oplogBSON, nullptr);
uassert(ErrorCodes::IncompleteTransactionHistory,
@@ -92,15 +93,16 @@ BSONObj findOneOplogEntry(OperationContext* opCtx, const repl::OpTime& opTime) {
} // namespace
-TransactionHistoryIterator::TransactionHistoryIterator(repl::OpTime startingOpTime)
- : _nextOpTime(std::move(startingOpTime)) {}
+TransactionHistoryIterator::TransactionHistoryIterator(repl::OpTime startingOpTime,
+ bool permitYield)
+ : _permitYield(permitYield), _nextOpTime(std::move(startingOpTime)) {}
bool TransactionHistoryIterator::hasNext() const {
return !_nextOpTime.isNull();
}
repl::OplogEntry TransactionHistoryIterator::next(OperationContext* opCtx) {
- BSONObj oplogBSON = findOneOplogEntry(opCtx, _nextOpTime);
+ BSONObj oplogBSON = findOneOplogEntry(opCtx, _nextOpTime, _permitYield);
auto oplogEntry = uassertStatusOK(repl::OplogEntry::parse(oplogBSON));
const auto& oplogPrevTsOption = oplogEntry.getPrevWriteOpTimeInTransaction();