Replace WT_SESSION_SKIP_CACHE_INCR session flag with explicit argument in serial functions

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Unresolved
    • Priority: Minor - P4
    • None
    • Affects Version/s: None
    • Component/s: Cache and Eviction
    • None
    • Storage Engines - Transactions
    • 117.321
    • None
    • None

      Summary

      WT-17598 batched per-update cache atomics in _wti_page_inmem_updates using a session flag (WT_SESSION_SKIP_CACHE_INCR) to suppress _wt_cache_page_inmem_incr inside the three serial functions. A reviewer noted a cleaner design: pass an explicit argument to the serial functions to indicate whether the cache increment should be performed, removing the need for the session flag entirely.

      Background

      _wt_update_serial, wt_insert_serial, and wt_col_append_serial each call wt_cache_page_inmem_incr after linking the new update/insert into the page. WT-17598 introduced WT_SESSION_SKIP_CACHE_INCR so that _wti_page_inmem_updates (which holds exclusive page ownership during the loop) can suppress these individual increments and issue a single bulk increment after the loop instead. The session flag was a pragmatic choice to avoid a larger signature change.

      Proposed Change

      Add a bool cache_incr parameter to all three serial functions:

      • __wt_update_serial
      • __wt_insert_serial
      • __wt_col_append_serial

      When cache_incr is false, the function skips the _wt_cache_page_inmem_incr call. All existing callers (row_modify.c, col_modify.c) pass true; _wti_page_inmem_updates passes false and continues to issue the single bulk increment after the loop.

      Once the parameter is wired through, remove WT_SESSION_SKIP_CACHE_INCR and all sites that set/check it.

      Why This Is Better

      • Explicit argument is easier to reason about than implicit session state.
      • Eliminates a flag that must be cleared on both success and error paths.
      • Avoids the risk of the flag leaking if a future caller uses the serial functions in an unexpected context.

      References

      • WT-17598 — original batching change (PR #13843), where reviewer noted this follow-up

            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: