mirror of
https://github.com/fluencelabs/redis
synced 2025-06-14 09:41:21 +00:00
Prevent expirations and evictions while paused
Proposed fix to https://github.com/antirez/redis/issues/4027
This commit is contained in:
10
src/server.c
10
src/server.c
@ -777,6 +777,11 @@ void activeExpireCycle(int type) {
|
|||||||
int dbs_per_call = CRON_DBS_PER_CALL;
|
int dbs_per_call = CRON_DBS_PER_CALL;
|
||||||
long long start = ustime(), timelimit;
|
long long start = ustime(), timelimit;
|
||||||
|
|
||||||
|
/* When clients are paused the dataset should be static not just from the
|
||||||
|
* POV of clients not being able to write, but also from the POV of
|
||||||
|
* expires and evictions of keys not being performed. */
|
||||||
|
if (clientsArePaused()) return;
|
||||||
|
|
||||||
if (type == ACTIVE_EXPIRE_CYCLE_FAST) {
|
if (type == ACTIVE_EXPIRE_CYCLE_FAST) {
|
||||||
/* Don't start a fast cycle if the previous cycle did not exited
|
/* Don't start a fast cycle if the previous cycle did not exited
|
||||||
* for time limt. Also don't repeat a fast cycle for the same period
|
* for time limt. Also don't repeat a fast cycle for the same period
|
||||||
@ -3464,6 +3469,11 @@ int freeMemoryIfNeeded(void) {
|
|||||||
int slaves = listLength(server.slaves);
|
int slaves = listLength(server.slaves);
|
||||||
mstime_t latency, eviction_latency;
|
mstime_t latency, eviction_latency;
|
||||||
|
|
||||||
|
/* When clients are paused the dataset should be static not just from the
|
||||||
|
* POV of clients not being able to write, but also from the POV of
|
||||||
|
* expires and evictions of keys not being performed. */
|
||||||
|
if (clientsArePaused()) return C_OK;
|
||||||
|
|
||||||
/* Remove the size of slaves output buffers and AOF buffer from the
|
/* Remove the size of slaves output buffers and AOF buffer from the
|
||||||
* count of used memory. */
|
* count of used memory. */
|
||||||
mem_used = zmalloc_used_memory();
|
mem_used = zmalloc_used_memory();
|
||||||
|
Reference in New Issue
Block a user