From 7540de90fac2bb907c233d10281103fd3aa165ca Mon Sep 17 00:00:00 2001 From: Benety Goh Date: Fri, 6 Jan 2023 15:14:59 +0000 Subject: SERVER-72584 ensure that oplog entries for partial transactions have both logical session and txn number --- src/mongo/db/repl/oplog_applier_impl.cpp | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'src/mongo') 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. -- cgit v1.2.1