Atomic Transactions: Ensures that partial transaction results are not saved in a database.
Durable Transactions: Committed transactions are not lost due to hardware or software failures.
Failure Scenarios Managed by Recovery System:
Transaction Failure: Triggers rollback due to logical errors in the application program.
System Failure: Results in loss of main memory before blocks are saved to media, causing data loss from committed transactions. The recovery system can recover data written to main memory but not stored media.
Storage Media Failure: Corruption of the database or loss of database connection.
Definition: A file that records recovery-related database operations.
Types of Log Records:
Update Record: Indicates a transaction has changed data.
Compensation (Undo) Record: Indicates that data has been restored to the original value during a rollback.
Transaction Record: Marks transaction boundaries.
Checkpoint Record: Indicates all data in main memory has been saved to storage media.
Process Flow in Log:
Records start when transactions begin (start records).
Update records logged when transactions write changes.
Checkpoint records logged when memory updates are saved to media.
Rollbacks write compensation and rollback records to log.
Commit records are written when transactions successfully complete.
After all updates are reversed, a rollback record is written to the log.
A list of active transactions appears in checkpoint records, which is essential for recovery from system failures.
Undo Phase: Rolls back transactions that were not committed after the last checkpoint.
Redo Phase: Restores all committed transactions since the last checkpoint.
Redo Phase Actions:
Only commit records remove a transaction from the active transaction list.
Update records generate a database write.
Undo Phase Actions:
The system reads the log in reverse until it finds the last transaction's start record.
Writes compensation records for transactions that do not commit or roll back.
Database Availability: Percentage of time that the database is operating correctly.
Cold Backup: Database copy created at checkpoint; recovery reads log from the latest checkpoint.
Hot Backup: Transactions log records sent synchronously to a secondary, up-to-date database during operation.
This ensures that transaction processing isn't delayed.