Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
22996414
Commit
22996414
authored
Mar 31, 2017
by
spinlock
Committed by
antirez
Apr 18, 2017
Browse files
rdb: saving skiplist in reversed order to accelerate the deserialisation process
parent
d98ef35a
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/rdb.c
View file @
22996414
...
...
@@ -704,23 +704,24 @@ ssize_t rdbSaveObject(rio *rdb, robj *o) {
nwritten
+=
n
;
}
else
if
(
o
->
encoding
==
OBJ_ENCODING_SKIPLIST
)
{
zset
*
zs
=
o
->
ptr
;
dictIterator
*
di
=
dictGetIterator
(
zs
->
dict
);
dictEntry
*
de
;
zskiplist
*
zsl
=
zs
->
zsl
;
if
((
n
=
rdbSaveLen
(
rdb
,
dictSize
(
zs
->
dict
)
))
==
-
1
)
return
-
1
;
if
((
n
=
rdbSaveLen
(
rdb
,
zs
l
->
length
))
==
-
1
)
return
-
1
;
nwritten
+=
n
;
while
((
de
=
dictNext
(
di
))
!=
NULL
)
{
sds
ele
=
dictGetKey
(
de
);
double
*
score
=
dictGetVal
(
de
);
zskiplistNode
*
zn
=
zsl
->
tail
;
while
(
zn
!=
NULL
)
{
sds
ele
=
zn
->
ele
;
double
*
score
=
&
zn
->
score
;
if
((
n
=
rdbSaveRawString
(
rdb
,(
unsigned
char
*
)
ele
,
sdslen
(
ele
)))
==
-
1
)
return
-
1
;
nwritten
+=
n
;
if
((
n
=
rdbSaveBinaryDoubleValue
(
rdb
,
*
score
))
==
-
1
)
return
-
1
;
nwritten
+=
n
;
zn
=
zn
->
backward
;
}
dictReleaseIterator
(
di
);
}
else
{
serverPanic
(
"Unknown sorted set encoding"
);
}
...
...
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