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
6ddc908a
Commit
6ddc908a
authored
May 31, 2010
by
Pieter Noordhuis
Browse files
support rewriting the AOF with dual list encoding
parent
9eaef89f
Changes
1
Show whitespace changes
Inline
Side-by-side
redis.c
View file @
6ddc908a
...
@@ -8843,19 +8843,42 @@ static int rewriteAppendOnlyFile(char *filename) {
...
@@ -8843,19 +8843,42 @@ static int rewriteAppendOnlyFile(char *filename) {
if
(
fwriteBulkObject
(
fp
,
o
)
==
0
)
goto
werr
;
if
(
fwriteBulkObject
(
fp
,
o
)
==
0
)
goto
werr
;
}
else
if
(
o
->
type
==
REDIS_LIST
)
{
}
else
if
(
o
->
type
==
REDIS_LIST
)
{
/* Emit the RPUSHes needed to rebuild the list */
/* Emit the RPUSHes needed to rebuild the list */
char
cmd
[]
=
"*3
\r\n
$5
\r\n
RPUSH
\r\n
"
;
if
(
o
->
encoding
==
REDIS_ENCODING_ZIPLIST
)
{
unsigned
char
*
zl
=
o
->
ptr
;
unsigned
char
*
p
=
ziplistIndex
(
zl
,
0
);
unsigned
char
*
vstr
;
unsigned
int
vlen
;
long
long
vlong
;
while
(
ziplistGet
(
p
,
&
vstr
,
&
vlen
,
&
vlong
))
{
if
(
fwrite
(
cmd
,
sizeof
(
cmd
)
-
1
,
1
,
fp
)
==
0
)
goto
werr
;
if
(
fwriteBulkObject
(
fp
,
key
)
==
0
)
goto
werr
;
if
(
vstr
)
{
if
(
fwriteBulkString
(
fp
,(
char
*
)
vstr
,
vlen
)
==
0
)
goto
werr
;
}
else
{
if
(
fwriteBulkLongLong
(
fp
,
vlong
)
==
0
)
goto
werr
;
}
p
=
ziplistNext
(
zl
,
p
);
}
}
else
if
(
o
->
encoding
==
REDIS_ENCODING_LIST
)
{
list
*
list
=
o
->
ptr
;
list
*
list
=
o
->
ptr
;
listNode
*
ln
;
listNode
*
ln
;
listIter
li
;
listIter
li
;
listRewind
(
list
,
&
li
);
listRewind
(
list
,
&
li
);
while
((
ln
=
listNext
(
&
li
)))
{
while
((
ln
=
listNext
(
&
li
)))
{
char
cmd
[]
=
"*3
\r\n
$5
\r\n
RPUSH
\r\n
"
;
robj
*
eleobj
=
listNodeValue
(
ln
);
robj
*
eleobj
=
listNodeValue
(
ln
);
if
(
fwrite
(
cmd
,
sizeof
(
cmd
)
-
1
,
1
,
fp
)
==
0
)
goto
werr
;
if
(
fwrite
(
cmd
,
sizeof
(
cmd
)
-
1
,
1
,
fp
)
==
0
)
goto
werr
;
if
(
fwriteBulkObject
(
fp
,
key
)
==
0
)
goto
werr
;
if
(
fwriteBulkObject
(
fp
,
key
)
==
0
)
goto
werr
;
if
(
fwriteBulkObject
(
fp
,
eleobj
)
==
0
)
goto
werr
;
if
(
fwriteBulkObject
(
fp
,
eleobj
)
==
0
)
goto
werr
;
}
}
}
else
{
redisPanic
(
"Unknown list encoding"
);
}
}
else
if
(
o
->
type
==
REDIS_SET
)
{
}
else
if
(
o
->
type
==
REDIS_SET
)
{
/* Emit the SADDs needed to rebuild the set */
/* Emit the SADDs needed to rebuild the set */
dict
*
set
=
o
->
ptr
;
dict
*
set
=
o
->
ptr
;
...
...
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