mirror of
https://github.com/fluencelabs/redis
synced 2025-03-19 17:10:50 +00:00
RDB: expand dict if needed when rdb load object
This commit is contained in:
parent
aba76320d5
commit
24036b4d32
@ -1427,6 +1427,9 @@ robj *rdbLoadObject(int rdbtype, rio *rdb) {
|
|||||||
o = createZsetObject();
|
o = createZsetObject();
|
||||||
zs = o->ptr;
|
zs = o->ptr;
|
||||||
|
|
||||||
|
if (zsetlen > DICT_HT_INITIAL_SIZE)
|
||||||
|
dictExpand(zs->dict,zsetlen);
|
||||||
|
|
||||||
/* Load every single element of the sorted set. */
|
/* Load every single element of the sorted set. */
|
||||||
while(zsetlen--) {
|
while(zsetlen--) {
|
||||||
sds sdsele;
|
sds sdsele;
|
||||||
@ -1495,6 +1498,9 @@ robj *rdbLoadObject(int rdbtype, rio *rdb) {
|
|||||||
sdsfree(value);
|
sdsfree(value);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (o->encoding == OBJ_ENCODING_HT && len > DICT_HT_INITIAL_SIZE)
|
||||||
|
dictExpand(o->ptr,len);
|
||||||
|
|
||||||
/* Load remaining fields and values into the hash table */
|
/* Load remaining fields and values into the hash table */
|
||||||
while (o->encoding == OBJ_ENCODING_HT && len > 0) {
|
while (o->encoding == OBJ_ENCODING_HT && len > 0) {
|
||||||
len--;
|
len--;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user