90 lines
4.4 KiB
HTML
90 lines
4.4 KiB
HTML
<!--$Id: txn_recover.html 63573 2008-05-23 21:43:21Z trent.nelson $-->
|
|
<!--Copyright (c) 1997,2008 Oracle. All rights reserved.-->
|
|
<!--See the file LICENSE for redistribution information.-->
|
|
<html>
|
|
<head>
|
|
<title>Berkeley DB: DbEnv::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>DbEnv::txn_recover</b>
|
|
</td>
|
|
<td align=right>
|
|
<a href="../api_cxx/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 <db_cxx.h>
|
|
<p>
|
|
int
|
|
DbEnv::txn_recover(DB_PREPLIST preplist[],
|
|
long count, long *retp, u_int32_t flags);
|
|
</pre></b>
|
|
<hr size=1 noshade>
|
|
<b>Description: DbEnv::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 DbEnv::txn_recover method returns a list of those
|
|
prepared transactions.</p>
|
|
<p>The DbEnv::txn_recover method should only be called after the environment has
|
|
been recovered.</p>
|
|
<p>Multiple threads of control may call DbEnv::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_cxx/txn_commit.html">DbTxn::commit</a> or <a href="../api_cxx/txn_abort.html">DbTxn::abort</a>
|
|
on each returned transaction. Callers of DbEnv::txn_recover must call
|
|
<a href="../api_cxx/txn_discard.html">DbTxn::discard</a> to discard each transaction they do not resolve.</p>
|
|
<p>On return from DbEnv::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 DbEnv::txn_recover method
|
|
either returns a non-zero error value
|
|
or throws an exception that encapsulates a non-zero error value on
|
|
failure, and returns 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 DbEnv::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 DbEnv::txn_recover.
|
|
Calls to DbEnv::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 DbEnv::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_cxx/env_class.html">DbEnv</a>, <a href="../api_cxx/txn_class.html">DbTxn</a>
|
|
<br><b>See Also</b>
|
|
<a href="../api_cxx/txn_list.html">Transaction Subsystem and Related Methods</a>
|
|
</tt>
|
|
<table width="100%"><tr><td><br></td><td align=right>
|
|
<a href="../api_cxx/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>
|