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.
This commit is contained in:
antirez 2014-01-15 12:26:12 +01:00
parent 25ddefdea3
commit a687cbc19c

View File

@ -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