[SERVER-62785] Write change stream pre-images in the main storage engine transaction before the transaction reaches Prepared state Created: 20/Jan/22  Updated: 29/Oct/23  Resolved: 23/Mar/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 6.0.0-rc0

Type: Task Priority: Major - P3
Reporter: Mindaugas Malinauskas Assignee: Mindaugas Malinauskas
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Related
related to SERVER-63258 Resolve inconsistency around the writ... Closed
Backwards Compatibility: Fully Compatible
Sprint: QE 2022-04-04, QE 2022-02-21, QE 2022-03-07, QE 2022-03-21
Participants:

 Description   

For write operations in a mongodb transaction it is desirable to write change stream pre-images in the main storage engine transaction before the storage engine transaction reaches the Prepared state as opposed to writing the pre-images in a storage engine transaction that commits oplog entry(-ies) indicating that the transaction prepared.
If the pre-images are not written in the main transaction as described above, when a prepared transaction is aborted, the pre-images associated with operations of that transaction get written on the primary node, but not on the secondaries. This happens because when the oplog is applied on the secondaries, the aborted transactions essentially don’t trigger any action on the secondaries. The expired pre-image deletion process ultimately gets rid of these documents. However, inconsistent pre-image state between the primary and secondary nodes is not ideal and can delay deletion of pre-images associated with prepared and later aborted transactions.

Explore the options of achieving this improvement and implement the best one if feasible. 



 Comments   
Comment by Githook User [ 23/Mar/22 ]

Author:

{'name': 'Mindaugas Malinauskas', 'email': 'mindaugas.malinauskas@mongodb.com'}

Message: SERVER-62785 Write change stream pre-images in the main storage engine transaction for prepared transactions
Branch: master
https://github.com/mongodb/mongo/commit/f65692d2b92ecaf505dc73f82d5490f9528f5fe2

Comment by Githook User [ 23/Mar/22 ]

Author:

{'name': 'Mindaugas Malinauskas', 'email': 'mindaugas.malinauskas@mongodb.com'}

Message: SERVER-62785 Write change stream pre-images in the main storage engine transaction for prepared transactions
Branch: master
https://github.com/10gen/mongo-enterprise-modules/commit/0ea17399f60992703ec97abec8c01d6386ba4bff

Generated at Thu Feb 08 05:56:03 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.