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
1bc18373
Commit
1bc18373
authored
Jun 02, 2010
by
antirez
Browse files
better swapout policy while loading RDB file
parent
2691b01b
Changes
1
Hide whitespace changes
Inline
Side-by-side
redis.c
View file @
1bc18373
...
...
@@ -4076,6 +4076,7 @@ static int rdbLoad(char *filename) {
}
while
(
1
)
{
robj
*
key
,
*
val
;
int
force_swapout
;
expiretime
=
-
1
;
/* Read type. */
...
...
@@ -4140,9 +4141,13 @@ static int rdbLoad(char *filename) {
continue
;
}
force_swapout
=
0
;
if
((
zmalloc_used_memory
()
-
server
.
vm_max_memory
)
>
1024
*
1024
*
32
)
force_swapout
=
1
;
/* If we have still some hope of having some value fitting memory
* then we try random sampling. */
if
(
!
swap_all_values
&&
server
.
vm_enabled
&&
(
loadedkeys
%
5000
)
==
0
)
{
if
(
!
swap_all_values
&&
server
.
vm_enabled
&&
force_swapout
)
{
while
(
zmalloc_used_memory
()
>
server
.
vm_max_memory
)
{
if
(
vmSwapOneObjectBlocking
()
==
REDIS_ERR
)
break
;
}
...
...
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