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

Function _dictRehashStep

src/dict.cpp:599–603  ·  view source on GitHub ↗

This function performs just a step of rehashing, and only if hashing has * not been paused for our hash table. When we have iterators in the * middle of a rehashing we can't mess with the two hash tables otherwise * some element can be missed or duplicated. * * This function is called by common lookup or update operations in the * dictionary so that the hash table automatically migrates from

Source from the content-addressed store, hash-verified

597 * dictionary so that the hash table automatically migrates from H1 to H2
598 * while it is actively used. */
599static void _dictRehashStep(dict *d) {
600 int16_t pauserehash;
601 __atomic_load(&d->pauserehash, &pauserehash, __ATOMIC_RELAXED);
602 if (pauserehash == 0) dictRehash(d,1);
603}
604
605/* Add an element to the target hash table */
606int dictAdd(dict *d, void *key, void *val, dictEntry **existing)

Callers 6

dictAddRawFunction · 0.85
dictGenericDeleteFunction · 0.85
dictFindWithPrevFunction · 0.85
dictGetRandomKeyFunction · 0.85
dictGetSomeKeysFunction · 0.85
dictForceRehashFunction · 0.85

Calls 1

dictRehashFunction · 0.85

Tested by

no test coverage detected