mirror of
https://github.com/fluencelabs/redis
synced 2025-03-19 09:00:51 +00:00
Merge pull request #4861 from soloestoy/rdb-dict-expand
RDB: expand dict if needed when rdb load object
This commit is contained in:
commit
9fa2e7020e
@ -1441,6 +1441,9 @@ robj *rdbLoadObject(int rdbtype, rio *rdb) {
|
||||
o = createZsetObject();
|
||||
zs = o->ptr;
|
||||
|
||||
if (zsetlen > DICT_HT_INITIAL_SIZE)
|
||||
dictExpand(zs->dict,zsetlen);
|
||||
|
||||
/* Load every single element of the sorted set. */
|
||||
while(zsetlen--) {
|
||||
sds sdsele;
|
||||
@ -1509,6 +1512,9 @@ robj *rdbLoadObject(int rdbtype, rio *rdb) {
|
||||
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 */
|
||||
while (o->encoding == OBJ_ENCODING_HT && len > 0) {
|
||||
len--;
|
||||
|
Loading…
x
Reference in New Issue
Block a user