ScalingBeginner

Why does a user see their own change revert?

“After adding read replicas, users report seeing old data right after saving. Explain.”

What this tests

  • Replication lag
  • Read routing

Answers by level

Read the beginner answer first and notice what is missing.

Asynchronous replication means replicas are briefly behind the primary. The write went to the primary; the immediate read went to a lagging replica that had not replayed it yet — a "read your own writes" violation. It is not a bug in the database; it is what async replication means.

Fix by routing a session’s reads to the primary for a few seconds after a write, or waiting for the replica to reach the write’s WAL position.

Green flags · Red flags

Strong green flag · Explains it is expected behaviour, not a fault.
Green flags
  • Names replication lag
  • Read-your-writes routing
  • Knows it is inherent to async
Red flags
  • Blames caching
  • Wants to make all replication synchronous

Follow-up questions

F1
How do you guarantee a user sees their own write?

Scenario

A profile edit reverts on refresh but is correct 3 seconds later. What changed recently and how do you fix it?

Learn this topic