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

Fix a comment in txn_begin about having allocated txn-id

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major - P3
    • Resolution: Fixed
    • None
    • WT11.0.0, 6.1.0-rc0
    • None

    Description

      __wt_txn_begin has the following code/comment:

              /*
               * Stall here if the cache is completely full. We have allocated a transaction ID which
               * makes it possible for eviction to decide we're contributing to the problem and return
               * WT_ROLLBACK. The WT_SESSION.begin_transaction API can't return rollback, continue on.
               */
              WT_RET_ERROR_OK(__wt_cache_eviction_check(session, false, true, NULL), WT_ROLLBACK);
       
              __wt_txn_get_snapshot(session);
      

      The comment says "We have allocated a transaction ID which makes it possible ..". We have not allocated the transaction ID yet, that is why we can check for eviction without rolling back. "not" is missing in the comment.

      Unless I am reading this wrong, should be a trivial fix.

      Note:
      __wt_txn_id_check() does the allocation of the txn-id using __wt_txn_id_alloc. This happens as part of actual modification in a transaction by __txn_next_op. So allocation of a txn-id is deferred until there is some modification. Hence I believe when calling __wt_txn_begin we have not yet allocated a txn-id when we check for eviction.

      Attachments

        Activity

          People

            backlog-server-storage-engines Backlog - Storage Engines Team
            sulabh.mahajan@mongodb.com Sulabh Mahajan
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: