From 2e1979a21e0d30e8dacb86617f891fb004700fbc Mon Sep 17 00:00:00 2001 From: "zhaozhao.zz" <276441700@qq.com> Date: Tue, 4 Jan 2022 19:08:10 +0800 Subject: use startEvictionTimeProc() in config set maxmemory (#10019) This would mean that the effects of `CONFIG SET maxmemory` may not be visible once the command returns. That could anyway happen since incremental eviction was added in redis 6.2 (see #7653) We do this to fix one of the propagation bugs about eviction see #9890 and #10014. --- src/evict.c | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) (limited to 'src/evict.c') diff --git a/src/evict.c b/src/evict.c index 9d0557df1..933141638 100644 --- a/src/evict.c +++ b/src/evict.c @@ -466,6 +466,14 @@ static int evictionTimeProc( return AE_NOMORE; } +void startEvictionTimeProc(void) { + if (!isEvictionProcRunning) { + isEvictionProcRunning = 1; + aeCreateTimeEvent(server.el, 0, + evictionTimeProc, NULL, NULL); + } +} + /* Check if it's safe to perform evictions. * Returns 1 if evictions can be performed * Returns 0 if eviction processing should be skipped @@ -712,11 +720,7 @@ int performEvictions(void) { * memory, don't want to spend too much time here. */ if (elapsedUs(evictionTimer) > eviction_time_limit_us) { // We still need to free memory - start eviction timer proc - if (!isEvictionProcRunning) { - isEvictionProcRunning = 1; - aeCreateTimeEvent(server.el, 0, - evictionTimeProc, NULL, NULL); - } + startEvictionTimeProc(); break; } } -- cgit v1.2.1