add assertion for kvstore's dictType (#1004)

Signed-off-by: zhaozhao.zz <zhaozhao.zz@alibaba-inc.com>
This commit is contained in:
zhaozhao.zz 2024-09-10 03:13:18 +08:00 committed by GitHub
parent 20d583f774
commit f504cf233b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

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;