Log and log records
The log is a sequence of log records, recording all the updated activities in the database. In stable storage, logs for each transaction are maintained. Any operation which is performed on the database is recorded on the log. Prior to performing any modification to the database, an updated log record is created to reflect that modification. An update log record represented as: <Ti, Xj, V1, V2> has these fields:
- Transaction identifier: Unique Identifier of the transaction that performed the write operation.
- Data item: Unique identifier of the data item written.
- Old value: Value of data item prior to write.
- New value: Value of data item after write operation.
Other types of log records are:
- <Ti start>: It contains information about when a transaction Ti starts.
- <Ti commit>: It contains information about when a transaction Ti commits.
- <Ti abort>: It contains information about when a transaction Ti aborts.
Log based Recovery in DBMS
The atomicity property of DBMS states that either all the operations of transactions must be performed or none. The modifications done by an aborted transaction should not be visible to the database and the modifications done by the committed transaction should be visible. To achieve our goal of atomicity, the user must first output stable storage information describing the modifications, without modifying the database itself. This information can help us ensure that all modifications performed by committed transactions are reflected in the database. This information can also help us ensure that no modifications made by an aborted transaction persist in the database.