Berkeley DB Reference Guide:
Logging Subsystem
PrevRefNext

Introduction to the logging subsystem

The Logging subsystem is the logging facility used by Berkeley DB. It is largely Berkeley DB-specific, although it is potentially useful outside of the Berkeley DB package for applications wanting write-ahead logging support. Applications wanting to use the log for purposes other than logging file modifications based on a set of open file descriptors will almost certainly need to make source code modifications to the Berkeley DB code base.

A log can be shared by any number of threads of control. The DB_ENV->open method is used to open a log. When the log is no longer in use, it should be closed using the DB_ENV->close method.

Individual log entries are identified by log sequence numbers. Log sequence numbers are stored in an opaque object, a DB_LSN.

The DB_ENV->log_cursor method is used to allocate a log cursor. Log cursors have two methods: DB_LOGC->get method to retrieve log records from the log, and DB_LOGC->close method to destroy the cursor.

There are additional methods for integrating the log subsystem with a transaction processing system:


DB_ENV->log_flush log_compare DB_ENV->log_file DB_ENV->log_archive DB_ENV->log_stat DB_ENV->remove
Logging Subsystem and Related MethodsDescription
DB_LSNLog Sequence Numbers
log_compareCompare two Log Sequence Numbers
DB_ENV->log_archiveList log and database files
DB_ENV->log_fileMap Log Sequence Numbers to log files
DB_ENV->log_flushFlush log records
DB_ENV->log_printfAppend informational message to the log
DB_ENV->log_putWrite a log record
DB_ENV->log_statReturn log subsystem statistics
Logging Subsystem Cursors
DB_ENV->log_cursorCreate a log cursor handle
DB_LOGC->closeClose a log cursor
DB_LOGC->getRetrieve a log record
Logging Subsystem Configuration
DB_ENV->log_set_configConfigure the logging subsystem
DB_ENV->set_lg_bsizeSet log buffer size
DB_ENV->set_lg_dirSet the environment logging directory
DB_ENV->set_lg_filemodeSet log file mode
DB_ENV->set_lg_maxSet log file size
DB_ENV->set_lg_regionmaxSet logging region size

PrevRefNext

Copyright (c) 1996,2008 Oracle. All rights reserved.