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

Remove race in reconstruct_prepared_transactions_initial_sync.js

    XMLWordPrintable

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major - P3
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 4.9.0, 4.2.13, 4.4.5
    • Component/s: None
    • Labels:
      None
    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Backport Requested:
      v4.4, v4.2
    • Sprint:
      Repl 2020-11-30
    • Linked BF Score:
      17

      Description

      In reconstruct_prepared_transactions_initial_sync.js, there is a race between the primary receiving the "commit transaction" instruction from the test for transaction four, and the primary receiving a heartbeat response or replSetUpdatePosition from the secondary notifying it that the secondary has applied the "prepare" instruction for that same transaction.

      Currently, we "prepare" transaction four on the primary while the secondary is in initial sync. We then call "awaitSecondaryNodes" to ensure that the secondary has finished initial sync (and therefore applied the "prepare" oplog entry for transaction four) before committing the transaction. However, "awaitSecondaryNodes" does not guarantee that the primary has heard from the secondary that it has applied the "prepare" for the transaction, which would allow it to advance the majority commit point to or past the "prepare" entry. Thus, if the commit transaction request is received by the primary before the primary receives such an update from the secondary, then the majority commit point will still be behind the "prepare" entry for the transaction and we will hit this uassert.

      We should add something like ReplSetTest.awaitLastOpCommitted before committing the transaction to ensure not only that the secondary has finished initial sync + applied the prepare op locally, but also that the primary is aware of this fact and can therefore advance the majority commit point.

        Attachments

          Activity

            People

            Assignee:
            george.wangensteen George Wangensteen
            Reporter:
            george.wangensteen George Wangensteen
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: