mirror of
https://github.com/berkeleydb/libdb.git
synced 2024-11-17 01:26:25 +00:00
270 lines
12 KiB
HTML
270 lines
12 KiB
HTML
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||
<html xmlns="http://www.w3.org/1999/xhtml">
|
||
<head>
|
||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||
<title>DbEnv::log_archive()</title>
|
||
<link rel="stylesheet" href="apiReference.css" type="text/css" />
|
||
<meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
|
||
<link rel="start" href="index.html" title="Berkeley DB C++ API Reference" />
|
||
<link rel="up" href="lsn.html" title="Chapter 8. The DbLsn Handle" />
|
||
<link rel="prev" href="envget_lg_regionmax.html" title="DbEnv::get_lg_regionmax()" />
|
||
<link rel="next" href="logcursor.html" title="DbEnv::log_cursor()" />
|
||
</head>
|
||
<body>
|
||
<div xmlns="" class="navheader">
|
||
<div class="libver">
|
||
<p>Library Version 11.2.5.2</p>
|
||
</div>
|
||
<table width="100%" summary="Navigation header">
|
||
<tr>
|
||
<th colspan="3" align="center">DbEnv::log_archive()</th>
|
||
</tr>
|
||
<tr>
|
||
<td width="20%" align="left"><a accesskey="p" href="envget_lg_regionmax.html">Prev</a> </td>
|
||
<th width="60%" align="center">Chapter 8.
|
||
The DbLsn Handle
|
||
</th>
|
||
<td width="20%" align="right"> <a accesskey="n" href="logcursor.html">Next</a></td>
|
||
</tr>
|
||
</table>
|
||
<hr />
|
||
</div>
|
||
<div class="sect1" lang="en" xml:lang="en">
|
||
<div class="titlepage">
|
||
<div>
|
||
<div>
|
||
<h2 class="title" style="clear: both"><a id="logarchive"></a>DbEnv::log_archive()</h2>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<pre class="programlisting">#include <db_cxx.h>
|
||
|
||
int
|
||
DbEnv::log_archive(char *(*listp)[], u_int32_t flags);</pre>
|
||
<p>
|
||
The <code class="methodname">DbEnv::log_archive()</code> method returns an array of log or database
|
||
filenames.
|
||
</p>
|
||
<p>
|
||
By default, <code class="methodname">DbEnv::log_archive()</code> returns the names of all of the
|
||
log files that are no longer in use (for example, that are no longer involved in active
|
||
transactions), and that may safely be archived for catastrophic recovery and then removed
|
||
from the system. If there are no filenames to return, the memory location to which
|
||
<span class="bold"><strong>listp</strong></span> refers will be set to NULL.
|
||
</p>
|
||
<p>
|
||
When Replication Manager is in use, log archiving is
|
||
performed in a replication group-aware manner such that the
|
||
log file status of other sites in the group is considered to
|
||
determine if a log file is in use.
|
||
</p>
|
||
<p>
|
||
|
||
Arrays of log filenames are stored in allocated memory. If application-specific allocation
|
||
routines have been declared (see <a class="xref" href="envset_alloc.html" title="DbEnv::set_alloc()">DbEnv::set_alloc()</a>
|
||
for more information), they are used to allocate the memory; otherwise, the standard
|
||
C library <span class="bold"><strong>malloc</strong></span>(3) is used. The caller is responsible
|
||
for deallocating the memory. To deallocate the memory, free the memory reference;
|
||
references inside the returned memory need not be individually freed.
|
||
</p>
|
||
<p>
|
||
Log cursor handles (returned by the <a class="xref" href="logcursor.html" title="DbEnv::log_cursor()">DbEnv::log_cursor()</a>
|
||
method) may have open file descriptors for log files in the database environment. Also,
|
||
the Berkeley DB interfaces to the database environment logging subsystem (for example,
|
||
<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
|
||
for log files as well. On operating systems where filesystem related system calls (for
|
||
example, rename and unlink on Windows/NT) can fail if a process has an open file descriptor
|
||
for the affected file, attempting to move or remove the log files listed by
|
||
<code class="methodname">DbEnv::log_archive()</code> may fail. All Berkeley DB internal use of log
|
||
cursors operates on active log files only and furthermore, is short-lived in nature. So,
|
||
an application seeing such a failure should be restructured to close any open log cursors
|
||
it may have, and otherwise to retry the operation until it succeeds. (Although the latter
|
||
is not likely to be necessary; it is hard to imagine a reason to move or rename a log file
|
||
in which transactions are being logged or aborted.)
|
||
</p>
|
||
<p>
|
||
See <a class="link" href="db_archive.html" title="db_archive">db_archive</a> for more information on
|
||
database archival procedures.
|
||
</p>
|
||
<p>
|
||
The <code class="methodname">DbEnv::log_archive()</code> <span>
|
||
|
||
<span>
|
||
method either returns a non-zero error value or throws an
|
||
exception that encapsulates a non-zero error value on
|
||
failure, and returns 0 on success.
|
||
</span>
|
||
</span>
|
||
</p>
|
||
<div class="sect2" lang="en" xml:lang="en">
|
||
<div class="titlepage">
|
||
<div>
|
||
<div>
|
||
<h3 class="title"><a id="id3618208"></a>Parameters</h3>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="sect3" lang="en" xml:lang="en">
|
||
<div class="titlepage">
|
||
<div>
|
||
<div>
|
||
<h4 class="title"><a id="id3618198"></a>listp</h4>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<p>
|
||
The <span class="bold"><strong>listp</strong></span> parameter references memory
|
||
into which the allocated array of log or database filenames is copied.
|
||
If there are no filenames to return, the memory location to which
|
||
<span class="bold"><strong>listp</strong></span> refers will be set to NULL.
|
||
</p>
|
||
</div>
|
||
<div class="sect3" lang="en" xml:lang="en">
|
||
<div class="titlepage">
|
||
<div>
|
||
<div>
|
||
<h4 class="title"><a id="id3617848"></a>flags</h4>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<p>
|
||
The <span class="bold"><strong>flags</strong></span> parameter must be set to 0
|
||
or by bitwise inclusively <span class="bold"><strong>OR</strong></span>'ing
|
||
together one or more of the following values:
|
||
</p>
|
||
<div class="itemizedlist">
|
||
<ul type="disc">
|
||
<li>
|
||
<p><a id="archive_DB_ARCH_ABS"></a>
|
||
<code class="literal">DB_ARCH_ABS</code>
|
||
</p>
|
||
<p>
|
||
All pathnames are returned as absolute pathnames, instead of relative
|
||
to the database home directory.
|
||
</p>
|
||
</li>
|
||
<li>
|
||
<p><a id="archive_DB_ARCH_DATA"></a>
|
||
<code class="literal">DB_ARCH_DATA</code>
|
||
</p>
|
||
<p>
|
||
Return the database files that need to be archived in order to recover
|
||
the database from catastrophic failure. If any of the database files
|
||
have not been accessed during the lifetime of the current log files,
|
||
<code class="methodname">DbEnv::log_archive()</code> will not include them in this list. It is also
|
||
possible that some of the files referred to by the log have since been
|
||
deleted from the system.
|
||
</p>
|
||
<p>
|
||
The <code class="literal">DB_ARCH_DATA</code> and <code class="literal">DB_ARCH_LOG flags</code> are mutually exclusive.
|
||
</p>
|
||
</li>
|
||
<li>
|
||
<p><a id="archive_DB_ARCH_LOG"></a>
|
||
<code class="literal">DB_ARCH_LOG</code>
|
||
</p>
|
||
<p>
|
||
Return all the log filenames, regardless of whether or not they are in
|
||
use.
|
||
</p>
|
||
<p>
|
||
The <code class="literal">DB_ARCH_DATA</code> and <code class="literal">DB_ARCH_LOG flags</code> are mutually exclusive.
|
||
</p>
|
||
</li>
|
||
<li>
|
||
<p><a id="archive_DB_ARCH_REMOVE"></a>
|
||
<code class="literal">DB_ARCH_REMOVE</code>
|
||
</p>
|
||
<p>
|
||
Remove log files that are no longer needed; no filenames are returned.
|
||
Automatic log file removal is likely to make catastrophic recovery
|
||
impossible.
|
||
</p>
|
||
<p>
|
||
The <code class="literal">DB_ARCH_REMOVE</code> flag may not be specified with any other flag.
|
||
</p>
|
||
</li>
|
||
</ul>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<div class="sect2" lang="en" xml:lang="en">
|
||
<div class="titlepage">
|
||
<div>
|
||
<div>
|
||
<h3 class="title"><a id="id3618525"></a>Errors</h3>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<p>
|
||
The <code class="methodname">DbEnv::log_archive()</code> <span>
|
||
|
||
<span>
|
||
method may fail and throw a <a class="link" href="dbexception.html" title="Chapter 6. The DbException Class">DbException</a>
|
||
exception, encapsulating one of the following non-zero errors, or return one
|
||
of the following non-zero errors:
|
||
</span>
|
||
</span>
|
||
</p>
|
||
<div class="sect3" lang="en" xml:lang="en">
|
||
<div class="titlepage">
|
||
<div>
|
||
<div>
|
||
<h4 class="title"><a id="id3618433"></a>EINVAL</h4>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<p>
|
||
An invalid flag value or parameter was specified.
|
||
</p>
|
||
</div>
|
||
</div>
|
||
<div class="sect2" lang="en" xml:lang="en">
|
||
<div class="titlepage">
|
||
<div>
|
||
<div>
|
||
<h3 class="title"><a id="id3618601"></a>Class</h3>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<p>
|
||
<a class="link" href="env.html" title="Chapter 5. The DbEnv Handle">DbEnv</a>,
|
||
<a class="link" href="logc.html" title="The DbLogc Handle">DbLogc</a>,
|
||
<a class="link" href="lsn.html" title="Chapter 8. The DbLsn Handle">DbLsn</a>
|
||
</p>
|
||
</div>
|
||
<div class="sect2" lang="en" xml:lang="en">
|
||
<div class="titlepage">
|
||
<div>
|
||
<div>
|
||
<h3 class="title"><a id="id3618195"></a>See Also</h3>
|
||
</div>
|
||
</div>
|
||
</div>
|
||
<p>
|
||
<a class="xref" href="lsn.html#loglist" title="Logging Subsystem and Related Methods">Logging Subsystem and Related Methods</a>
|
||
</p>
|
||
</div>
|
||
</div>
|
||
<div class="navfooter">
|
||
<hr />
|
||
<table width="100%" summary="Navigation footer">
|
||
<tr>
|
||
<td width="40%" align="left"><a accesskey="p" href="envget_lg_regionmax.html">Prev</a> </td>
|
||
<td width="20%" align="center">
|
||
<a accesskey="u" href="lsn.html">Up</a>
|
||
</td>
|
||
<td width="40%" align="right"> <a accesskey="n" href="logcursor.html">Next</a></td>
|
||
</tr>
|
||
<tr>
|
||
<td width="40%" align="left" valign="top">DbEnv::get_lg_regionmax() </td>
|
||
<td width="20%" align="center">
|
||
<a accesskey="h" href="index.html">Home</a>
|
||
</td>
|
||
<td width="40%" align="right" valign="top"> DbEnv::log_cursor()</td>
|
||
</tr>
|
||
</table>
|
||
</div>
|
||
</body>
|
||
</html>
|