• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src/router/db-4.8.30/docs/api_reference/CXX/
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>DbEnv::log_archive()</title>
7    <link rel="stylesheet" href="apiReference.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 C++ API Reference" />
10    <link rel="up" href="lsn.html" title="Chapter 8.  The DbLsn Handle" />
11    <link rel="prev" href="envget_lg_regionmax.html" title="DbEnv::get_lg_regionmax()" />
12    <link rel="next" href="logcursor.html" title="DbEnv::log_cursor()" />
13  </head>
14  <body>
15    <div class="navheader">
16      <table width="100%" summary="Navigation header">
17        <tr>
18          <th colspan="3" align="center">DbEnv::log_archive()</th>
19        </tr>
20        <tr>
21          <td width="20%" align="left"><a accesskey="p" href="envget_lg_regionmax.html">Prev</a> </td>
22          <th width="60%" align="center">Chapter 8. 
23                The DbLsn Handle
24        </th>
25          <td width="20%" align="right"> <a accesskey="n" href="logcursor.html">Next</a></td>
26        </tr>
27      </table>
28      <hr />
29    </div>
30    <div class="sect1" lang="en" xml:lang="en">
31      <div class="titlepage">
32        <div>
33          <div>
34            <h2 class="title" style="clear: both"><a id="logarchive"></a>DbEnv::log_archive()</h2>
35          </div>
36        </div>
37      </div>
38      <pre class="programlisting">#include &lt;db_cxx.h&gt;
39 
40int
41DbEnv::log_archive(char *(*listp)[], u_int32_t flags);</pre>
42      <p>
43         The <code class="methodname">DbEnv::log_archive()</code> method returns an array of log or database
44         filenames.
45    </p>
46      <p>
47         By default, <code class="methodname">DbEnv::log_archive()</code> returns the names of all of the
48         log files that are no longer in use (for example, that are no longer involved in active
49         transactions), and that may safely be archived for catastrophic recovery and then removed
50         from the system.  If there are no filenames to return, the memory location to which
51         <span class="bold"><strong>listp</strong></span> refers will be set to NULL.
52    </p>
53      <p>
54
55         Arrays of log filenames are stored in allocated memory.  If application-specific allocation
56         routines have been declared (see <a class="xref" href="envset_alloc.html" title="DbEnv::set_alloc()">DbEnv::set_alloc()</a> 
57         for more information), they are used to allocate the memory; otherwise, the standard
58         C library <span class="bold"><strong>malloc</strong></span>(3) is used.  The caller is responsible
59         for deallocating the memory.  To deallocate the memory, free the memory reference;
60         references inside the returned memory need not be individually freed.
61    </p>
62      <p>
63         Log cursor handles (returned by the <a class="xref" href="logcursor.html" title="DbEnv::log_cursor()">DbEnv::log_cursor()</a>
64         method) may have open file descriptors for log files in the database environment.  Also,
65         the Berkeley DB interfaces to the database environment logging subsystem (for example,
66         <a class="xref" href="logput.html" title="DbEnv::log_put()">DbEnv::log_put()</a>  and <a class="xref" href="txnabort.html" title="DbTxn::abort()">DbTxn::abort()</a> ) may allocate log cursors and have open file descriptors
67         for log files as well.  On operating systems where filesystem related system calls (for
68         example, rename and unlink on Windows/NT) can fail if a process has an open file descriptor
69         for the affected file, attempting to move or remove the log files listed by
70         <code class="methodname">DbEnv::log_archive()</code> may fail.  All Berkeley DB internal use of log
71         cursors operates on active log files only and furthermore, is short-lived in nature.  So,
72         an application seeing such a failure should be restructured to close any open log cursors
73         it may have, and otherwise to retry the operation until it succeeds.  (Although the latter
74         is not likely to be necessary; it is hard to imagine a reason to move or rename a log file
75         in which transactions are being logged or aborted.)
76    </p>
77      <p>
78         See <a class="link" href="db_archive.html" title="db_archive">db_archive</a> for more information on 
79         database archival procedures.
80    </p>
81      <p>
82         The <code class="methodname">DbEnv::log_archive()</code> <span>
83            
84            <span>
85                method either returns a non-zero error value or throws an
86                exception that encapsulates a non-zero error value on
87                failure, and returns 0 on success.
88            </span>
89        </span>
90    </p>
91      <div class="sect2" lang="en" xml:lang="en">
92        <div class="titlepage">
93          <div>
94            <div>
95              <h3 class="title"><a id="id1683585"></a>Parameters</h3>
96            </div>
97          </div>
98        </div>
99        <div class="sect3" lang="en" xml:lang="en">
100          <div class="titlepage">
101            <div>
102              <div>
103                <h4 class="title"><a id="id1684900"></a>flags</h4>
104              </div>
105            </div>
106          </div>
107          <p>
108                          The <span class="bold"><strong>flags</strong></span> parameter must be set to 0
109                          or by bitwise inclusively <span class="bold"><strong>OR</strong></span>'ing
110                          together one or more of the following values:
111                     </p>
112          <div class="itemizedlist">
113            <ul type="disc">
114              <li>
115                <p><a id="archive_DB_ARCH_ABS"></a>
116                  <code class="literal">DB_ARCH_ABS</code>
117            </p>
118                <p>
119                 All pathnames are returned as absolute pathnames, instead of relative
120                 to the database home directory.
121            </p>
122              </li>
123              <li>
124                <p><a id="archive_DB_ARCH_DATA"></a>
125                  <code class="literal">DB_ARCH_DATA</code>
126            </p>
127                <p>
128                 Return the database files that need to be archived in order to recover
129                 the database from catastrophic failure.  If any of the database files
130                 have not been accessed during the lifetime of the current log files,
131                 <code class="methodname">DbEnv::log_archive()</code> will not include them in this list.  It is also
132                 possible that some of the files referred to by the log have since been
133                 deleted from the system.
134            </p>
135                <p>
136                The <code class="literal">DB_ARCH_DATA</code> and <code class="literal">DB_ARCH_LOG flags</code> are mutually exclusive.
137            </p>
138              </li>
139              <li>
140                <p><a id="archive_DB_ARCH_LOG"></a>
141                  <code class="literal">DB_ARCH_LOG</code>
142            </p>
143                <p>
144                 Return all the log filenames, regardless of whether or not they are in
145                 use.
146            </p>
147                <p>
148                The <code class="literal">DB_ARCH_DATA</code> and <code class="literal">DB_ARCH_LOG flags</code> are mutually exclusive.
149            </p>
150              </li>
151              <li>
152                <p><a id="archive_DB_ARCH_REMOVE"></a>
153                  <code class="literal">DB_ARCH_REMOVE</code>
154            </p>
155                <p>
156                 Remove log files that are no longer needed; no filenames are returned.
157                 Automatic log file removal is likely to make catastrophic recovery
158                 impossible.
159            </p>
160                <p>
161                The <code class="literal">DB_ARCH_REMOVE</code> flag may not be specified with any other flag.
162            </p>
163              </li>
164            </ul>
165          </div>
166        </div>
167        <div class="sect3" lang="en" xml:lang="en">
168          <div class="titlepage">
169            <div>
170              <div>
171                <h4 class="title"><a id="id1685187"></a>listp</h4>
172              </div>
173            </div>
174          </div>
175          <p>
176                          The <span class="bold"><strong>listp</strong></span> parameter references memory
177                          into which the allocated array of log or database filenames is copied.
178                           If there are no filenames to return, the memory location to which
179                          <span class="bold"><strong>listp</strong></span> refers will be set to NULL.
180                     </p>
181        </div>
182      </div>
183      <div class="sect2" lang="en" xml:lang="en">
184        <div class="titlepage">
185          <div>
186            <div>
187              <h3 class="title"><a id="id1685016"></a>Errors</h3>
188            </div>
189          </div>
190        </div>
191        <p>
192                         The <code class="methodname">DbEnv::log_archive()</code> <span>
193            
194            <span>
195                method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a> 
196                exception, encapsulating one of the following non-zero errors, or return one
197                of the following non-zero errors:
198            </span>
199        </span>
200                    </p>
201        <div class="sect3" lang="en" xml:lang="en">
202          <div class="titlepage">
203            <div>
204              <div>
205                <h4 class="title"><a id="id1685024"></a>EINVAL</h4>
206              </div>
207            </div>
208          </div>
209          <p>
210                An invalid flag value or parameter was specified.
211            </p>
212        </div>
213      </div>
214      <div class="sect2" lang="en" xml:lang="en">
215        <div class="titlepage">
216          <div>
217            <div>
218              <h3 class="title"><a id="id1685189"></a>Class</h3>
219            </div>
220          </div>
221        </div>
222        <p>
223                    <a class="link" href="env.html" title="Chapter 5.  The DbEnv Handle">DbEnv</a>, 
224                    <a class="link" href="logc.html" title="The DbLogc Handle">DbLogc</a>, 
225                    <a class="link" href="lsn.html" title="Chapter 8.  The DbLsn Handle">DbLsn</a> 
226            </p>
227      </div>
228      <div class="sect2" lang="en" xml:lang="en">
229        <div class="titlepage">
230          <div>
231            <div>
232              <h3 class="title"><a id="id1684720"></a>See Also</h3>
233            </div>
234          </div>
235        </div>
236        <p>
237                     <a class="xref" href="lsn.html#loglist" title="Logging Subsystem and Related Methods">Logging Subsystem and Related Methods</a> 
238                </p>
239      </div>
240    </div>
241    <div class="navfooter">
242      <hr />
243      <table width="100%" summary="Navigation footer">
244        <tr>
245          <td width="40%" align="left"><a accesskey="p" href="envget_lg_regionmax.html">Prev</a> </td>
246          <td width="20%" align="center">
247            <a accesskey="u" href="lsn.html">Up</a>
248          </td>
249          <td width="40%" align="right"> <a accesskey="n" href="logcursor.html">Next</a></td>
250        </tr>
251        <tr>
252          <td width="40%" align="left" valign="top">DbEnv::get_lg_regionmax() </td>
253          <td width="20%" align="center">
254            <a accesskey="h" href="index.html">Home</a>
255          </td>
256          <td width="40%" align="right" valign="top"> DbEnv::log_cursor()</td>
257        </tr>
258      </table>
259    </div>
260  </body>
261</html>
262