ExportXMLWordPrintableJSON

    • Type: Bug
    • Resolution: Duplicate
    • Priority: Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Transactions
    • None
    • Storage Engines - Transactions
    • 79.111
    • None
    • None

      _wt_txn_snapshot_save passes byte sizes to _wt_calloc_def, which already multiplies the count by the element size.

      • The saved snapshot array is allocated with 8 * session_array.size IDs instead of session_array.size.
      • The WT_TXN_SNAPSHOT allocation holds sizeof(WT_TXN_SNAPSHOT) structures instead of one.

      The save runs when an application thread refreshes its snapshot to evict a page and when it evicts under the checkpoint's snapshot. With session_max=33000, as MongoDB configures it, each save allocates and zeroes 2,114,752 bytes instead of 264,344.

      Fix: use __wt_calloc_one for the structure and session_array.size as the count for the array. The saved array is swapped with the transaction's snapshot and refilled by a new snapshot or a copy of the checkpoint snapshot; neither holds more than session_array.size IDs.

      Reported with a fix in https://github.com/wiredtiger/wiredtiger/pull/14941 by an external contributor.

            Assignee:
            [DO NOT USE] Backlog - Storage Engines Team
            Reporter:
            Chenhao Qu
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: