summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2014-06-07 14:25:47 +0200
committerantirez <antirez@gmail.com>2014-06-07 14:28:21 +0200
commit67029323a303dce64ffa9ed573c26cbe8381d9b4 (patch)
tree66bbcb9ac15d469b849579ee0f9fb85b9a678e22
parent531e577e2d5b0644d7c11ed8d3f5f958b32bb187 (diff)
downloadredis-67029323a303dce64ffa9ed573c26cbe8381d9b4.tar.gz
Cluster: SET-CONFIG-EPOCH should update currentEpoch.
SET-CONFIG-EPOCH, used by redis-trib at cluster creation time, failed to update the currentEpoch, making it possible after a failover for a server to set its configEpoch to a value smaller than the current one (since configEpochs are obtained using currentEpoch). The bug totally break the Redis Cluster algorithms and protocols allowing for permanent split brain conditions about the slots configuration as shown in issue #1799.
-rw-r--r--src/cluster.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/src/cluster.c b/src/cluster.c
index 948cc9140..bdaf36fbd 100644
--- a/src/cluster.c
+++ b/src/cluster.c
@@ -3790,6 +3790,8 @@ void clusterCommand(redisClient *c) {
addReplyError(c,"Node config epoch is already non-zero");
} else {
myself->configEpoch = epoch;
+ if (server.cluster->currentEpoch < epoch)
+ server.cluster->currentEpoch = epoch;
/* No need to fsync the config here since in the unlucky event
* of a failure to persist the config, the conflict resolution code
* will assign an unique config to this node. */