diff options
author | Viktor Söderqvist <viktor.soderqvist@est.tech> | 2022-11-20 23:23:54 +0100 |
---|---|---|
committer | Viktor Söderqvist <viktor.soderqvist@est.tech> | 2023-01-11 10:25:20 +0100 |
commit | b60d33c91eef09aea34cecad789c552405737c55 (patch) | |
tree | d106927d7b6ef9d64d530a9722c6affa3dbe7e83 /src/object.c | |
parent | d4e9e0aebdc2c44c252e8ca27644b4392a6e820b (diff) | |
download | redis-b60d33c91eef09aea34cecad789c552405737c55.tar.gz |
Remove the bucket-cb from dictScan and move dictEntry defrag to dictScanDefrag
This change deletes the dictGetNext and dictGetNextRef functions, so the
dict API doesn't expose the next field at all.
The bucket function in dictScan is deleted. A separate dictScanDefrag function
is added which takes a defrag alloc function to defrag-reallocate the dict entries.
"Dirty" code accessing the dict internals in active defrag is removed.
An 'afterReplaceEntry' is added to dictType, which allows the dict user
to keep the dictEntry metadata up to date after reallocation/defrag/move.
Additionally, for updating the cluster slot-to-key mapping, after a dictEntry
has been reallocated, we need to know which db a dict belongs to, so we store
a pointer to the db in a new metadata section in the dict struct, which is
a new mechanism similar to dictEntry metadata. This adds some complexity but
provides better isolation.
Diffstat (limited to 'src/object.c')
-rw-r--r-- | src/object.c | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/object.c b/src/object.c index ca9a24088..67e372032 100644 --- a/src/object.c +++ b/src/object.c @@ -1252,7 +1252,8 @@ struct redisMemOverhead *getMemoryOverheadData(void) { mem_total+=mem; /* Account for the slot to keys map in cluster mode */ - mem = dictSize(db->dict) * dictMetadataSize(db->dict); + mem = dictSize(db->dict) * dictEntryMetadataSize(db->dict) + + dictMetadataSize(db->dict); mh->db[mh->num_dbs].overhead_ht_slot_to_keys = mem; mem_total+=mem; |