Transaction 1: A transaction that adds a new supplier to the supplier's table.
Transaction 2: A transaction that increases the price of a product.
Serializable, Read committed, Repeatable read
CORRECTED TABLE FOR READ COMMITTED ISOLATION LEVEL:
T1 T2
w.l(x)
w(x)
w.l(y)
w(y)
commit
u.l(x)
commit
u.l(y)
KEY CORRECTIONS FOR READ COMMITTED ISOLATION LEVEL:
1. Write Locks Held Until Commit:
- In Read Committed isolation level, write locks (w.l) are held until the transaction
commits
- This prevents dirty writes (other transactions modifying uncommitted data)
- This prevents dirty reads (other transactions reading uncommitted data)
2. Unlock After Commit:
- T1: Acquires w.l(x), writes w(x), commits, then releases u.l(x)
- T2: Acquires w.l(y), writes w(y), commits, then releases u.l(y)
- Locks are released immediately after commit, not before
3. Why Write Locks in Read Committed?
- Write locks ensure that:
• No other transaction can read uncommitted changes (prevents dirty reads)
• No other transaction can modify the same data simultaneously (prevents lost
updates)
• Changes are only visible after commit
4. Correct Schedule:
- T1: w.l(x) → w(x) → commit → u.l(x)
- T2: w.l(y) → w(y) → commit → u.l(y)
5. What Was Wrong in Original Table:
- Original had: u.l(x) before commit (INCORRECT)
- Corrected to: u.l(x) after commit (CORRECT)
- This ensures no transaction can see uncommitted data
Legend:
- w.l(x) = Write lock on x (exclusive lock)
- w(x) = Write operation on x
- u.l(x) = Unlock x (release write lock)
- commit = Transaction commit point
Note: Since T1 and T2 operate on different data items (x and y), there is no conflict
between them, and they can execute concurrently.