• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/router/db-4.8.30/docs/programmer_reference/
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml">
4  <head>
5    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6    <title>Chapter��16.�� The Logging Subsystem</title>
7    <link rel="stylesheet" href="gettingStarted.css" type="text/css" />
8    <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
9    <link rel="start" href="index.html" title="Berkeley DB Programmer's Reference Guide" />
10    <link rel="up" href="index.html" title="Berkeley DB Programmer's Reference Guide" />
11    <link rel="prev" href="lock_nondb.html" title="Locking and non-Berkeley DB applications" />
12    <link rel="next" href="log_config.html" title="Configuring logging" />
13  </head>
14  <body>
15    <div class="navheader">
16      <table width="100%" summary="Navigation header">
17        <tr>
18          <th colspan="3" align="center">Chapter��16.��
19		The Logging Subsystem
20        </th>
21        </tr>
22        <tr>
23          <td width="20%" align="left"><a accesskey="p" href="lock_nondb.html">Prev</a>��</td>
24          <th width="60%" align="center">��</th>
25          <td width="20%" align="right">��<a accesskey="n" href="log_config.html">Next</a></td>
26        </tr>
27      </table>
28      <hr />
29    </div>
30    <div class="chapter" lang="en" xml:lang="en">
31      <div class="titlepage">
32        <div>
33          <div>
34            <h2 class="title"><a id="log"></a>Chapter��16.��
35		The Logging Subsystem
36        </h2>
37          </div>
38        </div>
39      </div>
40      <div class="toc">
41        <p>
42          <b>Table of Contents</b>
43        </p>
44        <dl>
45          <dt>
46            <span class="sect1">
47              <a href="log.html#log_intro">Introduction to the logging subsystem</a>
48            </span>
49          </dt>
50          <dt>
51            <span class="sect1">
52              <a href="log_config.html">Configuring logging</a>
53            </span>
54          </dt>
55          <dt>
56            <span class="sect1">
57              <a href="log_limits.html">Log file limits</a>
58            </span>
59          </dt>
60        </dl>
61      </div>
62      <div class="sect1" lang="en" xml:lang="en">
63        <div class="titlepage">
64          <div>
65            <div>
66              <h2 class="title" style="clear: both"><a id="log_intro"></a>Introduction to the logging subsystem</h2>
67            </div>
68          </div>
69        </div>
70        <p>The Logging subsystem is the logging facility used by Berkeley DB.  It is
71largely Berkeley DB-specific, although it is potentially useful outside of
72the Berkeley DB package for applications wanting write-ahead logging support.
73Applications wanting to use the log for purposes other than logging file
74modifications based on a set of open file descriptors will almost
75certainly need to make source code modifications to the Berkeley DB code
76base.</p>
77        <p>A log can be shared by any number of threads of control.  The
78<a href="../api_reference/C/envopen.html" class="olink">DB_ENV-&gt;open()</a> method is used to open a log.  When the log is no longer
79in use, it should be closed using the <a href="../api_reference/C/envclose.html" class="olink">DB_ENV-&gt;close()</a> method.</p>
80        <p>Individual log entries are identified by log sequence numbers.  Log
81sequence numbers are stored in an opaque object, an <a href="../api_reference/C/lsn.html" class="olink">DB_LSN</a>.</p>
82        <p>The <a href="../api_reference/C/logcursor.html" class="olink">DB_ENV-&gt;log_cursor()</a> method is used to allocate a log cursor.  Log cursors
83have two methods: <a href="../api_reference/C/logcget.html" class="olink">DB_LOGC-&gt;get()</a> method to retrieve log records from the
84log, and <a href="../api_reference/C/logcclose.html" class="olink">DB_LOGC-&gt;close()</a> method to destroy the cursor.</p>
85        <p>There are additional methods for integrating the log subsystem with a
86transaction processing system:</p>
87        <div class="variablelist">
88          <dl>
89            <dt>
90              <span class="term">
91                <a href="../api_reference/C/logflush.html" class="olink">DB_ENV-&gt;log_flush()</a>
92              </span>
93            </dt>
94            <dd>Flushes the log up to a particular log sequence number.</dd>
95            <dt>
96              <span class="term">
97                <a href="../api_reference/C/logcompare.html" class="olink">DB_ENV-&gt;log_compare()</a>
98              </span>
99            </dt>
100            <dd>Allows applications to compare any two log sequence numbers.</dd>
101            <dt>
102              <span class="term">
103                <a href="../api_reference/C/logfile.html" class="olink">DB_ENV-&gt;log_file()</a>
104              </span>
105            </dt>
106            <dd>Maps a log sequence number to the specific log file that contains it.</dd>
107            <dt>
108              <span class="term">
109                <a href="../api_reference/C/logarchive.html" class="olink">DB_ENV-&gt;log_archive()</a>
110              </span>
111            </dt>
112            <dd>Returns various sets of log filenames.  These methods are used for
113database administration; for example, to determine if log files may
114safely be removed from the system.</dd>
115            <dt>
116              <span class="term">
117                <a href="../api_reference/C/logstat.html" class="olink">DB_ENV-&gt;log_stat()</a>
118              </span>
119            </dt>
120            <dd> The display <a href="../api_reference/C/db_stat.html" class="olink">db_stat utility</a> utility used the <a href="../api_reference/C/logstat.html" class="olink">DB_ENV-&gt;log_stat()</a> method to
121display statistics about the log.</dd>
122            <dt>
123              <span class="term">
124                <a href="../api_reference/C/envremove.html" class="olink">DB_ENV-&gt;remove()</a>
125              </span>
126            </dt>
127            <dd>The log meta-information (but not the log files themselves) may be
128removed using the <a href="../api_reference/C/envremove.html" class="olink">DB_ENV-&gt;remove()</a> method.</dd>
129          </dl>
130        </div>
131        <div class="informaltable">
132          <table border="1" width="80%">
133            <colgroup>
134              <col />
135              <col />
136            </colgroup>
137            <thead>
138              <tr>
139                <th>Logging Subsystem and Related Methods</th>
140                <th>Description</th>
141              </tr>
142            </thead>
143            <tbody>
144              <tr>
145                <td>
146                  <a href="../api_reference/C/lsn.html" class="olink">DB_LSN</a>
147                </td>
148                <td>Log Sequence Numbers</td>
149              </tr>
150              <tr>
151                <td>
152                  <a href="../api_reference/C/logcompare.html" class="olink">DB_ENV-&gt;log_compare()</a>
153                </td>
154                <td>Compare two Log Sequence Numbers</td>
155              </tr>
156              <tr>
157                <td>
158                  <a href="../api_reference/C/logarchive.html" class="olink">DB_ENV-&gt;log_archive()</a>
159                </td>
160                <td>List log and database files</td>
161              </tr>
162              <tr>
163                <td>
164                  <a href="../api_reference/C/logfile.html" class="olink">DB_ENV-&gt;log_file()</a>
165                </td>
166                <td>Map Log Sequence Numbers to log files</td>
167              </tr>
168              <tr>
169                <td>
170                  <a href="../api_reference/C/logflush.html" class="olink">DB_ENV-&gt;log_flush()</a>
171                </td>
172                <td>Flush log records</td>
173              </tr>
174              <tr>
175                <td>
176                  <a href="../api_reference/C/logprintf.html" class="olink">DB_ENV-&gt;log_printf()</a>
177                </td>
178                <td>Append informational message to the log</td>
179              </tr>
180              <tr>
181                <td>
182                  <a href="../api_reference/C/logput.html" class="olink">DB_ENV-&gt;log_put()</a>
183                </td>
184                <td>Write a log record</td>
185              </tr>
186              <tr>
187                <td>
188                  <a href="../api_reference/C/logstat.html" class="olink">DB_ENV-&gt;log_stat()</a>
189                </td>
190                <td>Return log subsystem statistics</td>
191              </tr>
192              <tr>
193                <td>
194                  <span class="emphasis">
195                    <em>Logging Subsystem Cursors</em>
196                  </span>
197                </td>
198                <td>��</td>
199              </tr>
200              <tr>
201                <td>
202                  <a href="../api_reference/C/logcursor.html" class="olink">DB_ENV-&gt;log_cursor()</a>
203                </td>
204                <td>Create a log cursor handle</td>
205              </tr>
206              <tr>
207                <td>
208                  <a href="../api_reference/C/logcclose.html" class="olink">DB_LOGC-&gt;close()</a>
209                </td>
210                <td>Close a log cursor</td>
211              </tr>
212              <tr>
213                <td>
214                  <a href="../api_reference/C/logcget.html" class="olink">DB_LOGC-&gt;get()</a>
215                </td>
216                <td>Retrieve a log record</td>
217              </tr>
218              <tr>
219                <td>
220                  <span class="emphasis">
221                    <em>Logging Subsystem Configuration</em>
222                  </span>
223                </td>
224                <td>��</td>
225              </tr>
226              <tr>
227                <td>
228                  <a href="../api_reference/C/envlog_set_config.html" class="olink">DB_ENV-&gt;log_set_config()</a>
229                </td>
230                <td>Configure the logging subsystem</td>
231              </tr>
232              <tr>
233                <td>
234                  <a href="../api_reference/C/envset_lg_bsize.html" class="olink">DB_ENV-&gt;set_lg_bsize()</a>
235                </td>
236                <td>Set log buffer size</td>
237              </tr>
238              <tr>
239                <td>
240                  <a href="../api_reference/C/envset_lg_dir.html" class="olink">DB_ENV-&gt;set_lg_dir()</a>
241                </td>
242                <td>Set the environment logging directory</td>
243              </tr>
244              <tr>
245                <td>
246                  <a href="../api_reference/C/envset_lg_filemode.html" class="olink">DB_ENV-&gt;set_lg_filemode()</a>
247                </td>
248                <td>Set log file mode</td>
249              </tr>
250              <tr>
251                <td>
252                  <a href="../api_reference/C/envset_lg_max.html" class="olink">DB_ENV-&gt;set_lg_max()</a>
253                </td>
254                <td>Set log file size</td>
255              </tr>
256              <tr>
257                <td>
258                  <a href="../api_reference/C/envset_lg_regionmax.html" class="olink">DB_ENV-&gt;set_lg_regionmax()</a>
259                </td>
260                <td>Set logging region size</td>
261              </tr>
262            </tbody>
263          </table>
264        </div>
265      </div>
266    </div>
267    <div class="navfooter">
268      <hr />
269      <table width="100%" summary="Navigation footer">
270        <tr>
271          <td width="40%" align="left"><a accesskey="p" href="lock_nondb.html">Prev</a>��</td>
272          <td width="20%" align="center">��</td>
273          <td width="40%" align="right">��<a accesskey="n" href="log_config.html">Next</a></td>
274        </tr>
275        <tr>
276          <td width="40%" align="left" valign="top">Locking and non-Berkeley DB applications��</td>
277          <td width="20%" align="center">
278            <a accesskey="h" href="index.html">Home</a>
279          </td>
280          <td width="40%" align="right" valign="top">��Configuring logging</td>
281        </tr>
282      </table>
283    </div>
284  </body>
285</html>
286