Next: , Previous: , Up: Top   [Contents][Index]


5 Database Errors

The module stores the collected metrics in a GNU DBM file. Normally only one process can have write access to the database. While it is updating the database, another processes wishing to obtain access (whether read-write or read-only) will wait until it has finished. This waiting consists in several attempts. During each attempt the process sleeps for certain amount of time, and then tries to lock and open the database. Two configuration variables help tune this process: database-retry sets the number of attempts to take, and database-wait defines the time to sleep within each attempt. These are discussed in detail in Configuration.

Even in most meticulously configured systems, a possibility of a timeout still remains. Such timeouts can happen in the following functions: openmetrics_add, openmetrics_incr, openmetrics_set, and openmetrics_reset. Beside this, another errors that can occur when accessing database files affect these functions. By default, when a database-related error occurs these functions raise the e_dbfailure exception. Unless properly caught and handled, this exception will cause the filter to return temporary failure and terminate prematurely. Obviously such behavior is not well-suited for production environments. To avoid it, mfmod_openmetrics provides the following variable:

Variable: number openmetrics_safe

Control gracious handling of database-related expressions.

If set to 1, instead of raising exceptions in case of error, the above-mentioned functions will report the error using echo and return. The execution of the filter will continue normally.

By default this variable is initialized to 0. It is recommended to set it to 1 in the startup handler.