Skip to content
Related Articles
Open in App
Not now

Related Articles

Recovery With Concurrent Transactions

Improve Article
Save Article
  • Last Updated : 25 Aug, 2020
Improve Article
Save Article

Concurrency control means that multiple transactions can be executed at the same time and then the interleaved logs occur. But there may be changes in transaction results so maintain the order of execution of those transactions.

During recovery, it would be very difficult for the recovery system to backtrack all the logs and then start recovering.

Recovery with concurrent transactions can be done in the following four ways.

  1. Interaction with concurrency control
  2. Transaction rollback
  3. Checkpoints
  4. Restart recovery

Interaction with concurrency control :

In this scheme, the recovery scheme depends greatly on the concurrency control scheme that is used. So, to rollback a failed transaction, we must undo the updates performed by the transaction.

Transaction rollback :

  • In this scheme, we rollback a failed transaction by using the log.
  • The system scans the log backward a failed transaction, for every log record found in the log the system restores the data item.

Checkpoints :

  • Checkpoints is a process of saving a snapshot of the applications state so that it can restart from that point in case of failure.
  • Checkpoint is a point of time at which a record is written onto the database form the buffers.
  • Checkpoint shortens the recovery process.
  • When it reaches the checkpoint, then the transaction will be updated into the database, and till that point, the entire log file will be removed from the file. Then the log file is updated with the new step of transaction till the next checkpoint and so on.
  • The checkpoint is used to declare the point before which the DBMS was in the consistent state, and all the transactions were committed.

To ease this situation, ‘Checkpoints‘ Concept is used by the most DBMS.

  • In this scheme, we used checkpoints to reduce the number of log records that the system must scan when it recovers from a crash.
  • In a concurrent transaction processing system, we require that the checkpoint log record be of the form <checkpoint L>, where ‘L’ is a list of transactions active at the time of the checkpoint.
  • A fuzzy checkpoint is a checkpoint where transactions are allowed to perform updates even while buffer blocks are being written out.

Restart recovery :

  • When the system recovers from a crash, it constructs two lists.
  • The undo-list consists of transactions to be undone, and the redo-list consists of transaction to be redone.
  • The system constructs the two lists as follows: Initially, they are both empty. The system scans the log backward, examining each record, until it finds the first <checkpoint> record.
My Personal Notes arrow_drop_up
Related Articles

Start Your Coding Journey Now!