Slideshow:
|
/* ==================================================
Step 1: identify the commited/uncommitted transactions
================================================== */
Scan the redo log:
{
identify the committed transaction // There is a COMMIT record
identify the uncommitted/aborted transaction
}
/* ==================================================
Step 2a: undo the uncommited/aborted transactions
================================================== */
Scan the undo log backwards:
{
For ( each < T, A, v, w > in the undo/redo log )
{
if ( T is uncommitted/aborted )
{
Update A with the (before) value v; // Undo the action !!!
}
}
}
/* ==================================================
Step 2b: redo the commited transactions
================================================== */
Scan the undo log forewards:
{
For ( each < T, A, v, w > in the undo/redo log )
{
if ( T is commited )
{
Update A with the (after) value w; // Redo the action !!!
}
}
}
/* =========================================================
Step 3: mark the uncommited tranasactions as failed....
========================================================= */
For ( each T that is uncommited ) do
{
Write <ABORT T> to log;
}
Flush-Log
|
|
|
Recovery:
|
Comment:
|
|
Recovery:
|
Comment:
|
|
2 possibilities:
|
Recovery if <COMMIT T> was written:
|
Comment:
|
Recovery if <COMMIT T> was not written:
|
Comment:
|
|
Recovery:
|
|
|