diff --git a/src/replication.c b/src/replication.c index 064d2bece0e827f4713d1d267307e819f493dde5..68fd802934479c92c303996aaa6ce28b81f46930 100644 --- a/src/replication.c +++ b/src/replication.c @@ -1970,6 +1970,11 @@ void replicationUnsetMaster(void) { * with PSYNC version 2, there is no need for full resync after a * 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. */ + server.repl_no_slaves_since = server.unixtime; } /* This function is called when the slave lose the connection with the