| 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 17. 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 xmlns="" class="navheader"> |
| 16 | <div class="libver"> |
| 17 | <p>Library Version 11.2.5.3</p> |
| 18 | </div> |
| 19 | <table width="100%" summary="Navigation header"> |
| 20 | <tr> |
| 21 | <th colspan="3" align="center">Chapter 17. |
| 22 | The Logging Subsystem |
| 23 | </th> |
| 24 | </tr> |
| 25 | <tr> |
| 26 | <td width="20%" align="left"><a accesskey="p" href="lock_nondb.html">Prev</a> </td> |
| 27 | <th width="60%" align="center"> </th> |
| 28 | <td width="20%" align="right"> <a accesskey="n" href="log_config.html">Next</a></td> |
| 29 | </tr> |
| 30 | </table> |
| 31 | <hr /> |
| 32 | </div> |
| 33 | <div class="chapter" lang="en" xml:lang="en"> |
| 34 | <div class="titlepage"> |
| 35 | <div> |
| 36 | <div> |
| 37 | <h2 class="title"><a id="log"></a>Chapter 17. |
| 38 | The Logging Subsystem |
| 39 | </h2> |
| 40 | </div> |
| 41 | </div> |
| 42 | </div> |
| 43 | <div class="toc"> |
| 44 | <p> |
| 45 | <b>Table of Contents</b> |
| 46 | </p> |
| 47 | <dl> |
| 48 | <dt> |
| 49 | <span class="sect1"> |
| 50 | <a href="log.html#log_intro">Introduction to the logging subsystem</a> |
| 51 | </span> |
| 52 | </dt> |
| 53 | <dt> |
| 54 | <span class="sect1"> |
| 55 | <a href="log_config.html">Configuring logging</a> |
| 56 | </span> |
| 57 | </dt> |
| 58 | <dt> |
| 59 | <span class="sect1"> |
| 60 | <a href="log_limits.html">Log file limits</a> |
| 61 | </span> |
| 62 | </dt> |
| 63 | </dl> |
| 64 | </div> |
| 65 | <div class="sect1" lang="en" xml:lang="en"> |
| 66 | <div class="titlepage"> |
| 67 | <div> |
| 68 | <div> |
| 69 | <h2 class="title" style="clear: both"><a id="log_intro"></a>Introduction to the logging subsystem</h2> |
| 70 | </div> |
| 71 | </div> |
| 72 | </div> |
| 73 | <p>The Logging subsystem is the logging facility used by Berkeley DB. It is |
| 74 | largely Berkeley DB-specific, although it is potentially useful outside of |
| 75 | the Berkeley DB package for applications wanting write-ahead logging support. |
| 76 | Applications wanting to use the log for purposes other than logging file |
| 77 | modifications based on a set of open file descriptors will almost |
| 78 | certainly need to make source code modifications to the Berkeley DB code |
| 79 | base.</p> |
| 80 | <p>A log can be shared by any number of threads of control. The |
| 81 | <a href="../api_reference/C/envopen.html" class="olink">DB_ENV->open()</a> method is used to open a log. When the log is no longer |
| 82 | in use, it should be closed using the <a href="../api_reference/C/envclose.html" class="olink">DB_ENV->close()</a> method.</p> |
| 83 | <p>Individual log entries are identified by log sequence numbers. Log |
| 84 | sequence numbers are stored in an opaque object, an <a href="../api_reference/C/lsn.html" class="olink">DB_LSN</a>.</p> |
| 85 | <p>The <a href="../api_reference/C/logcursor.html" class="olink">DB_ENV->log_cursor()</a> method is used to allocate a log cursor. Log cursors |
| 86 | have two methods: <a href="../api_reference/C/logcget.html" class="olink">DB_LOGC->get()</a> method to retrieve log records from the |
| 87 | log, and <a href="../api_reference/C/logcclose.html" class="olink">DB_LOGC->close()</a> method to destroy the cursor.</p> |
| 88 | <p>There are additional methods for integrating the log subsystem with a |
| 89 | transaction processing system:</p> |
| 90 | <div class="variablelist"> |
| 91 | <dl> |
| 92 | <dt> |
| 93 | <span class="term"> |
| 94 | <a href="../api_reference/C/logflush.html" class="olink">DB_ENV->log_flush()</a> |
| 95 | </span> |
| 96 | </dt> |
| 97 | <dd>Flushes the log up to a particular log sequence number.</dd> |
| 98 | <dt> |
| 99 | <span class="term"> |
| 100 | <a href="../api_reference/C/logcompare.html" class="olink">DB_ENV->log_compare()</a> |
| 101 | </span> |
| 102 | </dt> |
| 103 | <dd>Allows applications to compare any two log sequence numbers.</dd> |
| 104 | <dt> |
| 105 | <span class="term"> |
| 106 | <a href="../api_reference/C/logfile.html" class="olink">DB_ENV->log_file()</a> |
| 107 | </span> |
| 108 | </dt> |
| 109 | <dd>Maps a log sequence number to the specific log file that contains it.</dd> |
| 110 | <dt> |
| 111 | <span class="term"> |
| 112 | <a href="../api_reference/C/logarchive.html" class="olink">DB_ENV->log_archive()</a> |
| 113 | </span> |
| 114 | </dt> |
| 115 | <dd>Returns various sets of log filenames. These methods are used for |
| 116 | database administration; for example, to determine if log files may |
| 117 | safely be removed from the system.</dd> |
| 118 | <dt> |
| 119 | <span class="term"> |
| 120 | <a href="../api_reference/C/logstat.html" class="olink">DB_ENV->log_stat()</a> |
| 121 | </span> |
| 122 | </dt> |
| 123 | <dd> The display <a href="../api_reference/C/db_stat.html" class="olink">db_stat</a> utility used the <a href="../api_reference/C/logstat.html" class="olink">DB_ENV->log_stat()</a> method to |
| 124 | display statistics about the log.</dd> |
| 125 | <dt> |
| 126 | <span class="term"> |
| 127 | <a href="../api_reference/C/envremove.html" class="olink">DB_ENV->remove()</a> |
| 128 | </span> |
| 129 | </dt> |
| 130 | <dd>The log meta-information (but not the log files themselves) may be |
| 131 | removed using the <a href="../api_reference/C/envremove.html" class="olink">DB_ENV->remove()</a> method.</dd> |
| 132 | </dl> |
| 133 | </div> |
| 134 | <p>For more information on the logging subsystem methods, see the <a href="../api_reference/C/lsn.html#loglist" class="olink">Logging Subsystem and Related Methods</a> section in the <em class="citetitle">Berkeley DB C API Reference Guide.</em></p> |
| 135 | </div> |
| 136 | </div> |
| 137 | <div class="navfooter"> |
| 138 | <hr /> |
| 139 | <table width="100%" summary="Navigation footer"> |
| 140 | <tr> |
| 141 | <td width="40%" align="left"><a accesskey="p" href="lock_nondb.html">Prev</a> </td> |
| 142 | <td width="20%" align="center"> </td> |
| 143 | <td width="40%" align="right"> <a accesskey="n" href="log_config.html">Next</a></td> |
| 144 | </tr> |
| 145 | <tr> |
| 146 | <td width="40%" align="left" valign="top">Locking and non-Berkeley DB applications </td> |
| 147 | <td width="20%" align="center"> |
| 148 | <a accesskey="h" href="index.html">Home</a> |
| 149 | </td> |
| 150 | <td width="40%" align="right" valign="top"> Configuring logging</td> |
| 151 | </tr> |
| 152 | </table> |
| 153 | </div> |
| 154 | </body> |
| 155 | </html> |