Day 4 10 min
Unique ids across servers
1 / 6 · ≈ 14 min left
The problem
An order service writes to one database, and every order gets its id from an auto-increment column. Sales grow. The team splits the orders over 4 databases, and each one keeps its own counter.
Two weeks later, support finds two different orders with id 1 000 017, one in each of two databases. A refund for one customer goes to the other.
The fix the team wants: every server makes its own ids, with no shared counter, and two ids never collide.