1
0
mirror of https://github.com/fluencelabs/redis synced 2025-03-31 14:51:04 +00:00

Cluster: always increment the configEpoch in SETNODE after import.

Removed a stale conditional preventing the configEpoch from incrementing
after the import in certain conditions. Since the master got a new slot
it should always claim a new configuration.
This commit is contained in:
antirez 2014-02-11 09:48:53 +01:00
parent a1349728ea
commit 44f7afe28a

@ -3166,8 +3166,6 @@ void clusterCommand(redisClient *c) {
if (n == myself && if (n == myself &&
server.cluster->importing_slots_from[slot]) server.cluster->importing_slots_from[slot])
{ {
clusterNode *old_owner =
server.cluster->importing_slots_from[slot];
/* This slot was manually migrated, set this node configEpoch /* This slot was manually migrated, set this node configEpoch
* to a new epoch so that the new version can be propagated * to a new epoch so that the new version can be propagated
* by the cluster. * by the cluster.
@ -3175,11 +3173,9 @@ void clusterCommand(redisClient *c) {
* FIXME: the new version should be agreed otherwise a race * FIXME: the new version should be agreed otherwise a race
* is possible if while a manual resharding is in progress * is possible if while a manual resharding is in progress
* the master is failed over by a slave. */ * the master is failed over by a slave. */
if (old_owner->configEpoch > myself->configEpoch) { server.cluster->currentEpoch++;
server.cluster->currentEpoch++; myself->configEpoch = server.cluster->currentEpoch;
myself->configEpoch = server.cluster->currentEpoch; clusterDoBeforeSleep(CLUSTER_TODO_FSYNC_CONFIG);
clusterDoBeforeSleep(CLUSTER_TODO_FSYNC_CONFIG);
}
server.cluster->importing_slots_from[slot] = NULL; server.cluster->importing_slots_from[slot] = NULL;
} }
clusterDelSlot(slot); clusterDelSlot(slot);