Eviction should use cached-only history-store opens

    • Type: Task
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Cache and Eviction
    • None
    • Storage Engines - Foundations
    • 102.867
    • None
    • None

      Motivation

      WT-18465 fixed the observed deadlock by marking the shared history store last, but the root invariant remains: a thread holding eviction state must not block on the handle-list or schema locks while opening the history store. This has recurred through WT-5785/WT-5946, WT-7053, WT-14957, and WT-18465.

      Make reconciliation under WT_REC_EVICT use only a cached HS cursor. On a miss, fail the eviction attempt with EBUSY, leave the page resident for retry, and increment a dedicated statistic. The failure mode should be a skipped eviction, not a hung step-down or an annual rare deadlock. Checkpoint reconciliation should retain the normal HS open because it does not hold eviction state.

      Implementation constraints from WT-18465 review

      This must not be implemented by returning EBUSY directly from _wti_rec_hs_insert_updates. That function runs inside _rec_write_wrapup, where errors currently panic rather than propagate as recoverable eviction failures.

      At minimum:

      • Preflight all required cached HS cursors before entering reconciliation wrapup.
      • Route a miss through the complete pre-wrapup cleanup path.
      • Cover every HS open used by eviction reconciliation, not only update insertion.
      • Handle paths that need two HS cursors simultaneously.
      • Preserve behavior when cache_cursors=false, where cursor-cache-only lookup can never succeed.
      • Avoid using WT_REC_EVICT alone as proof that the caller can retry; whole-file close also sets it.
      • Keep the miss statistic meaningful in production.

      Acceptance criteria

      • No eviction reconciliation path takes the handle-list or schema lock while holding evict_busy.
      • A missing cached HS cursor returns EBUSY through normal eviction handling without panic.
      • Existing tests pass with cursor caching enabled and disabled.
      • A regression test demonstrates that a forced cache miss produces a retryable eviction failure and records the statistic.

      References

            Assignee:
            [DO NOT USE] Backlog - Storage Engines Team
            Reporter:
            Sid Mahajan
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: