Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix for when active rehashing kvstore dictionaries are replaced by defrag #1512

Merged
merged 1 commit into from
Jan 6, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions src/kvstore.c
Original file line number Diff line number Diff line change
Expand Up @@ -753,7 +753,13 @@ void kvstoreDictLUTDefrag(kvstore *kvs, kvstoreDictLUTDefragFunction *defragfn)
for (int didx = 0; didx < kvs->num_dicts; didx++) {
dict **d = kvstoreGetDictRef(kvs, didx), *newd;
if (!*d) continue;
/* In case we will defrag the dictionary while it is registered to active-rehashing
* we need to make sure to update the registration in the rehashing list.
* So we keep the list node and after the defrag operation completes we reassign the value to the
* dictionary pointer. */
listNode *rehashing_node = ((kvstoreDictMetadata *)dictMetadata(*d))->rehashing_node;
if ((newd = defragfn(*d))) *d = newd;
if (rehashing_node) listNodeValue(rehashing_node) = *d;
}
}

Expand Down
Loading