summaryrefslogtreecommitdiff
path: root/src/mongo
diff options
context:
space:
mode:
Diffstat (limited to 'src/mongo')
-rw-r--r--src/mongo/db/auth/auth_op_observer.h3
-rw-r--r--src/mongo/db/free_mon/free_mon_op_observer.h3
-rw-r--r--src/mongo/db/op_observer/fcv_op_observer.h3
-rw-r--r--src/mongo/db/op_observer/op_observer.h11
-rw-r--r--src/mongo/db/op_observer/op_observer_impl.cpp6
-rw-r--r--src/mongo/db/op_observer/op_observer_impl.h3
-rw-r--r--src/mongo/db/op_observer/op_observer_impl_test.cpp67
-rw-r--r--src/mongo/db/op_observer/op_observer_noop.h3
-rw-r--r--src/mongo/db/op_observer/op_observer_registry.h5
-rw-r--r--src/mongo/db/op_observer/user_write_block_mode_op_observer.h3
-rw-r--r--src/mongo/db/repl/primary_only_service_op_observer.h3
-rw-r--r--src/mongo/db/repl/tenant_migration_donor_op_observer.h3
-rw-r--r--src/mongo/db/repl/tenant_migration_recipient_op_observer.h3
-rw-r--r--src/mongo/db/s/config_server_op_observer.h3
-rw-r--r--src/mongo/db/s/query_analysis_op_observer.h3
-rw-r--r--src/mongo/db/s/range_deleter_service_op_observer.h3
-rw-r--r--src/mongo/db/s/resharding/resharding_op_observer.h3
-rw-r--r--src/mongo/db/s/shard_server_op_observer.h3
-rw-r--r--src/mongo/db/serverless/shard_split_donor_op_observer.h3
-rw-r--r--src/mongo/db/transaction/transaction_participant.cpp5
-rw-r--r--src/mongo/db/transaction/transaction_participant_retryable_writes_test.cpp6
-rw-r--r--src/mongo/db/transaction/transaction_participant_test.cpp9
-rw-r--r--src/mongo/idl/cluster_server_parameter_op_observer.h3
23 files changed, 66 insertions, 91 deletions
diff --git a/src/mongo/db/auth/auth_op_observer.h b/src/mongo/db/auth/auth_op_observer.h
index 4b4186db6af..3437f89dd99 100644
--- a/src/mongo/db/auth/auth_op_observer.h
+++ b/src/mongo/db/auth/auth_op_observer.h
@@ -205,8 +205,7 @@ public:
const UUID& uuid) final;
void onUnpreparedTransactionCommit(OperationContext* opCtx,
- std::vector<repl::ReplOperation>* statements,
- size_t numberOfPrePostImagesToWrite) final {}
+ TransactionOperations* transactionOperations) final {}
void onPreparedTransactionCommit(
OperationContext* opCtx,
diff --git a/src/mongo/db/free_mon/free_mon_op_observer.h b/src/mongo/db/free_mon/free_mon_op_observer.h
index 60f3d4ed5b7..b33131e4e7d 100644
--- a/src/mongo/db/free_mon/free_mon_op_observer.h
+++ b/src/mongo/db/free_mon/free_mon_op_observer.h
@@ -205,8 +205,7 @@ public:
const UUID& uuid) final {}
void onUnpreparedTransactionCommit(OperationContext* opCtx,
- std::vector<repl::ReplOperation>* statements,
- size_t numberOfPrePostImagesToWrite) final {}
+ TransactionOperations* transactionOperations) final {}
void onPreparedTransactionCommit(
OperationContext* opCtx,
diff --git a/src/mongo/db/op_observer/fcv_op_observer.h b/src/mongo/db/op_observer/fcv_op_observer.h
index c7641fd6d9a..f4d77200ed8 100644
--- a/src/mongo/db/op_observer/fcv_op_observer.h
+++ b/src/mongo/db/op_observer/fcv_op_observer.h
@@ -200,8 +200,7 @@ public:
const NamespaceString& collectionName,
const UUID& uuid) final {}
void onUnpreparedTransactionCommit(OperationContext* opCtx,
- std::vector<repl::ReplOperation>* statements,
- size_t numberOfPrePostImagesToWrite) final {}
+ TransactionOperations* transactionOperations) final {}
void onPreparedTransactionCommit(
OperationContext* opCtx,
diff --git a/src/mongo/db/op_observer/op_observer.h b/src/mongo/db/op_observer/op_observer.h
index f8bfd52e235..f0371ce6e94 100644
--- a/src/mongo/db/op_observer/op_observer.h
+++ b/src/mongo/db/op_observer/op_observer.h
@@ -36,6 +36,7 @@
#include "mongo/db/catalog/commit_quorum_options.h"
#include "mongo/db/jsobj.h"
#include "mongo/db/repl/rollback.h"
+#include "mongo/db/transaction/transaction_operations.h"
namespace mongo {
@@ -410,15 +411,11 @@ public:
* transaction, before the RecoveryUnit onCommit() is called. It must not be called when no
* transaction is active.
*
- * The 'statements' are the list of CRUD operations to be applied in this transaction.
- *
- * The 'numberOfPrePostImagesToWrite' is the number of CRUD operations that have a pre-image
- * to write as a noop oplog entry. The op observer will reserve oplog slots for these
- * preimages in addition to the statements.
+ * The 'transactionOperations' contains the list of CRUD operations (formerly 'statements') to
+ * be applied in this transaction.
*/
virtual void onUnpreparedTransactionCommit(OperationContext* opCtx,
- std::vector<repl::ReplOperation>* statements,
- size_t numberOfPrePostImagesToWrite) = 0;
+ TransactionOperations* transactionOperations) = 0;
/**
* The onPreparedTransactionCommit method is called on the commit of a prepared transaction,
* after the RecoveryUnit onCommit() is called. It must not be called when no transaction is
diff --git a/src/mongo/db/op_observer/op_observer_impl.cpp b/src/mongo/db/op_observer/op_observer_impl.cpp
index aa867b8847d..d784138e4ad 100644
--- a/src/mongo/db/op_observer/op_observer_impl.cpp
+++ b/src/mongo/db/op_observer/op_observer_impl.cpp
@@ -2024,8 +2024,10 @@ void logCommitOrAbortForPreparedTransaction(OperationContext* opCtx,
} // namespace
void OpObserverImpl::onUnpreparedTransactionCommit(OperationContext* opCtx,
- std::vector<repl::ReplOperation>* statements,
- size_t numberOfPrePostImagesToWrite) {
+ TransactionOperations* transactionOperations) {
+ auto statements = transactionOperations->getMutableOperationsForOpObserver();
+ auto numberOfPrePostImagesToWrite = transactionOperations->getNumberOfPrePostImagesToWrite();
+
invariant(opCtx->getTxnNumber());
if (!opCtx->writesAreReplicated()) {
diff --git a/src/mongo/db/op_observer/op_observer_impl.h b/src/mongo/db/op_observer/op_observer_impl.h
index bb704238a01..7445ff5dc69 100644
--- a/src/mongo/db/op_observer/op_observer_impl.h
+++ b/src/mongo/db/op_observer/op_observer_impl.h
@@ -215,8 +215,7 @@ public:
const NamespaceString& collectionName,
const UUID& uuid) final;
void onUnpreparedTransactionCommit(OperationContext* opCtx,
- std::vector<repl::ReplOperation>* statements,
- size_t numberOfPrePostImagesToWrite) final;
+ TransactionOperations* transactionOperations) final;
void onBatchedWriteStart(OperationContext* opCtx) final;
void onBatchedWriteCommit(OperationContext* opCtx) final;
void onBatchedWriteAbort(OperationContext* opCtx) final;
diff --git a/src/mongo/db/op_observer/op_observer_impl_test.cpp b/src/mongo/db/op_observer/op_observer_impl_test.cpp
index f08f1a9592f..25dfeee2408 100644
--- a/src/mongo/db/op_observer/op_observer_impl_test.cpp
+++ b/src/mongo/db/op_observer/op_observer_impl_test.cpp
@@ -134,10 +134,9 @@ template <typename OpObserverType>
void commitUnpreparedTransaction(OperationContext* opCtx, OpObserverType& opObserver) {
auto txnParticipant = TransactionParticipant::get(opCtx);
auto txnOps = txnParticipant.retrieveCompletedTransactionOperations(opCtx);
- opObserver.onUnpreparedTransactionCommit(
- opCtx,
- txnOps->getMutableOperationsForOpObserver(),
- txnParticipant.getNumberOfPrePostImagesToWriteForTest());
+ ASSERT_EQUALS(txnOps->getNumberOfPrePostImagesToWrite(),
+ txnParticipant.getNumberOfPrePostImagesToWriteForTest());
+ opObserver.onUnpreparedTransactionCommit(opCtx, txnOps);
}
std::vector<repl::OpTime> reserveOpTimesInSideTransaction(OperationContext* opCtx, size_t count) {
@@ -1595,8 +1594,8 @@ TEST_F(OpObserverTransactionTest, CommittingUnpreparedNonEmptyTransactionWritesT
}
auto txnOps = txnParticipant.retrieveCompletedTransactionOperations(opCtx());
- opObserver().onUnpreparedTransactionCommit(
- opCtx(), txnOps->getMutableOperationsForOpObserver(), 0);
+ ASSERT_EQUALS(txnOps->getNumberOfPrePostImagesToWrite(), 0);
+ opObserver().onUnpreparedTransactionCommit(opCtx(), txnOps);
opCtx()->getWriteUnitOfWork()->commit();
assertTxnRecord(txnNum(), {}, DurableTxnStateEnum::kCommitted);
@@ -1608,8 +1607,8 @@ TEST_F(OpObserverTransactionTest,
txnParticipant.unstashTransactionResources(opCtx(), "prepareTransaction");
auto txnOps = txnParticipant.retrieveCompletedTransactionOperations(opCtx());
- opObserver().onUnpreparedTransactionCommit(
- opCtx(), txnOps->getMutableOperationsForOpObserver(), 0);
+ ASSERT_EQUALS(txnOps->getNumberOfPrePostImagesToWrite(), 0);
+ opObserver().onUnpreparedTransactionCommit(opCtx(), txnOps);
txnParticipant.stashTransactionResources(opCtx());
@@ -1679,8 +1678,8 @@ TEST_F(OpObserverTransactionTest, TransactionalInsertTest) {
opObserver().onInserts(opCtx(), *autoColl1, inserts1.begin(), inserts1.end(), false);
opObserver().onInserts(opCtx(), *autoColl2, inserts2.begin(), inserts2.end(), false);
auto txnOps = txnParticipant.retrieveCompletedTransactionOperations(opCtx());
- opObserver().onUnpreparedTransactionCommit(
- opCtx(), txnOps->getMutableOperationsForOpObserver(), 0);
+ ASSERT_EQUALS(txnOps->getNumberOfPrePostImagesToWrite(), 0);
+ opObserver().onUnpreparedTransactionCommit(opCtx(), txnOps);
auto oplogEntryObj = getSingleOplogEntry(opCtx());
checkCommonFields(oplogEntryObj);
OplogEntry oplogEntry = assertGet(OplogEntry::parse(oplogEntryObj));
@@ -1744,8 +1743,8 @@ TEST_F(OpObserverTransactionTest, TransactionalInsertTestIncludesTenantId) {
opObserver().onInserts(opCtx(), *autoColl2, inserts2.begin(), inserts2.end(), false);
auto txnOps = txnParticipant.retrieveCompletedTransactionOperations(opCtx());
- opObserver().onUnpreparedTransactionCommit(
- opCtx(), txnOps->getMutableOperationsForOpObserver(), 0);
+ ASSERT_EQUALS(txnOps->getNumberOfPrePostImagesToWrite(), 0);
+ opObserver().onUnpreparedTransactionCommit(opCtx(), txnOps);
auto oplogEntryObj = getSingleOplogEntry(opCtx());
checkCommonFields(oplogEntryObj);
@@ -1818,8 +1817,8 @@ TEST_F(OpObserverTransactionTest, TransactionalUpdateTest) {
opObserver().onUpdate(opCtx(), update1);
opObserver().onUpdate(opCtx(), update2);
auto txnOps = txnParticipant.retrieveCompletedTransactionOperations(opCtx());
- opObserver().onUnpreparedTransactionCommit(
- opCtx(), txnOps->getMutableOperationsForOpObserver(), 0);
+ ASSERT_EQUALS(txnOps->getNumberOfPrePostImagesToWrite(), 0);
+ opObserver().onUnpreparedTransactionCommit(opCtx(), txnOps);
auto oplogEntry = getSingleOplogEntry(opCtx());
checkCommonFields(oplogEntry);
auto o = oplogEntry.getObjectField("o");
@@ -1873,8 +1872,8 @@ TEST_F(OpObserverTransactionTest, TransactionalUpdateTestIncludesTenantId) {
opObserver().onUpdate(opCtx(), update2);
auto txnOps = txnParticipant.retrieveCompletedTransactionOperations(opCtx());
- opObserver().onUnpreparedTransactionCommit(
- opCtx(), txnOps->getMutableOperationsForOpObserver(), 0);
+ ASSERT_EQUALS(txnOps->getNumberOfPrePostImagesToWrite(), 0);
+ opObserver().onUnpreparedTransactionCommit(opCtx(), txnOps);
auto oplogEntryObj = getSingleOplogEntry(opCtx());
checkCommonFields(oplogEntryObj);
@@ -1925,8 +1924,8 @@ TEST_F(OpObserverTransactionTest, TransactionalDeleteTest) {
<< "y"));
opObserver().onDelete(opCtx(), nss2, uuid2, 0, {});
auto txnOps = txnParticipant.retrieveCompletedTransactionOperations(opCtx());
- opObserver().onUnpreparedTransactionCommit(
- opCtx(), txnOps->getMutableOperationsForOpObserver(), 0);
+ ASSERT_EQUALS(txnOps->getNumberOfPrePostImagesToWrite(), 0);
+ opObserver().onUnpreparedTransactionCommit(opCtx(), txnOps);
auto oplogEntry = getSingleOplogEntry(opCtx());
checkCommonFields(oplogEntry);
auto o = oplogEntry.getObjectField("o");
@@ -1967,8 +1966,8 @@ TEST_F(OpObserverTransactionTest, TransactionalDeleteTestIncludesTenantId) {
opObserver().onDelete(opCtx(), nss2, uuid2, 0, {});
auto txnOps = txnParticipant.retrieveCompletedTransactionOperations(opCtx());
- opObserver().onUnpreparedTransactionCommit(
- opCtx(), txnOps->getMutableOperationsForOpObserver(), 0);
+ ASSERT_EQUALS(txnOps->getNumberOfPrePostImagesToWrite(), 0);
+ opObserver().onUnpreparedTransactionCommit(opCtx(), txnOps);
auto oplogEntryObj = getSingleOplogEntry(opCtx());
checkCommonFields(oplogEntryObj);
@@ -2015,8 +2014,8 @@ TEST_F(OpObserverTransactionTest,
donorMtab->startBlockingWrites();
auto txnOps = txnParticipant.retrieveCompletedTransactionOperations(opCtx());
- ASSERT_THROWS_CODE(opObserver().onUnpreparedTransactionCommit(
- opCtx(), txnOps->getMutableOperationsForOpObserver(), 0),
+ ASSERT_EQUALS(txnOps->getNumberOfPrePostImagesToWrite(), 0);
+ ASSERT_THROWS_CODE(opObserver().onUnpreparedTransactionCommit(opCtx(), txnOps),
DBException,
ErrorCodes::TenantMigrationConflict);
@@ -3440,8 +3439,8 @@ TEST_F(OpObserverMultiEntryTransactionTest, TransactionSingleStatementTest) {
WriteUnitOfWork wuow(opCtx());
opObserver().onInserts(opCtx(), *autoColl, inserts.begin(), inserts.end(), false);
auto txnOps = txnParticipant.retrieveCompletedTransactionOperations(opCtx());
- opObserver().onUnpreparedTransactionCommit(
- opCtx(), txnOps->getMutableOperationsForOpObserver(), 0);
+ ASSERT_EQUALS(txnOps->getNumberOfPrePostImagesToWrite(), 0);
+ opObserver().onUnpreparedTransactionCommit(opCtx(), txnOps);
auto oplogEntryObj = getNOplogEntries(opCtx(), 1)[0];
checkSessionAndTransactionFields(oplogEntryObj);
auto oplogEntry = assertGet(OplogEntry::parse(oplogEntryObj));
@@ -3474,8 +3473,8 @@ TEST_F(OpObserverMultiEntryTransactionTest, TransactionalInsertTest) {
opObserver().onInserts(opCtx(), *autoColl1, inserts1.begin(), inserts1.end(), false);
opObserver().onInserts(opCtx(), *autoColl2, inserts2.begin(), inserts2.end(), false);
auto txnOps = txnParticipant.retrieveCompletedTransactionOperations(opCtx());
- opObserver().onUnpreparedTransactionCommit(
- opCtx(), txnOps->getMutableOperationsForOpObserver(), 0);
+ ASSERT_EQUALS(txnOps->getNumberOfPrePostImagesToWrite(), 0);
+ opObserver().onUnpreparedTransactionCommit(opCtx(), txnOps);
auto oplogEntryObjs = getNOplogEntries(opCtx(), 4);
std::vector<OplogEntry> oplogEntries;
mongo::repl::OpTime expectedPrevWriteOpTime;
@@ -3552,8 +3551,8 @@ TEST_F(OpObserverMultiEntryTransactionTest, TransactionalUpdateTest) {
opObserver().onUpdate(opCtx(), update1);
opObserver().onUpdate(opCtx(), update2);
auto txnOps = txnParticipant.retrieveCompletedTransactionOperations(opCtx());
- opObserver().onUnpreparedTransactionCommit(
- opCtx(), txnOps->getMutableOperationsForOpObserver(), 0);
+ ASSERT_EQUALS(txnOps->getNumberOfPrePostImagesToWrite(), 0);
+ opObserver().onUnpreparedTransactionCommit(opCtx(), txnOps);
auto oplogEntryObjs = getNOplogEntries(opCtx(), 2);
std::vector<OplogEntry> oplogEntries;
mongo::repl::OpTime expectedPrevWriteOpTime;
@@ -3611,8 +3610,8 @@ TEST_F(OpObserverMultiEntryTransactionTest, TransactionalDeleteTest) {
<< "y"));
opObserver().onDelete(opCtx(), nss2, uuid2, 0, {});
auto txnOps = txnParticipant.retrieveCompletedTransactionOperations(opCtx());
- opObserver().onUnpreparedTransactionCommit(
- opCtx(), txnOps->getMutableOperationsForOpObserver(), 0);
+ ASSERT_EQUALS(txnOps->getNumberOfPrePostImagesToWrite(), 0);
+ opObserver().onUnpreparedTransactionCommit(opCtx(), txnOps);
auto oplogEntryObjs = getNOplogEntries(opCtx(), 2);
std::vector<OplogEntry> oplogEntries;
mongo::repl::OpTime expectedPrevWriteOpTime;
@@ -4013,8 +4012,8 @@ TEST_F(OpObserverMultiEntryTransactionTest, UnpreparedTransactionPackingTest) {
opObserver().onInserts(opCtx(), *autoColl1, inserts1.begin(), inserts1.end(), false);
opObserver().onInserts(opCtx(), *autoColl2, inserts2.begin(), inserts2.end(), false);
auto txnOps = txnParticipant.retrieveCompletedTransactionOperations(opCtx());
- opObserver().onUnpreparedTransactionCommit(
- opCtx(), txnOps->getMutableOperationsForOpObserver(), 0);
+ ASSERT_EQUALS(txnOps->getNumberOfPrePostImagesToWrite(), 0);
+ opObserver().onUnpreparedTransactionCommit(opCtx(), txnOps);
auto oplogEntryObjs = getNOplogEntries(opCtx(), 1);
std::vector<OplogEntry> oplogEntries;
mongo::repl::OpTime expectedPrevWriteOpTime;
@@ -4223,8 +4222,8 @@ TEST_F(OpObserverLargeTransactionTest, LargeTransactionCreatesMultipleOplogEntri
txnParticipant.addTransactionOperation(opCtx(), operation1);
txnParticipant.addTransactionOperation(opCtx(), operation2);
auto txnOps = txnParticipant.retrieveCompletedTransactionOperations(opCtx());
- opObserver().onUnpreparedTransactionCommit(
- opCtx(), txnOps->getMutableOperationsForOpObserver(), 0);
+ ASSERT_EQUALS(txnOps->getNumberOfPrePostImagesToWrite(), 0);
+ opObserver().onUnpreparedTransactionCommit(opCtx(), txnOps);
auto oplogEntryObjs = getNOplogEntries(opCtx(), 2);
std::vector<OplogEntry> oplogEntries;
mongo::repl::OpTime expectedPrevWriteOpTime;
diff --git a/src/mongo/db/op_observer/op_observer_noop.h b/src/mongo/db/op_observer/op_observer_noop.h
index 8bea94e5578..9a91fc7601e 100644
--- a/src/mongo/db/op_observer/op_observer_noop.h
+++ b/src/mongo/db/op_observer/op_observer_noop.h
@@ -183,8 +183,7 @@ public:
const NamespaceString& collectionName,
const UUID& uuid) override {}
void onUnpreparedTransactionCommit(OperationContext* opCtx,
- std::vector<repl::ReplOperation>* statements,
- size_t numberOfPrePostImagesToWrite) override {}
+ TransactionOperations* transactionOperations) override {}
void onBatchedWriteStart(OperationContext* opCtx) final {}
void onBatchedWriteCommit(OperationContext* opCtx) final {}
void onBatchedWriteAbort(OperationContext* opCtx) final {}
diff --git a/src/mongo/db/op_observer/op_observer_registry.h b/src/mongo/db/op_observer/op_observer_registry.h
index 0ce554bfb9a..93a4cda1197 100644
--- a/src/mongo/db/op_observer/op_observer_registry.h
+++ b/src/mongo/db/op_observer/op_observer_registry.h
@@ -413,11 +413,10 @@ public:
}
void onUnpreparedTransactionCommit(OperationContext* opCtx,
- std::vector<repl::ReplOperation>* statements,
- size_t numberOfPrePostImagesToWrite) override {
+ TransactionOperations* transactionOperations) override {
ReservedTimes times{opCtx};
for (auto& o : _observers)
- o->onUnpreparedTransactionCommit(opCtx, statements, numberOfPrePostImagesToWrite);
+ o->onUnpreparedTransactionCommit(opCtx, transactionOperations);
}
void onPreparedTransactionCommit(
diff --git a/src/mongo/db/op_observer/user_write_block_mode_op_observer.h b/src/mongo/db/op_observer/user_write_block_mode_op_observer.h
index 40e39378e68..e401278faf1 100644
--- a/src/mongo/db/op_observer/user_write_block_mode_op_observer.h
+++ b/src/mongo/db/op_observer/user_write_block_mode_op_observer.h
@@ -229,8 +229,7 @@ public:
const UUID& uuid) final {}
void onUnpreparedTransactionCommit(OperationContext* opCtx,
- std::vector<repl::ReplOperation>* statements,
- size_t numberOfPrePostImagesToWrite) final {}
+ TransactionOperations* transactionOperations) final {}
void onPreparedTransactionCommit(
OperationContext* opCtx,
diff --git a/src/mongo/db/repl/primary_only_service_op_observer.h b/src/mongo/db/repl/primary_only_service_op_observer.h
index 391f612daa9..e55386403d9 100644
--- a/src/mongo/db/repl/primary_only_service_op_observer.h
+++ b/src/mongo/db/repl/primary_only_service_op_observer.h
@@ -207,8 +207,7 @@ public:
const UUID& uuid) final {}
void onUnpreparedTransactionCommit(OperationContext* opCtx,
- std::vector<repl::ReplOperation>* statements,
- size_t numberOfPrePostImagesToWrite) final {}
+ TransactionOperations* transactionOperations) final {}
void onPreparedTransactionCommit(
OperationContext* opCtx,
diff --git a/src/mongo/db/repl/tenant_migration_donor_op_observer.h b/src/mongo/db/repl/tenant_migration_donor_op_observer.h
index 842a43926ab..0bc7e0022f5 100644
--- a/src/mongo/db/repl/tenant_migration_donor_op_observer.h
+++ b/src/mongo/db/repl/tenant_migration_donor_op_observer.h
@@ -204,8 +204,7 @@ public:
const UUID& uuid) final {}
void onUnpreparedTransactionCommit(OperationContext* opCtx,
- std::vector<repl::ReplOperation>* statements,
- size_t numberOfPrePostImagesToWrite) final {}
+ TransactionOperations* transactionOperations) final {}
void onPreparedTransactionCommit(
OperationContext* opCtx,
diff --git a/src/mongo/db/repl/tenant_migration_recipient_op_observer.h b/src/mongo/db/repl/tenant_migration_recipient_op_observer.h
index b62a276b86d..06684b2bc87 100644
--- a/src/mongo/db/repl/tenant_migration_recipient_op_observer.h
+++ b/src/mongo/db/repl/tenant_migration_recipient_op_observer.h
@@ -206,8 +206,7 @@ public:
const UUID& uuid) final {}
void onUnpreparedTransactionCommit(OperationContext* opCtx,
- std::vector<repl::ReplOperation>* statements,
- size_t numberOfPrePostImagesToWrite) final {}
+ TransactionOperations* transactionOperations) final {}
void onPreparedTransactionCommit(
OperationContext* opCtx,
diff --git a/src/mongo/db/s/config_server_op_observer.h b/src/mongo/db/s/config_server_op_observer.h
index 64411e8c2a4..00d6a2d7309 100644
--- a/src/mongo/db/s/config_server_op_observer.h
+++ b/src/mongo/db/s/config_server_op_observer.h
@@ -207,8 +207,7 @@ public:
const UUID& uuid) override {}
void onUnpreparedTransactionCommit(OperationContext* opCtx,
- std::vector<repl::ReplOperation>* statements,
- size_t numberOfPrePostImagesToWrite) override {}
+ TransactionOperations* transactionOperations) override {}
void onPreparedTransactionCommit(
OperationContext* opCtx,
diff --git a/src/mongo/db/s/query_analysis_op_observer.h b/src/mongo/db/s/query_analysis_op_observer.h
index 998ff0b7cf3..1dc18c6ce42 100644
--- a/src/mongo/db/s/query_analysis_op_observer.h
+++ b/src/mongo/db/s/query_analysis_op_observer.h
@@ -206,8 +206,7 @@ public:
const UUID& uuid) final {}
void onUnpreparedTransactionCommit(OperationContext* opCtx,
- std::vector<repl::ReplOperation>* statements,
- size_t numberOfPrePostImagesToWrite) final {}
+ TransactionOperations* transactionOperations) final {}
void onPreparedTransactionCommit(
OperationContext* opCtx,
diff --git a/src/mongo/db/s/range_deleter_service_op_observer.h b/src/mongo/db/s/range_deleter_service_op_observer.h
index 430535ceac5..1ac62baadd8 100644
--- a/src/mongo/db/s/range_deleter_service_op_observer.h
+++ b/src/mongo/db/s/range_deleter_service_op_observer.h
@@ -211,8 +211,7 @@ private:
const UUID& uuid) override {}
void onUnpreparedTransactionCommit(OperationContext* opCtx,
- std::vector<repl::ReplOperation>* statements,
- size_t numberOfPrePostImagesToWrite) override {}
+ TransactionOperations* transactionOperations) override {}
void onPreparedTransactionCommit(
OperationContext* opCtx,
diff --git a/src/mongo/db/s/resharding/resharding_op_observer.h b/src/mongo/db/s/resharding/resharding_op_observer.h
index de3a84ded6b..ae48c80fa74 100644
--- a/src/mongo/db/s/resharding/resharding_op_observer.h
+++ b/src/mongo/db/s/resharding/resharding_op_observer.h
@@ -227,8 +227,7 @@ public:
const UUID& uuid) override {}
void onUnpreparedTransactionCommit(OperationContext* opCtx,
- std::vector<repl::ReplOperation>* statements,
- size_t numberOfPrePostImagesToWrite) override {}
+ TransactionOperations* transactionOperations) override {}
void onPreparedTransactionCommit(
OperationContext* opCtx,
diff --git a/src/mongo/db/s/shard_server_op_observer.h b/src/mongo/db/s/shard_server_op_observer.h
index 3c1db831e7d..a14ddbb87fc 100644
--- a/src/mongo/db/s/shard_server_op_observer.h
+++ b/src/mongo/db/s/shard_server_op_observer.h
@@ -206,8 +206,7 @@ public:
const UUID& uuid) override {}
void onUnpreparedTransactionCommit(OperationContext* opCtx,
- std::vector<repl::ReplOperation>* statements,
- size_t numberOfPrePostImagesToWrite) override {}
+ TransactionOperations* transactionOperations) override {}
void onPreparedTransactionCommit(
OperationContext* opCtx,
diff --git a/src/mongo/db/serverless/shard_split_donor_op_observer.h b/src/mongo/db/serverless/shard_split_donor_op_observer.h
index fba3471c7dd..797a86966a1 100644
--- a/src/mongo/db/serverless/shard_split_donor_op_observer.h
+++ b/src/mongo/db/serverless/shard_split_donor_op_observer.h
@@ -203,8 +203,7 @@ public:
const UUID& uuid) final {}
void onUnpreparedTransactionCommit(OperationContext* opCtx,
- std::vector<repl::ReplOperation>* statements,
- size_t numberOfPrePostImagesToWrite) final {}
+ TransactionOperations* transactionOperations) final {}
void onPreparedTransactionCommit(
OperationContext* opCtx,
diff --git a/src/mongo/db/transaction/transaction_participant.cpp b/src/mongo/db/transaction/transaction_participant.cpp
index ef9ea4bd469..bbc259739f1 100644
--- a/src/mongo/db/transaction/transaction_participant.cpp
+++ b/src/mongo/db/transaction/transaction_participant.cpp
@@ -1785,10 +1785,7 @@ void TransactionParticipant::Participant::commitUnpreparedTransaction(OperationC
auto opObserver = opCtx->getServiceContext()->getOpObserver();
invariant(opObserver);
- opObserver->onUnpreparedTransactionCommit(
- opCtx,
- txnOps->getMutableOperationsForOpObserver(),
- p().transactionOperations.getNumberOfPrePostImagesToWrite());
+ opObserver->onUnpreparedTransactionCommit(opCtx, txnOps);
// Read-only transactions with all read concerns must wait for any data they read to be majority
// committed. For local read concern this is to match majority read concern. For both local and
diff --git a/src/mongo/db/transaction/transaction_participant_retryable_writes_test.cpp b/src/mongo/db/transaction/transaction_participant_retryable_writes_test.cpp
index a8412b81472..5a8cd2dfec5 100644
--- a/src/mongo/db/transaction/transaction_participant_retryable_writes_test.cpp
+++ b/src/mongo/db/transaction/transaction_participant_retryable_writes_test.cpp
@@ -119,11 +119,9 @@ public:
std::function<void()> onTransactionPrepareFn = [this]() { transactionPrepared = true; };
void onUnpreparedTransactionCommit(OperationContext* opCtx,
- std::vector<repl::ReplOperation>* statements,
- size_t numberOfPrePostImagesToWrite) override {
+ TransactionOperations* transactionOperations) override {
ASSERT_TRUE(opCtx->lockState()->inAWriteUnitOfWork());
- OpObserverNoop::onUnpreparedTransactionCommit(
- opCtx, statements, numberOfPrePostImagesToWrite);
+ OpObserverNoop::onUnpreparedTransactionCommit(opCtx, transactionOperations);
uassert(ErrorCodes::OperationFailed,
"onUnpreparedTransactionCommit() failed",
diff --git a/src/mongo/db/transaction/transaction_participant_test.cpp b/src/mongo/db/transaction/transaction_participant_test.cpp
index b6b5012ab6f..057c4a87a69 100644
--- a/src/mongo/db/transaction/transaction_participant_test.cpp
+++ b/src/mongo/db/transaction/transaction_participant_test.cpp
@@ -118,8 +118,7 @@ public:
std::function<void()> onTransactionPrepareFn = []() {};
void onUnpreparedTransactionCommit(OperationContext* opCtx,
- std::vector<repl::ReplOperation>* statements,
- size_t numberOfPrePostImagesToWrite) override;
+ TransactionOperations* transactionOperations) override;
bool onUnpreparedTransactionCommitThrowsException = false;
bool unpreparedTransactionCommitted = false;
std::function<void(const std::vector<repl::ReplOperation>&)> onUnpreparedTransactionCommitFn =
@@ -185,17 +184,17 @@ void OpObserverMock::onTransactionPrepare(
}
void OpObserverMock::onUnpreparedTransactionCommit(OperationContext* opCtx,
- std::vector<repl::ReplOperation>* statements,
- size_t numberOfPrePostImagesToWrite) {
+ TransactionOperations* transactionOperations) {
ASSERT(opCtx->lockState()->inAWriteUnitOfWork());
- OpObserverNoop::onUnpreparedTransactionCommit(opCtx, statements, numberOfPrePostImagesToWrite);
+ OpObserverNoop::onUnpreparedTransactionCommit(opCtx, transactionOperations);
uassert(ErrorCodes::OperationFailed,
"onUnpreparedTransactionCommit() failed",
!onUnpreparedTransactionCommitThrowsException);
unpreparedTransactionCommitted = true;
+ auto statements = transactionOperations->getMutableOperationsForOpObserver();
onUnpreparedTransactionCommitFn(*statements);
}
diff --git a/src/mongo/idl/cluster_server_parameter_op_observer.h b/src/mongo/idl/cluster_server_parameter_op_observer.h
index 0de4a831616..42452afe7b8 100644
--- a/src/mongo/idl/cluster_server_parameter_op_observer.h
+++ b/src/mongo/idl/cluster_server_parameter_op_observer.h
@@ -203,8 +203,7 @@ public:
const UUID& uuid) final {}
void onUnpreparedTransactionCommit(OperationContext* opCtx,
- std::vector<repl::ReplOperation>* statements,
- size_t numberOfPrePostImagesToWrite) final {}
+ TransactionOperations* transactionOperations) final {}
void onBatchedWriteStart(OperationContext* opCtx) final {}