diff options
author | Bar Shaul <88437685+barshaul@users.noreply.github.com> | 2022-06-21 07:40:48 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-06-20 21:40:48 -0700 |
commit | 091701f363da953695b52cd7b4d7668d47f0258e (patch) | |
tree | 20304a8e6e115baac3d25c300ac2f2c0c500ad25 /src/cluster.c | |
parent | ff6419658bd8c8800734a7f19520c2aa7cd68a90 (diff) | |
download | redis-091701f363da953695b52cd7b4d7668d47f0258e.tar.gz |
Set replicas' configEpoch to 0 when loaded from cluster configuration file (#10798)
* Changed clusterLoadConfig to set the config epoch of replica nodes to 0 when loaded.
Diffstat (limited to 'src/cluster.c')
-rw-r--r-- | src/cluster.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/cluster.c b/src/cluster.c index cdbc565ec..a5d614815 100644 --- a/src/cluster.c +++ b/src/cluster.c @@ -308,8 +308,10 @@ int clusterLoadConfig(char *filename) { if (atoi(argv[4])) n->ping_sent = mstime(); if (atoi(argv[5])) n->pong_received = mstime(); - /* Set configEpoch for this node. */ - n->configEpoch = strtoull(argv[6],NULL,10); + /* Set configEpoch for this node. + * If the node is a replica, set its config epoch to 0. + * If it's a primary, load the config epoch from the configuration file. */ + n->configEpoch = (nodeIsSlave(n) && n->slaveof) ? 0 : strtoull(argv[6],NULL,10); /* Populate hash slots served by this instance. */ for (j = 8; j < argc; j++) { |