Skip to content

Commit

Permalink
add assertion for kvstore's dictType (valkey-io#1004)
Browse files Browse the repository at this point in the history
Signed-off-by: zhaozhao.zz <zhaozhao.zz@alibaba-inc.com>
  • Loading branch information
soloestoy authored Sep 9, 2024
1 parent 20d583f commit f504cf2
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/kvstore.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit f504cf2

Please sign in to comment.