summaryrefslogtreecommitdiff
path: root/src/replication.c
diff options
context:
space:
mode:
authorantirez <antirez@gmail.com>2018-01-16 15:52:13 +0100
committerantirez <antirez@gmail.com>2018-01-16 15:52:13 +0100
commitb23927b240c68139700b7ac4bd4ce9370503aa60 (patch)
treeadb95cfa9eaba1dd3f2dfd489108ad8df3a2ff5f /src/replication.c
parent0cc43760d774520d5a8c3b6b0f3a35694fc504fc (diff)
downloadredis-b23927b240c68139700b7ac4bd4ce9370503aa60.tar.gz
Hopefully more clear comment to explain the change in #4607.
Diffstat (limited to 'src/replication.c')
-rw-r--r--src/replication.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/replication.c b/src/replication.c
index 68fd80293..a9fe1d66a 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;
}