You have one session, so you play both sessions of a timeline yourself, one statement at a time.
The timeline from the lesson, on Ava's account (500):
| Time | Session A (withdraw 100) | Session B (deposit 50) |
|---|---|---|
| 1 | reads Ava: 500 | |
| 2 | reads Ava: 500 | |
| 3 | writes 400 | |
| 4 | writes 550 |
- Run the two writes in order, with the fixed numbers from the timeline: first set Ava's balance to 400, then to 550.
- Look at
account_log. Which amount did the bank lose track of? - Now replay the same two changes on Liam's account (200), but write each one so it computes from the current balance. Liam must end with 150.
Name the problem in each case:
- A report reads a balance that another transaction changed and then rolled back.
- A transaction counts the accounts twice. Between the counts, another transaction inserts an account and commits.
- A transaction reads Liam's balance twice and gets two values.