Information Technology Reference
In-Depth Information
In all cases, when the updates have been redone, the database has been restored to
the state that existed at the time when T
2
committed. Then T
1
is aborted and rolled
back. The rollback includes performing (logically) the undo action D
1
Œx;
v
,which
is legal in every case, and the legality need not be checked (see Algorithm
4.9
).
t
Actually, the entire
ARIES
recovery algorithm consists of the following four steps,
executed in the order shown, when the system restarts after a system crash:
1. The
analysis pass
: with a forward scan of the log starting from the most
recently taken checkpoint, the active-transaction and modified-page tables are
reconstructed.
2. The
redo pass
: with a forward scan of the log all updates missing from the disk
version of the database are redone.
3. The
undo pass
: with a backward scan of the log, all forward-rolling transactions
are aborted and rolled back, and the rollback of all backward-rolling transactions
is run into completion.
4. Taking a checkpoint.
The
ARIES
algorithm requires that the buffer manager use the
WA L
protocol
during both normal transaction processing and recovery. No other restrictions are
imposed on the buffering policy: it is permitted to steal dirty pages from the buffer,
and modified pages do not need to be taken to disk during transaction commitment.
Thus,
ARIES
permits the buffering policies that are the most liberal: steal and no
force.
4.7
Analysis Pass for Do-Redo-Undo Recovery
In the
analysis pass
, the log is scanned to find out which transactions were active and
which pages possibly had updates in the buffer when the failure occurred. The input
to the pass is the
LSN
of the
begin-checkpoint
record of the last (fuzzy) checkpoint
that was completed (i.e., the value of
B
EGIN
-C
HECKPOINT
-LSN
). The output is the
active-transaction table, the modified-page table, and the
R
EDO
-LSN
value, which is
the location where the redo pass must begin processing the log. Database pages are
not accessed during the analysis pass.
In the analysis pass, the log is scanned from the
begin-checkpoint
record to the
end of the log. In scanning the log, the call
get-next-log-record
.n/
is used to fetch the log record with the
LSN
next to n. The active-transaction table and
modified-page table are initialized from the log records written at the checkpoint.
While scanning the log, when an update to page p is found and p is not found
in the modified-page table, the page-id of p is stored in the table, and its
R
EC
-LSN
is set to the
LSN
of the log record for the update. This is done because that update
must have turned page p from an unmodified page into a modified one. At the end
of the log scan, the
R
EDO
-LSN
is set to the minimum of the
R
EC
-LSN
values in the