📄 intro.so
字号:
m4_comment([$Id: intro.so,v 10.26 2006/11/13 18:05:04 bostic Exp $])m4_ref_title(Transaction Subsystem, Introduction to the transaction subsystem, introduction to the @transaction subsystem, mp/config, txn/config)m4_p([dnlThe Transaction subsystem makes operations atomic, consistent, isolated,and durable in the face of system and application failures. The subsystemrequires that the data be properly logged and locked in order to attainthese properties. m4_db contains all the components necessary totransaction-protect the m4_db access methods, and other forms of data maybe protected if they are logged and locked appropriately.])m4_p([dnlThe Transaction subsystem is created, initialized, and opened by calls tom4_ref(dbenv_open) with the m4_ref(DB_INIT_TXN) flag specified. Notethat enabling transactions automatically enables logging, but does notenable locking because a single thread of control that needed atomicityand recoverability would not require it.])m4_p([dnlThe m4_ref(txn_begin) function starts a transaction, returning an opaquehandle to a transaction. If the parent parameter to m4_ref(txn_begin) isnon-NULL, the new transaction is a child of the designated parenttransaction.])m4_p([dnlThe m4_ref(txn_abort) function ends the designated transaction and causesall updates performed by the transaction to be undone. The end result isthat the database is left in a state identical to the state that existedprior to the m4_ref(txn_begin). If the aborting transaction has any childtransactions associated with it (even ones that have already beencommitted), they are also aborted. Any transactions that are unresolved(neither committed nor aborted) when the application or system failsare aborted during recovery.])m4_p([dnlThe m4_ref(txn_commit) function ends the designated transaction and makesall the updates performed by the transaction permanent, even in the faceof application or system failure. If this is a parent transactioncommitting, all child transactions that individually committed orhad not been resolved are also committed.])m4_p([dnlTransactions are identified by 32-bit unsigned integers. The IDassociated with any transaction can be obtained using the m4_ref(txn_id)function. If an application is maintaining information outside of m4_dbit wants to transaction-protect, it should use this transaction ID asthe locking ID.])m4_p([dnlThe m4_ref(txn_checkpoint) function causes a transaction checkpoint. Acheckpoint is performed using to a specific log sequence number (LSN),referred to as the checkpoint LSN. When a checkpoint completessuccessfully, it means that all data buffers whose updates are describedby LSNs less than the checkpoint LSN have been written to disk. This, inturn, means that the log records less than the checkpoint LSN are nolonger necessary for normal recovery (although they would be required forcatastrophic recovery if the database files were lost), and all log filescontaining only records prior to the checkpoint LSN may be safely archivedand removed.])m4_p([dnlThe time required to run normal recovery is proportional to the amountof work done between checkpoints. If a large number of modificationshappen between checkpoints, many updates recorded in the log maynot have been written to disk when failure occurred, and recovery maytake longer to run. Generally, if the interval between checkpoints isshort, data may be being written to disk more frequently, but therecovery time will be shorter. Often, the checkpoint interval is tunedfor each specific application.])m4_p([dnlThe m4_refT(txn_stat) returns information about the status of thetransaction subsystem. It is the programmatic interface used by them4_ref(db_stat) utility.])m4_p([dnlThe transaction system is closed by a call to m4_ref(dbenv_close).])m4_p([dnlFinally, the entire transaction system may be removed using them4_refT(dbenv_remove).])include(txn/m4.methods)m4_page_footer
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -