mirror of
https://github.com/fluencelabs/redis
synced 2025-04-30 04:52:13 +00:00
convert the zipmap into hash in rdb loading if the zipmap has too many elements
This commit is contained in:
parent
cebac46589
commit
44d4b87f1f
@ -893,7 +893,12 @@ robj *rdbLoadObject(int type, FILE *fp) {
|
|||||||
o->ptr = zmalloc(sdslen(aux->ptr));
|
o->ptr = zmalloc(sdslen(aux->ptr));
|
||||||
memcpy(o->ptr,aux->ptr,sdslen(aux->ptr));
|
memcpy(o->ptr,aux->ptr,sdslen(aux->ptr));
|
||||||
decrRefCount(aux);
|
decrRefCount(aux);
|
||||||
/* FIXME: conver the object if needed */
|
/* Convert to real hash if the number of items is too large.
|
||||||
|
* We don't check the max item size as this requires an O(N)
|
||||||
|
* scan usually. */
|
||||||
|
if (zipmapLen(o->ptr) > server.hash_max_zipmap_entries) {
|
||||||
|
convertToRealHash(o);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
redisPanic("Unknown object type");
|
redisPanic("Unknown object type");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user