• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src-rt-6.x.4708/router/db-4.8.30/tcl/docs/
1<!--Copyright 1999-2009 Oracle.  All rights reserved.-->
2<HTML>
3<HEAD>
4   <META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
5   <META NAME="GENERATOR" CONTENT="Mozilla/4.08 [en] (X11; I; FreeBSD 3.3-RELEASE i386) [Netscape]">
6</HEAD>
7<BODY>
8
9<H2>
10<A NAME="Logging Commands"></A>Logging Commands</H2>
11Logging commands work from the environment handle to control the use of
12the log files.&nbsp; Log files are opened when the environment is opened
13and closed when the environment is closed.&nbsp; In all of the commands
14in the logging subsystem that take or return a log sequence number, it
15is of the form:
16<BR><B>{<I>fileid offset</I>}</B>
17<BR>where the <B><I>fileid</I></B> is an identifier of the log file, as
18returned from the <A HREF="#> <env> log_get">log_get</A> call.
19<P><B>> &lt;env> log_archive [-arch_abs] [-arch_data] [-arch_log]</B>
20<P>This command returns&nbsp; a list of log files that are no longer in
21use.&nbsp; It is a direct call to the <A HREF="../../docs/api_c/log_archive.html">log_archive</A>
22function. The arguments are:
23<UL>
24<LI>
25<B>-arch_abs </B>selects DB_ARCH_ABS to return all pathnames as absolute
26pathnames</LI>
27
28<LI>
29<B>-arch_data </B>selects DB_ARCH_DATA to return a list of database files</LI>
30
31<LI>
32<B>-arch_log </B>selects DB_ARCH_LOG to return a list of log files</LI>
33</UL>
34
35<HR WIDTH="100%">
36<BR><B>> &lt;env> log_compare <I>lsn1 lsn2</I></B>
37<P>This command compares two log sequence numbers, given as <B><I>lsn1</I></B>
38and <B><I>lsn2</I></B>.&nbsp; It is a direct call to the <A HREF="../../docs/api_c/log_compare.html">log_compare</A>
39function.&nbsp; It will return a -1, 0, 1 to indicate if <B><I>lsn1</I></B>
40is less than, equal to or greater than <B><I>lsn2</I></B> respectively.
41<BR>
42<HR WIDTH="100%">
43<BR><B>> &lt;env> log_file <I>lsn</I></B>
44<P>This command returns&nbsp; the file name associated with the given <B><I>lsn</I></B>.&nbsp;
45It is a direct call to the <A HREF="../../docs/api_c/log_file.html">log_file</A>
46function.
47<BR>
48<HR WIDTH="100%">
49<BR><B>> &lt;env> log_flush [<I>lsn</I>]</B>
50<P>This command&nbsp; flushes the log up to the specified <B><I>lsn</I></B>
51or flushes all records if none is given&nbsp; It is a direct call to the
52<A HREF="../../docs/api_c/log_flush.html">log_flush</A>
53function.&nbsp; It returns either a 0 (for success), a DB error message
54or it throws a Tcl error with a system message.
55<BR>
56<HR WIDTH="100%">
57<BR><A NAME="<env> log_get"></A><B>> &lt;env> log_get<I> </I>[-checkpoint]
58[-current] [-first] [-last] [-next] [-prev] [-set <I>lsn</I>]</B>
59<P>This command retrieves a record from the log according to the <B><I>lsn</I></B>
60given and returns it and the data.&nbsp; It is a direct call to the <A HREF="../../docs/api_c/log_get.html">log_get</A>
61function.&nbsp; It is a way of implementing a manner of log iteration similar
62to <A HREF="../../docs/api_tcl/db_cursor.html">cursors</A>.&nbsp;&nbsp;
63The information we return is similar to database information.&nbsp; We
64return a list where the first item is the LSN (which is a list itself)
65and the second item is the data.&nbsp; So it looks like, fully expanded,
66<B>{{<I>fileid</I>
67<I>offset</I>}
68<I>data</I>}.</B>&nbsp;
69In the case where DB_NOTFOUND is returned, we return an empty list <B>{}</B>.&nbsp;
70All other errors return a Tcl error.&nbsp; The arguments are:
71<UL>
72<LI>
73<B>-checkpoint </B>selects the DB_CHECKPOINT flag to return the LSN/data
74pair of the last record written through <A HREF="#> <env> log_put">log_put</A>
75with DB_CHECKPOINT specified</LI>
76
77<LI>
78<B>-current</B> selects the DB_CURRENT flag to return the current record</LI>
79
80<LI>
81<B>-first</B> selects the DB_FIRST flag to return the first record in the
82log.</LI>
83
84<LI>
85<B>-last </B>selects the DB_LAST flag to return the last record in the
86log.</LI>
87
88<LI>
89<B>-next</B> selects the DB_NEXT flag to return the next record in the
90log.</LI>
91
92<LI>
93<B>-prev </B>selects the DB_PREV flag to return the&nbsp; previous record
94in the log.</LI>
95
96<LI>
97<B>-set</B> selects the DB_SET flag to return the record specified by the
98given <B><I>lsn</I></B></LI>
99</UL>
100
101<HR WIDTH="100%">
102<BR><A NAME="> <env> log_put"></A><B>> &lt;env> log_put<I> </I>[-checkpoint]
103[-flush] <I>record</I></B>
104<P>This command stores a <B><I>record</I></B> into the log and returns
105the LSN of the log record.&nbsp; It is a direct call to the <A HREF="../../docs/api_c/log_put.html">log_put</A>
106function.&nbsp; It returns either an LSN or it throws a Tcl error with
107a system message.&nbsp;<B> </B>The arguments are:
108<UL>
109<LI>
110<B>-checkpoint </B>selects the DB_CHECKPOINT flag</LI>
111
112<LI>
113<B>-flush </B>selects the DB_FLUSH flag to flush the log to disk.</LI>
114</UL>
115
116<HR WIDTH="100%">
117<BR><B>> &lt;env> log_stat</B>
118<P>This command returns&nbsp; the statistics associated with the logging
119subsystem.&nbsp; It is a direct call to the <A HREF="../../docs/api_c/log_stat.html">log_stat</A>
120function.&nbsp; It returns a list of name/value pairs of the DB_LOG_STAT
121structure.
122</BODY>
123</HTML>
124