• Home
  • History
  • Annotate
  • Line#
  • Navigate
  • Raw
  • Download
  • only in /asuswrt-rt-n18u-9.0.0.4.380.2695/release/src/router/db-4.8.30/docs/api_reference/CXX/
1<?xml version="1.0" encoding="UTF-8" standalone="no"?>
2<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml">
4  <head>
5    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
6    <title>DbEnv::txn_recover()</title>
7    <link rel="stylesheet" href="apiReference.css" type="text/css" />
8    <meta name="generator" content="DocBook XSL Stylesheets V1.73.2" />
9    <link rel="start" href="index.html" title="Berkeley DB C++ API Reference" />
10    <link rel="up" href="txn.html" title="Chapter 13.  The DbTxn Handle" />
11    <link rel="prev" href="txnprepare.html" title="DbTxn::prepare()" />
12    <link rel="next" href="txnset_name.html" title="DbTxn::set_name()" />
13  </head>
14  <body>
15    <div class="navheader">
16      <table width="100%" summary="Navigation header">
17        <tr>
18          <th colspan="3" align="center">DbEnv::txn_recover()</th>
19        </tr>
20        <tr>
21          <td width="20%" align="left"><a accesskey="p" href="txnprepare.html">Prev</a> </td>
22          <th width="60%" align="center">Chapter 13. 
23                The DbTxn Handle 
24        </th>
25          <td width="20%" align="right"> <a accesskey="n" href="txnset_name.html">Next</a></td>
26        </tr>
27      </table>
28      <hr />
29    </div>
30    <div class="sect1" lang="en" xml:lang="en">
31      <div class="titlepage">
32        <div>
33          <div>
34            <h2 class="title" style="clear: both"><a id="txnrecover"></a>DbEnv::txn_recover()</h2>
35          </div>
36        </div>
37      </div>
38      <pre class="programlisting">#include &lt;db_cxx.h&gt;
39 
40int
41DbEnv::txn_recover(DB_PREPLIST preplist[],
42    long count, long *retp, u_int32_t flags);</pre>
43      <p>
44         Database environment recovery restores transactions that were
45         prepared, but not yet resolved at the time of the system shut down or
46         crash, to their state prior to the shut down or crash, including any
47         locks previously held.  The <code class="methodname">DbEnv::txn_recover()</code> method returns a
48         list of those prepared transactions.
49    </p>
50      <p>
51         The <code class="methodname">DbEnv::txn_recover()</code> method should only be called after the
52         environment has been recovered.
53    </p>
54      <p>
55         Multiple threads of control may call <code class="methodname">DbEnv::txn_recover()</code>, but only
56         one thread of control may resolve each returned transaction, that is,
57         only one thread of control may call <a class="xref" href="txncommit.html" title="DbTxn::commit()">DbTxn::commit()</a>  
58         or <a class="xref" href="txnabort.html" title="DbTxn::abort()">DbTxn::abort()</a>  on each
59         returned transaction.  Callers of <code class="methodname">DbEnv::txn_recover()</code> must call
60         <a class="xref" href="txndiscard.html" title="DbTxn::discard()">DbTxn::discard()</a>  to
61         discard each transaction they do not resolve.
62    </p>
63      <p>
64         On return from <code class="methodname">DbEnv::txn_recover()</code>, the <span class="bold"><strong>preplist</strong></span> parameter will be filled in with a list of transactions
65         that must be resolved by the application (committed, aborted or discarded).  The <span class="bold"><strong>preplist</strong></span> parameter is a structure of type
66         <code class="literal">DB_PREPLIST</code>; the following <code class="literal">DB_PREPLIST</code> fields will be
67         filled in:
68    </p>
69      <div class="itemizedlist">
70        <ul type="disc">
71          <li>
72            <p>
73                    <span class="bold"><strong>DB_TXN * txn;</strong></span>
74                </p>
75            <p>
76                    The transaction handle for the transaction.
77                </p>
78          </li>
79          <li>
80            <p>
81                    <span class="bold"><strong>u_int8_t gid[DB_XIDDATASIZE];</strong></span>
82                </p>
83            <p>
84                    The global transaction ID for the transaction.  The global transaction
85                    ID is the one specified when the transaction was prepared.  The
86                    application is responsible for ensuring uniqueness among global
87                    transaction IDs.
88                </p>
89          </li>
90        </ul>
91      </div>
92      <p>
93         The <code class="methodname">DbEnv::txn_recover()</code> <span>
94            
95            <span>
96                method either returns a non-zero error value or throws an
97                exception that encapsulates a non-zero error value on
98                failure, and returns 0 on success.
99            </span>
100        </span>
101      </p>
102      <div class="sect2" lang="en" xml:lang="en">
103        <div class="titlepage">
104          <div>
105            <div>
106              <h3 class="title"><a id="id1714886"></a>Parameters</h3>
107            </div>
108          </div>
109        </div>
110        <div class="sect3" lang="en" xml:lang="en">
111          <div class="titlepage">
112            <div>
113              <div>
114                <h4 class="title"><a id="id1714945"></a>count</h4>
115              </div>
116            </div>
117          </div>
118          <p>
119                          The <span class="bold"><strong>count</strong></span> parameter specifies the
120                          number of available entries in the passed-in <span class="bold"><strong>preplist</strong></span> array.  The <span class="bold"><strong>retp</strong></span> parameter returns the number of entries
121                          <code class="methodname">DbEnv::txn_recover()</code> has filled in, in the array.
122                     </p>
123        </div>
124        <div class="sect3" lang="en" xml:lang="en">
125          <div class="titlepage">
126            <div>
127              <div>
128                <h4 class="title"><a id="id1715316"></a>flags</h4>
129              </div>
130            </div>
131          </div>
132          <p>
133                          The <span class="bold"><strong>flags</strong></span> parameter must be set to
134                          one of the following values:
135                     </p>
136          <div class="itemizedlist">
137            <ul type="disc">
138              <li>
139                <p>
140                  <code class="literal">DB_FIRST</code>
141            </p>
142                <p>
143                 Begin returning a list of prepared, but not yet resolved transactions.
144                 Specifying this flag begins a new pass over all prepared, but not yet
145                 completed transactions, regardless of whether they have already been
146                 returned in previous calls to <code class="methodname">DbEnv::txn_recover.()</code> Calls to
147                 <code class="methodname">DbEnv::txn_recover()</code> from different threads of control should not be
148                 intermixed in the same environment.
149            </p>
150              </li>
151              <li>
152                <p>
153                 <code class="literal">DB_NEXT</code>
154            </p>
155                <p>
156                 Continue returning a list of prepared, but not yet resolved
157                 transactions, starting where the last call to 
158                 <code class="methodname">DbEnv::txn_recover()</code>
159                 left off.
160            </p>
161              </li>
162            </ul>
163          </div>
164        </div>
165        <div class="sect3" lang="en" xml:lang="en">
166          <div class="titlepage">
167            <div>
168              <div>
169                <h4 class="title"><a id="id1715111"></a>preplist</h4>
170              </div>
171            </div>
172          </div>
173          <p>
174                          The <span class="bold"><strong>preplist</strong></span> parameter references
175                          memory into which  the list of transactions to be resolved by the
176                          application is copied.
177                     </p>
178        </div>
179      </div>
180      <div class="sect2" lang="en" xml:lang="en">
181        <div class="titlepage">
182          <div>
183            <div>
184              <h3 class="title"><a id="id1715360"></a>Class</h3>
185            </div>
186          </div>
187        </div>
188        <p>
189                 <a class="link" href="env.html" title="Chapter 5.  The DbEnv Handle">DbEnv</a>, <a class="link" href="txn.html" title="Chapter 13.  The DbTxn Handle">DbTxn</a> 
190            </p>
191      </div>
192      <div class="sect2" lang="en" xml:lang="en">
193        <div class="titlepage">
194          <div>
195            <div>
196              <h3 class="title"><a id="id1715527"></a>See Also</h3>
197            </div>
198          </div>
199        </div>
200        <p>
201                     <a class="xref" href="txn.html#txnlist" title="Transaction Subsystem and Related Methods">Transaction Subsystem and Related Methods</a> 
202                </p>
203      </div>
204    </div>
205    <div class="navfooter">
206      <hr />
207      <table width="100%" summary="Navigation footer">
208        <tr>
209          <td width="40%" align="left"><a accesskey="p" href="txnprepare.html">Prev</a> </td>
210          <td width="20%" align="center">
211            <a accesskey="u" href="txn.html">Up</a>
212          </td>
213          <td width="40%" align="right"> <a accesskey="n" href="txnset_name.html">Next</a></td>
214        </tr>
215        <tr>
216          <td width="40%" align="left" valign="top">DbTxn::prepare() </td>
217          <td width="20%" align="center">
218            <a accesskey="h" href="index.html">Home</a>
219          </td>
220          <td width="40%" align="right" valign="top"> DbTxn::set_name()</td>
221        </tr>
222      </table>
223    </div>
224  </body>
225</html>
226