[SERVER-62671] [Retryability] Handle committing and aborting prepared retryable internal transaction after failover Created: 14/Jan/22  Updated: 29/Oct/23  Resolved: 28/Jan/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

Backwards Compatibility: Fully Compatible
Operating System: ALL
Sprint: Sharding 2022-01-24, Sharding 2022-02-07
Participants:

 Description   

There are two known bugs related to resuming prepared retryable internal transactions after failover:

  1. When a new primary steps up, it resumes all prepared transactions without doing a refresh. So for a retryable internal transaction, the TransactionParticipant will have an empty p().activeTxnCommittedStatements after the transaction commits since the map is populated by onPreparedTransactionCommit() which doesn’t run on secondaries, plus secondaries don’t do addTransactionOperation() while applying the applyOps oplog entries for transactions. As a result, any retries with/without internal transactions will cause the write statements that were executed in that transaction to re-execute.
  2. When a new primary steps up, if there is a prepared retryable internal transaction, the node will hang in the step for refreshing the locks. The reason is that when it checks out the internal session, it will try to refresh the parent session (new behavior introduced in SERVER-62020) and hang because it cannot acquire the global IS lock with this side opCtx because the main opCtx is holding the RSTL lock.


 Comments   
Comment by Githook User [ 28/Jan/22 ]

Author:

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

Message: SERVER-62671 Handle committing and aborting prepared retryable internal transaction after failover
Branch: master
https://github.com/mongodb/mongo/commit/28bb1f5727621fef7dd8b59fd180259befde8457

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