MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / defragSet

Function defragSet

src/defrag.cpp:636–652  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

634}
635
636long defragSet(redisDb *db, dictEntry *kde) {
637 long defragged = 0;
638 robj *ob = (robj*)dictGetVal(kde);
639 dict *d, *newd;
640 serverAssert(ob->type == OBJ_SET && ob->encoding == OBJ_ENCODING_HT);
641 d = (dict*)ptrFromObj(ob);
642 if (dictSize(d) > cserver.active_defrag_max_scan_fields)
643 defragLater(db, kde);
644 else
645 defragged += activeDefragSdsDict(d, DEFRAG_SDS_DICT_NO_VAL);
646 /* handle the dict struct */
647 if ((newd = (dict*)activeDefragAlloc(ptrFromObj(ob))))
648 defragged++, ob->m_ptr = newd;
649 /* defrag the dict tables */
650 defragged += dictDefragTables((dict*)ptrFromObj(ob));
651 return defragged;
652}
653
654/* Defrag callback for radix tree iterator, called for each node,
655 * used in order to defrag the nodes allocations. */

Callers 1

defragKeyFunction · 0.85

Calls 5

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

Tested by

no test coverage detected