Extract update chain traversal logic from __curversion_next_single_key

XMLWordPrintableJSON

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

      Extract the update chain traversal logic (lines 256-388) into focused helper functions. This section walks the in-memory update list, handles tombstones, reconstructs modify values, and populates version cursor metadata. Breaking this into helpers will remove ~30-40 branches from the main function.

      Tasks

      • src/cursor/cur_version.c — Create __curversion_process_update_chain() helper that processes updates on the chain, returns WT_NOTFOUND when exhausted (criterion: function compiles, handles all update types including tombstones, modifies, and aborted updates)
      • src/cursor/cur_version.c — Create __curversion_emit_update_value() helper to pack and emit a single update's metadata and value (criterion: function correctly calls __curversion_set_value_with_format with all 14 metadata fields)
      • src/cursor/cur_version.c — Create __curversion_advance_update_chain() helper to find the next non-obsolete update, respecting first_globally_visible and aborted updates (criterion: correctly implements the logic from lines 352-383)
      • src/cursor/cur_version.c — Refactor __curversion_next_single_key to call the new helpers for the update chain section (criterion: lines 256-388 replaced with helper calls, behavior unchanged)

      Files to create or modify

      • src/cursor/cur_version.c — Add 3 new static helper functions, refactor __curversion_next_single_key to use them

      Definition of Done

      • Three new static helper functions added: _curversion_process_update_chain, curversion_emit_update_value, _curversion_advance_update_chain
      • __curversion_next_single_key lines 256-388 replaced with calls to helpers
      • CCN of __curversion_next_single_key reduced by at least 25 points (measured by lizard)
      • 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-17479 extract update chain traversal helpers" -y
        

            Assignee:
            Etienne Petrel
            Reporter:
            Etienne Petrel
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: