~ubuntu-branches/ubuntu/natty/evolution-data-server/natty

« back to all changes in this revision

Viewing changes to libdb/docs/ref/transapp/logfile.html

  • Committer: Bazaar Package Importer
  • Author(s): Didier Roche
  • Date: 2010-05-17 17:02:06 UTC
  • mfrom: (1.1.79 upstream) (1.6.12 experimental)
  • Revision ID: james.westby@ubuntu.com-20100517170206-4ufr52vwrhh26yh0
Tags: 2.30.1-1ubuntu1
* Merge from debian experimental. Remaining change:
  (LP: #42199, #229669, #173703, #360344, #508494)
  + debian/control:
    - add Vcs-Bzr tag
    - don't use libgnome
    - Use Breaks instead of Conflicts against evolution 2.25 and earlier.
  + debian/evolution-data-server.install,
    debian/patches/45_libcamel_providers_version.patch:
    - use the upstream versioning, not a Debian-specific one 
  + debian/libedata-book1.2-dev.install, debian/libebackend-1.2-dev.install,
    debian/libcamel1.2-dev.install, debian/libedataserverui1.2-dev.install:
    - install html documentation
  + debian/rules:
    - don't build documentation it's shipped with the tarball

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
<!--$Id$-->
2
 
<!--Copyright 1997-2002 by Sleepycat Software, Inc.-->
3
 
<!--All rights reserved.-->
4
 
<!--See the file LICENSE for redistribution information.-->
5
 
<html>
6
 
<head>
7
 
<title>Berkeley DB Reference Guide: Log file removal</title>
8
 
<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
9
 
<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,java,C,C++">
10
 
</head>
11
 
<body bgcolor=white>
12
 
<a name="2"><!--meow--></a>
13
 
<table width="100%"><tr valign=top>
14
 
<td><h3><dl><dt>Berkeley DB Reference Guide:<dd>Berkeley DB Transactional Data Store Applications</dl></h3></td>
15
 
<td align=right><a href="../../ref/transapp/archival.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/transapp/recovery.html"><img src="../../images/next.gif" alt="Next"></a>
16
 
</td></tr></table>
17
 
<p>
18
 
<h1 align=center>Log file removal</h1>
19
 
<p>The fourth component of the infrastructure, log file removal, concerns
20
 
the ongoing disk consumption of the database log files.  Depending on
21
 
the rate at which the application writes to the databases and the
22
 
available disk space, the number of log files may increase quickly
23
 
enough so that disk space will be a resource problem.  For this reason,
24
 
you will periodically want to remove log files in order to conserve disk
25
 
space.  This procedure is distinct from database and log file archival
26
 
for catastrophic recovery, and you cannot remove the current log files
27
 
simply because you have created a database snapshot or copied log files
28
 
to archival media.
29
 
<p>Log files may be removed at any time, as long as:
30
 
<p><ul type=disc>
31
 
<li>the log file is not involved in an active transaction.
32
 
<li>a checkpoint has been written subsequent to the log file's
33
 
creation.
34
 
<li>the log file is not the only log file in the environment.
35
 
</ul>
36
 
<p>Obviously, if you are preparing for catastrophic failure, you will want
37
 
to copy the log files to archival media before you remove them.
38
 
<p>To remove log files, take the following steps:
39
 
<p><ol>
40
 
<p><li>If you are concerned with catastrophic failure, first copy the log files
41
 
to backup media as described in
42
 
<a href="archival.html">Archival for catastrophic recovery</a>.
43
 
<p><li>Run <a href="../../utility/db_archive.html">db_archive</a> without options to identify all the log files
44
 
that are no longer in use (for example, are no longer involved in an
45
 
active transaction.)
46
 
<p><li>Remove those log files from the system.
47
 
</ol>
48
 
<p>The functionality provided by the <a href="../../utility/db_archive.html">db_archive</a> utility is also
49
 
available directly from the Berkeley DB library.  The following code fragment
50
 
removes log files no longer needed by the database environment:
51
 
<p><blockquote><pre>int
52
 
main(int argc, char *argv)
53
 
{
54
 
<b>     /* Start a logfile removal thread. */
55
 
        if ((ret = pthread_create(
56
 
            &ptid, NULL, logfile_thread, (void *)dbenv)) != 0) {
57
 
                fprintf(stderr,
58
 
                    "txnapp: failed spawning log file removal thread: %s\n",
59
 
                    strerror(ret));
60
 
                exit (1);
61
 
        }</b>
62
 
}
63
 
<p>
64
 
<b>void *
65
 
logfile_thread(void *arg)
66
 
{
67
 
        DB_ENV *dbenv;
68
 
        int ret;
69
 
        char **begin, **list;
70
 
<p>
71
 
        dbenv = arg;
72
 
        dbenv-&gt;errx(dbenv,
73
 
            "Log file removal thread: %lu", (u_long)pthread_self());
74
 
<p>
75
 
        /* Check once every 5 minutes. */
76
 
        for (;; sleep(300)) {
77
 
                /* Get the list of log files. */
78
 
                if ((ret = dbenv-&gt;log_archive(dbenv, &list, DB_ARCH_ABS)) != 0) {
79
 
                        dbenv-&gt;err(dbenv, ret, "DB_ENV-&gt;log_archive");
80
 
                        exit (1);
81
 
                }
82
 
<p>
83
 
                /* Remove the log files. */
84
 
                if (list != NULL) {
85
 
                        for (begin = list; *list != NULL; ++list)
86
 
                                if ((ret = remove(*list)) != 0) {
87
 
                                        dbenv-&gt;err(dbenv,
88
 
                                            ret, "remove %s", *list);
89
 
                                        exit (1);
90
 
                                }
91
 
                        free (begin);
92
 
                }
93
 
        }
94
 
        /* NOTREACHED */
95
 
}</b></pre></blockquote>
96
 
<table width="100%"><tr><td><br></td><td align=right><a href="../../ref/transapp/archival.html"><img src="../../images/prev.gif" alt="Prev"></a><a href="../../reftoc.html"><img src="../../images/ref.gif" alt="Ref"></a><a href="../../ref/transapp/recovery.html"><img src="../../images/next.gif" alt="Next"></a>
97
 
</td></tr></table>
98
 
<p><font size=1><a href="http://www.sleepycat.com">Copyright Sleepycat Software</a></font>
99
 
</body>
100
 
</html>