2
<!--Copyright 1997-2002 by Sleepycat Software, Inc.-->
3
<!--All rights reserved.-->
4
<!--See the file LICENSE for redistribution information.-->
7
<title>Berkeley DB Reference Guide: Berkeley DB and logging</title>
8
<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
9
<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++">
12
<a name="2"><!--meow--></a>
13
<table width="100%"><tr valign=top>
14
<td><h3><dl><dt>Berkeley DB Reference Guide:<dd>Logging Subsystem</dl></h3></td>
15
<td align=right><a href="../../ref/lock/nondb.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/log/config.html"><img src="../../images/next.gif" alt="Next"></a>
18
<h1 align=center>Berkeley DB and logging</h1>
19
<p>The Logging subsystem is the logging facility used by Berkeley DB. It is
20
largely Berkeley DB-specific, although it is potentially useful outside of
21
the Berkeley DB package for applications wanting write-ahead logging support.
22
Applications wanting to use the log for purposes other than logging file
23
modifications based on a set of open file descriptors will almost
24
certainly need to make source code modifications to the Berkeley DB code
26
<p>A log can be shared by any number of threads of control. The
27
<a href="../../api_c/env_open.html">DB_ENV->open</a> interface is used to open a log. When the log is no
28
longer in use, it should be closed using the <a href="../../api_c/env_close.html">DB_ENV->close</a>
30
<p>Individual log entries are identified by log sequence numbers. Log
31
sequence numbers are stored in an opaque object, a <a href="../../api_c/lsn_class.html">DB_LSN</a>.
32
<p>The <a href="../../api_c/log_cursor.html">DB_ENV->log_cursor</a> method is used to allocate a log cursor. Log cursors
33
have two methods: <a href="../../api_c/logc_get.html">DB_LOGC->get</a> method to retrieve log records from the
34
log, and <a href="../../api_c/logc_close.html">DB_LOGC->close</a> method to destroy the cursor.
35
<p>There are additional interfaces for integrating the log subsystem with a
36
transaction processing system:
38
<p><dt><a href="../../api_c/log_flush.html">DB_ENV->log_flush</a><dd>Flushes the log up to a particular log sequence number.
39
<p><dt><a href="../../api_c/log_compare.html">log_compare</a><dd>Allows applications to compare any two log sequence numbers.
40
<p><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.
41
<p><dt><a href="../../api_c/log_archive.html">DB_ENV->log_archive</a><dd>Returns various sets of log filenames. These interfaces are used for
42
database administration; for example, to determine if log files may
43
safely be removed from the system.
44
<p><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> interface
45
to display statistics about the log.
46
<p><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
47
removed using the <a href="../../api_c/env_remove.html">DB_ENV->remove</a> interface.
50
<p><table border=1 align=center>
51
<tr><th>Logging Subsystem and Related Methods</th><th>Description</th></tr>
52
<tr><td><a href="../../api_c/log_archive.html">DB_ENV->log_archive</a></td><td>List log and database files</td></tr>
53
<tr><td><a href="../../api_c/log_cursor.html">DB_ENV->log_cursor</a></td><td>Create a log cursor handle</td></tr>
54
<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>
55
<tr><td><a href="../../api_c/log_flush.html">DB_ENV->log_flush</a></td><td>Flush log records</td></tr>
56
<tr><td><a href="../../api_c/log_put.html">DB_ENV->log_put</a></td><td>Write a log record</td></tr>
57
<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>
58
<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>
59
<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>
60
<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>
61
<tr><td><a href="../../api_c/log_compare.html">log_compare</a></td><td>Compare two Log Sequence Numbers</td></tr>
62
<tr><td><a href="../../api_c/log_stat.html">DB_ENV->log_stat</a></td><td>Return log subsystem statistics</td></tr>
63
<tr><td><a href="../../api_c/logc_close.html">DB_LOGC->close</a></td><td>Close a log cursor</td></tr>
64
<tr><td><a href="../../api_c/logc_get.html">DB_LOGC->get</a></td><td>Retrieve a log record</td></tr>
66
<table width="100%"><tr><td><br></td><td align=right><a href="../../ref/lock/nondb.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/log/config.html"><img src="../../images/next.gif" alt="Next"></a>
68
<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font>