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

Double check the timestamps when prepare the transaction

    • Type: Icon: Improvement Improvement
    • Resolution: Works as Designed
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Btree
    • Storage Engines

      We check the timestamp in __wt_txn_prepare.

          /* Set the prepare timestamp. */
          WT_RET(__wt_txn_set_timestamp(session, cfg, false));
      
          if (!F_ISSET(txn, WT_TXN_HAS_TS_PREPARE))
              WT_RET_MSG(session, EINVAL, "prepare timestamp is not set");
      
          if (F_ISSET(txn, WT_TXN_HAS_TS_COMMIT))
              WT_RET_MSG(
                session, EINVAL, "commit timestamp must not be set before transaction is prepared");
      

      However, we have done the same check already in _wt_txn_set_timestamp (_wt_txn_set_prepare_timestamp) for prepared timestamp.

          if (F_ISSET(txn, WT_TXN_HAS_TS_PREPARE))
              WT_RET_MSG(session, EINVAL, "prepare timestamp is already set");
      
          if (F_ISSET(txn, WT_TXN_HAS_TS_COMMIT))
              WT_RET_MSG(session, EINVAL,
                "commit timestamp should not have been set before the prepare timestamp");
      

      We can change one of the check to an assert.

            Assignee:
            backlog-server-storage-engines [DO NOT USE] Backlog - Storage Engines Team
            Reporter:
            chenhao.qu@mongodb.com Chenhao Qu
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: