diff options
author | Benety Goh <benety@mongodb.com> | 2022-10-26 20:55:21 -0400 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2022-10-27 01:50:58 +0000 |
commit | 6c2e51f7e831b7eab41cc03c0d7e3533a71457b9 (patch) | |
tree | 966de5bedc111f0d8e8b07e976c2da8750836ec2 /src/mongo/db/transaction/transaction_operations.cpp | |
parent | c11e37e8d3977f913130ec517c7fe20d0b804cc5 (diff) | |
download | mongo-6c2e51f7e831b7eab41cc03c0d7e3533a71457b9.tar.gz |
SERVER-70765 make TransactionOperations::getApplyOpsInfo() limits mandatory
Diffstat (limited to 'src/mongo/db/transaction/transaction_operations.cpp')
-rw-r--r-- | src/mongo/db/transaction/transaction_operations.cpp | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/src/mongo/db/transaction/transaction_operations.cpp b/src/mongo/db/transaction/transaction_operations.cpp index f50a9ef49b8..2f4619ca50d 100644 --- a/src/mongo/db/transaction/transaction_operations.cpp +++ b/src/mongo/db/transaction/transaction_operations.cpp @@ -52,25 +52,21 @@ namespace { std::vector<BSONObj> packOperationsIntoApplyOps( std::vector<repl::ReplOperation>::const_iterator operationsBegin, std::vector<repl::ReplOperation>::const_iterator operationsEnd, - boost::optional<std::size_t> oplogEntryCountLimit, - boost::optional<std::size_t> oplogEntrySizeLimitBytes) { + std::size_t oplogEntryCountLimit, + std::size_t oplogEntrySizeLimitBytes) { std::vector<BSONObj> operations; std::size_t totalOperationsSize{0}; for (auto operationIter = operationsBegin; operationIter != operationsEnd; ++operationIter) { const auto& operation = *operationIter; - if (oplogEntryCountLimit) { - if (operations.size() == *oplogEntryCountLimit) { - break; - } + if (operations.size() == oplogEntryCountLimit) { + break; } - if (oplogEntrySizeLimitBytes) { - if ((operations.size() > 0 && - (totalOperationsSize + - repl::DurableOplogEntry::getDurableReplOperationSize(operation) > - *oplogEntrySizeLimitBytes))) { - break; - } + if ((operations.size() > 0 && + (totalOperationsSize + + repl::DurableOplogEntry::getDurableReplOperationSize(operation) > + oplogEntrySizeLimitBytes))) { + break; } auto serializedOperation = operation.toBSON(); @@ -180,9 +176,9 @@ TransactionOperations::CollectionUUIDs TransactionOperations::getCollectionUUIDs TransactionOperations::ApplyOpsInfo TransactionOperations::getApplyOpsInfo( const std::vector<OplogSlot>& oplogSlots, - bool prepare, - boost::optional<std::size_t> oplogEntryCountLimit, - boost::optional<std::size_t> oplogEntrySizeLimitBytes) const { + std::size_t oplogEntryCountLimit, + std::size_t oplogEntrySizeLimitBytes, + bool prepare) const { const auto& operations = _transactionOperations; if (operations.empty()) { return {{}, /*numberOfOplogSlotsUsed=*/0}; |