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

Method gcDisposeSnapshot

src/snapshot.cpp:137–158  ·  view source on GitHub ↗

static */

Source from the content-addressed store, hash-verified

135}
136
137/* static */ void redisDbPersistentDataSnapshot::gcDisposeSnapshot(redisDbPersistentDataSnapshot *psnapshot)
138{
139 psnapshot->m_refCount--;
140 if (psnapshot->m_refCount <= 0)
141 {
142 serverAssert(psnapshot->m_refCount == 0);
143 // Remove our ref from any children and dispose them too
144 redisDbPersistentDataSnapshot *psnapshotChild = psnapshot;
145 std::vector<redisDbPersistentDataSnapshot*> vecClean;
146 while ((psnapshotChild = psnapshotChild->m_spdbSnapshotHOLDER.get()) != nullptr)
147 vecClean.push_back(psnapshotChild);
148
149 for (auto psnapshotChild : vecClean)
150 gcDisposeSnapshot(psnapshotChild);
151
152 //psnapshot->m_pdict->iterators--;
153 psnapshot->m_spdbSnapshotHOLDER.release();
154 psnapshot->m_pdbSnapshot = nullptr;
155 g_pserver->garbageCollector.enqueue(serverTL->gcEpoch, std::unique_ptr<redisDbPersistentDataSnapshot>(psnapshot));
156 serverLog(LL_VERBOSE, "Garbage collected snapshot");
157 }
158}
159
160void redisDbPersistentData::restoreSnapshot(const redisDbPersistentDataSnapshot *psnapshot)
161{

Callers

nothing calls this directly

Calls 4

serverLogFunction · 0.85
getMethod · 0.45
releaseMethod · 0.45
enqueueMethod · 0.45

Tested by

no test coverage detected