From f504cf233bd08d56b1aa4af6c1ef3a2b4aa0ac60 Mon Sep 17 00:00:00 2001 From: "zhaozhao.zz" Date: Tue, 10 Sep 2024 03:13:18 +0800 Subject: [PATCH] add assertion for kvstore's dictType (#1004) Signed-off-by: zhaozhao.zz --- src/kvstore.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/kvstore.c b/src/kvstore.c index ca48f8df5..66f92db54 100644 --- a/src/kvstore.c +++ b/src/kvstore.c @@ -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;