Greetings overflowers,
In Redis sentinel/cluster setup, can we use the WAIT command with the total number of slaves to ensure strong consistency across the Redis servers? Why not?
Kind regards
WAIT
implements synchronous replication for Redis. Synchronous replication is required but not sufficient in order to achieve strong consistency. Strong consistency is practically the sum of two things:
WAIT does not provide "2". The replication process in Redis is performed by Sentinel or Redis Cluster, and is not able to provide property 2
(since the synchronous replication in Redis is the exception not the rule, so there was no much focus on that aspect). However what Redis replication does is to attempt to promote the slave that appears to preserve the greatest amount of data. While this does not change the theoretical guarantees of Redis failover, that can still lose acknowledged writes, it means that if you use WAIT
, there are more slaves having a given operation into their memory, and in turn it is a lot more likely that in the event of a failover, the operation will be retained. However while this will make a failure mode that discards the acknowledged operation hard to trigger, there always exists a failure mode with this properties.
TLDR: WAIT
does not make Redis linearizable, what it does is to make sure the specified number of slaves will receive the write, that in turn makes failover more robust, but without any hard guarantee.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With