diff options
author | Benety Goh <benety@mongodb.com> | 2023-01-06 15:14:59 +0000 |
---|---|---|
committer | Evergreen Agent <no-reply@evergreen.mongodb.com> | 2023-01-06 16:05:12 +0000 |
commit | 7540de90fac2bb907c233d10281103fd3aa165ca (patch) | |
tree | 9ad3927defc96f6f5af2c250415a8d0d471f8487 | |
parent | 24d3b65af21a007a6ec617cb1fc7d77905a103d6 (diff) | |
download | mongo-7540de90fac2bb907c233d10281103fd3aa165ca.tar.gz |
SERVER-72584 ensure that oplog entries for partial transactions have both logical session and txn number
-rw-r--r-- | src/mongo/db/repl/oplog_applier_impl.cpp | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mongo/db/repl/oplog_applier_impl.cpp b/src/mongo/db/repl/oplog_applier_impl.cpp index f7f01d12988..6d4818d5ac7 100644 --- a/src/mongo/db/repl/oplog_applier_impl.cpp +++ b/src/mongo/db/repl/oplog_applier_impl.cpp @@ -719,6 +719,11 @@ void OplogApplierImpl::_deriveOpsAndFillWriterVectors( // We also do this for prepare during initial sync. if (op.isPartialTransaction() || (op.shouldPrepare() && getOptions().mode == OplogApplication::Mode::kInitialSync)) { + // applyOps entries generated by a transaction must have a sessionId and a + // transaction number. + invariant(op.getSessionId(), op.toStringForLogging()); + invariant(op.getTxnNumber(), op.toStringForLogging()); + auto& partialTxnList = partialTxnOps[*op.getSessionId()]; // If this operation belongs to an existing partial transaction, partialTxnList // must contain the previous operations of the transaction. |