Extract history store traversal and reconstruction from __curversion_next_single_key

XMLWordPrintableJSON

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

      Extract the history store traversal logic (lines 580-693) into helper functions. This section positions the history store cursor, iterates through HS records, reconstructs modify operations, and validates timestamp ordering. It includes complex looping with early exits and timestamp comparisons.

      Tasks

      • src/cursor/cur_version.c — Create __curversion_position_hs_cursor() helper to set up and position the HS cursor for the current key (lines 595-610) (criterion: correctly handles both row-leaf and col-var page types, sets proper key format)
      • src/cursor/cur_version.c — Create __curversion_reconstruct_hs_value() helper to handle WT_UPDATE_MODIFY reconstruction onto the upd_value buffer (lines 630-641) (criterion: correctly applies modify or assigns standard value, handles max_memsize)
      • src/cursor/cur_version.c — Create __curversion_find_hs_record() helper that iterates HS until finding a non-duplicate record in timestamp order (lines 620-654) (criterion: correctly implements the for-loop with duplicate-skip logic for timestamp order mode)
      • src/cursor/cur_version.c — Create __curversion_check_hs_timestamp_bounds() helper to validate HS record against start_timestamp (lines 656-672) (criterion: returns WT_NOTFOUND when done, handles both stop_ts=MAX and stop_ts!=MAX cases)
      • src/cursor/cur_version.c — Refactor history store section of __curversion_next_single_key (lines 580-693) to use the new helpers (criterion: complexity reduced, early-exit conditions preserved)

      Files to create or modify

      • src/cursor/cur_version.c — Add 4 new static helper functions, refactor history store section in __curversion_next_single_key

      Definition of Done

      • Four new static helper functions added: _curversion_position_hs_cursor, curversion_reconstruct_hs_value, curversion_find_hs_record, _curversion_check_hs_timestamp_bounds
      • __curversion_next_single_key lines 580-693 replaced with helper calls
      • CCN of __curversion_next_single_key reduced by at least 15 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-17481 extract history store traversal logic" -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: