-
Type:
Sub-task
-
Resolution: Won't Do
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Block Manager
-
None
-
Storage Engines
-
210.394
-
SE Persistence backlog
-
None
The prototype allocates max_size[WT_SKIP_MAXDEPTH] for every WT_EXT node, wasting memory on shallow nodes (most nodes have depth 1-3, not 10). Switching to a variable-length array matching the existing next[] pattern saves memory and improves cache locality. Diagnostic assertions from ticket 2.2 will catch any correctness issues introduced here.
Tasks
- src/include/block.h — Change wt_off_t max_size[WT_SKIP_MAXDEPTH] in WT_EXT to be part of the variable-length next[] array allocation (criterion: WT_EXT structure comment documents that next[0..depth-1] is offset skiplist, next[depth..2*depth-1] is size skiplist, next[2*depth..3*depth-1] is max_size)
- src/block/block_session.c — Update __block_ext_alloc allocation from sizeof(WT_EXT) + skipdepth * 2 * sizeof(WT_EXT *) to sizeof(WT_EXT) + skipdepth * 2 * sizeof(WT_EXT *) + skipdepth * sizeof(wt_off_t) (criterion: allocation size accounts for max_size array)
- src/block/block_ext.c — Update all ext->max_size[i] accesses to use the new offset within next[] array (e.g., ((wt_off_t *)&ext->next[2 * ext->depth])[i]) or introduce a helper macro (criterion: all max_size accesses work with variable-length layout)
- test/catch2/block/utils_extlist.cpp — Update test utilities to handle variable-length max_size if they directly access WT_EXT internals (criterion: Catch2 block tests still compile and pass)
Files to create or modify
- src/include/block.h — WT_EXT structure definition
- src/block/block_session.c — WT_EXT allocation
- src/block/block_ext.c — all max_size accesses
- test/catch2/block/utils_extlist.cpp — test utilities
Definition of Done
- max_size is a variable-length array sized to match node depth
- Memory allocation updated to account for variable-length max_size
- All code correctly accesses max_size with new layout
- Catch2 block tests pass