From 4366bbaa616c9043ca4b44e63affc31dfcb6ab24 Mon Sep 17 00:00:00 2001 From: Binbin Date: Wed, 15 Nov 2023 13:55:34 +0800 Subject: [PATCH] Empty rehashing list in emptyDbStructure (#12764) This is currently harmless, since we have already cleared the dict before, it will reset the rehashidx to -1, and in incrementallyRehash we will call dictIsRehashing to check. It would be nice to empty the list to avoid meaningless attempts, and the code is also unified to reduce misunderstandings. --- src/db.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/db.c b/src/db.c index 8260676d42..52ac7965e6 100644 --- a/src/db.c +++ b/src/db.c @@ -684,6 +684,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) { + listEmpty(dbarray[j].sub_dict[subdict].rehashing); 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));