summaryrefslogtreecommitdiff
path: root/src/mongo/db/op_observer/op_observer.h
diff options
context:
space:
mode:
authorCheahuychou Mao <mao.cheahuychou@gmail.com>2023-05-16 18:42:34 +0000
committerEvergreen Agent <no-reply@evergreen.mongodb.com>2023-05-16 22:00:24 +0000
commit9354aa6ccf769929ed3e7bd09f0dd95f8ab3a2a2 (patch)
tree3e8918826719bbfd5315b01fefd6b7b951637f99 /src/mongo/db/op_observer/op_observer.h
parentf05053d2cb65b84eaed4db94c25e9fe4be82d78c (diff)
downloadmongo-9354aa6ccf769929ed3e7bd09f0dd95f8ab3a2a2.tar.gz
SERVER-76807 Avoid adding opTimes for non-retryable internal transactions to the session migration new opTime buffer
Diffstat (limited to 'src/mongo/db/op_observer/op_observer.h')
-rw-r--r--src/mongo/db/op_observer/op_observer.h15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/mongo/db/op_observer/op_observer.h b/src/mongo/db/op_observer/op_observer.h
index 2e55e918a33..ed9a4213af6 100644
--- a/src/mongo/db/op_observer/op_observer.h
+++ b/src/mongo/db/op_observer/op_observer.h
@@ -521,11 +521,20 @@ public:
Date_t wallClockTime) = 0;
/**
- * This is called when a transaction transitions into prepare while it is not primary. Example
- * case can include secondary oplog application or when node was restared and tries to
- * recover prepared transactions from the oplog.
+ * This method is called when a transaction transitions into prepare while it is not primary,
+ * e.g. during secondary oplog application or recoverying prepared transactions from the
+ * oplog after restart. The method explicitly requires a session id (i.e. does not use the
+ * session id attached to the opCtx) because transaction oplog application currently applies the
+ * oplog entries for each prepared transaction in multiple internal sessions acquired from the
+ * InternalSessionPool. Currently, those internal sessions are completely unrelated to the
+ * session for the transaction itself. For a non-retryable internal transaction, not using the
+ * transaction session id in the codepath here can cause the opTime for the transaction to
+ * show up in the chunk migration opTime buffer although the writes they correspond to are not
+ * retryable and therefore are discarded anyway.
+ *
*/
virtual void onTransactionPrepareNonPrimary(OperationContext* opCtx,
+ const LogicalSessionId& lsid,
const std::vector<repl::OplogEntry>& statements,
const repl::OpTime& prepareOpTime) = 0;