[SERVER-66481] Failure to start an internal cross-shard transaction from a shardsvr mongod on behalf of a client that is already running a transaction Created: 16/May/22  Updated: 29/Oct/23  Resolved: 06/Jun/22

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

Type: Bug Priority: Major - P3
Reporter: Cheahuychou Mao Assignee: Jason Zhang
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Related
Backwards Compatibility: Fully Compatible
Operating System: ALL
Backport Requested:
v6.0
Sprint: Sharding NYC 2022-05-30, Sharding NYC 2022-06-13
Participants:

 Description   

The transaction API supports running an internal cross-shard transaction from a shardsvr mongod on behalf of a client regardless of the session configuration it is running with (i.e. the mongod acts a router). However, currently it is unable to do so if the client is running a transaction. The reason is that when starting a cross-shard transaction from a shardsvr mongod, the transaction API sends all the commands in the transaction through the ServiceEntryPointMongos (i.e. the transaction is driven by the TransactionRouter for the client session on that mongod); the API currently always sends the first command in the transaction without startTransaction and this causes the transaction to fail with NoSuchTransaction since the TransactionRouter is unaware of any ongoing transaction with that session id and transaction number (only the TransactionParticipant is). Making the API send the first command with startTransaction=true would allow the TransactionRouter on the mongod to successfully initialize the transaction. However, if the shard acting as a router for internal transaction also participates in the transaction, the first command to that shard would fail with ConflictingOperationInProgress since the TransactionRouter would send that command with startTransaction=true since it is unaware that the transaction has already started on that shard. 



 Comments   
Comment by Githook User [ 13/Jun/22 ]

Author:

{'name': 'Jason Zhang', 'email': 'jason.zhang@mongodb.com', 'username': 'jz1242'}

Message: SERVER-66481 Disable cross-shard internal transactions run from a shard

(cherry picked from commit 9e56fb40d86bab1a77ffa60fd8a94c4783735734)
Branch: v6.0
https://github.com/mongodb/mongo/commit/895e8c6f612471da79c8e913d6d08f0e1b56c027

Comment by Githook User [ 06/Jun/22 ]

Author:

{'name': 'Jason Zhang', 'email': 'jason.zhang@mongodb.com', 'username': 'jz1242'}

Message: SERVER-66481 Disable cross-shard internal transactions run from a shard
Branch: master
https://github.com/mongodb/mongo/commit/9e56fb40d86bab1a77ffa60fd8a94c4783735734

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