mirror of
https://codeberg.org/redict/redict.git
synced 2025-01-23 00:28:26 -05:00
convert the zipmap into hash in rdb loading if the zipmap has too many elements
This commit is contained in:
parent
4d60dea853
commit
f8956ed6d8
@ -838,7 +838,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…
Reference in New Issue
Block a user