The Recovery Mechanism Component of a DBMS supports atomicity and durability. It ensures that the database stays consistent despite system failures.
This scheme is based on making copies of the database (also known as shadow copies).
Recommended for first-time reading
Initial State
New Copy Workspace
Empty
Old Copy (Current)
Points to address_a
Empty Location
Ready
The db-pointer is pointing to the current 'Old DB Copy' on the disk.
db-pointer is maintained on the disk; which at any instant points to the current copy of DB.db-pointer to point to the new copy of DB."The implementation is dependent on write to the db-pointer being atomic. Luckily, disk system provide atomic updates to entire block or at least a disk sector. So, we make sure db-pointer lies entirely in a single sector by storing it at the beginning of a block."
Inefficient, as entire DB is copied for every Transaction.
• 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.
Stable storage: A classification of computer data storage technology that guarantees atomicity for any given write operation and allows software to be written that is robust against some hardware and power failures.
<T₀ start>
<T₀, A, 950>
// Only New Value<T₀, B, 2050>
<T₀ commit>
<T₀ start>
<T₀, B, 2000, 2050>
<T₀ commit>