From 6d550f2de4f3fbf8e073483d716c9e85b38e8456 Mon Sep 17 00:00:00 2001 From: antirez Date: Tue, 11 Feb 2014 10:06:10 +0100 Subject: [PATCH] Cluster: configEpoch assignment in SETNODE improved. Avoid to trash a configEpoch for every slot migrated if this node has already the max configEpoch across the cluster. Still work to do in this area but this avoids both ending with a very high configEpoch without any reason and to flood the system with fsyncs. --- src/cluster.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/src/cluster.c b/src/cluster.c index aeedc177..b6562341 100644 --- a/src/cluster.c +++ b/src/cluster.c @@ -3174,9 +3174,13 @@ void clusterCommand(redisClient *c) { * FIXME: the new version should be agreed otherwise a race * is possible if while a manual resharding is in progress * the master is failed over by a slave. */ - server.cluster->currentEpoch++; - myself->configEpoch = server.cluster->currentEpoch; - clusterDoBeforeSleep(CLUSTER_TODO_FSYNC_CONFIG); + uint64_t maxEpoch = clusterGetMaxEpoch(); + + if (myself->configEpoch != maxEpoch) { + server.cluster->currentEpoch++; + myself->configEpoch = server.cluster->currentEpoch; + clusterDoBeforeSleep(CLUSTER_TODO_FSYNC_CONFIG); + } server.cluster->importing_slots_from[slot] = NULL; } clusterDelSlot(slot); -- GitLab