From 6258edebf04ef5104409e11c60b60923db0e778f Mon Sep 17 00:00:00 2001 From: "zhaozhao.zz" Date: Fri, 10 Nov 2023 21:52:57 +0800 Subject: [PATCH] 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. --- src/db.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/db.c b/src/db.c index b7df85021..da9722273 100644 --- a/src/db.c +++ b/src/db.c @@ -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].resize_cursor = 0; 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; memset(slot_size_index, 0, sizeof(unsigned long long) * (CLUSTER_SLOTS + 1)); }