Do not update the LRU info on key lookup when we have a saving child. With this trivial change the additional memory used while saving with a background child in presence of many read operations is zero.

This commit is contained in:
antirez 2010-11-02 18:59:48 +01:00
parent 3ce014c766
commit 7d0966a6b7

View File

@ -11,8 +11,11 @@ robj *lookupKey(redisDb *db, robj *key) {
if (de) {
robj *val = dictGetEntryVal(de);
/* Update the access time for the aging algorithm. */
val->lru = server.lruclock;
/* Update the access time for the aging algorithm.
* Don't do it if we have a saving child, as this will trigger
* a copy on write madness. */
if (server.bgsavechildpid == -1 && server.bgrewritechildpid == -1)
val->lru = server.lruclock;
if (server.vm_enabled) {
if (val->storage == REDIS_VM_MEMORY ||