DataReelDataReelC++ Toolkit Documentation

dr_digest

What a database file holds, as one 64-bit digest whatever its layout (DataReel 7.4).

Contents

Usage
Examples

Usage

dr_digest FILE [--kind btree|bytes|objects]

It prints one line, "HASH COUNT FILE": the hash as 16 hex digits, then the number of objects, keys or bytes it covers. The kinds:

Without --kind it is btree for a .btx file and bytes for anything else. Exit 0 ok, 1 the file could not be read (the reason on standard error), 2 usage. From code, the same digest is gxDatabaseDigest() of gxddigest.h. It is the same as "gxrepl digest" of the 7.4 betas, so digests taken with either compare. Digests of vector indexes: vix_rebuild --digest.

Examples

The files of the db_infohog example (contacts.ihd, a database, and contacts.ihx, its B-tree index):

$ dr_digest contacts.ihd --kind objects
2529221e36f1d836 2 contacts.ihd
$ dr_digest contacts.ihx --kind btree
7e8ef133d7365933 2 contacts.ihx
$ dr_digest contacts.ihd
cf3f301eee79783d 65888 contacts.ihd

Without --kind a file that does not end in .btx is hashed as bytes (65888 is its size). A database rebuilt with db_debug holds the same objects in a different layout: the objects digest stays the same and the bytes digest changes:

$ db_debug contacts.ihd r            (name the new file rebuilt.ihd)
$ dr_digest rebuilt.ihd --kind objects
2529221e36f1d836 2 rebuilt.ihd
$ dr_digest rebuilt.ihd
d26365d0b030cefb 65518 rebuilt.ihd

Errors:

$ dr_digest missing.gxd
dr_digest: cannot open missing.gxd          (exit 1)
$ dr_digest
Usage: dr_digest FILE [--kind btree|bytes|objects]   (exit 2)