Incorrect dhandle used for WT_STAT_CONN_DSRC_INCR in RTS file_skipped path

XMLWordPrintableJSON

    • Type: Bug
    • Resolution: Fixed
    • Priority: Major - P3
    • WT12.0.0, 9.0.0-rc0
    • Affects Version/s: None
    • Component/s: RTS
    • None
    • Storage Engines - Persistence
    • 292.766
    • SE Persistence backlog
    • 1

      Issue Summary

      The WT_STAT_CONN_DSRC_INCR macro is incorrectly used in the file_skipped path within

      rts_btree_walk.c:441

      . When a file is skipped, the macro increments the per-datasource stat on the metadata file's dhandle, not the btree being evaluated, because session->dhandle is set to the metadata cursor's dhandle at this point. This leads to inflated stats for the metadata file and does not correctly account for the skipped btree.

      Context

      • The macro WT_STAT_CONN_DSRC_INCR increments both the connection-level and per-datasource stat, using session->dhandle to locate the datasource stat.
      • In the file_skipped block, the session's dhandle is the metadata file's dhandle, as no btree dhandle is opened for skipped files.
      • The only dhandle change in this context is inside WT_WITHOUT_DHANDLE, which temporarily nulls and restores the dhandle, but after this block, it is still the metadata dhandle.
      • As a result, the per-datasource stat is incremented for the wrong file.

      Proposed Solution

      Replace the macro in the file_skipped block to only increment the connection-level stat:

      if (file_skipped) {
      -   WT_STAT_CONN_DSRC_INCR(session, txn_rts_btrees_skipped);
      +   WT_STAT_CONN_INCR(session, txn_rts_btrees_skipped);
          (void)__wt_atomic_add_uint64_relaxed(&S2C(session)->rts->progress.btrees_skipped, 1);
      }
      

      This ensures only the correct connection-level stat is incremented, avoiding incorrect updates to the metadata file's per-datasource stat.


      Original Slack thread: Slack Thread
      This ticket was generated by AI from a Slack thread.

            Assignee:
            Etienne Petrel
            Reporter:
            Memento Slack Bot
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: