MCPcopy Create free account
hub / github.com/F-Stack/f-stack / dictDefragTables

Function dictDefragTables

app/redis-6.2.6/src/defrag.c:164–178  ·  view source on GitHub ↗

Defrag helper for dict main allocations (dict struct, and hash tables). * receives a pointer to the dict* and implicitly updates it when the dict * struct itself was moved. Returns a stat of how many pointers were moved. */

Source from the content-addressed store, hash-verified

162 * receives a pointer to the dict* and implicitly updates it when the dict
163 * struct itself was moved. Returns a stat of how many pointers were moved. */
164long dictDefragTables(dict* d) {
165 dictEntry **newtable;
166 long defragged = 0;
167 /* handle the first hash table */
168 newtable = activeDefragAlloc(d->ht[0].table);
169 if (newtable)
170 defragged++, d->ht[0].table = newtable;
171 /* handle the second hash table */
172 if (d->ht[1].table) {
173 newtable = activeDefragAlloc(d->ht[1].table);
174 if (newtable)
175 defragged++, d->ht[1].table = newtable;
176 }
177 return defragged;
178}
179
180/* Internal function used by zslDefrag */
181void zslUpdateNode(zskiplist *zsl, zskiplistNode *oldnode, zskiplistNode *newnode, zskiplistNode **update) {

Callers 3

defragZsetSkiplistFunction · 0.85
defragHashFunction · 0.85
defragSetFunction · 0.85

Calls 1

activeDefragAllocFunction · 0.85

Tested by

no test coverage detected