diff --git a/src/replication.c b/src/replication.c index 86e138ca4..8177eb073 100644 --- a/src/replication.c +++ b/src/replication.c @@ -2703,6 +2703,9 @@ void replicationUnsetMaster(void) { * 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; + + /* Reset down time so it'll be ready for when we turn into replica again. */ + server.repl_down_since = 0; /* Fire the role change modules event. */ moduleFireServerEvent(REDISMODULE_EVENT_REPLICATION_ROLE_CHANGED, diff --git a/src/server.c b/src/server.c index cec63fff0..993260619 100644 --- a/src/server.c +++ b/src/server.c @@ -5120,7 +5120,8 @@ sds genRedisInfoString(const char *section) { if (server.repl_state != REPL_STATE_CONNECTED) { info = sdscatprintf(info, "master_link_down_since_seconds:%jd\r\n", - (intmax_t)(server.unixtime-server.repl_down_since)); + server.repl_down_since ? + (intmax_t)(server.unixtime-server.repl_down_since) : -1); } info = sdscatprintf(info, "slave_priority:%d\r\n"