Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
936ade80
Commit
936ade80
authored
Jun 23, 2017
by
Salvatore Sanfilippo
Committed by
GitHub
Jun 23, 2017
Browse files
Merge pull request #4028 from zintrepid/prevent_expirations_while_paused
Prevent expirations and evictions while paused
parents
8b768e8e
a3e53cf9
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/evict.c
View file @
936ade80
...
@@ -380,6 +380,12 @@ int freeMemoryIfNeeded(void) {
...
@@ -380,6 +380,12 @@ int freeMemoryIfNeeded(void) {
long
long
delta
;
long
long
delta
;
int
slaves
=
listLength
(
server
.
slaves
);
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
/* 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. */
* to subtract the slaves output buffers. We can just return ASAP. */
mem_reported
=
zmalloc_used_memory
();
mem_reported
=
zmalloc_used_memory
();
...
...
src/expire.c
View file @
936ade80
...
@@ -105,6 +105,10 @@ void activeExpireCycle(int type) {
...
@@ -105,6 +105,10 @@ 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
;
/* We cannot expire keys while clients are paused as the dataset is
* supposed to be static. */
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
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment