Eliminate 7-byte alignment padding in __wt_page_modify caused by bool instantiated

XMLWordPrintableJSON

    • Storage Engines - Transactions
    • 289.187
    • SE Transactions - 2026-06-05
    • 1

      Problem

      __wt_page_modify wastes 7 bytes per modified page due to a bool alignment hole:

      bool instantiated;        /* 1 byte at offset ~224 */
      /* 7 bytes compiler padding */
      WT_UPDATE **inst_updates; /* pointer, requires 8-byte alignment */
      

      The trailing small fields (rec_result, restore_state, flags) are already packed together at the end of the struct (btmem.h ~533-543), but instantiated is declared separately just above page_lock / inst_updates, forcing 7 bytes of wasted padding before the next pointer.

      Fix

      Move instantiated to sit alongside rec_result, restore_state, and flags at the end of the struct. All four are uint8_t-sized (bool is 1 byte on this platform) and are used together during page reconciliation and instantiation, so grouping them is also a locality improvement. The change saves 7 bytes per WT_PAGE_MODIFY allocation with no semantic effect.

      References

      • src/include/btmem.h, struct __wt_page_modify, lines ~506-507 (instantiated declaration) and ~533-543 (trailing flag fields)

            Assignee:
            Chenhao Qu
            Reporter:
            Chenhao Qu
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: