Introduction

The bthash subroutine library has been designed to run in an online environment as well as a batch environment. All errors have messages written to stderr. This satisfies the batch environment. In addition, all errors result in a return to the calling program with an error code.

There are several kinds of error codes.

The following error codes indicate an abnormal condition. The calling program should be written to take corrective action when these error codes occur.

Simple error conditions have small error codes.

For instance, error code 1 indicates a not found condition from a hget call.

The simple error codes are documented in the Subroutine Calls document.

The error codes documentation in the errors directory covers abnormal error conditions. Return to the index and study the error codes for each subroutine. This will guide you in writing error recovery routines in your program.

In general, if hshhdr->reason is not equal to zero after a subroutine call, your program needs to pass control to an error recovery routine. In some cases the error code indicates that the database has been corrupted. You should stop accessing the database when this happens and restore to an earlier version of the database.

A simple example of a data corruption error occurs when an error is detected in the middle of a delete. The subroutine returns when the error condition is detected. Thus the delete has not finished and the database is corrupted. You need to restore the database when this happens.

The insertion process also takes several steps. Data corruption is possible in the middle of this process if a hardware problem arises.

The update process just involves a single write operation. If that call doesn't complete then data corruption is possible.