📄 fail.so
字号:
m4_comment([$Id: fail.so,v 10.2 2005/10/19 21:10:31 bostic Exp $])m4_ref_title(m4_tam Applications, Handling failure in Transactional Data Store applications,, transapp/term, transapp/app)m4_p([dnlWhen building Transactional Data Store applications, there are designissues to consider whenever a thread of control with open m4_db handlesfails for any reason (where a thread of control may be either a truethread or a process).])m4_p([dnlThe first case is handling system failure: if the system fails, thedatabase environment and the databases may be left in a corrupted state.In this case, recovery must be performed on the database environmentbefore any further action is taken, in order to:])m4_bulletbeginm4_bullet([recover the database environment resources,])m4_bullet([dnlrelease any locks or mutexes that may have been held to avoid starvationas the remaining threads of control convoy behind the held locks, and])m4_bullet([dnlresolve any partially completed operations that may have left a databasein an inconsistent or corrupted state.])m4_bulletendm4_p([dnlFor details on performing recovery, see the m4_link(recovery, [Recoveryprocedures]).])m4_p([dnlThe second case is handling the failure of a thread of control. Thereare resources maintained in database environments that may be leftlocked or corrupted if a thread of control exits unexpectedly. Theseresources include data structure mutexes, logical database locks andunresolved transactions (that is, transactions which were never abortedor committed). While Transactional Data Store applications can treatthe failure of a thread of control in the same way as they do a systemfailure, they have an alternative choice, the m4_refT(dbenv_failchk).])m4_p([dnlThe m4_refT(dbenv_failchk) will return m4_ref(DB_RUNRECOVERY) if thedatabase environment is unusable as a result of the thread of controlfailure. (If a data structure mutex or a database write lock is leftheld by thread of control failure, the application should not continueto use the database environment, as subsequent use of the environmentis likely to result in threads of control convoying behind the heldlocks.) The m4_ref(dbenv_failchk) call will release any database readlocks that have been left held by the exit of a thread of control, andabort any unresolved transactions. In this case, the application cancontinue to use the database environment.])m4_p([dnlA Transactional Data Store application recovering from a thread ofcontrol failure should call m4_ref(dbenv_failchk), and, if it returnssuccess, the application can continue. If m4_ref(dbenv_failchk) returnsm4_ref(DB_RUNRECOVERY), the application should proceed as described forthe case of system failure.])m4_p([dnlIt greatly simplifies matters that recovery may be performed regardlessof whether recovery needs to be performed; that is, it is not an errorto recover a database environment for which recovery is not strictlynecessary. For this reason, applications should not try to determineif the database environment was active when the application or systemfailed. Instead, applications should run recovery any time them4_refT(dbenv_failchk) returns m4_ref(DB_RUNRECOVERY), or, if theapplication is not calling m4_refT(dbenv_failchk), any time any threadof control accessing the database environment fails, as well as any timethe system reboots.])m4_page_footer
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -