Cluster: slave validity factor is now user configurable.

Check the commit changes in the example redis.conf for more information.
This commit is contained in:
antirez
2014-05-22 16:57:47 +02:00
parent ce37488919
commit 39603a7e31
6 changed files with 69 additions and 8 deletions

View File

@ -2410,14 +2410,14 @@ void clusterHandleSlaveFailover(void) {
if (data_age > server.cluster_node_timeout)
data_age -= server.cluster_node_timeout;
/* Check if our data is recent enough. For now we just use a fixed
* constant of ten times the node timeout since the cluster should
* react much faster to a master down.
/* Check if our data is recent enough according to the slave validity
* factor configured by the user.
*
* Check bypassed for manual failovers. */
if (data_age >
((mstime_t)server.repl_ping_slave_period * 1000) +
(server.cluster_node_timeout * REDIS_CLUSTER_SLAVE_VALIDITY_MULT))
if (server.cluster_slave_validity_factor &&
data_age >
(((mstime_t)server.repl_ping_slave_period * 1000) +
(server.cluster_node_timeout * server.cluster_slave_validity_factor)))
{
if (!manual_failover) return;
}