From 66ec1412fec9ef60a0158832ed82e8ef490efe69 Mon Sep 17 00:00:00 2001 From: antirez Date: Sun, 22 Dec 2013 10:05:16 +0100 Subject: [PATCH] Redis Cluster: add repl_ping_slave_period to slave data validity time. When the configured node timeout is very small, the data validity time (maximum data age for a slave to try a failover) is too little (ten times the configured node timeout) when the replication link with the master is mostly idle. In this case we'll receive some data from the master only every server.repl_ping_slave_period to refresh the last interaction with the master. This commit adds to the max data validity time the slave ping period to avoid this problem of slaves sensing too old data without a good reason. However this max data validity time is likely a setting that should be configurable by the Redis Cluster user in a way completely independent from the node timeout. --- src/cluster.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cluster.c b/src/cluster.c index 6b0b59ac..5831fb5c 100644 --- a/src/cluster.c +++ b/src/cluster.c @@ -1900,7 +1900,8 @@ void clusterHandleSlaveFailover(void) { * constant of ten times the node timeout since the cluster should * react much faster to a master down. */ if (data_age > - server.cluster_node_timeout * REDIS_CLUSTER_SLAVE_VALIDITY_MULT) + (server.repl_ping_slave_period * 1000) + + (server.cluster_node_timeout * REDIS_CLUSTER_SLAVE_VALIDITY_MULT)) return; /* Compute the time at which we can start an election. */