1<!--$Id: env_failchk.so,v 10.7 2007/09/21 20:06:01 bostic Exp $-->
2<!--Copyright (c) 1997,2008 Oracle.  All rights reserved.-->
3<!--See the file LICENSE for redistribution information.-->
4<html>
5<head>
6<title>Berkeley DB: DB_ENV-&gt;failchk</title>
7<meta name="description" content="Berkeley DB: An embedded database programmatic toolkit.">
8<meta name="keywords" content="embedded,database,programmatic,toolkit,btree,hash,hashing,transaction,transactions,locking,logging,access method,access methods,Java,C,C++">
9</head>
10<body bgcolor=white>
11<table width="100%"><tr valign=top>
12<td>
13<b>DB_ENV-&gt;failchk</b>
14</td>
15<td align=right>
16<a href="/api_c/api_core.html"><img src="/images/api.gif" alt="API"></a>
17<a href="/ref/toc.html"><img src="/images/ref.gif" alt="Ref"></a></td>
18</tr></table>
19<hr size=1 noshade>
20<tt>
21<b><pre>
22#include &lt;db.h&gt;
23<p>
24int
25DB_ENV-&gt;failchk(DB_ENV *dbenv, u_int32_t flags);
26</pre></b>
27<hr size=1 noshade>
28<b>Description: DB_ENV-&gt;failchk</b>
29<p>The DB_ENV-&gt;failchk method checks for threads of control (either a true
30thread or a process) that have exited while manipulating Berkeley DB library
31data structures, while holding a logical database lock, or with an
32unresolved transaction (that is, a transaction that was never aborted
33or committed).  For more information, see <a href="/ref/cam/app.html">Architecting Data Store and Concurrent Data Store applications</a>, and
34<a href="/ref/transapp/app.html">Architecting Transactional Data Store
35applications</a>.</p>
36<p>The DB_ENV-&gt;failchk method is based on the "thread_id" and "is_alive"
37functions specified to the <a href="/api_c/env_set_thread_id.html">DB_ENV-&gt;set_thread_id</a> method.  Applications
38calling the DB_ENV-&gt;failchk method must have already called the
39<a href="/api_c/env_set_isalive.html">DB_ENV-&gt;set_isalive</a> method, on the same <a href="/api_c/env_class.html">DB_ENV</a>, and must have
40configured their database environment using the
41<a href="/api_c/env_set_thread_count.html">DB_ENV-&gt;set_thread_count</a> method.</p>
42<p>If DB_ENV-&gt;failchk determines a thread of control exited while
43holding database read locks, it will release those locks.  If
44DB_ENV-&gt;failchk determines a thread of control exited with an
45unresolved transaction, the transaction will be aborted.  In either of
46these cases, DB_ENV-&gt;failchk will return 0 and the application may
47continue to use the database environment.</p>
48<p>In either of these cases, the DB_ENV-&gt;failchk method will also report
49the process and thread IDs associated with any released locks or
50aborted transactions.  The information is printed to a specified output
51channel (see the <a href="/api_c/env_set_msgfile.html">DB_ENV-&gt;set_msgfile</a> method for more information), or
52passed to an application callback function (see the
53<a href="/api_c/env_set_msgcall.html">DB_ENV-&gt;set_msgcall</a> method for more information).</p>
54<p>If DB_ENV-&gt;failchk determines a thread of control has exited such
55that database environment recovery is required, it will return
56<a href="/ref/program/errorret.html#DB_RUNRECOVERY">DB_RUNRECOVERY</a>.  In this case, the application should not
57continue to use the database environment.  For a further description as
58to the actions the application should take when this failure occurs, see
59<a href="/ref/cam/fail.html">Handling failure in Data Store and
60Concurrent Data Store applications</a>, and
61<a href="/ref/transapp/fail.html">Handling failure in Transactional
62Data Store applications</a>.</p>
63<p>The DB_ENV-&gt;failchk method may not be called before the <a href="/api_c/env_open.html">DB_ENV-&gt;open</a> method is called.</p>
64<p>The DB_ENV-&gt;failchk method
65returns a non-zero error value on failure
66and 0 on success.
67</p>
68<b>Parameters</b> <br>
69 <b>flags</b><ul compact><li>The <b>flags</b> parameter is currently unused, and must be set to 0.</ul>
70<br>
71<br><b>Errors</b>
72<p>The DB_ENV-&gt;failchk method
73may fail and return one of the following non-zero errors:</p>
74<br>
75<b>EINVAL</b><ul compact><li>An
76invalid flag value or parameter was specified.</ul>
77<br>
78<hr size=1 noshade>
79<br><b>Class</b>
80<a href="/api_c/env_class.html">DB_ENV</a>
81<br><b>See Also</b>
82<a href="/api_c/env_list.html">Database Environments and Related Methods</a>
83</tt>
84<table width="100%"><tr><td><br></td><td align=right>
85<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>
86</td></tr></table>
87<p><font size=1>Copyright (c) 1996,2008 Oracle.  All rights reserved.</font>
88</body>
89</html>
90