From 32d0a79f7871052429f38c65ee0b341c7fbbe3e5 Mon Sep 17 00:00:00 2001 From: antirez Date: Sat, 7 Jun 2014 14:37:09 +0200 Subject: [PATCH] Cluster: check that configEpoch never goes back. Since there are ways to alter the configEpoch outside of the failover procedure (for exampel CLUSTER SET-CONFIG-EPOCH and via the configEpoch collision resolution algorithm), make always sure, before replacing our configEpoch with a new one, that it is greater than the current one. --- src/cluster.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/cluster.c b/src/cluster.c index bdaf36fb..1193d6c6 100644 --- a/src/cluster.c +++ b/src/cluster.c @@ -2516,7 +2516,8 @@ void clusterHandleSlaveFailover(void) { } /* 3) Update my configEpoch to the epoch of the election. */ - myself->configEpoch = server.cluster->failover_auth_epoch; + if (myself->configEpoch < server.cluster->failover_auth_epoch) + myself->configEpoch = server.cluster->failover_auth_epoch; /* 4) Update state and save config. */ clusterUpdateState();