Professional Documents
Culture Documents
ARIES: A Transaction Recovery Method Supporting Fine Granularity Locking and Partial Rollbacks Using Write-Ahead Logging
ARIES: A Transaction Recovery Method Supporting Fine Granularity Locking and Partial Rollbacks Using Write-Ahead Logging
ARIES: A Transaction Recovery Method Supporting Fine Granularity Locking and Partial Rollbacks Using Write-Ahead Logging
1 Goals of ARIES
1. Simplicity. The main algorithm needs to be simple in order to not make it error-prone.
2. Operation Logging. Use the concept Log Sequence Number (LSN) on a Write-Ahead Log
(WAL) method to keep track of all actions made.
3. Flexible Storage Management. Efficient support for storage and manipulation of varying
length of data is important.
4. Partial Rollbacks. Support the concept of savepoints and rollbacks to checkpoints.
5. Flexible Buffer Management. The recovery method should make the least number of
restrictive assumptions about the buffer management policies, and take advantage of any
specific policies in effect.
6. Recovery Independence. It should be possible to image copy and perform media recovery
or restart recovery at different granularities rather than the entire database.
7. Logical Undo. The ability (during undo) to affect a page that is different from the one
modified during forward processing.
8. Parellelism and Fast Recovery. Redo and undo processing must be page-oriented in
order to exploit parallelism during the different stages of recovery.
9. Minimal Overhead. Have a good performance during normal execution and restart recov-
ery.
2 Overview of ARIES
• Algorithm for Recovery and Isolation Exploiting Semantics
• Developed at IBM Research in early 1990s
• Guarantees atomicity and durability
1
3 Data Structures
3.1 Log Records
1. LSN. Log Sequence Number
2. Type. Type of log record
3. TransID. Identifier of transaction
4. PrevLSN. LSN of the preceding log record
5. PageID. Identifier of data page
6. UndoNxtLSN. The next-to-be-undone LSN
7. Data. Describes the undo/redo action performed
4 Normal Processing
4.1 Updates
• During a normal execution, each transaction invokes a series or reads and writes, followed
by commit or abort.
• During writes, the data page is fixed in the buffer pool and may be latch in X mode, then
the update is performed.
• All updates are logged first in the buffer log before executing the actual action.
• At the end of the transaction, a COMMIT log is written on the buffer log then the buffer
logs until the COMMIT record are flushed into the disk log.
• After successful commit, a TXN-END record may be written on the buffer log to signal the
system that the transaction logs until the COMMIT record buffer log can now be removed
from the buffer log.
4.2 Rollbacks
• Partial and Total Rollbacks
• A partial rollback of a transaction restores the state of the transaction to a certain savepoint.
• A total rollback restores the data page to a state before the start of the transaction.
• During rollback, the transaction updates are played back until a certain checkpoint or at the
start of transaction.
• At each update record, a compensation log record (CLR) is written on the buffer log before
the rollback action is performed.
• The CLR describes the actions taken to undo the action performed by the transaction.
2
4.3 Transaction Termination
• The prepare record written on log includes the list of update-type locks to be able to
reacquire these locks during system failures.
• A transaction enters an in-doubt state when the final state of the transaction cannot be
determined.
• A transaction in the in-doubt state, can be committed by writing an end record and releasing
its locks. Then, all pending actions must be performed.
• A transaction in the in-doubt state, can be rolled-back by writing a rollback record, discarding
the pending actions, and releasing the locks.
4.4 Checkpoints
• A non fuzzy checkpoint (aka transaction consistent checkpoint prevents all new transac-
tions from executing while waiting for currently running transactions to finish, before creating
a checkpoint.
• An action consistent checkpoint keeps a record of the ATT and DPT. However, it halts
all currently executing actions when creating the checkpoint.
• A fuzzy checkpoint has a start and end checkpoint logs and keeps a record of the ATT and
DPT at the end of the checkpoint.
• ARIES uses fuzzy checkpoints.
5 Restart Processing
1. Analysis Pass: Scan the log until before the crash and determine which transactions com-
mitted and failed.
2. Redo Pass: Repeat all actions
2. If a transaction has a transaction-end record, the transaction is removed from the ATT.
3. If an action is performed by a transaction not in ATT, then add the transaction in the ATT.
4. If a transaction has a transaction commit record, then change the status of the transaction
to committing in ATT.
5. For update records, if a transaction updated a page that is not in DPT, add the page in DPT
and set recLSN=LSN
3
5.3 Undo Pass
1. Undo all actions from transactions that are in ATT.
2. For each undo action performed, a record in the log is written ahead of time, CLRs.
1. Perform the repeating of history for online objects and postpone for offline objects.
2. Proceed with the usual undo pass, except for transactions (stopped transactions) that fail to
generate CLR due to offline objects.
3. Acquire locks for stopped transactions for actions that are not yet done.
4. When previously offline objects became online, first repeat history and continue undoing
stopped transactions. After undoing these transactions, their held locks are released.
5. Once a lock on the previously offline object is released, new transaction can now perform
actions on this object in parallel with undoing other transactions.
We might still want to start new transactions before completion of rollbacks of loser transactions,
even if none of recoverable objects are offline.
1. first repeat history, and reacquire locks for the uncommitted updates of loser and in-doubt
transactions;
2. start processing of new transactions even if the rollbacks of loser transactions run in parallel
The locks acquired on step 1 is released upon completion of rolling back.
4
7 Media Recovery
• When a fuzzy image copy operation is initiated, the location of the begin checkpoint record
of the most recent complete checkpoint is noted and remembered along with the image copy
data.
• When a media recovery is required, the image-copied version of the entity is reloaded and
then a redo scan is initiated starting from the media recovery redo point.
• Page-oriented logging provides recovery independence among objects
• Individual pages may be corrupted. An efficient way to recover the corrupted page is to read
to uncorrupted page from the non-volatile storage and bring it up to date by rolling forward
the page state.
9 Recovery Paradigms
The following are recovery paradigms of System R that have caused difficulties in achieving the
goals of ARIES.
• selective redo during restart
• undo work preceding redo work during restart recovery
• no logging of updates performed during transaction rollback
• no logging of index and space management information changes
• no tracking of page state on page itself to relate it to logged updates
5
10.2 Buffer Management
• Encompass, NonStop SQL, OLM, VLM and DB2 - steal, no force
• IMS FP (MSDBs) - deferred updating
• Encompass, NonStop SQL, DB2 and IMS - write CLRs during restart rollbacks
6
10.10 Restart Checkpoints
• IMS, DB2, OLM, VLM - end of restart recovery
11 Attributes of ARIES
1. Support for finer than page-level concurrency control and multiple granularities of locking
15. Bounded logging during restart in spite of repeated failures or of nested rollbacks
16. Permits exploitation of parallelism and selective/deferred processing for faster restart.
17. Fuzzy image copying (archive dumping) for media recovery.
22. Early release of locks during transaction rollback and deadlock resolution during partial
rollbacks
12 Reference
C. Mohan, et al., ”ARIES: A Transaction Recovery Method Supporting FineGranularity Locking
and Partial Rollbacks Using Write-Ahead Logging”, TODS 17(1), 1992.