⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fail.so

📁 berkeley db 4.6.21的源码。berkeley db是一个简单的数据库管理系统
💻 SO
字号:
m4_comment([$Id: fail.so,v 10.2 2005/10/19 21:10:31 bostic Exp $])m4_ref_title(m4_cam Applications,    Handling failure in Data Store and Concurrent Data Store applications,,    cam/intro, cam/app)m4_p([dnlWhen building Data Store and Concurrent Data Store applications, thereare design issues to consider whenever a thread of control with openm4_db handles fails for any reason (where a thread of control may beeither a true thread or a process).])m4_p([dnlThe simplest case is handling system failure for any Data Store orConcurrent Data Store application.  In the case of system failure, itdoesn't matter if the application has opened a database environment oris just using standalone databases: if the system fails, after theapplication has modified a database and has not subsequently flushed thedatabase to stable storage (by calling either the m4_ref(dbh_close),m4_ref(dbh_sync) or m4_refT(memp_sync)s), the database may be left in acorrupted state.  In this case, before accessing the database again, thedatabase should either be:])m4_bulletbeginm4_bullet([removed and re-created,])m4_bullet([removed and restored from the last known good backup, or])m4_bullet([dnlverified using the m4_refT(dbh_verify) or m4_ref(db_verify) utility.  Ifthe database does not verify cleanly, the contents may be salvaged usingthe m4_option(R) and m4_option(r) options of the m4_ref(db_dump)utility.])m4_bulletendm4_p([dnlApplications where the potential for data loss is unacceptable shouldconsider the m4_tam product, which offers standard transactionaldurability guarantees, including recoverability after failure.])m4_p([dnlAdditionally, system failure requires that any persistent databaseenvironment (that is, any database environment not created using them4_ref(DB_PRIVATE) flag), be removed.  Database environments may beremoved using the m4_refT(dbenv_remove).  If the persistent databaseenvironment was backed by the filesystem (that is, the environment wasnot created using the m4_ref(DB_SYSTEM_MEM) flag), the databaseenvironment may also be safely removed by deleting the environment'sfiles with standard system utilities.])m4_p([dnlThe second case is application failure for a Data Store application,with or without a database environment, or application failure for aConcurrent Data Store application without a database environment: as inthe case of system failure, if any thread of control fails, after theapplication has modified a database and has not subsequently flushed thedatabase to stable storage, the database may be left in a corruptedstate.  In this case, the database should be handled as describedpreviously in the system failure case.])m4_p([dnlThe third case is application failure for a Concurrent Data Storeapplication with a database environment.  There are resources maintainedin database environments that may be left locked if a thread of controlexits without first closing all open m4_db handles.  Concurrent DataStore applications with database environments have an additional optionfor handling the unexpected exit of a thread of control, them4_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.  Inthis case, the application can continue to use the databaseenvironment.])m4_p([dnlA Concurrent Data Store application recovering from a thread of controlfailure should call m4_ref(dbenv_failchk), and, if it returns success,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_page_footer

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -