Evaluate skipping emptied internal pages on non-cursor walk and descent paths

    • Type: Task
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Btree
    • Storage Engines - Transactions
    • 212.598
    • None
    • None

      Background

      WT-18406 (PR 14561) skips reading a WT_REF_DISK internal page on a disaggregated tree when the address-cell time aggregate shows the whole subtree is deleted and visible. The change lives in _wt_btcur_skip_page() and is used only by cursor next/prev via _wt_tree_walk_custom_skip().

      Chenhao asked on that PR whether the same optimisation can be applied elsewhere. WT_READ_SKIP_INTL is not that skip: it only withholds internal pages from the caller. The walk engine still __wt_page_swap}}s an on-disk internal in so it can descend. Without a skip callback that returns {{skipp = true, emptied internals are still read.

      This ticket is the evaluation, not an implementation commitment.

      What is already covered

      • Cursor next/prev (snapshot, not KEY_ONLY / IGNORE_TOMBSTONE): WT-18406.
      • RTS __rts_btree_walk_page_skip: already skips on-disk pages whose aggregate is stable past the rollback timestamp. An emptied subtree is a subset of that.
      • Prepared discover: already skips on-disk pages with !ta->prepare.

      What cannot skip

      These walks need the internal page itself, or they never read from disk:

      • Checkpoint cleanup — walks internals to mark obsolete children; skipping would miss cleanup. Related to the local-block-manager follow-up.
      • Compact — needs internals to decide rewrite.
      • Verify page-discard — must collect every live page id for PALI.
      • Statistics walk — needs exact internal/leaf/entry counts.
      • Checkpoint / eviction file walks — WT_READ_CACHE, no disk read.

      Candidates to evaluate

      Paths that look for visible records, do not need internal-page contents, and do not go through __wt_btcur_skip_page:

      1. __wt_random_descent (src/btree/bt_random.c). Random cursor and eviction sampling treat a WT_REF_DISK internal as a valid descent target and swap it in. An emptied subtree still produces no key.
      2. _wti_tree_walk_skip / _tree_walk_skip_count_callback. next_random sample-size walks skip deleted leaves only; an emptied on-disk internal is still read.

      _wt_row_search / _wt_col_search look similar but also position inserts. Treat them as out of scope unless the evaluation shows a safe read-only subset.

      Expected outcome

      • Confirm or reject the two candidates above (and any other non-walk descent found during the review).
      • If a path is safe, either implement the skip there or split an implementation ticket.
      • If none are worth doing, close this with the analysis.

            Assignee:
            Shoufu Du
            Reporter:
            Shoufu Du
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: