Use relaxed ordering for the log tmp_fileid atomic counter

XMLWordPrintableJSON

    • Storage Engines - Persistence
    • 295.283
    • SE Persistence backlog
    • None

      Motivation:

      log->tmp_fileid (src/log/log_private.h) is a shared counter that hands out unique temporary-file ids when threads prepare log files. Its only use (src/log/log.c, _wti_log_allocfile) is a sequentially consistent _wt_atomic_add_uint32:

      tmp_id = __wt_atomic_add_uint32(&log->tmp_fileid, 1);
      

      Uniqueness comes from the atomic RMW being indivisible, which holds at any memory order; the counter gates no other memory. Relaxed ordering is therefore sufficient, and it matches the log->fileid counter which was made relaxed in WT-16301.

      This is a code-quality micro-optimization, not a bug: sequential consistency is a safe superset, so the current code is correct.

      Tasks:

      • Change the tmp_fileid increment to __wt_atomic_add_uint32_relaxed.
      • Remove the FIXME referencing this ticket added in WT-16301.

      Definition of Done:

      • log->tmp_fileid uses relaxed ordering.
      • No functional or behavioral change.

            Assignee:
            Etienne Petrel
            Reporter:
            Etienne Petrel
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: