Slideshow:
.... /* ======================================= Undo log write rule R2 When transaction commits: Write all updates to disk ======================================= */ else if ( T's operation = OUTPUT <COMMIT T> (to disk) ) { 1. for ( each DB item D updated by transaction T ) { OUTPUT(D); // Write (new value) to disk } /* ============================== Transaction can commit now... ============================== */ 2a. write <COMMIT T> to log; 2b. FLUSH log (to disk); } .... |
The UNDO log write rule U2 cause the following performance bottleneck:
|
|
|
|
|
|
|
|
Transaction manager executes an operation /* ================================================================== Redo log write rule: Only update database elem's modified by committed transactions. When you update ANY of the modified database elem: You must write ALL redo log records of the transaction so that you can update ALL modified database elems ================================================================== */ if ( operation = OUTPUT(X) ) { /* ============================================= Database elem X was updated by transaction T ============================================= */ if ( T's state == COMMITTED ) // COMMIT record in log file on disk !! { OUTPUT(X); // OK to perform the OUTPUT operation } else if ( T's state == COMPLETED SUCCESSFFULLY ) { FLUSH log; // Write all log records to disk // including the log records belonging to T // We made sure that all updates by T can be (re)done OUTPUT(X); // Then perform the requested operation } else /* Uncommitted transaction !! */ { return; // Do not write data updated by // an uncomitted transaction to disk !!! } } else { perform operation; } |
|
The reason is the following:
|
Notice that:
|
|
Example:
Notice that:
|
|