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

The split prepared transaction mechanism causes opTimes for non-retryable internal transactions to get added to the session migration new opTime buffer

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 7.1.0-rc0, 7.0.0-rc2
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Sharding NYC
    • Fully Compatible
    • ALL
    • v7.0
    • Sharding NYC 2023-05-29
    • 135

      Non-retryable internal transactions refer to internal transactions started internally to execute some write for a client with retryWrite: false session. Such transactions always have session id of the form (id, uid, txnUUID) where where id is the id of the client session and txnUUID is an internally generated UUID. Such session ids are exclusively used to run internal transactions so they can never be used to run retryable writes. As such, they are not migrated during chunk migration. Currently, this is how they are excluded from session migration:

      • The SessionCatalogMigrationSource filters out all sessions with session id of the form (id, uid, txnUUID) when it looks up existing sessions to migrate.
      • The LogTransactionOperationsForShardingHandler does not add the opTime for transactions with session of the form (id, uid, txnUUID) to the new opTime buffer.

      However, there have been some recent changes that can cause the the opTime for a non-retryable write internal transaction to end up in the new opTime buffer:

      BF-28542 contains an example of how issue this manifests.

      As a quick fix, SERVER-76806 will make SessionCatalogMigrationSource::_fetchNextNewWriteOplog just discard non-retryable internal transaction oplog entries it sees. Ideally, we should find a way to avoid adding the opTimes for non-retryable internal transactions to the SessionMigrationCatalogSource _newWriteOpTimeList buffer to avoid the wasted work on looking up the oplog entry here.

            Assignee:
            cheahuychou.mao@mongodb.com Cheahuychou Mao
            Reporter:
            cheahuychou.mao@mongodb.com Cheahuychou Mao
            Votes:
            0 Vote for this issue
            Watchers:
            6 Start watching this issue

              Created:
              Updated:
              Resolved: