blob: 49f2f0ad2e02923d33948a7b1c7f85fcff24a555 (
plain)
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
|
<!--Copyright 1999-2002 by Sleepycat Software, Inc.-->
<!--All rights reserved.-->
<HTML>
<HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<META NAME="GENERATOR" CONTENT="Mozilla/4.08 [en] (X11; I; FreeBSD 3.3-RELEASE i386) [Netscape]">
</HEAD>
<BODY>
<H2>
<A NAME="Logging Commands"></A>Logging Commands</H2>
Logging commands work from the environment handle to control the use of
the log files. Log files are opened when the environment is opened
and closed when the environment is closed. In all of the commands
in the logging subsystem that take or return a log sequence number, it
is of the form:
<BR><B>{<I>fileid offset</I>}</B>
<BR>where the <B><I>fileid</I></B> is an identifier of the log file, as
returned from the <A HREF="#> <env> log_get">log_get</A> call.
<P><B>> <env> log_archive [-arch_abs] [-arch_data] [-arch_log]</B>
<P>This command returns a list of log files that are no longer in
use. It is a direct call to the <A HREF="../../docs/api_c/log_archive.html">log_archive</A>
function. The arguments are:
<UL>
<LI>
<B>-arch_abs </B>selects DB_ARCH_ABS to return all pathnames as absolute
pathnames</LI>
<LI>
<B>-arch_data </B>selects DB_ARCH_DATA to return a list of database files</LI>
<LI>
<B>-arch_log </B>selects DB_ARCH_LOG to return a list of log files</LI>
</UL>
<HR WIDTH="100%">
<BR><B>> <env> log_compare <I>lsn1 lsn2</I></B>
<P>This command compares two log sequence numbers, given as <B><I>lsn1</I></B>
and <B><I>lsn2</I></B>. It is a direct call to the <A HREF="../../docs/api_c/log_compare.html">log_compare</A>
function. It will return a -1, 0, 1 to indicate if <B><I>lsn1</I></B>
is less than, equal to or greater than <B><I>lsn2</I></B> respectively.
<BR>
<HR WIDTH="100%">
<BR><B>> <env> log_file <I>lsn</I></B>
<P>This command returns the file name associated with the given <B><I>lsn</I></B>.
It is a direct call to the <A HREF="../../docs/api_c/log_file.html">log_file</A>
function.
<BR>
<HR WIDTH="100%">
<BR><B>> <env> log_flush [<I>lsn</I>]</B>
<P>This command flushes the log up to the specified <B><I>lsn</I></B>
or flushes all records if none is given It is a direct call to the
<A HREF="../../docs/api_c/log_flush.html">log_flush</A>
function. It returns either a 0 (for success), a DB error message
or it throws a Tcl error with a system message.
<BR>
<HR WIDTH="100%">
<BR><A NAME="<env> log_get"></A><B>> <env> log_get<I> </I>[-checkpoint]
[-current] [-first] [-last] [-next] [-prev] [-set <I>lsn</I>]</B>
<P>This command retrieves a record from the log according to the <B><I>lsn</I></B>
given and returns it and the data. It is a direct call to the <A HREF="../../docs/api_c/log_get.html">log_get</A>
function. It is a way of implementing a manner of log iteration similar
to <A HREF="../../docs/api_tcl/db_cursor.html">cursors</A>.
The information we return is similar to database information. We
return a list where the first item is the LSN (which is a list itself)
and the second item is the data. So it looks like, fully expanded,
<B>{{<I>fileid</I>
<I>offset</I>}
<I>data</I>}.</B>
In the case where DB_NOTFOUND is returned, we return an empty list <B>{}</B>.
All other errors return a Tcl error. The arguments are:
<UL>
<LI>
<B>-checkpoint </B>selects the DB_CHECKPOINT flag to return the LSN/data
pair of the last record written through <A HREF="#> <env> log_put">log_put</A>
with DB_CHECKPOINT specified</LI>
<LI>
<B>-current</B> selects the DB_CURRENT flag to return the current record</LI>
<LI>
<B>-first</B> selects the DB_FIRST flag to return the first record in the
log.</LI>
<LI>
<B>-last </B>selects the DB_LAST flag to return the last record in the
log.</LI>
<LI>
<B>-next</B> selects the DB_NEXT flag to return the next record in the
log.</LI>
<LI>
<B>-prev </B>selects the DB_PREV flag to return the previous record
in the log.</LI>
<LI>
<B>-set</B> selects the DB_SET flag to return the record specified by the
given <B><I>lsn</I></B></LI>
</UL>
<HR WIDTH="100%">
<BR><A NAME="> <env> log_put"></A><B>> <env> log_put<I> </I>[-checkpoint]
[-flush] <I>record</I></B>
<P>This command stores a <B><I>record</I></B> into the log and returns
the LSN of the log record. It is a direct call to the <A HREF="../../docs/api_c/log_put.html">log_put</A>
function. It returns either an LSN or it throws a Tcl error with
a system message. <B> </B>The arguments are:
<UL>
<LI>
<B>-checkpoint </B>selects the DB_CHECKPOINT flag</LI>
<LI>
<B>-flush </B>selects the DB_FLUSH flag to flush the log to disk.</LI>
</UL>
<HR WIDTH="100%">
<BR><B>> <env> log_stat</B>
<P>This command returns the statistics associated with the logging
subsystem. It is a direct call to the <A HREF="../../docs/api_c/log_stat.html">log_stat</A>
function. It returns a list of name/value pairs of the DB_LOG_STAT
structure.
</BODY>
</HTML>
|