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

Test mongos/mongoq handling TenantMigrationAborted inside a transaction

    XMLWordPrintableJSON

Details

    • Icon: Task Task
    • Resolution: Fixed
    • Icon: Major - P3 Major - P3
    • 5.2.0
    • None
    • None
    • None
    • Fully Compatible
    • Server Serverless 2021-11-15, Server Serverless 2021-11-29

    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.

      Attachments

        Activity

          People

            sophia.tan@mongodb.com Sophia Tan
            esha.maharishi@mongodb.com Esha Maharishi (Inactive)
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: