Sophie

Sophie

distrib > Mandriva > 2010.1 > x86_64 > media > main-release > by-pkgid > a00abf5f94bf470fd4cc9e10b2d135e0 > files > 267

lib64db4.8-devel-4.8.26-1mdv2010.1.x86_64.rpm

<?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>DB_ENV-&gt;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 7.  The DB_LSN Handle" />
    <link rel="prev" href="envget_lg_regionmax.html" title="DB_ENV-&gt;get_lg_regionmax()" />
    <link rel="next" href="logcursor.html" title="DB_ENV-&gt;log_cursor()" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">DB_ENV-&gt;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 7. 
                The DB_LSN 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>DB_ENV-&gt;log_archive()</h2>
          </div>
        </div>
      </div>
      <pre class="programlisting">#include &lt;db.h&gt;

int
DB_ENV-&gt;log_archive(DB_ENV *env, char *(*listp)[], u_int32_t flags);  </pre>
      <p>
         The <code class="methodname">DB_ENV-&gt;log_archive()</code> method returns an array of log or database
         filenames.
    </p>
      <p>
         By default, <code class="methodname">DB_ENV-&gt;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>

         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="DB_ENV-&gt;set_alloc()">DB_ENV-&gt;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="DB_ENV-&gt;log_cursor()">DB_ENV-&gt;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="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
         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">DB_ENV-&gt;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">DB_ENV-&gt;log_archive()</code> method is the underlying method used by the
         <a class="link" href="db_archive.html" title="db_archive">db_archive</a> utility.
         See the <a class="link" href="db_archive.html" title="db_archive">db_archive</a>
         utility source code for an example of using <code class="methodname">DB_ENV-&gt;log_archive()</code> in
         a IEEE/ANSI Std 1003.1 (POSIX) environment.
    </p>
      <p>
         The <code class="methodname">DB_ENV-&gt;log_archive()</code> <span>
            <span>
                  method returns a non-zero error value on failure and 0 on success.
            </span>
            
        </span>
    </p>
      <div class="sect2" lang="en" xml:lang="en">
        <div class="titlepage">
          <div>
            <div>
              <h3 class="title"><a id="id1680300"></a>Parameters</h3>
            </div>
          </div>
        </div>
        <div class="sect3" lang="en" xml:lang="en">
          <div class="titlepage">
            <div>
              <div>
                <h4 class="title"><a id="id1680685"></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">DB_ENV-&gt;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 class="sect3" lang="en" xml:lang="en">
          <div class="titlepage">
            <div>
              <div>
                <h4 class="title"><a id="id1680973"></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>
      <div class="sect2" lang="en" xml:lang="en">
        <div class="titlepage">
          <div>
            <div>
              <h3 class="title"><a id="id1680992"></a>Errors</h3>
            </div>
          </div>
        </div>
        <p>
                         The <code class="methodname">DB_ENV-&gt;log_archive()</code> <span>
            <span>
                 method may fail and 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="id1680614"></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="id1680782"></a>Class</h3>
            </div>
          </div>
        </div>
        <p>
                    <a class="link" href="env.html" title="Chapter 5.  The DB_ENV Handle">DB_ENV</a>, 
                    <a class="link" href="logc.html" title="The DB_LOGC Handle">DB_LOGC</a>, 
                    <a class="link" href="lsn.html" title="Chapter 7.  The DB_LSN Handle">DB_LSN</a> 
            </p>
      </div>
      <div class="sect2" lang="en" xml:lang="en">
        <div class="titlepage">
          <div>
            <div>
              <h3 class="title"><a id="id1680766"></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">DB_ENV-&gt;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"> DB_ENV-&gt;log_cursor()</td>
        </tr>
      </table>
    </div>
  </body>
</html>