Skip to content

test(coverage): C driver for cold recovery handlers (bam_root/irep/rcuradj, db_ovref 0->covered) - #93

Merged
gburd merged 2 commits into
masterfrom
coverage/recd-handlers-final
Jul 30, 2026
Merged

test(coverage): C driver for cold recovery handlers (bam_root/irep/rcuradj, db_ovref 0->covered)#93
gburd merged 2 commits into
masterfrom
coverage/recd-handlers-final

Conversation

@gburd

@gburd gburd commented Jul 30, 2026

Copy link
Copy Markdown
Collaborator

A targeted C driver (test/db/recd_handlers.c, modeled on recd_compact.c) covers 4 of 5 recovery-record handlers no tcl recd test can reach — all were 0 calls at baseline.

handler how triggered result
__bam_root_recover subdb create under txn, commit/abort 0 → exec 5, 53% br
__bam_irep_recover compaction of deep btree (front deletes → pinsert(BPI_REPLACE)) 0 → exec 4790, 60% br
__bam_rcuradj_recover rrecno DB_RENUMBER cursor adjust under child txn, abort 0 → exec 3, 74% br
__db_ovref_recover DB->truncate() of btree with overflow items, commit/abort 0 → exec 680, 68% br

Both REDO and UNDO exercised; every scenario verifies DB integrity post-recovery. Driver is self-cleaning, SIGALRM-guarded (~9s), wired into run_coverage.sh COV_BACKUP block.

5th handler (__db_cksum_recover) documented as unreachable, not forced: its __db_cksum marker 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 tcl recd016 has.

No engine bugs — all 4 handlers replay cleanly (redo + undo).

gburd added 2 commits July 30, 2026 08:00
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.
@gburd
gburd merged commit a3145a0 into master Jul 30, 2026
45 of 47 checks passed
@gburd
gburd deleted the coverage/recd-handlers-final branch July 30, 2026 12:03
@github-actions

Copy link
Copy Markdown

Coccinelle convention checks

No new violations. ✅

Resolved since baseline (2) -- update dist/cocci/baseline.txt to lock these in.
rule_mutex_unbalanced|MUTEX_UNBALANCED|src/crypto/mersenne/mt19937db.c|return (ret);
rule_mutex_unbalanced|MUTEX_UNBALANCED|src/mp/mp_register.c|return (ret);

@github-actions

Copy link
Copy Markdown

ABI diff vs v5.3.32 (libabigail — authoritative)

Removed exported symbols (nm -D, _NNNN version suffix normalized)

None.


Advisory: libabigail/nm is the authoritative binary-ABI check; Coccinelle is complementary source-level early warning. See dist/cocci/README.md.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant