-
Type:
Task
-
Resolution: Declined
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Cursors
-
None
-
Storage Engines
-
171.909
-
None
-
None
Extract the on-disk value handling logic (lines 390-578) into helper functions. This section includes page type checks, on-disk value retrieval, time window stop/no-stop handling, timestamp ordering validation, and prepare state logic. The nested conditionals for timestamp comparison and visibility checks contribute significantly to CCN.
Tasks
- src/cursor/cur_version.c — Create __curversion_should_skip_ondisk() helper to evaluate all timestamp-order skip conditions (lines 437-494), returning true if should skip (criterion: function centralizes all 6+ skip conditions with correct prepare/rollback handling)
- src/cursor/cur_version.c — Create __curversion_check_timestamp_bounds() helper to validate start_timestamp boundary conditions (lines 509-527), returning WT_NOTFOUND when done (criterion: correctly checks both stop and no-stop time window cases)
- src/cursor/cur_version.c — Create __curversion_compute_ondisk_stop_metadata() helper to compute stop_ts, stop_txn, stop_prepared and related fields from time window and tombstone state (lines 459-546) (criterion: returns all stop metadata fields correctly for both has-stop and no-stop cases)
- src/cursor/cur_version.c — Create __curversion_emit_ondisk_value() helper to pack and emit the on-disk value with its metadata (lines 549-573) (criterion: correctly formats all 14 metadata fields for disk image location)
- src/cursor/cur_version.c — Refactor __curversion_next_single_key on-disk section (lines 390-578) to use the new helpers (criterion: complexity reduced, logic flow clearer)
Files to create or modify
- src/cursor/cur_version.c — Add 4 new static helper functions, refactor on-disk section in __curversion_next_single_key
Definition of Done
- Four new static helper functions added: _curversion_should_skip_ondisk, curversion_check_timestamp_bounds, curversion_compute_ondisk_stop_metadata, _curversion_emit_ondisk_value
- __curversion_next_single_key lines 390-578 replaced with helper calls
- CCN of __curversion_next_single_key reduced by at least 20 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-17480 extract on-disk value visibility logic" -y