Database Systems · Recoverability
Cascading Rollback (Cascading Abort)
Overview
A recoverable schedule requires that a transaction commits only after every transaction whose values it read has committed.
When one transaction's failure forces several dependent transactions to roll back, the result is a cascading rollback (cascading abort): the schedule stays recoverable, but work is wasted and, if commits are ordered badly, the final data can be wrong.
Key concepts
- Recoverable schedule rule: a transaction must not commit unless every transaction whose value it read has committed. A schedule that follows this rule is recoverable; otherwise it is unrecoverable.
- Cascading rollback / cascading abort: the failure of one transaction causes multiple other transactions to roll back.
- Correctness dependency chain: T2's value depends on what T1 computed, and T3's correctness depends on T2's correctness, so T3 depends on T2 and T2 depends on T1.
- Avoiding cascading rollback: do not read from an uncommitted transaction; wait until it commits.
- Cascadeless: the desired property that even if one transaction rolls back, another transaction does not have to roll back.
How it works
- T1 reads A, computes, and writes A, but has not committed.
- T2 reads the value of A written by T1, modifies A, and writes A, but has not committed.
- T3 reads the value of A written by T2, modifies A, and writes A.
- If T1 rolls back because of a failure before T2 and T3 commit:
- T1 must roll back.
- T2 must also roll back and undo all its changes, because its value was based on T1's uncommitted value.
- T3 must also roll back and undo all its changes, because its value was based on T2's uncommitted value.
- The schedule is recoverable, but all computations done by T2 and T3 are undone, wasting CPU time.
- The commit-ordering rule keeps schedules recoverable: do not commit a transaction until the transaction it read from has committed.
This rule can still lead to cascading rollbacks, since if the source transaction rolls back, every dependent transaction must also roll back.
Formulas
- Final value after all three increments: (initial value of A plus one increment of 10 from each of T1, T2, T3).
Worked examples
Initial value of A = 10. All three transactions T1, T2, T3 increment A by 10.
Step-by-step values:
- T1 reads A = 10, increments by 10, writes A = 20.
- T2 starts from A = 20, increments by 10, writes A = 30.
- T3 starts from A = 30, increments by 10, writes A = 40.
- The final value computed by T3 is correct, provided all commit.
Case 1: T1 aborts before T2 and T3 commit
- T1 rolls back, so A is restored to 10.
- T2 must roll back and undo its change.
- T3 must roll back and undo its change.
- The schedule is recoverable, but all work of T2 and T3 is wasted.
Case 2: T3 commits before T1 and T2 roll back
- T3's change becomes final.
- If T1 and T2 then roll back, T3's committed change cannot be undone.
- The rolled-back changes of T1 and T2 cannot be reconciled with T3's committed value, so the result is incorrect.
Case 3: T2 commits early, before T1 aborts
- T2 is considered complete and will not be executed again.
- T1 aborts: T1 had read A = 10 and written A = 20; on rollback, T1 sets A back to 10.
- T3 is not over, so T3 rolls back.
- Later, T1 re-executes: A goes from 10 to 20. T3 re-executes: A goes from 20 to 30. T2 does not re-execute, because it had already committed.
- Final value becomes 30, not the correct 40. Only two increments are applied on re-execution (10 by T1 and 10 by T3); T2's increment is effectively lost because its base value from T1 was undone.
Comparison
| Situation | Transactions that must roll back | Final value / effect | Correctness |
|---|---|---|---|
| All three commit in order | None | 40 | Correct |
| T1 aborts before any commit | T1, T2, T3 | T2 and T3 work undone; recoverable but wasteful | Recoverable, but wasted CPU time |
| T3 commits before T1 and T2 roll back | T1, T2; T3 cannot be undone | T3's committed change remains final | Incorrect / inconsistent |
| T2 commits before T1 aborts | T1 and T3; T2 is not re-executed | After re-execution A = 30 instead of 40 | Incorrect; one increment is lost |
Revision summary
- Cascading rollback / cascading abort: one transaction's failure forces multiple dependent transactions to roll back.
- Recoverable schedule rule: do not commit unless every transaction whose value you read has already committed.
- A schedule can be recoverable and still be inefficient, because cascading rollback wastes CPU time.
- Correctness dependency is chained: T2 depends on T1, and T3 depends on T2; if T1 aborts, T2 must abort, and then T3 must abort.
- To avoid cascading rollback, do not read from an uncommitted transaction; wait until it commits.
- Goal: design transactions/schedules that are cascadeless — if one transaction rolls back, other transactions do not have to roll back.
- Trap: committing a dependent transaction early (T2 or T3) makes its change final and cannot be undone, producing an incorrect final value.
Previous-year exam insights
- A schedule is recoverable iff for every pair of transactions Ti, Tj, if Tj reads a value written by Ti, then Ti commits before Tj commits; otherwise it is unrecoverable.
Asked inGATE 2016GATE 2015 - A schedule is cascadeless (avoids cascading aborts) iff every transaction reads only values written by committed transactions; strict schedules (no read or write of uncommitted data) are a stronger condition that also avoids cascading aborts.
Asked inGATE 2016 - When a transaction aborts, every transaction that read a value written by it (directly or transitively) must also be rolled back; to find them, follow the read-from (dirty-read) dependency edges from the aborted transaction.
Asked inGATE 2025GATE 2015 - A blind write (a write not preceded by a read of that item by the same transaction) creates no read-from dependency on the earlier writer, so the earlier writer's abort does not cascade to it through a read; but any transaction that reads the blind writer's value still depends on it and must be rolled back if it aborts.
Asked inGATE 2025 - Recoverability, cascadelessness and strictness form a hierarchy: every strict schedule is cascadeless, and every cascadeless schedule is recoverable, but not conversely.
Asked inGATE 2016 - In an unrecoverable schedule, a transaction that read uncommitted data commits before the writer aborts; the committed value cannot be undone, so atomicity is violated and the schedule cannot be recovered.
Asked inGATE 2015