[SERVER-63071] [Retryability] Prepared internal transactions for retryable findAndModify can cause stepup to hang Created: 28/Jan/22  Updated: 29/Oct/23  Resolved: 04/Feb/22

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 5.3.0

Type: Bug Priority: Major - P3
Reporter: Cheahuychou Mao Assignee: Cheahuychou Mao
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
Operating System: ALL
Sprint: Sharding 2022-02-07
Participants:

 Description   

Consider a shard with two nodes: n0 (primary) and n1 (secondary). We run a findAndModify command with pre/post image in a retryable internal transaction on the shard, and then we run a prepareTransaction command. As part of preparing the transaction, n0 writes an applyOps oplog entry and a config.image_collection entry for the transaction. The writes are done in a separate RecoveryUnit (i.e. storage transaction) from the one for the transaction. As part of applying the applyOps oplog entry for the transaction, n1 also writes a config.image_collection entry for it. However, the write is done in the same RecoveryUnit as the one for the transaction. As a result, the config.image_collection IX lock does not get released when the write completes (i.e. it is held along with other locks acquired for the transaction until the transaction commits or aborts). While the transaction is in prepare, n0 steps down. There are two cases:

  • If n0 steps up, the stepup hook would not hang since the config.image_collection IX lock is not being held by the prepared transaction.


 Comments   
Comment by Githook User [ 04/Feb/22 ]

Author:

{'name': 'Cheahuychou Mao', 'email': 'mao.cheahuychou@gmail.com', 'username': 'cheahuychou'}

Message: SERVER-63071 Prepared internal transactions for retryable findAndModify can cause stepup to hang
Branch: master
https://github.com/mongodb/mongo/commit/7eb93258d074ee3bac55e0a79902972f1cb4c89d

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