Information Technology Reference
In-Depth Information
The WA L protocol in turn guarantees that the log disk always “runs ahead” of the
disk version of the database, that is, the log disk always contains the log records for
all the updates found in the disk versions of the pages (and often more). Thus, when
recovering from a failure, the log contains the necessary information for redoing the
updates that are recorded on the log disk but are missing from the disk version of the
database and also for undoing the updates of active transactions that went onto disk
before the failure. At the start of recovery, a transaction is considered to be active if
it has no commit log record (C )onthelogdisk.
3.8
The Commit Protocol
The commit protocol of a transaction (i.e., the execution of the C action) includes
generating the commit log record, flushing the log (called the principle of force-
log-at-commit ), releasing any resources (such as locks) reserved for and still held
by the transaction, and deleting the transaction record from the active-transaction
table. The commit protocol is given as Algorithm 3.3 .
Algorithm 3.3 Procedure commit .T /
log .n;hT; Ci/
flush-the-log ./
Release all locks held by T
Delete the transaction record of T from the active-transaction table
Return a notification of the commit of T to the application process
The implementation of the complete-rollback action C of an aborted transac-
tion T is the same as for the commit action except that in the last step, the application
process that generates T is notified that T has completed its rollback instead of
having committed.
The call flush-the-log ./ takes onto the log disk those log records from the log
buffer that have not yet been written onto disk. In other words, the modified log file
pages in the log buffer are flushed. If multiple pages are flushed, they are flushed in
their logical order, so that the sequence of log records on the log disk is always a
prefix of the sequence of log records appended into the log buffer, even if the system
crashes during the flushing.
The above commit protocol is sufficient for a centralized database system, and
also for local transactions in a distributed database system (where a transaction
started at a given site is termed local if it only operates on data stored at that site). For
a distributed transaction, that is, one that operates on data stored at several sites, the
commit protocol is far more complicated: when a transaction operates on data stored
at different sites, it gives rise to a set of local transactions (one for each of those
sites), whose execution must be coordinated so that either all the local transactions
 
Search WWH ::




Custom Search