Investigate reads racing an async step-down against the stable table being marked read-only and outdated

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Layered Tables
    • Storage Engines - Foundations
    • 218.324
    • SE Foundations - 2026-08-04, SE Foundations - 2026-08-18
    • 5

      Readers are allowed to continue across an async step-down. The step-down marks the live stable btrees read-only and outdated while those readers may be mid operation. We should verify that every cursor read path handles this transition correctly, and add tests where coverage is missing.

      Cases to check for each operation:

      search

      • The operation enters before the role flip and performs its lookup after the tree is marked.
      • The lookup needs the history store during that window.
      • A search that triggers the lazy open of the stable constituent while the marking walk runs.

      next / prev

      • The cursor is positioned on the stable tree when the role changes and the next operation reopens the constituent onto a checkpoint view. Position is carried over by cursor duplication. Verify no skipped or duplicated keys in both directions.
      • A scan that holds its snapshot across the step-down and keeps the old handle pinned. The rest of the scan must stay on a consistent view.
      • A scan that straddles the mark mid walk, some keys returned before and some after.

      search_near

      • Same windows as search.
      • Neighbor selection that mixes state read before the mark with state read after it.
      • Repositioning after the reopen when the aimed key does not exist in the new view.

      history store

      • The live shared history store handle is also marked read-only and outdated at step-down. Readers that need older versions during and after the transition must still reach the right history store content.
      • A reader whose session has no cached history store cursor and opens one fresh after the mark.
      • A reader crossing the transition mid transaction, with history store lookups on both sides of the mark.

      General

      • A transaction spanning the whole step-down must see consistent results for identical reads before and after the mark.
      • An outdated handle kept alive by readers across a later checkpoint pickup, reads through it must stay consistent.
      • Cached cursors that reopen after their handle is marked outdated.

      Any bugs coming out of this investigation will be filed as separate tickets.

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

              Created:
              Updated: