summaryrefslogtreecommitdiff
path: root/src/evict.c
diff options
context:
space:
mode:
authorSalvatore Sanfilippo <antirez@gmail.com>2017-06-23 11:39:02 +0200
committerGitHub <noreply@github.com>2017-06-23 11:39:02 +0200
commit936ade80b2dc2019bfc2dc20de024ede91d6eacb (patch)
tree5437688a09fc65943061af062e7bfcf4b5d7faea /src/evict.c
parent8b768e8ea4a0616e71645e2e812803026765ba16 (diff)
parenta3e53cf9bcf05671e3ac4a170bb6791dbff62eec (diff)
downloadredis-936ade80b2dc2019bfc2dc20de024ede91d6eacb.tar.gz
Merge pull request #4028 from zintrepid/prevent_expirations_while_paused
Prevent expirations and evictions while paused
Diffstat (limited to 'src/evict.c')
-rw-r--r--src/evict.c6
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();