[Retryability] Make transaction participants throw RetryableTransactionInProgress if a retry arrives while the transaction has not been committed or aborted

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Fixed
    • Priority: Major - P3
    • 5.3.0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Fully Compatible
    • Sharding 2022-01-10, Sharding 2022-01-24, Sharding 2022-02-07
    • 3
    • None
    • 3
    • None
    • None
    • None
    • None
    • None
    • None

      This is to handle the case where the external client retries retryable writes that are being executed using internal transactions. This is from the design:

      To support such retries but avoid executing write statements within a retryable internal transaction more than once, upon seeing a startTransaction statement for a new internal transaction, a transaction participant will also check if there is an existing in-progress internal transaction for the write command that the new transaction corresponds to. If there is, it will throw a RetryableTransactionInProgress error. The error will be caught and cause the startTransaction statement to block until the existing transaction commits or aborts. If the existing transaction commits, a RetryableTransactionCommitted error will be thrown and the mongos will retry the transaction (with the original txnRetryCounter) to retrieve the original response. If the existing transaction aborts, a NoSuchTransaction will be thrown and the mongos will retry the transaction (with a higher txnRetryCounter).

            Assignee:
            Cheahuychou Mao
            Reporter:
            Cheahuychou Mao
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: