1<!--$Id: intro.so,v 10.25 2006/11/13 18:05:02 bostic Exp $-->
2<!--Copyright (c) 1997,2008 Oracle.  All rights reserved.-->
3<!--See the file LICENSE for redistribution information.-->
4<html>
5<head>
6<title>Berkeley DB Reference Guide: Introduction to the logging subsystem</title>
7<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
8<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++">
9</head>
10<body bgcolor=white>
11<a name="2"><!--meow--></a>
12<table width="100%"><tr valign=top>
13<td><b><dl><dt>Berkeley DB Reference Guide:<dd>Logging Subsystem</dl></b></td>
14<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>
15</td></tr></table>
16<p align=center><b>Introduction to the logging subsystem</b></p>
17<p>The Logging subsystem is the logging facility used by Berkeley DB.  It is
18largely Berkeley DB-specific, although it is potentially useful outside of
19the Berkeley DB package for applications wanting write-ahead logging support.
20Applications wanting to use the log for purposes other than logging file
21modifications based on a set of open file descriptors will almost
22certainly need to make source code modifications to the Berkeley DB code
23base.</p>
24<p>A log can be shared by any number of threads of control.  The
25<a href="../../api_c/env_open.html">DB_ENV-&gt;open</a> method is used to open a log.  When the log is no longer
26in use, it should be closed using the <a href="../../api_c/env_close.html">DB_ENV-&gt;close</a> method.</p>
27<p>Individual log entries are identified by log sequence numbers.  Log
28sequence numbers are stored in an opaque object, a <a href="../../api_c/lsn_class.html">DB_LSN</a>.</p>
29<p>The <a href="../../api_c/log_cursor.html">DB_ENV-&gt;log_cursor</a> method is used to allocate a log cursor.  Log cursors
30have two methods: <a href="../../api_c/logc_get.html">DB_LOGC-&gt;get</a> method to retrieve log records from the
31log, and <a href="../../api_c/logc_close.html">DB_LOGC-&gt;close</a> method to destroy the cursor.</p>
32<p>There are additional methods for integrating the log subsystem with a
33transaction processing system:</p>
34<br>
35<b><a href="../../api_c/log_flush.html">DB_ENV-&gt;log_flush</a></b><ul compact><li>Flushes the log up to a particular log sequence number.</ul>
36<b><a href="../../api_c/log_compare.html">log_compare</a></b><ul compact><li>Allows applications to compare any two log sequence numbers.</ul>
37<b><a href="../../api_c/log_file.html">DB_ENV-&gt;log_file</a>   </b><ul compact><li>Maps a log sequence number to the specific log file that contains it.</ul>
38<b><a href="../../api_c/log_archive.html">DB_ENV-&gt;log_archive</a></b><ul compact><li>Returns various sets of log filenames.  These methods are used for
39database administration; for example, to determine if log files may
40safely be removed from the system.</ul>
41<b><a href="../../api_c/log_stat.html">DB_ENV-&gt;log_stat</a>   </b><ul compact><li>The display <a href="../../utility/db_stat.html">db_stat</a> utility uses the <a href="../../api_c/log_stat.html">DB_ENV-&gt;log_stat</a> method to
42display statistics about the log.</ul>
43<b><a href="../../api_c/env_remove.html">DB_ENV-&gt;remove</a></b><ul compact><li>The log meta-information (but not the log files themselves) may be
44removed using the <a href="../../api_c/env_remove.html">DB_ENV-&gt;remove</a> method.</ul>
45<br>
46<!--$Id: m4.methods,v 1.7 2008/01/23 21:15:44 sarette Exp $-->
47<table border=1 align=center>
48<tr><th>Logging Subsystem and Related Methods</th><th>Description</th></tr>
49<!--DbLsn--><tr><td><a href="../../api_c/lsn_class.html">DB_LSN</a></td><td>Log Sequence Numbers</td></tr>
50<!--log_compare--><tr><td><a href="../../api_c/log_compare.html">log_compare</a></td><td>Compare two Log Sequence Numbers</td></tr>
51<!--DbEnv::log_archive--><tr><td><a href="../../api_c/log_archive.html">DB_ENV-&gt;log_archive</a></td><td>List log and database files</td></tr>
52<!--DbEnv::log_file--><tr><td><a href="../../api_c/log_file.html">DB_ENV-&gt;log_file</a></td><td>Map Log Sequence Numbers to log files</td></tr>
53<!--DbEnv::log_flush--><tr><td><a href="../../api_c/log_flush.html">DB_ENV-&gt;log_flush</a></td><td>Flush log records</td></tr>
54<!--DbEnv::log_printf--><tr><td><a href="../../api_c/log_printf.html">DB_ENV-&gt;log_printf</a></td><td>Append informational message to the log</td></tr>
55<!--DbEnv::log_put--><tr><td><a href="../../api_c/log_put.html">DB_ENV-&gt;log_put</a></td><td>Write a log record</td></tr>
56<!--DbEnv::log_stat--><tr><td><a href="../../api_c/log_stat.html">DB_ENV-&gt;log_stat</a></td><td>Return log subsystem statistics</td></tr>
57<tr><th>Logging Subsystem Cursors</th><th><br></th></tr>
58<!--DbLogc::-->
59<!--DbLogc::--><tr><td><a href="../../api_c/log_cursor.html">DB_ENV-&gt;log_cursor</a></td><td>Create a log cursor handle</td></tr>
60<!--DbLogc::close--><tr><td><a href="../../api_c/logc_close.html">DB_LOGC-&gt;close</a></td><td>Close a log cursor</td></tr>
61<!--DbLogc::get--><tr><td><a href="../../api_c/logc_get.html">DB_LOGC-&gt;get</a></td><td>Retrieve a log record</td></tr>
62<tr><th>Logging Subsystem Configuration</th><th><br></th></tr>
63<!--DbEnv::log_set_config--><tr><td><a href="../../api_c/env_log_set_config.html">DB_ENV-&gt;log_set_config</a></td><td>Configure the logging subsystem</td></tr>
64<!--DbEnv::set_lg_bsize--><tr><td><a href="../../api_c/env_set_lg_bsize.html">DB_ENV-&gt;set_lg_bsize</a></td><td>Set log buffer size</td></tr>
65<!--DbEnv::set_lg_dir--><tr><td><a href="../../api_c/env_set_lg_dir.html">DB_ENV-&gt;set_lg_dir</a></td><td>Set the environment logging directory</td></tr>
66<!--DbEnv::set_lg_filemode--><tr><td><a href="../../api_c/env_set_lg_mode.html">DB_ENV-&gt;set_lg_filemode</a></td><td>Set log file mode</td></tr>
67<!--DbEnv::set_lg_max--><tr><td><a href="../../api_c/env_set_lg_max.html">DB_ENV-&gt;set_lg_max</a></td><td>Set log file size</td></tr>
68<!--DbEnv::set_lg_regionmax--><tr><td><a href="../../api_c/env_set_lg_regionmax.html">DB_ENV-&gt;set_lg_regionmax</a></td><td>Set logging region size</td></tr>
69</table>
70<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>
71</td></tr></table>
72<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
73</body>
74</html>
75