summaryrefslogtreecommitdiff
path: root/src/mongo/db/transaction_participant.cpp
diff options
context:
space:
mode:
authorMatthew Russotto <matthew.russotto@10gen.com>2019-05-22 14:36:19 -0400
committerMatthew Russotto <matthew.russotto@10gen.com>2019-05-23 10:48:33 -0400
commite35e202e414df3f917ff26937f5e8325cce56b1e (patch)
treeabb394e16886c6918014fe5b7ef370509f16b267 /src/mongo/db/transaction_participant.cpp
parent358c0af2fe875d6a768cf87d7ddfaeb3181f804a (diff)
downloadmongo-e35e202e414df3f917ff26937f5e8325cce56b1e.tar.gz
SERVER-39811 Add a threshold of the total size of buffered oplog entries in a transaction and make it tunable, defaulting to unlimited
Diffstat (limited to 'src/mongo/db/transaction_participant.cpp')
-rw-r--r--src/mongo/db/transaction_participant.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/mongo/db/transaction_participant.cpp b/src/mongo/db/transaction_participant.cpp
index 34f83ba6888..3b963c9d7b8 100644
--- a/src/mongo/db/transaction_participant.cpp
+++ b/src/mongo/db/transaction_participant.cpp
@@ -1128,6 +1128,13 @@ void TransactionParticipant::Participant::addTransactionOperation(
p().transactionOperations.push_back(operation);
p().transactionOperationBytes += repl::OplogEntry::getDurableReplOperationSize(operation);
+ auto transactionSizeLimitBytes = gTransactionSizeLimitBytes.load();
+ uassert(ErrorCodes::TransactionTooLarge,
+ str::stream() << "Total size of all transaction operations must be less than "
+ << "server parameter 'transactionSizeLimitBytes' = "
+ << transactionSizeLimitBytes,
+ p().transactionOperationBytes <= static_cast<size_t>(transactionSizeLimitBytes));
+
// Creating transactions larger than 16MB requires a new oplog format only available in FCV 4.2.
const auto isFCV42 = serverGlobalParams.featureCompatibility.getVersion() ==
ServerGlobalParams::FeatureCompatibility::Version::kFullyUpgradedTo42;