[SERVER-76368] Allow TransactionRouter on a mongod to early reap retryable sessions Created: 20/Apr/23  Updated: 29/Oct/23  Resolved: 10/May/23

Status: Closed
Project: Core Server
Component/s: None
Affects Version/s: None
Fix Version/s: 7.1.0-rc0, 7.0.0-rc1

Type: Task Priority: Major - P3
Reporter: Jack Mulrow Assignee: Jack Mulrow
Resolution: Fixed Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original Estimate: Not Specified

Issue Links:
Backports
Related
related to SERVER-75919 Investigate if runTransactionOnShardi... Closed
Backwards Compatibility: Fully Compatible
Backport Requested:
v7.0
Sprint: Sharding NYC 2023-05-01, Sharding NYC 2023-05-15
Participants:

 Description   

Retryable sessions used for retryable transactions have special rules for when they can be reaped from the SessionCatalog. Each session is tied to a txnNumber for some client session and can be reaped once a transaction or retryable write with a higher txnNumber has started on that client session. To remove retryable sessions as soon as possible, they are erased from the SessionCatalog after a new transaction/retryable write starts on a mongos or mongod and the session of the new write is released.

This logic does not currently work when a mongod accesses the same retryable session from the router and participant roles (ie TransactionRouter and TransactionParticipant). The participant keeps a map of retryable sessions for the latest transaction, so if the router role tries to clear a retryable session, it may still be in the map, and if the same process accesses that session in the participant role, it may use the freed session and crash. There are very few remote transactions run from a mongod currently, so early reaping was disabled in the router role on a mongod (in SERVER-75919), but we should enable the reaping safely.



 Comments   
Comment by Githook User [ 10/May/23 ]

Author:

{'name': 'Jack Mulrow', 'email': 'jack.mulrow@mongodb.com', 'username': 'jsmulrow'}

Message: SERVER-76368 Allow TransactionRouter on a mongod to early reap retryable sessions

(cherry picked from commit c5bde8dfab169ae2e020eef3e3c1bab8c5f6e841)
Branch: v7.0
https://github.com/mongodb/mongo/commit/9ab3b55115c0dddd7918ec57d4b122afcb9ba305

Comment by Githook User [ 10/May/23 ]

Author:

{'name': 'Jack Mulrow', 'email': 'jack.mulrow@mongodb.com', 'username': 'jsmulrow'}

Message: SERVER-76368 Allow TransactionRouter on a mongod to early reap retryable sessions
Branch: master
https://github.com/mongodb/mongo/commit/c5bde8dfab169ae2e020eef3e3c1bab8c5f6e841

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