File: archive.html

package info (click to toggle)
db 2%3A2.4.14-2.7.7.1.c
  • links: PTS
  • area: main
  • in suites: potato
  • size: 12,716 kB
  • ctags: 9,382
  • sloc: ansic: 35,556; tcl: 8,564; cpp: 4,890; sh: 2,075; makefile: 1,723; java: 1,632; sed: 419; awk: 153; asm: 41
file content (150 lines) | stat: -rw-r--r-- 5,068 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
<! "@(#)archive.so	10.11 (Sleepycat) 10/2/98">
<!Copyright 1997, 1998 by Sleepycat Software, Inc.  All rights reserved.>
<html>
<body bgcolor=white>
<head>
<title>Berkeley DB: log_archive</title>
<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
<meta name="keywords" content="embedded,database,programmatic,toolkit,b+tree,btr
ee,hash,hashing,transaction,transactions,locking,logging,access method,access me
thods,java,C,C++">
</head>
<h1>log_archive</h1>
<hr size=1 noshade>
<tt>
<h3>
<pre>
#include &lt;db.h&gt;
<p>
int
log_archive(DB_LOG *logp, char **list[],
    u_int32_t flags, void *(*db_malloc)(size_t));
</pre>
</h3>
<h1>Description</h1>
<p>
The log_archive function
creates a NULL-terminated array of log or database file names and copies
a pointer to them into the user-specified memory location <b>list</b>.
<p>
By default, log_archive returns the names of all of the log files
that are no longer in use (e.g., no longer involved in active transactions),
and that may safely be archived for catastrophic recovery and then removed
from the system.
If there were no file names to return, <b>list</b> will be set to NULL.
<p>
Arrays of log file names are created in allocated memory.
If
<b>db_malloc</b> is non-NULL, it is called to allocate the memory,
otherwise, the library function <b>malloc</b>(3)) is used.
The function <b>db_malloc</b> must match the calling conventions of
the <b>malloc</b>(3)) library routine.
Regardless, the caller is responsible for deallocating the returned
memory.
To deallocate the returned memory, free each returned memory pointer;
pointers inside the memory do not need to be individually freed.
<p>
The <b>flags</b> argument is specified by logically <b>OR</b>'ing together one or more of
the following values:
<dl compact>
<a name="DB_ARCH_ABS">
<p><dt>DB_ARCH_ABS<dd>All pathnames are returned as absolute pathnames,
instead of relative to the database home directory.
<a name="DB_ARCH_DATA">
<p><dt>DB_ARCH_DATA<dd>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,
log_archive will not include them in this list.  It is also
possible that some of the files referenced in the log have since been
deleted from the system.
<a name="DB_ARCH_LOG">
<p><dt>DB_ARCH_LOG<dd>Return all the log file names regardless of whether or not they are in
use.
</dl>
<p>
The DB_ARCH_DATA and DB_ARCH_LOG flags are mutually
exclusive.
<p>
See the <a href="../../utility/db_archive.html">db_archive</a> manual page for more information on database
archival procedures.
<p>
The log_archive function is the underlying function used by the <a href="../../utility/db_archive.html">db_archive</a> utility.
See the <a href="../../utility/db_archive.html">db_archive</a> utility source code for an example of using log_archive
in a POSIX 1003.1 environment.
<p>
The log_archive
function returns the value of <b>errno</b> on failure, and 0 on success.
<p>
<h1>Bugs</h1>
In a threaded application (i.e., one where the environment was created
with the DB_THREAD flag specified), calling log_archive will fail,
returning EINVAL.  To work around this problem, re-open the log explicitly
without specifying DB_THREAD.  This restriction is expected to be removed
in a future version of Berkeley DB.
<p>
<h1>Errors</h1>
If a fatal error occurs in Berkeley DB, the log_archive function may fail and return
DB_RUNRECOVERY, at which point all subsequent database calls will also
return DB_RUNRECOVERY.
<p>
The log_archive
function may fail and return <b>errno</b>
for any of the errors specified for the following Berkeley DB and C library
functions:
close(3),
fcntl(3),
fflush(3),
fprintf(3),
free(3),
getcwd(3),
getenv(3),
getpid(3),
getuid(3),
isdigit(3),
<a href="../../api_c/DbLog/compare.html">log_compare</a>,
<a href="../../api_c/DbLog/get.html">log_get</a>,
malloc(3),
memcpy(3),
memset(3),
open(3),
qsort(3),
realloc(3),
sigfillset(3),
sigprocmask(3),
snprintf(3),
stat(3),
strchr(3),
strcmp(3),
strerror(3),
strlen(3),
unlink(3),
vfprintf(3),
and
vsnprintf(3).
<p>
In addition, the log_archive
function may fail and return <b>errno</b>
for the following conditions:
<dl compact>
<p><dt>EINVAL<dd>An invalid flag value or parameter was specified.
<p>
The log was corrupted.
</dl>
<p>
<h1>See Also</h1>
log_archive,
<a href="../../api_c/DbLog/close.html">log_close</a>,
<a href="../../api_c/DbLog/compare.html">log_compare</a>,
<a href="../../api_c/DbLog/file.html">log_file</a>,
<a href="../../api_c/DbLog/flush.html">log_flush</a>,
<a href="../../api_c/DbLog/get.html">log_get</a>,
<a href="../../api_c/DbLog/open.html">log_open</a>,
<a href="../../api_c/DbLog/put.html">log_put</a>,
<a href="../../api_c/DbLog/db_register.html">log_register</a>,
<a href="../../api_c/DbLog/stat.html">log_stat</a>,
<a href="../../api_c/DbLog/unlink.html">log_unlink</a>
and
<a href="../../api_c/DbLog/db_unregister.html">log_unregister</a>.
</tt>
</body>
</html>