From 58459f96cd8d77c44021e250e6869a52e11e42d7 Mon Sep 17 00:00:00 2001 From: antirez Date: Wed, 15 Jan 2014 12:26:12 +0100 Subject: [PATCH] Cluster: periodically call clusterUpdateState() when cluster is down. Usually we update the cluster state (to understand if we should accept queries or reply with an error) only when there is a change in the state of the nodes. However for the "delayed rejoin" feature to work, that is, for a master to wait some time before accepting queries again after it rejoins the majority, we need to periodically update the last time when the node was partitioned away from the majority. With this commit if the cluster is down we update the state ten times per second. --- src/cluster.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cluster.c b/src/cluster.c index 8c6c2112b..87cdb2104 100644 --- a/src/cluster.c +++ b/src/cluster.c @@ -2207,7 +2207,8 @@ void clusterCron(void) { } clusterHandleSlaveFailover(); - if (update_state) clusterUpdateState(); + if (update_state || server.cluster->state == REDIS_CLUSTER_FAIL) + clusterUpdateState(); } /* This function is called before the event handler returns to sleep for