[SERVER-66844] Transaction API shouldn't use CancelableOperationContext Created: 27/May/22  Updated: 29/Oct/23  Resolved: 01/Jun/22

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

Type: Improvement 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
Depends
Related
Backwards Compatibility: Fully Compatible
Backport Requested:
v6.0
Sprint: Sharding NYC 2022-05-30, Sharding NYC 2022-06-13
Participants:
Linked BF Score: 5

 Description   

The transaction API uses CancelableOperationContext so killing the opCtx of the caller of the API will kill any opCtxs spawned to run transaction operations. CancelableOperationContext will kill its opCtx when its source token is canceled always with ErrorCodes::Interrupted. This can lead the API to fail with this generic, non-retryable code in scenarios where it should have been interrupted with a meaningful code, e.g. like InterruptedDueToReplState change on failover, which can lead to problems, e.g. an operation using the API pessimistically skips failover retry logic.

The spawned operations already use the same session as their caller, if they had one, so killSessions for an operation using the API will still work as expected, the only downside should be that killOp of the caller's opCtx won't interrupt the API's transaction, but it will still interrupt the caller's command.



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

Author:

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

Message: SERVER-66844 Transaction API shouldn't use CancelableOperationContext

(cherry picked from commit 074e2ac50c90395673d488e81ec86bfb3e29c1e7)
Branch: v6.0
https://github.com/mongodb/mongo/commit/a36f71f147c534b2f85a5c7c7d9acb32d24120ec

Comment by Githook User [ 31/May/22 ]

Author:

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

Message: SERVER-66844 Transaction API shouldn't use CancelableOperationContext
Branch: master
https://github.com/mongodb/mongo/commit/074e2ac50c90395673d488e81ec86bfb3e29c1e7

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