Log-based Recovery
- The log is a sequence of records.
- Log of each transaction is maintained in some stable storage so that if any failure occurs, then it can be recovered from there.
- If any operation is performed on the database, then it will be recorded in the log.
- But the process of storing the logs should be done before the actual transaction is applied in the database.
Recovery using Log records
- When the system is crashed, then the system consults the log to find which transactions need to be undone and which need to be redone.
- If the log contains the record and or , then the Transaction Ti needs to be redone.
- If log contains record but does not contain the record either or , then the Transaction Ti needs to be undone.