Sub topic 8
Recoverable, Casceless and Strict Schedules
Prerequisites and notation
Assume you know basic relational databases, SQL SELECT and UPDATE, and the meaning of a transaction schedule. A schedule is an ordering of operations from multiple transactions. We write rᵢ(X) for transaction Tᵢ reading item X, wᵢ(X) for writing it, and cᵢ or aᵢ for commit or abort.
These properties describe whether a schedule can recover safely after a transaction fails.
Recoverable schedules
A schedule is recoverable when a transaction commits only after every transaction whose data it read has committed.
If Tⱼ reads a value written by Tᵢ, then:
wᵢ(X) < rⱼ(X) implies cᵢ < cⱼFor example:
w₁(A), r₂(A), c₁, c₂This schedule is recoverable. T₂ reads T₁'s value, so T₁ commits first.
This schedule is not recoverable:
w₁(A), r₂(A), c₂, a₁T₂ committed a value that depended on T₁, but T₁ later aborted. The database may now contain a result based on invalid data.
Recoverability does not prevent dirty reads. T₂ can read uncommitted data. It only ensures that T₂ does not commit too early.
Cascadeless schedules
A schedule is cascadeless when a transaction reads a value only after the transaction that wrote the value commits.
For every read dependency:
wᵢ(X) < rⱼ(X) implies cᵢ < rⱼ(X)For example:
w₁(A), c₁, r₂(A), c₂T₂ reads only after T₁ commits, so the schedule is cascadeless.
A cascadeless schedule avoids cascading rollback, where aborting one transaction forces other transactions to abort because they read its uncommitted data. Every cascadeless schedule is recoverable, but a recoverable schedule need not be cascadeless.
Strict schedules
A schedule is strict when, after Tᵢ writes an item, no other transaction can read or write that item until Tᵢ commits or aborts.
Thus, after wᵢ(X), both rⱼ(X) and wⱼ(X) are forbidden until cᵢ or aᵢ.
Strictness prevents:
- Dirty reads, because another transaction cannot read an uncommitted write.
- Dirty writes, because another transaction cannot overwrite an uncommitted write.
- Cascading rollback.
Every strict schedule is cascadeless and recoverable. The reverse implications do not generally hold.
| Property | May read uncommitted data? | May overwrite uncommitted data? | Prevents cascading rollback? |
|---|---|---|---|
| Recoverable | Yes | Possibly | No |
| Cascadeless | No | Possibly | Yes |
| Strict | No | No | Yes |
A quick classification method
- List every pair where one transaction reads a value written by another.
- For recoverability, compare the writers' and readers' commit positions.
- For cascadelessness, check that each dependent read occurs after the writer commits.
- For strictness, check every read and write after an uncommitted write.
Exercise
Classify this schedule: w₁(X), r₂(X), c₁, c₂.
Show answer
It is recoverable because T₁ commits before T₂. It is not cascadeless or strict because T₂ reads X before T₁ commits.