Consolidate early-exit logic in __curversion_next_single_key

XMLWordPrintableJSON

    • Type: Task
    • Resolution: Declined
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: Cursors
    • None

      After extracting the three main sections, consolidate the remaining early-exit conditions, done-label logic, and error handling in __curversion_next_single_key. The function still has several inline conditionals at lines 263-266, 390-399, 580-590 that check start_timestamp and global visibility for early exit. Group these checks into a single helper to further reduce CCN.

      Tasks

      • src/cursor/cur_version.c — Create __curversion_check_early_exit() helper to evaluate whether to exit early based on start_timestamp, global visibility, and stop metadata state (criterion: consolidates all 3+ early-exit checks scattered across the function)
      • src/cursor/cur_version.c — Refactor _curversion_next_single_key to call _curversion_check_early_exit at the start of each major section (criterion: reduces inline conditionals, makes exit conditions explicit)
      • src/cursor/cur_version.c — Simplify the done-label section (lines 695-701) if possible by moving upd_found checks earlier (criterion: reduces nesting or branches at done label)

      Files to create or modify

      • src/cursor/cur_version.c — Add 1 helper function, refactor early-exit checks in __curversion_next_single_key

      Definition of Done

      • One new static helper function added: __curversion_check_early_exit
      • Early-exit logic at lines 263-266, 390-399, 580-590 replaced with helper call
      • CCN of __curversion_next_single_key reduced by at least 5 points from previous ticket's baseline
      • Evergreen patch submitted and all unit-test tasks pass on all build variants:
        evergreen patch -p wiredtiger --rt "unit-test" --rv ".*" -f -u -d "WT-17482 consolidate early-exit conditions" -y
        

            Assignee:
            [DO NOT USE] Backlog - Storage Engines Team
            Reporter:
            Etienne Petrel
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: