Commit 5ed66621 authored by Wang Yuan's avatar Wang Yuan Committed by Oran Agra
Browse files

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. 

(cherry picked from commit c85bf235)
parent f885e364
...@@ -416,6 +416,9 @@ long long emptyDbGeneric(redisDb *dbarray, int dbnum, int flags, void(callback)( ...@@ -416,6 +416,9 @@ long long emptyDbGeneric(redisDb *dbarray, int dbnum, int flags, void(callback)(
dictEmpty(dbarray[j].dict,callback); dictEmpty(dbarray[j].dict,callback);
dictEmpty(dbarray[j].expires,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 */ /* Post-flush actions */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment