add assertion for kvstore's dictType (#1004)

Signed-off-by: zhaozhao.zz <zhaozhao.zz@alibaba-inc.com>
Signed-off-by: Ping Xie <pingxie@google.com>
This commit is contained in:
zhaozhao.zz 2024-09-10 03:13:18 +08:00 committed by Ping Xie
parent 9e10a3d712
commit cbb5a3be8b

View File

@ -255,6 +255,12 @@ kvstore *kvstoreCreate(dictType *type, int num_dicts_bits, int flags) {
* for the dict cursor, see kvstoreScan */
assert(num_dicts_bits <= 16);
/* The dictType of kvstore needs to use the specific callbacks.
* If there are any changes in the future, it will need to be modified. */
assert(type->rehashingStarted == kvstoreDictRehashingStarted);
assert(type->rehashingCompleted == kvstoreDictRehashingCompleted);
assert(type->dictMetadataBytes == kvstoreDictMetadataSize);
kvstore *kvs = zcalloc(sizeof(*kvs));
kvs->dtype = type;
kvs->flags = flags;