SpinTheMic
Pro

Interview practice question

Replicas cause a double booking bug

System Design · Databases · Experienced

A booking system checks availability on a read replica and then writes the booking to the primary. Occasionally two people book the same slot. Why, and how do you fix it?

What a strong answer covers

Your AI report card counts how many of these ideas you cover.

  • Replica lag shows stale availability.
  • Check-then-act race condition.
  • Do check and write on primary in one transaction.
  • Unique constraint on slot.
  • Or conditional insert / SELECT FOR UPDATE.
Practise this topic

Start without signing up. Sign in free to get an AI report card on your answer.

See all topics