diff options
author | Zachary Marquez <zachary.marquez@mediafire.com> | 2017-06-01 16:24:10 -0500 |
---|---|---|
committer | Zachary Marquez <zachary.marquez@mediafire.com> | 2017-06-01 16:28:40 -0500 |
commit | a3e53cf9bcf05671e3ac4a170bb6791dbff62eec (patch) | |
tree | 4ef05fc881aaa50a6a35a853e275a25aaed4842c /src/evict.c | |
parent | e91b81c612cc8b0cbb4e7f9bc895e5f23d497027 (diff) | |
download | redis-a3e53cf9bcf05671e3ac4a170bb6791dbff62eec.tar.gz |
Prevent expirations and evictions while paused
Proposed fix to https://github.com/antirez/redis/issues/4027
Diffstat (limited to 'src/evict.c')
-rw-r--r-- | src/evict.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/src/evict.c b/src/evict.c index bf5bea6b0..77f63cba5 100644 --- a/src/evict.c +++ b/src/evict.c @@ -380,6 +380,12 @@ int freeMemoryIfNeeded(void) { long long delta; int slaves = listLength(server.slaves); + /* We cannot free memory while clients are paused as this will require + * evictions which modify the dataset and will break the guarantee that + * data will be static while clients are paused. */ + if (clientsArePaused()) + goto cant_free; + /* Check if we are over the memory usage limit. If we are not, no need * to subtract the slaves output buffers. We can just return ASAP. */ mem_reported = zmalloc_used_memory(); |