0% found this document useful (0 votes)
98 views10 pages

Database Management Systems-22

The ARIES recovery algorithm uses three passes: analysis, redo, and undo. The analysis pass determines which transactions need to be undone, which pages were dirty at the time of the crash, and the log sequence number (LSN) to start the redo pass. The redo pass repeats history by redoing log record actions from the redo LSN. The undo pass rolls back incomplete transactions using information from the analysis pass.

Uploaded by

Arun Sasidharan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
98 views10 pages

Database Management Systems-22

The ARIES recovery algorithm uses three passes: analysis, redo, and undo. The analysis pass determines which transactions need to be undone, which pages were dirty at the time of the crash, and the log sequence number (LSN) to start the redo pass. The redo pass repeats history by redoing log record actions from the redo LSN. The undo pass rolls back incomplete transactions using information from the analysis pass.

Uploaded by

Arun Sasidharan
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 10

ARIES Data Structures

 ARIES uses several data structures


 Log sequence number (LSN) identifies each log record
 Must be sequentially increasing
 Typically an offset from beginning of log file to allow fast access
 Easily extended to handle multiple log files
 Page LSN
 Log records of several different types
 Dirty page table

Database Management System (PPT) – M V Kamal, Associate Professor


ARIES Data Structures: Page LSN
 Each page contains a PageLSN which is the LSN of the last log record whose effects are
reflected on the page
 To update a page:
 X-latch the page, and write the log record
 Update the page
 Record the LSN of the log record in PageLSN
 Unlock page
 To flush page to disk, must first S-latch page
 Thus page state on disk is operation consistent
 Required to support physiological redo
 PageLSN is used during recovery to prevent repeated redo
 Thus ensuring idempotence

Database Management System (PPT) – M V Kamal, Associate Professor


ARIES Data Structures: Log Record
 Each log record contains LSN of previous log record of the same transaction

LSN TransID PrevLSN RedoInfo UndoInfo


 LSN in log record may be implicit
 Special redo-only log record called compensation log record (CLR) used to log actions
taken during recovery that never need to be undone
 Serves the role of operation-abort log records used in earlier recovery algorithm
 Has a field UndoNextLSN to note next (earlier) record to be undone
 Records in between would have already been undone
 Required to avoid repeated undo of already undone actions

LSN TransID UndoNextLSN RedoInfo

1 2 3 4 4' 3'
2' 1'

Database Management System (PPT) – M V Kamal, Associate Professor


ARIES Data Structures: DirtyPage Table
 DirtyPageTable
 List of pages in the buffer that have been updated
 Contains, for each such page
 PageLSN of the page
 RecLSN is an LSN such that log records before this LSN have already been
applied to the page version on disk
 Set to current end of log when a page is inserted into dirty page table (just
before being updated)
 Recorded in checkpoints, helps to minimize redo work

Database Management System (PPT) – M V Kamal, Associate Professor


ARIES Data Structures

Database Management System (PPT) – M V Kamal, Associate Professor


ARIES Data Structures: Checkpoint Log
 Checkpoint log record
 Contains:
 DirtyPageTable and list of active transactions
 For each active transaction, LastLSN, the LSN of the last log record written by
the transaction
 Fixed position on disk notes LSN of last completed
checkpoint log record
 Dirty pages are not written out at checkpoint time
 Instead, they are flushed out continuously, in the background
 Checkpoint is thus very low overhead
 can be done frequently

Database Management System (PPT) – M V Kamal, Associate Professor


ARIES Recovery Algorithm
ARIES recovery involves three passes
 Analysis pass: Determines
 Which transactions to undo
 Which pages were dirty (disk version not up to date) at time of crash
 RedoLSN: LSN from which redo should start
 Redo pass:
 Repeats history, redoing all actions from RedoLSN
 RecLSN and PageLSNs are used to avoid redoing actions already reflected on
page
 Undo pass:
 Rolls back all incomplete transactions
 Transactions whose abort was complete earlier are not undone
 Key idea: no need to undo these transactions: earlier undo actions were
logged, and are redone as required
Database Management System (PPT) – M V Kamal, Associate Professor
Aries Recovery: 3 Passes
 Analysis, redo and undo passes
 Analysis determines where redo should start
 Undo has to go back till start of earliest incomplete transaction

Last checkpoint End of Log


Time

Log Analysis pass


Redo pass
Undo pass

Database Management System (PPT) – M V Kamal, Associate Professor


ARIES Recovery: Analysis
Analysis pass
 Starts from last complete checkpoint log record
 Reads DirtyPageTable from log record
 Sets RedoLSN = min of RecLSNs of all pages in DirtyPageTable
 In case no pages are dirty, RedoLSN = checkpoint record’s LSN
 Sets undo-list = list of transactions in checkpoint log record
 Reads LSN of last log record for each transaction in undo-list from checkpoint
log record
 Scans forward from checkpoint
 .. Cont. on next page …

Database Management System (PPT) – M V Kamal, Associate Professor


ARIES Recovery: Analysis (Cont.)
Analysis pass (cont.)
 Scans forward from checkpoint
 If any log record found for transaction not in undo-list, adds transaction to undo-list
 Whenever an update log record is found
 If page is not in DirtyPageTable, it is added with RecLSN set to LSN of the
update log record
 If transaction end log record found, delete transaction from undo-list
 Keeps track of last log record for each transaction in undo-list
 May be needed for later undo
 At end of analysis pass:
 RedoLSN determines where to start redo pass
 RecLSN for each page in DirtyPageTable used to minimize redo work
 All transactions in undo-list need to be rolled back

Database Management System (PPT) – M V Kamal, Associate Professor

You might also like