As we noted earlier, a transaction may not always complete its execution successfully.
Such a transaction is termed aborted. If we are to ensure the atomicity
property, an aborted transaction must have no effect on the state of the database.
Thus, any changes that the aborted transaction made to the database must be
undone. Once the changes caused by an aborted transaction have been undone,
we say that the transaction has been rolled back. It is part of the responsibility of
the recovery scheme to manage transaction aborts. This is done typically by maintaining
a log. Each database modification made by a transaction is first recorded
in the log.We record the identifier of the transaction performing the modification,
the identifier of the data item being modified, and both the old value (prior to
modification) and the new value (after modification) of the data item. Only then
is the database itself modified. Maintaining a log provides the possibility of redoing
a modification to ensure atomicity and durability as well as the possibility of
undoing a modification to ensure atomicity in case of a failure during transaction
execution. Details of log-based recovery are discussed in Chapter 16.