CodePark/ questions / Replication, Sentinel & Cluster
START PRACTICINGPRACTICE
Backend question · Redis & caching › Replication, Sentinel & Cluster

A client gets OK for a write from the primary. The primary crashes before the write reaches any replica, and Sentinel promotes a replica. What happens to the write?

It is lost, because replication is asynchronous

The write is lost, because replication is asynchronous. The primary replies OK before it copies the write to replicas. So a failover can drop recent writes that were already acknowledged. "OK is only sent after replicas confirm" is wrong: Redis does not wait for replicas by default. The WAIT command can block until N replicas acknowledge. This makes the window smaller, but Redis still does not guarantee strong consistency. "Sentinel replays the old primary's memory" is also wrong: Sentinel cannot read a crashed primary's memory.