Debian Codegraph @

docs/api_reference/C/logarchive.html

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