Uploaded image for project: 'WiredTiger'
  1. WiredTiger
  2. WT-5046

Prepared transactions aren't properly cleared from global table with WT_CONN_LOG_DEBUG_MODE enabled

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.2.1, WT3.2.1, 4.3.1
    • Affects Version/s: None
    • Component/s: None
    • None
    • Storage Engines
    • 5
    • Storage Engines 2019-08-12, Storage Engines 2019-08-26
    • v4.0

      Given a prepared transaction we remove it's txnid from the global table at the end of the call to __wt_txn_prepare. On __wt_txn_commit we call __wt_txn_release which does the same thing except in the case of prepared transactions.

      		if (!F_ISSET(txn, WT_TXN_PREPARE))
      			__txn_remove_from_global_table(session);

      Now this wouldn't be an issue provided the prepared transaction wasn't being reallocated an id however when we commit the transaction calling __wt_txn_commit it calls __wt_txn_set_timestamp which calls __wt_txn_ts_log which if the flag WT_CONN_LOG_DEBUG is enabled calls __txn_logrec_init which calls ___wt_txn_id_check which then reallocates an id to our prepared txn. As such at the end of the call to __wt_txn_commit we don't clear our new id as our transaction is prepared which leaves an entry in the global table and blocks calls to rollback_to_stable when we're in debug mode.

      To reproduce this failure add the following assert to __wt_txn_id_check:

      WT_ASSERT(session, !F_ISSET(txn, WT_TXN_PREPARE));
      

      And run:

      ./buildscripts/resmoke.py --suite=replica_sets jstests/replsets/transactions_wait_for_write_concern.js
      

       In a debug build.

        1. wt5046.diff
          2 kB
          Alexander Gorrod

            Assignee:
            alex.cameron@mongodb.com Alex Cameron (Inactive)
            Reporter:
            luke.pearson@mongodb.com Luke Pearson
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: