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
4a9670f5
Commit
4a9670f5
authored
Apr 22, 2018
by
zhaozhao.zz
Committed by
antirez
Jun 12, 2018
Browse files
RDB: expand dict if needed when rdb load object
parent
d5712d21
Changes
1
Show whitespace changes
Inline
Side-by-side
src/rdb.c
View file @
4a9670f5
...
@@ -1441,6 +1441,9 @@ robj *rdbLoadObject(int rdbtype, rio *rdb) {
...
@@ -1441,6 +1441,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
;
...
@@ -1509,6 +1512,9 @@ robj *rdbLoadObject(int rdbtype, rio *rdb) {
...
@@ -1509,6 +1512,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
--
;
...
...
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