Audit WT_BTREE flags for atomic access

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Btree
    • None
    • Storage Engines - Transactions
    • 407.544
    • SE Transactions - 2026-08-14
    • 3

      The WT_BTREE handle keeps its flags in a single non-atomic uint32_t field, manipulated with the F_SET/F_CLR/F_ISSET macros. These perform non-atomic read-modify-write, so a flag update that races with a concurrent update to a different flag on the same handle can lose one of the writes.

      WT_BTREE_IN_MEMORY has been moved to a new atomic flags field (flags_atomic) and is now accessed with the atomic flag macros, because it is cleared at runtime while other threads may be reading or writing the flags. This ticket tracks a broader audit of the remaining WT_BTREE flags to determine which are modified after the handle is in use by multiple threads, and to move those to atomic access as well.

      Deliverables:

      • Classify each WT_BTREE flag as set-once-at-open versus mutated concurrently.
      • Move concurrently mutated flags to flags_atomic and convert their call sites to the atomic macros.
      • Document the invariant for the flags that remain in the non-atomic field.

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

              Created:
              Updated: