Compare the two log-based recovery schemes in terms of ease of implementation and overhead cost.
Ans: There are two types of log based recovery techniques: deferred update and immediate update scheme, which are as well known as NO-UNDO/REDO and UNDO/NO-REDO techniques correspondingly.
In the first scheme that is deferred update scheme, actual updates to the database are deferred or postponed till after a transaction completes its execution effectively and arrives its commit point. Earlier than reaching commit, all transactions updates are recorded in the log and in the cache buffer. Later than the transaction arrives its commit point and the log is force written to the disk, the updates are recorded in the database. If a transaction fails earlier than it reaches the commit point, it would not comprise modified the database and thus no undo is required.
But it may be needed to redo some of the operations as their influences may not have reached the database. If there is any failure, log files are employed to perform recovery operations. We observe the log file starting the last entry and go back till the most current checkpoint. The redo process performs all the writes to the database by using the after-image log records for the transaction, in the order in which they were written to the log. So this method assures that we will update any data item that was not properly updated prior to the failure.
In immediate update method, the database may be updated by few operations of transaction before the transaction arrives its commit point. In case of failure, we will have to redo the updates of committed transactions and undo the effects of uncommitted transactions. Identically to deferred update scheme, here as well log files are used to carry out the recovery scheme. Write-ahead protocol is employed to record the update operations in the log (on disk) earlier than it is written to the database. If a transaction aborts, the log can be employed to undo it, as it consists of all the old values for the update fields.