From 84fd745d65013bfdfc6d5482ebfbb1a1b7d66e05 Mon Sep 17 00:00:00 2001 From: Binbin Date: Tue, 6 Feb 2024 15:41:14 +0800 Subject: [PATCH] Fix kvstore unable to push resize_cursor for resize when dict is NULL (#13031) When the dict is NULL, we also need to push resize_cursor, otherwise it will keep doing useless continue here, and there is no way to resize the other dict behind it. Introduced in #12822. --------- Co-authored-by: Oran Agra --- src/kvstore.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/src/kvstore.c b/src/kvstore.c index d9ca45adb..a3dde2379 100644 --- a/src/kvstore.c +++ b/src/kvstore.c @@ -578,9 +578,7 @@ void kvstoreTryResizeDicts(kvstore *kvs, int limit) { for (int i = 0; i < limit; i++) { int didx = kvs->resize_cursor; dict *d = kvstoreGetDict(kvs, didx); - if (!d) - continue; - if (dictShrinkIfNeeded(d) == DICT_ERR) { + if (d && dictShrinkIfNeeded(d) == DICT_ERR) { dictExpandIfNeeded(d); } kvs->resize_cursor = (didx + 1) % kvs->num_dicts;