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

📄 nested.so

📁 berkeley db 4.6.21的源码。berkeley db是一个简单的数据库管理系统
💻 SO
字号:
m4_comment([$Id: nested.so,v 10.23 2003/01/24 18:01:58 bostic Exp $])m4_ref_title(m4_tam Applications,    Nested transactions,    nested @transactions, transapp/cursor, transapp/admin)m4_p([dnlm4_db provides support for nested transactions.  Nested transactionsallow an application to decompose a large or long-running transactioninto smaller units that may be independently aborted.])m4_p([dnlNormally, when beginning a transaction, the application will pass a NULLvalue for the parent argument to m4_ref(txn_begin).  If, however, theparent argument is a m4_ref(DbTxn) handle, the newly created transactionwill be treated as a nested transaction within the parent.  Transactionsmay nest arbitrarily deeply.  For the purposes of this discussion,transactions created with a parent identifier will be calledm4_italic(child transactions).])m4_p([dnlOnce a transaction becomes a parent, as long as any of its childtransactions are unresolved (that is, they have neither committed noraborted), the parent may not issue any m4_db calls except to begin morechild transactions, or to commit or abort.  For example, it may notissue any access method or cursor calls.  After all of a parent'schildren have committed or aborted, the parent may again requestoperations on its own behalf.])m4_p([dnlThe semantics of nested transactions are as follows.  When a childtransaction is begun, it inherits all the locks of its parent.  Thismeans that the child will never block waiting on a lock held by itsparent.  Further, locks held by two children of the same parent willalso conflict.  To make this concrete, consider the following set oftransactions and lock acquisitions.])m4_p([dnlTransaction T1 is the parent transaction.  It acquires a write lock onitem A and then begins two child transactions: C1 and C2.  C1 also wantsto acquire a write lock on A; this succeeds.  If C2 attempts to acquirea write lock on A, it will block until C1 releases the lock, at whichpoint it will succeed.  Now, let's say that C1 acquires a write lock onB.  If C2 now attempts to obtain a lock on B, it will block.  However,let's now assume that C1 commits.  Its locks are anti-inherited, whichmeans they are given to T1, so T1 will now hold a lock on B.  At thispoint, C2 would be unblocked and would then acquire a lock on B.])m4_p([dnlChild transactions are entirely subservient to their parent transaction.They may abort, undoing their operations regardless of the eventual fateof the parent.  However, even if a child transaction commits, if itsparent transaction is eventually aborted, the child's changes are undoneand the child's transaction is effectively aborted.  Any childtransactions that are not yet resolved when the parent commits or abortsare resolved based on the parent's resolution -- committing if theparent commits and aborting if the parent aborts.  Any childtransactions that are not yet resolved when the parent prepares are alsoprepared.])m4_page_footer

⌨️ 快捷键说明

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