test(coverage): cover db_compint varint codec + lock config/allocator (lock007, test143) - #85
Closed
gburd wants to merge 2 commits into
Closed
test(coverage): cover db_compint varint codec + lock config/allocator (lock007, test143)#85gburd wants to merge 2 commits into
gburd wants to merge 2 commits into
Conversation
… (varint codec) lock007 exercises every DB_ENV lock-subsystem config setter/getter (set_lk_max_locks/lockers/objects, set_lk_partitions, set_lk_tablesize, the DB_MEM_LOCK/LOCKER/LOCKOBJECT init counts, and set_lk_detect for all nine deadlock-detection policies), then runs a many-locker workload (200 lockers x 40 distinct objects) that exhausts the initial lock-region free lists and forces the region-growth loop in lock/lock_alloc.incl. test143 stores records into a -compress btree whose data sizes span the compressed-integer codec's 1/2/3-byte size classes and reads them back, driving __db_compress_int / __db_decompress_int32 in common/db_compint.c. Register both in testparams.tcl (lock, test groups).
Adds lock007 and test143:btree to the default coverage subset and documents the lift in the coverage README: common/db_compint.c 0.0% -> 15.7% (subset, identical footing) lock/lock_alloc.incl 0.0% -> 81.8% lock/lock_method.c 55.8% -> 58.0% Notes the codec ceiling: btree compression only marshals 32-bit lengths, so the 64-bit __db_decompress_int and the 4-9 byte size classes are unreachable from any Tcl workload -- those are exhaustively covered by the separate property-based tier test/pbt/pbt_compint.c.
Collaborator
Author
|
Superseded by rebased branch (resolved run_coverage.sh/README conflict vs #84; re-added lock007/test143 to COV_TESTS that git auto-resolution dropped); reopening. |
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.
Summary
Raises coverage of three cold libdb areas by adding two Tcl tests and wiring
them into the bounded coverage subset (
test/coverage/run_coverage.shCOV_TESTS):common/db_compint.c— the compressed-integer (varint) codec used bybtree compression.
lock/lock_method.c— theDB_ENVlock-subsystem config setters/getters.lock/lock_alloc.incl— the lock-region object/locker/lock allocator(included into
lock_region.c).Coverage before → after
Measured on identical footing: the exact
COV_TESTSsubset without the twonew tests (BEFORE) vs. with them (AFTER), instrumented
--coveragebuild in thenix dev shell, lcov
--branch-coverage(the same source of truth as the ranking).common/db_compint.clock/lock_alloc.incllock/lock_method.c(
lock_method.cwas already exercised in the subset by env020/statprint001'sgetters;
lock007adds the setter paths.lock_alloc.inclanddb_compint.cwere both 0% in the subset before — nothing grew the lock region or opened a
-compressbtree.)Tests added
lock007(grouplock) — sets every lock config knob before open(
set_lk_max_locks/lockers/objects,set_lk_partitions,set_lk_tablesize, theDB_MEM_LOCK/LOCKER/LOCKOBJECTinit counts, andset_lk_detectfor all nine deadlock-detection policies + a rejected boguspolicy), reads them back through the getters, then runs a many-locker
workload (200 lockers × 40 distinct read-lock objects) that exhausts the
initial lock-region free lists and forces the region-growth loop in
lock_alloc.incl.test143(grouptest) — stores records into a-compressbtree whosedata sizes span the codec's 1/2/3-byte size classes (1 B … 100 KB) and reads
them back (point-get + full cursor scan), driving
__db_compress_intonwrite and
__db_decompress_int32on read plus key prefix/suffix lengthcompression.
Both are registered in
testparams.tcland wired intoCOV_TESTS(
lock007:,test143:btree). Both PASS reliably (verified repeatedly undertimeout in both the
--coveragesubset run and a clean--enable-debugbuild).The db_compint ceiling and the PBT tier
db_compint.ccannot reach 100% from any Tcl workload: btree compression onlyever marshals 32-bit lengths, so the 64-bit
__db_decompress_int(~130 ofthe file's 324 lines) and the 4–9 byte size classes are unreachable from Tcl.
Those paths are already exhaustively property-tested by
test/pbt/pbt_compint.c— a separate property-based-testing tier thatround-trips random 64-bit values through
__db_compress_int/__db_decompress_intacross every size class. That tier is not part of theTcl coverage subset, which is why db_compint showed "cold" in the ranking even
though the codec is well covered overall. The tcl-reachable ceiling is ~24%;
test143reaches the practical ceiling for the codec's btree-driven path. TheREADME documents this. (The PBT tier was not modified.)
No engine changes / no real bug
Test-only change. No
src/engine code was modified. No real bug surfaced inthe codec or the lock allocator.
build_windows/*CRLF noise wasskip-worktree'd per the repo convention; no coverage artifacts committed.