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

Method prepOverwriteForSnapshot

src/db.cpp:2695–2710  ·  view source on GitHub ↗

This is a performance tool to prevent us copying over an object we're going to overwrite anyways

Source from the content-addressed store, hash-verified

2693
2694// This is a performance tool to prevent us copying over an object we're going to overwrite anyways
2695void redisDbPersistentData::prepOverwriteForSnapshot(char *key)
2696{
2697 if (g_pserver->maxmemory_policy & MAXMEMORY_FLAG_LFU)
2698 return;
2699
2700 if (m_pdbSnapshot != nullptr)
2701 {
2702 auto itr = m_pdbSnapshot->find_cached_threadsafe(key);
2703 if (itr.key() != nullptr)
2704 {
2705 sds keyNew = sdsdupshared(itr.key());
2706 if (dictAdd(m_pdictTombstone, keyNew, (void*)dictHashKey(m_pdict, key)) != DICT_OK)
2707 sdsfree(keyNew);
2708 }
2709 }
2710}
2711
2712void redisDbPersistentData::tryResize()
2713{

Callers 1

genericSetKeyFunction · 0.80

Calls 5

sdsdupsharedFunction · 0.85
sdsfreeFunction · 0.85
dictAddFunction · 0.70
keyMethod · 0.45

Tested by

no test coverage detected