[SERVER-61258] Test mongos/mongoq handling TenantMigrationAborted inside a transaction Created: 04/Nov/21  Updated: 29/Oct/23  Resolved: 18/Nov/21

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

Type: Task Priority: Major - P3
Reporter: Esha Maharishi (Inactive) Assignee: Sophia Tan
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Backwards Compatibility: Fully Compatible
Sprint: Server Serverless 2021-11-15, Server Serverless 2021-11-29
Participants:

 Description   

Update the existing tests of sending commands through mongos/mongoq during a tenant migration to confirm they are handled correctly when run inside a transaction.

Background

A transaction is a series of commands sent under a session with the same txnNumber and ending with a commitTransaction (see example).

If the commitTransaction is received on a donor while a tenant migration is blocking, the commitTransaction will hit the checkIfCanWriteOrThrow in OpObserverImpl::onUnpreparedTransactionCommit, which will throw TenantMigrationConflict. This TenantMigrationConflict exception will abort the transaction on the donor. The commitTransaction should return TenantMigrationAborted with a TransientTransactionError label.

If the tenant migration eventually aborts, mongoq/mongos will not retry the commitTransaction against the donor. If the client retry the commitTransaction against donor, since the donor has already aborted the transaction, the commitTransaction should return NoSuchTransaction (this error code essentially means "transaction aborted") with a TransientTransactionError label, as asserted here.

This ticket

This ticket is to confirm that mongoq correctly propagates back the NoSuchTransaction with TransientTransactionError in this case.

See here for an example of running a command in a transaction. We can test with the findAndModify command.



 Comments   
Comment by Githook User [ 18/Nov/21 ]

Author:

{'name': 'Sophia Tan', 'email': 'sophia_tll@hotmail.com', 'username': 'sophiatll'}

Message: SERVER-61258 Test mongos/mongoq handling TenantMigrationAborted inside a transaction
Branch: master
https://github.com/mongodb/mongo/commit/bd6b08daed4a016f5758970f1ecb760087ba62d9

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