Split evict_lru.c into focused source files

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Fixed
    • Priority: Minor - P4
    • WT12.0.0
    • Affects Version/s: None
    • Component/s: Cache and Eviction
    • None
    • Storage Engines - Transactions
    • 276.527
    • None
    • None

      Summary

      The monolithic src/evict/evict_lru.c (3622 lines) is difficult to navigate and makes it hard to reason about eviction subsystem boundaries. This task splits it into six focused source files with clear logical groupings.

      Changes

      New source files (replacing evict_lru.c):

      File Contents
      evict_thread.c Thread lifecycle (_evict_thread_chk/run/stop), eviction server (evict_server), pass loop (evict_pass), worker tuning (evict_tune_workers), work flags (_evict_update_work), public thread create/destroy
      evict_queue.c LRU sort comparators, queue fill (_wti_evict_lru_walk), queue drain (_wti_evict_lru_pages), server wake, queue clear helpers
      evict_walk.c Tree walk (_wti_evict_walk, evict_walk_tree), candidate selection (_wti_evict_push_candidate), walk target/prepare/skip helpers
      evict_dispatch.c Page eviction dispatch (_wti_evict_page), app-thread assist (_wti_evict_app_assist_worker), urgent queue, priority set/clear
      evict_exclusive.c File-level exclusive eviction (_wt_evict_file_exclusive_on/off), walk position clear/save (_wti_evict_clear_walk), handle list lock, saved walk tree management
      evict_verbose.c Cache dump diagnostics (__wt_verbose_dump_cache and its static helpers)

      Supporting changes:

      • evict_private.h: Added WTI_EVICT_ENTRY/WTI_EVICT_QUEUE struct definitions, WTI_WITH_PASS_LOCK macro, WT_EVICT_HAS_WORKERS macro, and extern declarations for all promoted _wti* functions
      • evict_inline.h: Added four shared inline helpers (_evict_list_clear, evict_queue_empty, evict_queue_full, _evict_page_updates_candidate) — placed here rather than evict_private.h to avoid a header ordering issue where WT_ASSERT expands to functions not yet declared at the evict.h include point in wt_internal.h
      • dist/filelist and dist/filelist.bzl: Replaced src/evict/evict_lru.c with the six new entries

      Scope

      Pure refactoring — no behavioural changes. Ten previously-static functions are promoted to _wti* scope to satisfy cross-file call requirements; one ignored return value (__wti_evict_clear_walk in evict_walk.c) is wrapped with WT_TRET. One explicit cast added in evict_inline.h for C++ compatibility (WT_DEBUG_POINTWT_BTREE *).

      Testing

      All eviction test suite files pass: test_eviction01test_eviction05, test_app_thread_evict01, test_cache_evict_config01/02, test_wt13867_interrupt_eviction_handler.

            Assignee:
            Haribabu Kommi
            Reporter:
            Haribabu Kommi
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: