diff --git a/src/config.c b/src/config.c index 79e43c301da..1a733788380 100644 --- a/src/config.c +++ b/src/config.c @@ -2252,7 +2252,7 @@ static int updateMaxmemory(const char **err) { if (server.maxmemory < used) { serverLog(LL_WARNING,"WARNING: the new maxmemory value set via CONFIG SET (%llu) is smaller than the current memory usage (%zu). This will result in key eviction and/or the inability to accept new write commands depending on the maxmemory-policy.", server.maxmemory, used); } - performEvictions(); + startEvictionTimeProc(); } return 1; } diff --git a/src/evict.c b/src/evict.c index 9d0557df17e..93314163805 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; } } diff --git a/src/server.h b/src/server.h index 7aa73ab73ce..bbeb2ad8bbf 100644 --- a/src/server.h +++ b/src/server.h @@ -3044,7 +3044,7 @@ unsigned long LFUDecrAndReturn(robj *o); #define EVICT_RUNNING 1 #define EVICT_FAIL 2 int performEvictions(void); - +void startEvictionTimeProc(void); /* Keys hashing / comparison functions for dict.c hash tables. */ uint64_t dictSdsHash(const void *key); diff --git a/tests/unit/moduleapi/propagate.tcl b/tests/unit/moduleapi/propagate.tcl index edeb23531e6..a95fbfd71b9 100644 --- a/tests/unit/moduleapi/propagate.tcl +++ b/tests/unit/moduleapi/propagate.tcl @@ -174,7 +174,8 @@ tags "modules" { # Note whenever there's double notification: SET with EX issues two separate # notifications: one for "set" and one for "expire" - # "config set" should not be here, see https://github.com/redis/redis/issues/10014 + # Note that although CONFIG SET maxmemory is called in this flow (see issue #10014), + # eviction will happen and will not induce propagation of the CONFIG command (see #10019). assert_replication_stream $repl { {select *} {multi} @@ -198,7 +199,6 @@ tags "modules" { {del asdf*} {incr notifications} {del asdf*} - {config set maxmemory 1} {multi} {incr notifications} {set asdf4 4}