Reset average ttl when empty databases (#8106)

On FLUSHDB or full sync, reset old average TTL stat.
This Stat is incrementally collected by the master over time when it searches for expired keys.
This commit is contained in:
Wang Yuan 2020-12-01 05:15:14 +08:00 committed by GitHub
parent e6d423362a
commit b6916ca91c

View File

@ -416,6 +416,9 @@ long long emptyDbGeneric(redisDb *dbarray, int dbnum, int flags, void(callback)(
dictEmpty(dbarray[j].dict,callback);
dictEmpty(dbarray[j].expires,callback);
}
/* Because we will start a new database, reset average ttl. */
dbarray[j].avg_ttl = 0;
dbarray[j].expires_cursor = 0;
}
/* Post-flush actions */