D. J. Bernstein
Data structures and program structures
cdb
The cdbstats and cdbtest programs
cdbstats
reads a (seekable) constant database
from its standard input
and prints a few statistics:
- records is the number of records in the database,
- d0 is the number of records at distance 0 from their hash,
- d1 is the number of records at distance 1 from their hash, etc.
cdbtest
reads a (seekable) constant database
from its standard input.
For each record in the database,
it double-checks that the record can be found by its key.
It prints tallies in several categories:
- found is the number of records
found correctly by their keys.
- different record is the number of records
where a different record was found with the same key.
This should not happen unless the database has multiple records
with the same key.
- bad length is the number of records
found but with the wrong data length.
This should never happen.
- not found is the number of records not found.
This should never happen.
- untested is the number of records
with keys longer than 1024 bytes.
cdbtest doesn't bother testing these records.