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.
This commit is contained in:
antirez 2013-12-22 10:05:16 +01:00
parent b2dedd9da8
commit 66ec1412fe

View File

@ -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. */