Skip to main content

Checkpoint: Databases & Data Access

advanced25 min readLesson 154 of 169

Prove you can fight for consistency under contention and keep the pool honest.

The exam question: two workers update the same inventory row at the same time. Both read stock = 1. Both decrement. How many widgets does the customer buy? One — if you built the write correctly.

The checkpoint challenge combines optimistic concurrency and the unit-of-work rule: apply a batch of decrements against a simulated table, where concurrent writers (the conflict_on_attempt simulation from the practice) race you, and each unit of work must either fully land or cleanly retry.