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 <oran@redislabs.com>
This commit is contained in:
Binbin 2024-02-06 15:41:14 +08:00 committed by GitHub
parent 8cd62f82ca
commit 84fd745d65
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 1 additions and 3 deletions

View File

@ -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;