diff options
author | Wang Yuan <wangyuancode@163.com> | 2020-12-01 05:15:14 +0800 |
---|---|---|
committer | Oran Agra <oran@redislabs.com> | 2021-01-12 16:25:37 +0200 |
commit | 5ed6662145b1cb43003850894c99439725206db0 (patch) | |
tree | a2ebdfcabf93b06905552725c6d0b940e49f3d2c | |
parent | f885e364ba9b9fe83b9b94e665547d70040ee89c (diff) | |
download | redis-5ed6662145b1cb43003850894c99439725206db0.tar.gz |
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 c85bf2352d2a3dd04872124d33066403b114a7e7)
-rw-r--r-- | src/db.c | 3 |
1 files changed, 3 insertions, 0 deletions
@@ -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 */ |