reset bucket_count when empty db (#12750)

Introduced in #12697 , should reset bucket_count when empty db, or the overhead memory usage of db can be miscalculated.
This commit is contained in:
zhaozhao.zz 2023-11-10 21:52:57 +08:00 committed by GitHub
parent cf6ed3feeb
commit 6258edebf0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -664,6 +664,7 @@ long long emptyDbStructure(redisDb *dbarray, int dbnum, int async,
dbarray[j].sub_dict[subdict].key_count = 0; dbarray[j].sub_dict[subdict].key_count = 0;
dbarray[j].sub_dict[subdict].resize_cursor = 0; dbarray[j].sub_dict[subdict].resize_cursor = 0;
if (server.cluster_enabled) { if (server.cluster_enabled) {
dbarray[j].sub_dict[subdict].bucket_count = 0;
unsigned long long *slot_size_index = dbarray[j].sub_dict[subdict].slot_size_index; unsigned long long *slot_size_index = dbarray[j].sub_dict[subdict].slot_size_index;
memset(slot_size_index, 0, sizeof(unsigned long long) * (CLUSTER_SLOTS + 1)); memset(slot_size_index, 0, sizeof(unsigned long long) * (CLUSTER_SLOTS + 1));
} }