-
Type:
Task
-
Resolution: Won't Do
-
Priority:
Major - P3
-
None
-
Affects Version/s: None
-
Component/s: Checkpoints
-
None
-
Storage Engines - Persistence
-
653.593
-
None
-
None
Lines 869-877 of __ckpt_process handle resetting the live system's alloc and discard extent lists by copying them to the checkpoint archive and reinitializing. This is the final piece of extractable logic. After extracting this, we verify that the cumulative refactoring has reduced cyclomatic complexity to <20 as targeted. If the complexity is still ≥20, additional micro-refactoring (e.g., extracting the ckpt_size calculation or breaking the lock/unlock into a scoped helper) may be needed.
Files to change
- src/block/block_ckpt.c — extract extent list reset logic and measure complexity
Tasks
- [ ] Create __ckpt_reset_extlists(session, ci) that encapsulates lines 869-877 (criterion: function copies alloc/discard to archive and reinitializes)
- [ ] Add spinlock assertion at the top of the function (criterion: WT_ASSERT_SPINLOCK_OWNED(session, &block->live_lock))
- [ ] Refactor __ckpt_process to call the helper (criterion: extent list reset is replaced by a single function call)
- [ ] Measure final complexity: lizard src/block/block_ckpt.c 2>/dev/null || python3 -m lizard src/block/block_ckpt.c 2>/dev/null (criterion: CCN for __ckpt_process is <20)
- [ ] If needed, perform additional micro-refactoring (criterion: extract ckpt_size calculation or other small sections until complexity <20)
- [ ] Run existing block manager unit tests (criterion: ctest --test-dir build -R block passes)
- [ ] Update function comment for __ckpt_process to describe the new high-level flow (criterion: comment clearly lists the major steps handled by helpers)
Definition of Done
- [ ] New static function __ckpt_reset_extlists handles resetting alloc and discard extent lists (lines 869-877)
- [ ] Function is called while block->live_lock is held (documented in function comment)
- [ ] __ckpt_process calls this helper instead of inline logic
- [ ] Cyclomatic complexity of __ckpt_process is <20 (measured with lizard src/block/block_ckpt.c 2>/dev/null || python3 -m lizard src/block/block_ckpt.c 2>/dev/null)
- [ ] If complexity is still ≥20, additional micro-refactoring is performed (e.g., extracting the ckpt_size calculation at lines 710-716 into a helper)
- [ ] All existing tests pass (run ctest --test-dir build -R block -j$(nproc))
- [ ] Code formatted with cd dist && ./s_clang_format
- [ ] Comments in __ckpt_process updated to reflect the new structure