Refactor layered cursor enter logic

XMLWordPrintableJSON

    • Storage Engines - Foundations
    • 705.641
    • None
    • None

      The entry point for layered cursor operations, __clayered_enter, currently coordinates two functions with poorly separated concerns. __clayered_adjust_state conflates role-change precondition checks, stable cursor reopening, and transaction context refresh. __clayered_open_cursors bundles ingest and stable first-open behind a compound condition that is hard to follow. Neither function has a complete picture of the stable cursor lifecycle.

      This ticket refactors __clayered_enter into three clearly separated components: (1) a simple null-check that opens the ingest cursor on first use; (2) a new __clayered_handle_stable that owns the full stable cursor lifecycle including fast path, first-open, checkpoint advancement, and role-change reopen; (3) a slimmed-down __clayered_adjust_state that handles only role-change preconditions, leader tracking, and transaction context refresh. __clayered_open_cursors is removed entirely.

      As a side effect, checkpoint_meta_lsn is now only updated when the stable cursor is actually opened or advanced, making it semantically accurate. The role-change value is computed once in __clayered_enter and passed down to both sub-functions, avoiding a stale re-read after clayered->leader has already been updated.

            Assignee:
            Ivan Kochin
            Reporter:
            Ivan Kochin
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: