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

Method restoreSnapshot

src/snapshot.cpp:160–171  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

158}
159
160void redisDbPersistentData::restoreSnapshot(const redisDbPersistentDataSnapshot *psnapshot)
161{
162 serverAssert(psnapshot->m_refCount == 1);
163 serverAssert(m_spdbSnapshotHOLDER.get() == psnapshot);
164
165 m_pdbSnapshot = psnapshot; // if it was deleted restore it
166 size_t expectedSize = psnapshot->size();
167 dictEmpty(m_pdict, nullptr);
168 dictEmpty(m_pdictTombstone, nullptr);
169 endSnapshot(psnapshot);
170 serverAssert(size() == expectedSize);
171}
172
173// This function is all about minimizing the amount of work done under global lock
174// when there has been lots of changes since snapshot creation a naive endSnapshot()

Callers 1

restoreDbBackupFunction · 0.80

Calls 3

dictEmptyFunction · 0.85
getMethod · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected