[SERVER-76741] Split-prepare transactions are aborted before reserving abort oplog entry Created: 02/May/23  Updated: 29/Oct/23  Resolved: 03/May/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.1.0-rc0, 7.0.0-rc1

Type: Bug Priority: Critical - P2
Reporter: Lingzhi Deng Assignee: Wenbin Zhu
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Related
related to SERVER-35863 Write an abortTransaction oplog entry... Closed
is related to SERVER-76774 Invariant that secondary oplog applic... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v7.0
Sprint: Repl 2023-05-15
Participants:
Linked BF Score: 135

 Description   

Primary aborts the split-prepared transactions before it reserves the abort oplog entry. This is a bug as it violates the assumption noted in the comment.

This bug would enable a sequence like the following - Let's say we have Txn1 and Txn2 that write to the same set of documents:
1. Txn1 is split and prepared on a node when the node was a secondary
2. The node steps up as a primary
3. The node aborts Txn1's split prepared transaction
4. Now, the node is able to prepare Txn2 with prepareOptime T1 since Txn1 is effectively aborted
5. The node reserves and writes abort oplog entry for Txn1 with optime T2

In this case, secondaries would see prepare of Txn2 before abort of Txn1, resulting in prepare conflicts when applying Txn2.



 Comments   
Comment by Githook User [ 04/May/23 ]

Author:

{'name': 'Wenbin Zhu', 'email': 'wenbin.zhu@mongodb.com', 'username': 'WenbinZhu'}

Message: SERVER-76741 Split prepared transactions should be aborted after reserving abort oplog slot.

(cherry picked from commit 9cf95efcbd37df83bcd9af4593e79c51ea4062ea)
Branch: v7.0
https://github.com/mongodb/mongo/commit/771fb1554b7ea624570ad0aeb317c5f2411719b4

Comment by Githook User [ 03/May/23 ]

Author:

{'name': 'Wenbin Zhu', 'email': 'wenbin.zhu@mongodb.com', 'username': 'WenbinZhu'}

Message: SERVER-76741 Split prepared transactions should be aborted after reserving abort oplog slot.
Branch: master
https://github.com/mongodb/mongo/commit/9cf95efcbd37df83bcd9af4593e79c51ea4062ea

Generated at Thu Feb 08 06:33:28 UTC 2024 using Jira 9.7.1#970001-sha1:2222b88b221c4928ef0de3161136cc90c8356a66.