<!--$Id: txn_recover.so,v 10.28 2007/05/30 17:24:41 margo Exp $--> <!--Copyright (c) 1997,2007 Oracle. All rights reserved.--> <!--See the file LICENSE for redistribution information.--> <html> <head> <title>Berkeley DB: DB_ENV->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> <h3>DB_ENV->txn_recover</h3> </td> <td align=right> <a href="../../db46-devel-4.6.21/api_c/api_core.html"><img src="../../db46-devel-4.6.21/images/api.gif" alt="API"></a> <a href="../../db46-devel-4.6.21/ref/toc.html"><img src="../../db46-devel-4.6.21/images/ref.gif" alt="Ref"></a></td> </tr></table> <hr size=1 noshade> <tt> <h3><pre> #include <db.h> <p> int DB_ENV->txn_recover(DB_ENV *dbenv, DB_PREPLIST preplist[], long count, long *retp, u_int32_t flags); </pre></h3> <hr size=1 noshade> <h3>Description: DB_ENV->txn_recover</h3> <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->txn_recover method returns a list of those prepared transactions.</p> <p>The DB_ENV->txn_recover method should only be called after the environment has been recovered.</p> <p>Multiple threads of control may call DB_ENV->txn_recover, but only one thread of control may resolve each returned transaction, that is, only one thread of control may call <a href="../../db46-devel-4.6.21/api_c/txn_commit.html">DB_TXN->commit</a> or <a href="../../db46-devel-4.6.21/api_c/txn_abort.html">DB_TXN->abort</a> on each returned transaction. Callers of DB_ENV->txn_recover must call <a href="../../db46-devel-4.6.21/api_c/txn_discard.html">DB_TXN->discard</a> to discard each transaction they do not resolve.</p> <p>On return from DB_ENV->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> <dl compact> <dt>DB_TXN * txn;<dd>The transaction handle for the transaction. <dt>u_int8_t gid[DB_XIDDATASIZE];<dd>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. </dl> <p>The DB_ENV->txn_recover method returns a non-zero error value on failure and 0 on success. </p> <h3>Parameters</h3> <dl compact> <dt><b>count</b><dd>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->txn_recover has filled in, in the array. <dt><b>flags</b><dd>The <b>flags</b> parameter must be set to one of the following values: <dl compact> <dt><a name="DB_FIRST">DB_FIRST</a><dd>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->txn_recover. Calls to DB_ENV->txn_recover from different threads of control should not be intermixed in the same environment. <dt><a name="DB_NEXT">DB_NEXT</a><dd>Continue returning a list of prepared, but not yet resolved transactions, starting where the last call to DB_ENV->txn_recover left off. </dl> <dt><b>preplist</b><dd>The <b>preplist</b> parameter references memory into which the list of transactions to be resolved by the application is copied. </dl> <hr size=1 noshade> <h3>Class</h3> <a href="../../db46-devel-4.6.21/api_c/env_class.html">DB_ENV</a>, <a href="../../db46-devel-4.6.21/api_c/txn_class.html">DB_TXN</a> <h3>See Also</h3> <a href="../../db46-devel-4.6.21/api_c/txn_list.html">Transaction Subsystem and Related Methods</a> </tt> <table width="100%"><tr><td><br></td><td align=right> <a href="../../db46-devel-4.6.21/api_c/api_core.html"><img src="../../db46-devel-4.6.21/images/api.gif" alt="API"></a><a href="../../db46-devel-4.6.21/ref/toc.html"><img src="../../db46-devel-4.6.21/images/ref.gif" alt="Ref"></a> </td></tr></table> <p><font size=1>Copyright (c) 1996,2007 Oracle. All rights reserved.</font> </body> </html>