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
23ec3690
Commit
23ec3690
authored
Mar 31, 2017
by
spinlock
Browse files
rdb: saving skiplist in reversed order to accelerate the deserialisation process
parent
271733f4
Changes
1
Hide whitespace changes
Inline
Side-by-side
src/rdb.c
View file @
23ec3690
...
...
@@ -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