Commit a81340ab authored by antirez's avatar antirez
Browse files

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.
parent a687cbc1
......@@ -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 &&
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment