[SERVER-49044] Make AsyncRequestSender not retry remote command requests with startTransaction=true Created: 23/Jun/20  Updated: 29/Oct/23  Resolved: 15/Jul/20

Status: Closed
Project: Core Server
Component/s: Sharding
Affects Version/s: None
Fix Version/s: 4.4.1, 4.7.0

Type: Bug Priority: Major - P3
Reporter: Cheahuychou Mao Assignee: Luis Osta (Inactive)
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Depends
Related
is related to SERVER-47645 Must invalidate all sessions on step ... Closed
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v4.4
Sprint: Sharding 2020-07-13, Sharding 2020-07-27
Participants:
Linked BF Score: 26

 Description   

The AsyncRequestSender can retry a remote command request on retriable errors up to kMaxNumFailedHostRetryAttempts times. Based on BF-17754, it is not safe for the ARS to retry remote commands that are run inside transactions since it can lead to a crash in the following case:

  1. There is an unprepared transaction that gets aborted by the RstlKillOpThread on stepdown and the command fails with InterruptedDueToReplStateChange.
  2. The ARS retries the remote command request for that transaction statement (with startTransaction: true) against the new primary and the transaction gets committed with two-phase commit.
  3. The transaction state in the old primary’s TransactionParticipant is still AbortedWithoutPrepare when the oplog entry for prepare gets replicated to the old primary so the transaction state assertion here fails and the op applier fails this fatal assertion.

So the ARS should check to see if the operation with startTransaction=true and not retry if it is. There is already a rough CR patch for testing this case. 

 



 Comments   
Comment by Githook User [ 12/Aug/20 ]

Author:

{'name': 'Luis Osta', 'email': 'luis.osta@mongodb.com', 'username': 'LuisOsta'}

Message: SERVER-49044 Make AsyncRequestSender not retry remote command requests with startTransaction=true

(cherry picked from commit e4ad46c0fab6ce2b633f212db65ab5479c4c191e)
Branch: v4.4
https://github.com/mongodb/mongo/commit/290fc62c9574828bb2c176a794f311935b31e8d4

Comment by Githook User [ 15/Jul/20 ]

Author:

{'name': 'Luis Osta', 'email': 'luis.osta@mongodb.com', 'username': 'LuisOsta'}

Message: SERVER-49044 Make AsyncRequestSender not retry remote command requests with startTransaction=true
Branch: master
https://github.com/mongodb/mongo/commit/e4ad46c0fab6ce2b633f212db65ab5479c4c191e

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