Unverified Commit be520829 authored by Salvatore Sanfilippo's avatar Salvatore Sanfilippo Committed by GitHub
Browse files

Merge pull request #6845 from oranagra/maxmemory_warning

fix maxmemory config warning
parents 13741fb9 a17bddf2
...@@ -1995,8 +1995,9 @@ static int updateMaxmemory(long long val, long long prev, char **err) { ...@@ -1995,8 +1995,9 @@ static int updateMaxmemory(long long val, long long prev, char **err) {
UNUSED(prev); UNUSED(prev);
UNUSED(err); UNUSED(err);
if (val) { if (val) {
if ((unsigned long long)val < zmalloc_used_memory()) { size_t used = zmalloc_used_memory()-freeMemoryGetNotCountedMemory();
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."); 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(); freeMemoryIfNeededAndSafe();
} }
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment