From a81340abaf16006ac78a9b6aecb44d50cb589822 Mon Sep 17 00:00:00 2001 From: antirez Date: Wed, 15 Jan 2014 12:34:33 +0100 Subject: [PATCH] Cluster: set a minimum rejoin delay if node_timeout is too small. The rejoin delay usually is the node timeout. However if the node timeout is too small, we set it to 500 milliseconds, that is a value chosen to be greater than most setups RTT / instances latency figures so that likely communication with other nodes happen before rejoining. --- src/cluster.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/cluster.c b/src/cluster.c index 87cdb2104..44bf9deed 100644 --- a/src/cluster.c +++ b/src/cluster.c @@ -2327,6 +2327,7 @@ int clusterDelNodeSlots(clusterNode *node) { * -------------------------------------------------------------------------- */ #define REDIS_CLUSTER_MAX_REJOIN_DELAY 5000 +#define REDIS_CLUSTER_MIN_REJOIN_DELAY 500 void clusterUpdateState(void) { int j, new_state; @@ -2392,6 +2393,8 @@ void clusterUpdateState(void) { * a configuration update. */ if (rejoin_delay > REDIS_CLUSTER_MAX_REJOIN_DELAY) rejoin_delay = REDIS_CLUSTER_MAX_REJOIN_DELAY; + if (rejoin_delay < REDIS_CLUSTER_MIN_REJOIN_DELAY) + rejoin_delay = REDIS_CLUSTER_MIN_REJOIN_DELAY; if (new_state == REDIS_CLUSTER_OK && server.cluster->myself->flags & REDIS_NODE_MASTER &&