diff options
author | antirez <antirez@gmail.com> | 2014-06-07 14:37:09 +0200 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2014-06-07 14:45:53 +0200 |
commit | 8b059f06d7c9244797ed3f03aadbd2c09205550b (patch) | |
tree | 7d92f7ccdec817cd5138d50d7c68860a0271779b | |
parent | 67029323a303dce64ffa9ed573c26cbe8381d9b4 (diff) | |
download | redis-8b059f06d7c9244797ed3f03aadbd2c09205550b.tar.gz |
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.
-rw-r--r-- | src/cluster.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/cluster.c b/src/cluster.c index bdaf36fbd..1193d6c6f 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(); |