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
e7546c63
Commit
e7546c63
authored
Jan 05, 2010
by
antirez
Browse files
BGREWRITEAOF now works with swapping on
parent
1b03836c
Changes
2
Hide whitespace changes
Inline
Side-by-side
redis.c
View file @
e7546c63
...
@@ -6527,9 +6527,20 @@ static int rewriteAppendOnlyFile(char *filename) {
...
@@ -6527,9 +6527,20 @@ static int rewriteAppendOnlyFile(char *filename) {
/* Iterate this DB writing every entry */
/* Iterate this DB writing every entry */
while
((
de
=
dictNext
(
di
))
!=
NULL
)
{
while
((
de
=
dictNext
(
di
))
!=
NULL
)
{
robj
*
key
=
dictGetEntryKey
(
de
);
robj
*
key
,
*
o
;
robj
*
o
=
dictGetEntryVal
(
de
);
time_t
expiretime
;
time_t
expiretime
=
getExpire
(
db
,
key
);
int
swapped
;
key
=
dictGetEntryKey
(
de
);
if
(
key
->
storage
==
REDIS_VM_MEMORY
)
{
o
=
dictGetEntryVal
(
de
);
swapped
=
0
;
}
else
{
o
=
vmPreviewObject
(
key
);
key
=
dupStringObject
(
key
);
swapped
=
1
;
}
expiretime
=
getExpire
(
db
,
key
);
/* Save the key and associated value */
/* Save the key and associated value */
if
(
o
->
type
==
REDIS_STRING
)
{
if
(
o
->
type
==
REDIS_STRING
)
{
...
@@ -6597,6 +6608,12 @@ static int rewriteAppendOnlyFile(char *filename) {
...
@@ -6597,6 +6608,12 @@ static int rewriteAppendOnlyFile(char *filename) {
if
(
fwriteBulk
(
fp
,
key
)
==
0
)
goto
werr
;
if
(
fwriteBulk
(
fp
,
key
)
==
0
)
goto
werr
;
if
(
fwriteBulkLong
(
fp
,
expiretime
)
==
0
)
goto
werr
;
if
(
fwriteBulkLong
(
fp
,
expiretime
)
==
0
)
goto
werr
;
}
}
/* We created a few temp objects if the key->value pair
* was about a swapped out object. Free both. */
if
(
swapped
)
{
decrRefCount
(
key
);
decrRefCount
(
o
);
}
}
}
dictReleaseIterator
(
di
);
dictReleaseIterator
(
di
);
}
}
...
...
redis.conf
View file @
e7546c63
...
@@ -49,9 +49,12 @@ databases 16
...
@@ -49,9 +49,12 @@ databases 16
# after 900 sec (15 min) if at least 1 key changed
# after 900 sec (15 min) if at least 1 key changed
# after 300 sec (5 min) if at least 10 keys changed
# after 300 sec (5 min) if at least 10 keys changed
# after 60 sec if at least 10000 keys changed
# after 60 sec if at least 10000 keys changed
save
900
1
#
save
300
10
# Note: you can disable saving at all commenting all the "save" lines.
save
60
10000
#save 900 1
#save 300 10
#save 60 10000
# Compress string objects using LZF when dump .rdb databases?
# Compress string objects using LZF when dump .rdb databases?
# For default that's set to 'yes' as it's almost always a win.
# For default that's set to 'yes' as it's almost always a win.
...
...
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