mirror of
https://github.com/fluencelabs/redis
synced 2025-06-12 08:41:21 +00:00
Cluster: slaves start failover with a small delay.
Redis Cluster can cope with a minority of nodes not informed about the failure of a master in time for some reason (netsplit or node not functioning properly, blocked, ...) however to wait a few seconds before to start the failover will make most "normal" failovers simpler as the FAIL message will propagate before the slave election happens.
This commit is contained in:
@ -1565,10 +1565,16 @@ void clusterCron(void) {
|
||||
}
|
||||
|
||||
/* If we are a slave and our master is down, but is serving slots,
|
||||
* call the function that handles the failover. */
|
||||
* call the function that handles the failover.
|
||||
* This function is called with a small delay in order to let the
|
||||
* FAIL message to propagate after failure detection, this is not
|
||||
* strictly required but makes 99.99% of failovers mechanically
|
||||
* simpler. */
|
||||
if (server.cluster->myself->flags & REDIS_NODE_SLAVE &&
|
||||
server.cluster->myself->slaveof &&
|
||||
server.cluster->myself->slaveof->flags & REDIS_NODE_FAIL &&
|
||||
(server.unixtime - server.cluster->myself->slaveof->fail_time) >
|
||||
REDIS_CLUSTER_FAILOVER_DELAY &&
|
||||
server.cluster->myself->slaveof->numslots != 0)
|
||||
{
|
||||
clusterHandleSlaveFailover();
|
||||
|
Reference in New Issue
Block a user