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: DbEnv::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>DbEnv::failchk</b> 14</td> 15<td align=right> 16<a href="../api_cxx/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 <db_cxx.h> 23<p> 24int 25DbEnv::failchk(u_int32_t flags); 26</pre></b> 27<hr size=1 noshade> 28<b>Description: DbEnv::failchk</b> 29<p>The DbEnv::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 DbEnv::failchk method is based on the "thread_id" and "is_alive" 37functions specified to the <a href="../api_cxx/env_set_thread_id.html">DbEnv::set_thread_id</a> method. Applications 38calling the DbEnv::failchk method must have already called the 39<a href="../api_cxx/env_set_isalive.html">DbEnv::set_isalive</a> method, on the same <a href="../api_cxx/env_class.html">DbEnv</a>, and must have 40configured their database environment using the 41<a href="../api_cxx/env_set_thread_count.html">DbEnv::set_thread_count</a> method.</p> 42<p>If DbEnv::failchk determines a thread of control exited while 43holding database read locks, it will release those locks. If 44DbEnv::failchk determines a thread of control exited with an 45unresolved transaction, the transaction will be aborted. In either of 46these cases, DbEnv::failchk will return 0 and the application may 47continue to use the database environment.</p> 48<p>In either of these cases, the DbEnv::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_cxx/env_set_msgfile.html">DbEnv::set_msgfile</a> method for more information), or 52passed to an application callback function (see the 53<a href="../api_cxx/env_set_msgcall.html">DbEnv::set_msgcall</a> method for more information).</p> 54<p>If DbEnv::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 DbEnv::failchk method may not be called before the <a href="../api_cxx/env_open.html">DbEnv::open</a> method is called.</p> 64<p>The DbEnv::failchk method 65either returns a non-zero error value 66or throws an exception that encapsulates a non-zero error value on 67failure, and returns 0 on success. 68</p> 69<b>Parameters</b> <br> 70 <b>flags</b><ul compact><li>The <b>flags</b> parameter is currently unused, and must be set to 0.</ul> 71<br> 72<br><b>Errors</b> 73<p>The DbEnv::failchk method 74may fail and throw 75<a href="../api_cxx/except_class.html">DbException</a>, 76encapsulating one of the following non-zero errors, or return one of 77the following non-zero errors:</p> 78<br> 79<b>EINVAL</b><ul compact><li>An 80invalid flag value or parameter was specified.</ul> 81<br> 82<hr size=1 noshade> 83<br><b>Class</b> 84<a href="../api_cxx/env_class.html">DbEnv</a> 85<br><b>See Also</b> 86<a href="../api_cxx/env_list.html">Database Environments and Related Methods</a> 87</tt> 88<table width="100%"><tr><td><br></td><td align=right> 89<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> 90</td></tr></table> 91<p><font size=1>Copyright (c) 1996,2008 Oracle. All rights reserved.</font> 92</body> 93</html> 94