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

Function defragSet

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

Source from the content-addressed store, hash-verified

611}
612
613long defragSet(redisDb *db, dictEntry *kde) {
614 long defragged = 0;
615 robj *ob = dictGetVal(kde);
616 dict *d, *newd;
617 serverAssert(ob->type == OBJ_SET && ob->encoding == OBJ_ENCODING_HT);
618 d = ob->ptr;
619 if (dictSize(d) > server.active_defrag_max_scan_fields)
620 defragLater(db, kde);
621 else
622 defragged += activeDefragSdsDict(d, DEFRAG_SDS_DICT_NO_VAL);
623 /* handle the dict struct */
624 if ((newd = activeDefragAlloc(ob->ptr)))
625 defragged++, ob->ptr = newd;
626 /* defrag the dict tables */
627 defragged += dictDefragTables(ob->ptr);
628 return defragged;
629}
630
631/* Defrag callback for radix tree iterator, called for each node,
632 * used in order to defrag the nodes allocations. */

Callers 1

defragKeyFunction · 0.85

Calls 4

defragLaterFunction · 0.85
activeDefragSdsDictFunction · 0.85
activeDefragAllocFunction · 0.85
dictDefragTablesFunction · 0.85

Tested by

no test coverage detected