summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWuYunlong <xzsyeb@126.com>2018-06-30 09:39:08 +0800
committerantirez <antirez@gmail.com>2018-08-03 17:07:23 +0200
commit8c6223f91d629efdf1f4e89002f188fd2914fe00 (patch)
tree4def4f5dfe88bb70513e37ca81a0f50bc6928897
parent9535c21515edeb71126ce02cd2e70147073996c2 (diff)
downloadredis-8c6223f91d629efdf1f4e89002f188fd2914fe00.tar.gz
fix server.repl_down_since resetting, so that slaves could failover
automatically as expected.
-rw-r--r--src/replication.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/replication.c b/src/replication.c
index 29f49a699..19ef497f3 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() {
@@ -1942,7 +1943,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. */