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

Migrations may not transfer writes from prepared transactions committed during cloning phase

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.1.9
    • Affects Version/s: None
    • Component/s: Sharding
    • None
    • Fully Compatible
    • ALL
    • Sharding 2019-03-11
    • 7

      If a transaction commits during the cloning phase of a chunk migration on the donor shard, any writes from the transaction are added to the transfer mods buffer by an op observer that registers onCommit handlers on the WriteUnitOfWork of the opCtx given to the observer.

      This relies on the WUOW committing and its handlers running before the locks associated with the transaction are dropped, so the donor shard can't enter the critical section without seeing the writes (which requires an X lock on the migrating collection).

      This is true for transactions that commit without prepare, but when committing a prepared transaction, the transaction is committed to storage and its locks are dropped before the transaction commit op observer runs with a new WUOW. This allows the donor shard to enter the critical section and finish the migration without transferring the transaction's writes to the recipient, losing data.

            Assignee:
            blake.oler@mongodb.com Blake Oler
            Reporter:
            jack.mulrow@mongodb.com Jack Mulrow
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: