Explain Isolation Levels Through a Lost Update on Seller Payout Balances
Last updated: November 29, 2026
Quick Overview
Two payout adjustment jobs credit the same seller at the same time, and one credit vanishes. Walk through which isolation levels allow this lost update, show it with a small versioned store, and give the fixes a production system would use.
Amazon
November 29, 20260
0
0 solved
Two payout adjustment jobs credit the same seller at the same time, and one credit vanishes. Walk through which isolation levels allow this lost update, show it with a small versioned store, and give the fixes a production system would use.
Seller payments and disbursements run many concurrent jobs against shared balances, and a lost credit is both a money bug and a trust bug. The interviewer checks precise knowledge of anomalies by isolation level and practical fixes that do not rely on everyone running at serializable.
What the Interviewer Expects
- Defines the lost update anomaly with a concrete interleaving
- States that read committed permits it while snapshot isolation with first-committer-wins and serializable prevent it
- Notes that the answer differs by database (for example Postgres repeatable read aborts, MySQL InnoDB repeatable read does not for plain reads)
- Gives fixes: atomic increment, SELECT FOR UPDATE, optimistic version check
- Mentions write skew as an anomaly snapshot isolation still allows
Key Topics to Cover
How to Approach This
- Apply SOLID principles. Single Responsibility makes code testable, Open/Closed makes it extensible.
- Choose data structures based on access patterns, not familiarity.
- Prefer immutable data and message passing over shared mutable state for concurrency.
- Design APIs with RESTful conventions, versioning, meaningful errors, and pagination from day one.
Possible Follow-up Questions
- Show a write skew example that snapshot isolation does not prevent.
- Why might you prefer an append-only ledger of credits over a mutable balance?
- How should the application handle a serialization failure?
- What does DynamoDB offer for this case?
Sharpen Your Skills on Codemia
Practice similar problems with our interactive workspace, get AI feedback, and track your progress.
Practice System Design ProblemsSample Answer
Requirements
- Balance starts at 1000 cents. Job A credits 200, job B credits 50, concurrently.
- Correct final balance: 1250.
- Show the anomaly and a level that prevents it, then the fix....
High-Level Design
Interleaving: A reads 1000, B reads 1000, A writes 1200 and commits, B writes 1050 and commits; A's credit is lost. Under read committed both commits succeed because each read saw committed data. ...