- When all the old logs are deleted from the system and stored permanently in the storage disk, the mechanism is called checkpoint.
- When the execution of the transaction takes place, the checkpoints are marked acting as a bookmark. After the execution, it creates log files.
- When the file reaches the checkpoint, the transaction status is updated, and the entire log file stays deleted. The new transaction step is used to update the log file, till the next checkpoint is reached and the process continues.
- The DBMS is in a consistent state, and all transactions are committed until it reaches the checkpoint.
Method of Recovering Using Checkpoint
A database is recovered from the recovery system in a below-mentioned manner:
- The log files are read from end to start i.e., from T4 to T1.
- Two lists redo and undo maintained by the recovery system.
- If a log with <Tn, Start> and <Tn, Commit> is entered in recovery system, the transaction gets in redo state. Here all transactions are deleted, and redone before saving logs.
- For instance, in the above diagram, T2 and T3 contain <Tn, Start> and <Tn, Commit whereas T1 will have only <Tn, Commit>. Hence, T1, T2, and T3 are in the redo list.
- The transactions get into undo state if there is a log with only <Tn, Start>. Here all logs are removed and transactions are all undone.
- For instance, in the above diagram, T4 has <Tn, Start>. Here T4 gets added to undo list since it is incomplete.