diff options
author | zhaozhao.zz <276441700@qq.com> | 2022-01-04 19:08:10 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-04 13:08:10 +0200 |
commit | 2e1979a21e0d30e8dacb86617f891fb004700fbc (patch) | |
tree | 2c6eeeaf14d29e5abb1a67507bb617a80f1b9099 /src/evict.c | |
parent | 87789fae0b767e47fef78ee994434554f2bf2f31 (diff) | |
download | redis-2e1979a21e0d30e8dacb86617f891fb004700fbc.tar.gz |
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.
Diffstat (limited to 'src/evict.c')
-rw-r--r-- | src/evict.c | 14 |
1 files changed, 9 insertions, 5 deletions
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; } } |