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

Race in recover_prepared_transactions_startup_secondary_application.js

    • Type: Icon: Bug Bug
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: 4.2.0-rc2
    • Component/s: Replication
    • Labels:
      None
    • ALL
    • 0

      recover_prepared_transactions_startup_secondary_application.js prepares a transaction, then restarts a secondary and queries it, expecting it to be in state SECONDARY. Sometimes the query fails, however, with "node is recovering". This is due to a race in the test. The test thinks that waiting for the prepare entry to be majority-committed implies that the restarted node has transitioned to state SECONDARY, but this is not always so.

      * Create a 2-node set
      * Prepare a transaction
      * In either order:
          * The secondary restarts & transitions to RECOVERING
          * The prepare entry is majority-committed
      * The test waits for the prepare entry to be majority-committed
      * The test queries the restarted node
      

      If the secondary restarts before the prepare is majority-committed, then waiting for the majority commit is the same as waiting for the restarted node to become SECONDARY, so querying the node is fine.

      If the secondary restarts after the prepare is majority-committed, then waiting for the majority commit is insufficient. The node could still be in RECOVERING and reject the query.

            Assignee:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Reporter:
            jesse@mongodb.com A. Jesse Jiryu Davis
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: