Skip to content

test(coverage): hot backup, DB_CONFIG parser, compaction-recovery (env_backup 0->97%, env_config 3->72%) - #82

Merged
gburd merged 3 commits into
masterfrom
coverage/backup-config-rebased
Jul 29, 2026
Merged

test(coverage): hot backup, DB_CONFIG parser, compaction-recovery (env_backup 0->97%, env_config 3->72%)#82
gburd merged 3 commits into
masterfrom
coverage/backup-config-rebased

Conversation

@gburd

@gburd gburd commented Jul 29, 2026

Copy link
Copy Markdown
Collaborator
file before after
env/env_backup.c 0% 96.7% (81.8% br)
env/env_config.c 3.2% 71.8% (61.4% br)
db/db_rec.c 18.0% 27.1% (branch 13.2→18.0)
db/db_backup.c (bonus) ~0% 43.0%

Tests added / wired

  • test/backup/backup_direct.c — C driver for the hot-backup config/callback API (all 4 config enums, WRITE_DIRECT, getters-before-alloc EINVAL, callbacks, backup()/dbbackup()) that db_hotbackup (NULL backup_handle) never reaches.
  • test/db/recd_compact.c — compaction-under-recovery: compacts a sparse btree (logs merge/pgno/pg_trunc), then DB_RECOVER_FATAL replays — the only way those ~330 lines of recover handlers run.
  • env007 wired into the subset (was registered, never run — it's already a comprehensive DB_CONFIG parser test; no new config test needed).
  • recd002:btree (splits) + recd016:btree (catastrophic recovery) added.
  • New COV_BACKUP=1 block (default on), self-cleaning + timeout-guarded.

No bugs found. Both drivers verified PASS under timeout on repeat runs.

gburd added 3 commits July 29, 2026 08:44
The Tcl backup.tcl test drives hot backup only through the db_hotbackup
utility, which calls DB_ENV->backup() with a NULL backup_handle -- so
env/env_backup.c (the four backup config setters/getters and the backup
callback setter/getter) was never reached (0% line/branch), and the
backup->open/write/close callback branches of db/db_backup.c stayed cold.

Add test/backup/backup_direct.c (same standalone-driver shape as
test/xa/xa_direct.c): it calls set/get_backup_config for all four config
enums (READ_COUNT/READ_SLEEP/SIZE/WRITE_DIRECT, the last on and off to hit
both F_SET and F_CLR), the getters-before-alloc EINVAL branches, and
set/get_backup_callbacks, then runs DB_ENV->backup()/dbbackup() with write
callbacks installed so the callback copy path in db_backup.c executes.
Self-cleans its home dir and runs under a hard SIGALRM + timeout guard.

Lift (coverage subset): env_backup.c 0%->96.7% line / 0%->81.8% branch;
db_backup.c callback path 43.0% line / 29.6% branch.
Three recovery record handlers in db/db_rec.c -- __db_merge_recover,
__db_pgno_recover, __db_pg_trunc_recover (~330 lines) -- fire only when
btree compaction / page-truncation log records are replayed.  No recd0NN
test runs compaction under recovery, so all three were completely cold.

Add test/db/recd_compact.c: it fills a small-page btree, deletes a large
contiguous range to leave sparse/empty pages, runs DB->compact(DB_FREE_SPACE)
in a transaction (logging __db_merge / __db_pgno / __db_pg_trunc records),
then re-opens the environment under DB_RECOVER_FATAL so catastrophic recovery
replays the whole log from the start, driving the redo/forward-roll branches
of those handlers.  It verifies the database still opens and reads back after
recovery.  Same self-clean + hard-timeout shape as the XA/upgrade drivers.

Lift (coverage subset, combined with recd002:btree + recd016): db_rec.c
18%->~27% line, ~13%->~18% branch; merge/pgno/pg_trunc/relink no longer cold.
…vers into subset

Add to the default COV_TESTS: env007 (comprehensive DB_CONFIG parser test --
writes a DB_CONFIG with many directives and confirms values via getters,
exercising __env_read_db_config + __config_scan; was registered but never in
the subset), recd002:btree (split recovery) and recd016:btree (catastrophic
recovery) for db_rec.c branch coverage.

Add a COV_BACKUP block (default on, same gating shape as COV_XA_UPG) that runs
the two new standalone drivers: test/backup/run_backup_direct.sh and
test/db/run_recd_compact.sh.  Both self-clean and run under a hard timeout.

Document the new surface in README.md (COV_BACKUP table row + section).

Lift (coverage subset): env_config.c 3.2%->71.8% line / 1.2%->61.4% branch
(via env007); env_backup.c 0%->96.7%/81.8%; db_rec.c 18%->27.1% line /
13.2%->18.0% branch.
@gburd
gburd merged commit 3364b1c into master Jul 29, 2026
45 of 47 checks passed
@gburd
gburd deleted the coverage/backup-config-rebased branch July 29, 2026 12:45
@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.31 (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