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

Fix a comment in txn_begin about having allocated txn-id

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • WT11.0.0, 6.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Labels:

      __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);

      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.

      __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.

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