test(coverage): C driver for cold recovery handlers (bam_root/irep/rcuradj, db_ovref 0->covered) - #93
Merged
Merged
Conversation
The Tcl recd0NN suite never produces the exact log records replayed by
four per-operation recovery handlers (recd003 does NOT unlock them --
they need scenarios no bounded recd test hits):
bt_rec.c __bam_root_recover -- subdb-create logs a __bam_root record
(root page set on file meta page)
bt_rec.c __bam_irep_recover -- compaction merges pages, replacing a
parent separator via __bam_pupdate ->
__bam_pinsert(BPI_REPLACE) -> __bam_irep
bt_rec.c __bam_rcuradj_recover-- rrecno (DB_RENUMBER) cursor adjust
logged under a CHILD txn, then aborted
(handler acts only on DB_TXN_ABORT)
db_rec.c __db_ovref_recover -- DB->truncate() of a btree with overflow
items logs __db_ovref(-1) per ovfl page
recd_handlers.c builds each scenario and replays it under DB_RECOVER /
DB_RECOVER_FATAL (and txn abort for the undo paths), verifying DB
integrity after recovery. Hard SIGALRM guard, self-cleaning home dir,
same shape as recd_compact.c. Runs in ~9s.
Lift (driver alone, all four go 0 calls -> covered):
__bam_root_recover ~53% branch
__bam_irep_recover ~60% branch
__bam_rcuradj_recover ~74% branch
__db_ovref_recover ~68% branch
Documented-but-uncovered: __db_cksum_recover. Its __db_cksum marker
record is only written on a checksum error during a logged page-in;
recovery's redo re-reads the still-corrupt page and panics (pgin failed)
before reaching the marker, so the handler never runs. Tcl recd016 has
the same limitation.
Run test/db/run_recd_handlers.sh alongside recd_compact in the COV_BACKUP driver block (default on), and document the four newly-covered recover handlers (and the one documented-uncovered __db_cksum_recover) in the coverage README.
Coccinelle convention checksNo new violations. ✅ Resolved since baseline (2) -- update dist/cocci/baseline.txt to lock these in. |
ABI diff vs
|
This was referenced Jul 30, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A targeted C driver (
test/db/recd_handlers.c, modeled onrecd_compact.c) covers 4 of 5 recovery-record handlers no tcl recd test can reach — all were 0 calls at baseline.__bam_root_recover__bam_irep_recoverpinsert(BPI_REPLACE))__bam_rcuradj_recover__db_ovref_recoverDB->truncate()of btree with overflow items, commit/abortBoth REDO and UNDO exercised; every scenario verifies DB integrity post-recovery. Driver is self-cleaning, SIGALRM-guarded (~9s), wired into
run_coverage.shCOV_BACKUP block.5th handler (
__db_cksum_recover) documented as unreachable, not forced: its__db_cksummarker is only logged on a checksum error during a logged page-in, but recovery's redo re-reads the still-corrupt page and panics (pgin failed) before reaching the marker — the same limitation tclrecd016has.No engine bugs — all 4 handlers replay cleanly (redo + undo).