<!--$Id: intro.so,v 10.25 2006/11/13 18:05:02 bostic Exp $--> <!--Copyright (c) 1997,2007 Oracle. All rights reserved.--> <!--See the file LICENSE for redistribution information.--> <html> <head> <title>Berkeley DB Reference Guide: Introduction to the logging subsystem</title> <meta name="description" content="Berkeley DB: An embedded database programmatic toolkit."> <meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++"> </head> <body bgcolor=white> <a name="2"><!--meow--></a> <table width="100%"><tr valign=top> <td><h3><dl><dt>Berkeley DB Reference Guide:<dd>Logging Subsystem</dl></h3></td> <td align=right><a href="../lock/nondb.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../toc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../log/config.html"><img src="../../images/next.gif" alt="Next"></a> </td></tr></table> <p> <h3 align=center>Introduction to the logging subsystem</h3> <p>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.</p> <p>A log can be shared by any number of threads of control. The <a href="../../api_c/env_open.html">DB_ENV->open</a> method is used to open a log. When the log is no longer in use, it should be closed using the <a href="../../api_c/env_close.html">DB_ENV->close</a> method.</p> <p>Individual log entries are identified by log sequence numbers. Log sequence numbers are stored in an opaque object, a <a href="../../api_c/lsn_class.html">DB_LSN</a>.</p> <p>The <a href="../../api_c/log_cursor.html">DB_ENV->log_cursor</a> method is used to allocate a log cursor. Log cursors have two methods: <a href="../../api_c/logc_get.html">DB_LOGC->get</a> method to retrieve log records from the log, and <a href="../../api_c/logc_close.html">DB_LOGC->close</a> method to destroy the cursor.</p> <p>There are additional methods for integrating the log subsystem with a transaction processing system:</p> <dl compact> <dt><a href="../../api_c/log_flush.html">DB_ENV->log_flush</a><dd>Flushes the log up to a particular log sequence number. <dt><a href="../../api_c/log_compare.html">log_compare</a><dd>Allows applications to compare any two log sequence numbers. <dt><a href="../../api_c/log_file.html">DB_ENV->log_file</a> <dd>Maps a log sequence number to the specific log file that contains it. <dt><a href="../../api_c/log_archive.html">DB_ENV->log_archive</a><dd>Returns various sets of log filenames. These methods are used for database administration; for example, to determine if log files may safely be removed from the system. <dt><a href="../../api_c/log_stat.html">DB_ENV->log_stat</a> <dd>The display <a href="../../utility/db_stat.html">db_stat</a> utility uses the <a href="../../api_c/log_stat.html">DB_ENV->log_stat</a> method to display statistics about the log. <dt><a href="../../api_c/env_remove.html">DB_ENV->remove</a><dd>The log meta-information (but not the log files themselves) may be removed using the <a href="../../api_c/env_remove.html">DB_ENV->remove</a> method. </dl> <!--$Id: m4.methods,v 1.6 2005/09/30 19:00:24 bostic Exp $--> <table border=1 align=center> <tr><th>Logging Subsystem and Related Methods</th><th>Description</th></tr> <!--DbLsn--><tr><td><a href="../../api_c/lsn_class.html">DB_LSN</a></td><td>Log Sequence Numbers</td></tr> <!--log_compare--><tr><td><a href="../../api_c/log_compare.html">log_compare</a></td><td>Compare two Log Sequence Numbers</td></tr> <!--DbEnv::log_archive--><tr><td><a href="../../api_c/log_archive.html">DB_ENV->log_archive</a></td><td>List log and database files</td></tr> <!--DbEnv::log_file--><tr><td><a href="../../api_c/log_file.html">DB_ENV->log_file</a></td><td>Map Log Sequence Numbers to log files</td></tr> <!--DbEnv::log_flush--><tr><td><a href="../../api_c/log_flush.html">DB_ENV->log_flush</a></td><td>Flush log records</td></tr> <!--DbEnv::log_printf--><tr><td><a href="../../api_c/log_printf.html">DB_ENV->log_printf</a></td><td>Append informational message to the log</td></tr> <!--DbEnv::log_put--><tr><td><a href="../../api_c/log_put.html">DB_ENV->log_put</a></td><td>Write a log record</td></tr> <!--DbEnv::log_stat--><tr><td><a href="../../api_c/log_stat.html">DB_ENV->log_stat</a></td><td>Return log subsystem statistics</td></tr> <tr><th>Logging Subsystem Cursors</th><th><br></th></tr> <!--DbLogc::--> <!--DbLogc::--><tr><td><a href="../../api_c/log_cursor.html">DB_ENV->log_cursor</a></td><td>Create a log cursor handle</td></tr> <!--DbLogc::close--><tr><td><a href="../../api_c/logc_close.html">DB_LOGC->close</a></td><td>Close a log cursor</td></tr> <!--DbLogc::get--><tr><td><a href="../../api_c/logc_get.html">DB_LOGC->get</a></td><td>Retrieve a log record</td></tr> <tr><th>Logging Subsystem Configuration</th><th><br></th></tr> <!--DbEnv::set_lg_bsize--><tr><td><a href="../../api_c/env_set_lg_bsize.html">DB_ENV->set_lg_bsize</a></td><td>Set log buffer size</td></tr> <!--DbEnv::set_lg_dir--><tr><td><a href="../../api_c/env_set_lg_dir.html">DB_ENV->set_lg_dir</a></td><td>Set the environment logging directory</td></tr> <!--DbEnv::set_lg_filemode--><tr><td><a href="../../api_c/env_set_lg_mode.html">DB_ENV->set_lg_filemode</a></td><td>Set log file mode</td></tr> <!--DbEnv::set_lg_max--><tr><td><a href="../../api_c/env_set_lg_max.html">DB_ENV->set_lg_max</a></td><td>Set log file size</td></tr> <!--DbEnv::set_lg_regionmax--><tr><td><a href="../../api_c/env_set_lg_regionmax.html">DB_ENV->set_lg_regionmax</a></td><td>Set logging region size</td></tr> </table> <table width="100%"><tr><td><br></td><td align=right><a href="../lock/nondb.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../toc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../log/config.html"><img src="../../images/next.gif" alt="Next"></a> </td></tr></table> <p><font size=1>Copyright (c) 1996,2007 Oracle. All rights reserved.</font> </body> </html>