Refactor __clayered_search_near_int into focused helpers

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Layered Tables
    • None
    • Storage Engines - Foundations
    • 1,579.711
    • None
    • None

      Problem:

      __clayered_search_near_int in src/cursor/cur_layered.c has grown to ~185 lines in a single flat body. Ingest probing, stable probing, truncate-list filtering, closest-cursor arbitration, and ingest-side tombstone skipping all share the same scope, with state threaded between them via locals.

      The function has accreted over several landings (WT-16811, prepared-conflict handling, earlier features). Each change was reasonable in isolation, but the combined cognitive load is now high enough that:

      • Any follow-on change has to re-read the whole body to stay safe.
      • Correctness-sensitive additions (e.g. the truncate-list filter on the stable path) end up buried inside an unrelated block, which makes it easy for a future read-path feature to forget an equivalent check in the right place.
      • The function is hard to add targeted assertions, verbose logging, or unit coverage to, because there is no smaller named surface to hook into.

      Goal:

      Reduce the cognitive load of __clayered_search_near_int. Shape is up to whoever picks this up; this is a readability refactor and must not change behavior.

      Acceptance criteria:

      • Top-level control flow of layered search-near is obvious at a glance.
      • Existing layered cursor and fast-truncate tests continue to pass.
      • No API or performance change.

      Non-goals: fixing bugs, changing semantics, reworking ingest/stable arbitration.

            Assignee:
            Jie Chen
            Reporter:
            Jie Chen
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: