101 lines
5.0 KiB
HTML
101 lines
5.0 KiB
HTML
<!--$Id: env_set_app_dispatch.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: DB_ENV->set_app_dispatch</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->set_app_dispatch</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 <db.h>
|
|
<p>
|
|
int
|
|
DB_ENV->set_app_dispatch(DB_ENV *dbenv,
|
|
int (*tx_recover)(DB_ENV *dbenv,
|
|
DBT *log_rec, DB_LSN *lsn, db_recops op));
|
|
</pre></b>
|
|
<hr size=1 noshade>
|
|
<b>Description: DB_ENV->set_app_dispatch</b>
|
|
<p>Declare a function to be called during transaction abort and recovery
|
|
to process application-specific log records.</p>
|
|
<p>The DB_ENV->set_app_dispatch method configures operations performed using the specified
|
|
<a href="../api_c/env_class.html">DB_ENV</a> handle, not all operations performed on the underlying
|
|
database environment.</p>
|
|
<p>The DB_ENV->set_app_dispatch method may not be called after the <a href="../api_c/env_open.html">DB_ENV->open</a> method is
|
|
called.
|
|
If the database environment already exists when
|
|
<a href="../api_c/env_open.html">DB_ENV->open</a> is called, the information specified to DB_ENV->set_app_dispatch
|
|
must be consistent with the existing environment or corruption can
|
|
occur.</p>
|
|
<p>The DB_ENV->set_app_dispatch method
|
|
returns a non-zero error value on failure
|
|
and 0 on success.
|
|
</p>
|
|
<b>Parameters</b> <br>
|
|
<b>tx_recover</b><ul compact><li>The <b>tx_recover</b> parameter is the application's abort and recovery
|
|
function. The function takes four parameters:
|
|
<br>
|
|
<b><b>dbenv</b></b><ul compact><li>The <b>dbenv</b> parameter is the enclosing database environment handle.</ul>
|
|
<b><b>log_rec</b></b><ul compact><li>The <b>log_rec</b> parameter is a log record.</ul>
|
|
<b><b>lsn</b></b><ul compact><li>The <b>lsn</b> parameter is a log sequence number.</ul>
|
|
<b><b>op</b></b><ul compact><li>The <b>op</b> parameter is one of the following values:</ul>
|
|
<br>
|
|
<b><a name="DB_TXN_BACKWARD_ROLL">DB_TXN_BACKWARD_ROLL</a></b><ul compact><li>The log is being read backward to determine which transactions have been
|
|
committed and to abort those operations that were not; undo the operation
|
|
described by the log record.</ul>
|
|
<b><a name="DB_TXN_FORWARD_ROLL">DB_TXN_FORWARD_ROLL</a></b><ul compact><li>The log is being played forward; redo the operation described by the log
|
|
record.</ul>
|
|
<b><a name="DB_TXN_ABORT">DB_TXN_ABORT</a></b><ul compact><li>The log is being read backward during a transaction abort; undo the
|
|
operation described by the log record.</ul>
|
|
<b><a name="DB_TXN_APPLY">DB_TXN_APPLY</a></b><ul compact><li>The log is being applied on a replica site; redo the operation
|
|
described by the log record.</ul>
|
|
<b><a name="DB_TXN_PRINT">DB_TXN_PRINT</a></b><ul compact><li>The log is being printed for debugging purposes; print the contents of
|
|
this log record in the desired format.</ul>
|
|
<br>
|
|
<p>The DB_TXN_FORWARD_ROLL and DB_TXN_APPLY operations
|
|
frequently imply the same actions, redoing changes that appear in the
|
|
log record, although if a recovery function is to be used on a
|
|
replication client where reads may be taking place concurrently with the
|
|
processing of incoming messages, DB_TXN_APPLY operations should
|
|
also perform appropriate locking. The macro DB_REDO(op) checks that the
|
|
operation is one of DB_TXN_FORWARD_ROLL or DB_TXN_APPLY,
|
|
and should be used in the recovery code to refer to the conditions under
|
|
which operations should be redone. Similarly, the macro DB_UNDO(op)
|
|
checks if the operation is one of DB_TXN_BACKWARD_ROLL or
|
|
DB_TXN_ABORT.</p>
|
|
<br>
|
|
<p>The function must return 0 on success and either <b>errno</b> or a
|
|
value outside of the Berkeley DB error name space on failure.</p></ul>
|
|
<br>
|
|
<br><b>Errors</b>
|
|
<p>The DB_ENV->set_app_dispatch method
|
|
may fail and return one of the following non-zero errors:</p>
|
|
<br>
|
|
<b>EINVAL</b><ul compact><li>If the method was called after <a href="../api_c/env_open.html">DB_ENV->open</a> was called; or if an
|
|
invalid flag value or parameter was specified.</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>
|