Repaso
Español
Databases & SQLAdvancedDB-16

A user updates their profile, refreshes, and sees the old data. Reads go to async read replicas. What is happening?

Options

  1. A cache stampede that happens on the key of the profile
  2. Replication lag; send that user's reads to the primary for a while (Correct option)
  3. A deadlock between two updates of the profile of the user
  4. Corruption in the index of the table that stores the users

Answer

Replication lag; fix with read-your-writes (route the user's reads to the primary briefly)

Why

With asynchronous replication, the primary database confirms the write immediately and sends it to the replicas a moment later.

If the next read hits a replica that has not received the change yet, the user sees old data. This delay is replication lag (eventual consistency).

Fix: after a user writes, send that user's reads to the primary for a short time.

Remember

Async replicas can be slightly behind the primary.

Key terms

Practice this question in Repaso