Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-66844

Transaction API shouldn't use CancelableOperationContext

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 6.0.0-rc9, 6.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • v6.0
    • Sharding NYC 2022-05-30, Sharding NYC 2022-06-13
    • 5

      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.

            Assignee:
            jack.mulrow@mongodb.com Jack Mulrow
            Reporter:
            jack.mulrow@mongodb.com Jack Mulrow
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: