Database Reference
In-Depth Information
Cannot be sure whether all log records are written.
So, the log records cannot be used to update the database.
IGNORE LOG RECORDS.
DATABASE STAYS IN PRIOR CONSISTENT STATE.
Immediate Updates Technique The deferred updates technique holds off all
database updates until a transaction reaches its commit point. The immediate
updates technique speeds up the processing by applying database updates as they
occur without waiting for the entire transaction to arrive at the commit point. This
may make a significant difference in a long transaction with many updates. The
writing of log records is interleaved with database updates.
Again, consider a transaction T, performing database operations, and the DBMS
writing log records for the transaction. Let us trace the actions of T.
1. When T starts, write a (T, BEGIN) record on the log file.
2. When T issues a write operation to data item D, write a (T, D, old value, new
value) record on the log file. For the immediate updates technique, both old
and new values or before image and after image are necessary.
3. Write the update to the database. (In practice, the update is made in the data-
base buffers in main memory and the actual update to the database takes place
when the buffers are next flushed to secondary storage.)
4. When the transaction commits, write (T,COMMIT) record on the log file.
5. If T aborts, write (T, ABORT) record on the log file. (Recovery process will
use log records to undo partial updates.)
Figure 15-29 is a simple illustration of the immediate updates technique for trans-
action T updating two data items, A and B. Note the chronological order of the log
records and database updates.
If a failure occurs, the recovery system scrutinizes the log file to identify the trans-
actions in progress at the time of failure. Beginning from the last record in the
log file, the recovery system goes back to the most recent checkpoint record. The
recovery system needs to examine only the log records in the interval from that
checkpoint and to take action to restore the database to a consistent state.
Log
File
TIME
Data-
base
Figure 15-29
Logging with immediate updates.
Search WWH ::




Custom Search