After a transaction completes successfully, the changes it has made to the database persist, even if there are system failures.
which means in case if the transaction gets committed, then all the modifications done by transaction must and should exist in database irrespective of any possible failure.
Let Ti be a transaction that transfers $50 from account A to account B. This transaction
can be defined as:
A := A − 50;
B := B + 50;
Lets assume that, just before the execution of transaction Ti, the values of accounts A and B are $1000 and $2000, respectively.
Once the execution of the transaction completes successfully, and the user who initiated the transaction has been notified that the transfer of funds has taken place, it must be the case that no system failure will result in a loss of data corresponding to this transfer of funds.
The durability property guarantees that, once a transaction completes successfully, all the updates that it carried out on the database persist, even if there is a system failure after the transaction completes execution.
We assume for now that a failure of the computer system may result in loss of data in main memory, but data written to disk are never lost. We can guarantee durability by ensuring that either:
- The updates carried out by the transaction have been written to disk before
the transaction completes.
- Information about the updates carried out by the transaction and written
to disk is sufficient to enable the database to reconstruct the updates when
the database system is restarted after the failure.
Ensuring durability is the responsibility of a component of the database system called the recovery-management component. The transaction-management component and the recovery-management component are closely related.