Prevent expirations and evictions while paused

Proposed fix to https://github.com/antirez/redis/issues/4027
This commit is contained in:
Zachary Marquez
2017-06-01 16:24:10 -05:00
parent e91b81c612
commit a3e53cf9bc
2 changed files with 10 additions and 0 deletions

View File

@ -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();