summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOran Agra <oran@redislabs.com>2020-02-06 09:23:22 +0200
committerOran Agra <oran@redislabs.com>2020-02-06 09:23:22 +0200
commita17bddf2a14a1bd85a3606d2023fb9bb92004770 (patch)
tree0b1151d6af3ff7601236e78f6c11158e07011285
parent44ac202fbfbca4210d016c9f77df987b27c1ae4c (diff)
downloadredis-a17bddf2a14a1bd85a3606d2023fb9bb92004770.tar.gz
fix maxmemory config warning
the warning condition was if usage > limit (saying it'll cause eviction or oom), but in fact the eviction and oom depends on used minus slave buffers. other than fixing the condition, i add info about the current usage and limit, which may be useful when looking at the log.
-rw-r--r--src/config.c5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/config.c b/src/config.c
index b19e78f74..173a90909 100644
--- a/src/config.c
+++ b/src/config.c
@@ -1995,8 +1995,9 @@ static int updateMaxmemory(long long val, long long prev, char **err) {
UNUSED(prev);
UNUSED(err);
if (val) {
- if ((unsigned long long)val < zmalloc_used_memory()) {
- serverLog(LL_WARNING,"WARNING: the new maxmemory value set via CONFIG SET is smaller than the current memory usage. This will result in key eviction and/or the inability to accept new write commands depending on the maxmemory-policy.");
+ size_t used = zmalloc_used_memory()-freeMemoryGetNotCountedMemory();
+ if ((unsigned long long)val < 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);
}
freeMemoryIfNeededAndSafe();
}