From 926beaa3c40bf31e4c28308c52f7f26c4087ed50 Mon Sep 17 00:00:00 2001 From: antirez Date: Tue, 16 Jan 2018 15:52:13 +0100 Subject: [PATCH] Hopefully more clear comment to explain the change in #4607. --- src/replication.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/replication.c b/src/replication.c index 97516300..87e5aed0 100644 --- a/src/replication.c +++ b/src/replication.c @@ -1971,9 +1971,10 @@ void replicationUnsetMaster(void) { * master switch. */ server.slaveseldb = -1; - /* We need to remember the time when we became a master and lost all - * attached slaves (if we had any), as after some time we'll free the - * replication backlog. */ + /* Once we turn from slave to master, we consider the starting time without + * slaves (that is used to count the replication backlog time to live) as + * starting from now. Otherwise the backlog will be freed after a + * failover if slaves do not connect immediately. */ server.repl_no_slaves_since = server.unixtime; }