Debugging and Testing

We have imported the debugging system from the old test suite into the new interface to aid in debugging problems.  There are several variables that are available both in gdb as globals to the C code, and variables in Tcl that the user can set.  These variables are linked together so that changes in one venue are reflected in the other.  The names of the variables have been modified a bit to reduce the likelihood
of namespace trampling.  We have added a double underscore to all the names.

The variables are all initialized to zero (0) thus resulting in debugging being turned off.  The purpose of the debugging, fundamentally, is to allow the user to set a breakpoint prior to making a DB call.  This breakpoint is set in the __db_loadme() function.  The user may selectively turn on various debugging areas each controlled by a separate variable (note they all have two (2) underscores prepended to the name):

Note to developers:  Anyone extending this interface must place a call to _debug_check() (no arguments) before every call into the DB library.

There is also a command available that will force a call to the _debug_check function.

> berkdb debug_check



For testing purposes we have added several hooks into the DB library and a small interface into the environment and/or database commands to manipulate the hooks.  This command interface and the hooks and everything that goes with it is only enabled when the test option is configured into DB.

> <env> test copy location
> <db> test copy location
> <env> test abort location
> <db> test abort location

In order to test recovery we need to be able to abort the creation or deletion process at various points.  Also we want to invoke a copy function to copy the database file(s)  at various points as well so that we can obtain before/after snapshots of the databases.  The interface provides the test command to specify a location where we wish to invoke a copy or an abort.  The command is available from either the environment or the database for convenience.  The location can be one of the following: