diff options
author | antirez <antirez@gmail.com> | 2018-08-27 12:09:08 +0200 |
---|---|---|
committer | antirez <antirez@gmail.com> | 2018-08-27 12:20:27 +0200 |
commit | 067647a78315cfa81bf489128afd6f4ae1388603 (patch) | |
tree | 294676823f6061a57714d32ca007bac34da4dfa7 /src/evict.c | |
parent | abf52c7cf412e2b7fd1235cb85248d23db295b48 (diff) | |
download | redis-067647a78315cfa81bf489128afd6f4ae1388603.tar.gz |
Introduce repl_slave_ignore_maxmemory flag internally.
Note: this breaks backward compatibility with Redis 4, since now slaves
by default are exact copies of masters and do not try to evict keys
independently.
Diffstat (limited to 'src/evict.c')
-rw-r--r-- | src/evict.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/src/evict.c b/src/evict.c index ecc25dd8e..cdb49a551 100644 --- a/src/evict.c +++ b/src/evict.c @@ -444,6 +444,10 @@ int getMaxmemoryState(size_t *total, size_t *logical, size_t *tofree, float *lev * Otehrwise if we are over the memory limit, but not enough memory * was freed to return back under the limit, the function returns C_ERR. */ int freeMemoryIfNeeded(void) { + /* By default slaves should ignore maxmemory and just be masters excat + * copies. */ + if (server.masterhost && server.repl_slave_ignore_maxmemory) return C_OK; + size_t mem_reported, mem_tofree, mem_freed; mstime_t latency, eviction_latency; long long delta; |