Cache stuck: eviction walk skips dirty stable btree

XMLWordPrintableJSON

    • Storage Engines - Foundations
    • 7.383
    • None
    • 3

      Summary

      After mirrored writes (wiredtiger/wiredtiger#14526), the eviction server never evicts dirty pages from the stable btree during the step-down window, and the cache becomes stuck.

      Root cause

      With mirrored writes, transactions that begin after the step-down timestamp is set write to both the stable and ingest constituents. This dirties the stable btree, which is marked WT_BTREE_READONLY.

      The eviction walk in src/evict/evict_walk.c (__evict_walk) skips the tree on every pass that is looking for dirty pages:

      /* Skip read-only btrees if we are not looking for clean/updates pages. */
      if (F_ISSET_ATOMIC_32(btree, WT_BTREE_READONLY) &&
        !F_ISSET(evict, WT_EVICT_CACHE_CLEAN | WT_EVICT_CACHE_UPDATES)) {
          WT_STAT_CONN_INCR(session, eviction_server_skip_trees_read_only);
          __evict_disagg_btree_skip_count(session, btree);
          continue;
      }
      

      The dirty stable btree is marked for eviction, but is skipped every time eviction looks for dirty content, so its dirty pages are never evicted and the cache fills up (cache stuck).

      Proposed fix

      Narrow the skip to stable checkpoint handles only — the follower read-only views identified by the .wt_stable/ URI component — and only when eviction is not looking for clean pages:

      /* Skip read-only btrees if we are not looking for clean/updates pages. */
      if (WT_URI_IS_STABLE_CHECKPOINT(dhandle->name) &&
        !F_ISSET(evict, WT_EVICT_CACHE_CLEAN)) {
          WT_STAT_CONN_INCR(session, eviction_server_skip_trees_read_only);
          __evict_disagg_btree_skip_count(session, btree);
          continue;
      }
      

      The live stable btree no longer matches the skip condition, so the eviction server walks it and can evict the dirty mirrored content.

      References

            Assignee:
            Sid Mahajan
            Reporter:
            Sid Mahajan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: