NIMCET, GATE, CUET & CBSE test series are live — start practicing free
syllabuzAI

ACID Properties and Log-Based Recovery in DBMS | GATE CSE

Learn transaction states, the ACID properties and who enforces each, and log-based recovery with undo, redo, deferred and immediate update and checkpoints for GATE CSE.

6 min read

AS

Aman Singh

Updated 26 November 2026

On this page

Quick answer: A transaction reads data with Read(X), changes it with Write(X), and ends with commit or abort. Atomicity (all or nothing) and durability (committed changes survive failures) come from the recovery manager, which uses a log, undo, redo and checkpoints. Isolation comes from concurrency control, and consistency is mainly the responsibility of whoever writes the transactions. After a crash under immediate-update logging, transactions that committed after the last checkpoint are redone, transactions that never committed are undone, and transactions that committed before the checkpoint need nothing.

GATE uses this topic for short conceptual questions and for log-analysis numericals. It is part of the Transactions and Concurrency Control chapter.

Transaction operations

  • Read(A): copy data item A from the database (disk or buffer) into a program variable in main memory.
  • Write(A): write the program variable's value back to A, first in the buffer and later on disk.
  • Commit: make the transaction's changes permanent.
  • Abort (rollback): undo every change the transaction made.

Transaction states

StateMeaning
ActiveRunning its operations
Partially committedLast operation done, but changes not yet guaranteed on disk
CommittedChanges recorded permanently
FailedCan't continue normally
AbortedRolled back; the database is back to its state before the transaction, which may be restarted or killed

The ACID properties

Atomicity

Either all of a transaction's operations take effect, or none do. If a transaction fails before commit, the recovery manager rolls it back with undo.

Consistency

Each transaction, run on its own, must take the database from one consistent state to another. The DBMS enforces declared integrity constraints, but it can't check the business logic of a transaction, so the programmer or DBA has to write correct transactions.

Isolation

Concurrent transactions must not interfere with each other. The result of running them concurrently must match some serial order. This is the job of the concurrency-control manager (see serializability and locking protocols).

Durability

Once a transaction commits, its changes must survive failures such as a power cut, an OS or DBMS crash, or a disk failure. This comes from the recovery manager, the log, and redundant storage such as backups and RAID.

PropertyResponsible component
AtomicityRecovery manager
ConsistencyProgrammer / DBA (plus integrity constraints)
IsolationConcurrency-control manager
DurabilityRecovery manager

Log-based recovery

The DBMS writes a log record to stable storage before the matching change reaches the database on disk. This rule is called write-ahead logging (WAL). Typical log records:

  • ⟨Ti start⟩
  • ⟨Ti, X, old value, new value⟩ for each write
  • ⟨Ti commit⟩ or ⟨Ti abort⟩
  • ⟨checkpoint⟩

Undo and redo

  • Undo(Ti): set every item Ti wrote back to its old value, scanning the log backwards.
  • Redo(Ti): reapply every write of Ti with its new value, scanning forwards. This is needed because a committed write may still sit only in the buffer when the system crashes.

Deferred vs immediate update

SchemeWhen the database is changedWhat recovery needs
Deferred updateOnly after commitRedo committed transactions; never undo
Immediate updatePossibly before commitUndo uncommitted and redo committed transactions

Checkpoints

Scanning the whole log after a crash would be slow. So the DBMS takes a checkpoint from time to time: it forces log records and modified buffer blocks to disk, then writes ⟨checkpoint⟩ along with the list of active transactions. After a crash:

  • Transactions that committed before the checkpoint need nothing, because their changes are already on disk.
  • Transactions that committed after the checkpoint (but before the crash) are redone.
  • Transactions that had not committed at the crash are undone, including any that were active at the checkpoint.

Worked example

Log at the time of the crash (immediate update):

#Record
1⟨T1 start⟩
2⟨T1, A, 100, 150⟩
3⟨T1 commit⟩
4⟨checkpoint⟩
5⟨T2 start⟩
6⟨T2, B, 200, 250⟩
7⟨T3 start⟩
8⟨T3, C, 50, 60⟩
9⟨T2 commit⟩
—crash

Step 1: T1 committed before the checkpoint, so no action. A = 150 is already on disk.

Step 2: T2 committed after the checkpoint, so redo it. B = 250.

Step 3: T3 never committed, so undo it. C = 50.

With deferred update, T3's write never reached the database, so recovery just redoes T2.

Other recovery methods

  • Shadow paging: keep the old page table untouched while a transaction writes to new pages, then switch to the new page table on commit. It needs no undo or redo log, but it fragments data and makes concurrency harder.
  • Media (disk) failure: restore the database from a backup, then redo from the archived log, or rely on RAID redundancy.

Summary table

Situation at crashImmediate updateDeferred update
Committed before checkpointNothingNothing
Committed after checkpointRedoRedo
Not committedUndoNothing

Exam tips

  • Mark the last checkpoint and the crash on the log first, then sort every transaction into one of the three rows of the summary table.
  • Undo uses old values and runs backwards; redo uses new values and runs forwards.
  • If the question says "deferred update", there is never any undo.

Common mistakes

  • Saying the DBMS alone guarantees consistency. It enforces constraints, but transaction logic is the programmer's job.
  • Redoing transactions that committed before the checkpoint.
  • Undoing committed transactions or redoing uncommitted ones.
  • Forgetting transactions that were active at the checkpoint. If they hadn't committed by the crash, they still need undo.

Practice questions

Q1. Which ACID properties does the recovery manager handle?

Answer: Atomicity and durability.

Q2. In the worked log, suppose the crash happened just before record 9. What changes?

Answer: T2 is now uncommitted, so with immediate update both T2 and T3 are undone (B = 200, C = 50) and nothing is redone.

Q3. Why does deferred update never need undo?

Answer: Uncommitted transactions never write to the database, so there is nothing to reverse.

FAQs

What are the ACID properties in DBMS?

They are atomicity, consistency, isolation and durability, the four guarantees that keep a database correct despite concurrent access and failures.

What is the difference between undo and redo?

Undo reverses an uncommitted transaction's writes using old values. Redo reapplies a committed transaction's writes using new values.

Why are checkpoints used in recovery?

They limit how much of the log has to be examined after a crash, since changes made before the checkpoint are already on disk.

Which DBMS component ensures isolation?

The concurrency-control manager, using protocols such as two-phase locking or timestamp ordering.

What is write-ahead logging?

It is the rule that a change's log record must reach stable storage before the changed data is written to the database on disk.

Conclusion

For recovery questions, sort each transaction by when it committed relative to the last checkpoint and the crash, then apply the summary table. Continue with conflict and view serializability, or go back to the Transactions and Concurrency Control chapter.

Concept Check

EASY

Consider the following statements: P: Time Stamp Ordering Protocols are always free from deadlock. Q: Two-phase Locking Protocols are always free from deadlock. Which of the following statements is/are CORRECT?

Suggested for you