summaryrefslogtreecommitdiff
path: root/src/replication.c
diff options
context:
space:
mode:
authorWuYunlong <xzsyeb@126.com>2018-06-30 09:39:08 +0800
committerWuYunlong <xzsyeb@126.com>2018-06-30 09:39:08 +0800
commit2e167f7d0e9abb5c49f8f0fb22a3fe2340ad0e31 (patch)
treeebe47660832e3890b53b0d1cfc44c0fd91df0f2a /src/replication.c
parentaeb7bc3ec6ef9721fee36c1e275fd73f7a984391 (diff)
downloadredis-2e167f7d0e9abb5c49f8f0fb22a3fe2340ad0e31.tar.gz
fix server.repl_down_since resetting, so that slaves could failover
automatically as expected.
Diffstat (limited to 'src/replication.c')
-rw-r--r--src/replication.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/replication.c b/src/replication.c
index 00c2a7199..d5b5dc23c 100644
--- a/src/replication.c
+++ b/src/replication.c
@@ -1087,6 +1087,7 @@ void replicationCreateMasterClient(int fd, int dbid) {
if (server.master->reploff == -1)
server.master->flags |= CLIENT_PRE_PSYNC;
if (dbid != -1) selectDb(server.master,dbid);
+ server.repl_down_since = 0;
}
void restartAOF() {
@@ -1950,7 +1951,6 @@ void replicationSetMaster(char *ip, int port) {
* our own parameters, to later PSYNC with the new master. */
if (was_master) replicationCacheMasterUsingMyself();
server.repl_state = REPL_STATE_CONNECT;
- server.repl_down_since = 0;
}
/* Cancel replication, setting the instance as a master itself. */