txn_recover.html   [plain text]


<!--$Id: txn_recover.so,v 10.28 2007/05/30 17:24:41 margo Exp $-->
<!--Copyright (c) 1997,2008 Oracle.  All rights reserved.-->
<!--See the file LICENSE for redistribution information.-->
<html>
<head>
<title>Berkeley DB: DB_ENV-&gt;txn_recover</title>
<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++">
</head>
<body bgcolor=white>
<table width="100%"><tr valign=top>
<td>
<b>DB_ENV-&gt;txn_recover</b>
</td>
<td align=right>
<a href="../api_c/api_core.html"><img src="../images/api.gif" alt="API"></a>
<a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a></td>
</tr></table>
<hr size=1 noshade>
<tt>
<b><pre>
#include &lt;db.h&gt;
<p>
int
DB_ENV-&gt;txn_recover(DB_ENV *dbenv, DB_PREPLIST preplist[],
    long count, long *retp, u_int32_t flags);
</pre></b>
<hr size=1 noshade>
<b>Description: DB_ENV-&gt;txn_recover</b>
<p>Database environment recovery restores transactions that were prepared,
but not yet resolved at the time of the system shut down or crash, to
their state prior to the shut down or crash, including any locks
previously held.  The DB_ENV-&gt;txn_recover method returns a list of those
prepared transactions.</p>
<p>The DB_ENV-&gt;txn_recover method should only be called after the environment has
been recovered.</p>
<p>Multiple threads of control may call DB_ENV-&gt;txn_recover, but only one
thread of control may resolve each returned transaction, that is, only
one thread of control may call <a href="../api_c/txn_commit.html">DB_TXN-&gt;commit</a> or <a href="../api_c/txn_abort.html">DB_TXN-&gt;abort</a>
on each returned transaction.  Callers of DB_ENV-&gt;txn_recover must call
<a href="../api_c/txn_discard.html">DB_TXN-&gt;discard</a> to discard each transaction they do not resolve.</p>
<p>On return from DB_ENV-&gt;txn_recover, the <b>preplist</b> parameter will
be filled in with a list of transactions that must be resolved by the
application (committed, aborted or discarded).  The <b>preplist</b>
parameter is a structure of type DB_PREPLIST; the following DB_PREPLIST
fields will be filled in:</p>
<br>
<b>DB_TXN * txn;</b><ul compact><li>The transaction handle for the transaction.</ul>
<b>u_int8_t gid[DB_XIDDATASIZE];</b><ul compact><li>The global transaction ID for the transaction.  The global transaction
ID is the one specified when the transaction was prepared.  The
application is responsible for ensuring uniqueness among global
transaction IDs.</ul>
<br>
<p>The DB_ENV-&gt;txn_recover method
returns a non-zero error value on failure
and 0 on success.
</p>
<b>Parameters</b> <br>
 <b>count</b><ul compact><li>The <b>count</b> parameter specifies the number of available entries
in the passed-in <b>preplist</b> array.  The <b>retp</b> parameter
returns the number of entries DB_ENV-&gt;txn_recover has filled in, in the
array.</ul>
 <b>flags</b><ul compact><li>The <b>flags</b> parameter must be set to one of the following values:
<br>
<b><a name="DB_FIRST">DB_FIRST</a></b><ul compact><li>Begin returning a list of prepared, but not yet resolved transactions.
Specifying this flag begins a new pass over all prepared, but not yet
completed transactions, regardless of whether they have already been returned
in previous calls to DB_ENV-&gt;txn_recover.
Calls to DB_ENV-&gt;txn_recover from different threads of control should not
be intermixed in the same environment.</ul>
<b><a name="DB_NEXT">DB_NEXT</a></b><ul compact><li>Continue returning a list of prepared, but not yet resolved transactions,
starting where the last call to DB_ENV-&gt;txn_recover left off.</ul>
<br></ul>
 <b>preplist</b><ul compact><li>The <b>preplist</b> parameter references memory into which
 the list of transactions to be resolved by the application is copied.</ul> 
<br>
<hr size=1 noshade>
<br><b>Class</b>
<a href="../api_c/env_class.html">DB_ENV</a>, <a href="../api_c/txn_class.html">DB_TXN</a>
<br><b>See Also</b>
<a href="../api_c/txn_list.html">Transaction Subsystem and Related Methods</a>
</tt>
<table width="100%"><tr><td><br></td><td align=right>
<a href="../api_c/api_core.html"><img src="../images/api.gif" alt="API"></a><a href="../ref/toc.html"><img src="../images/ref.gif" alt="Ref"></a>
</td></tr></table>
<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
</body>
</html>