Fix crash where tombstone is evicted

Former-commit-id: 1f6ff7cc0fc0173610d77a69076eeaf478c3b701
This commit is contained in:
John Sully 2020-06-03 23:30:35 -04:00
parent 6a9b345f56
commit a80b8c1b11

View File

@ -283,13 +283,18 @@ void redisDbPersistentData::endSnapshot(const redisDbPersistentDataSnapshot *psn
while ((de = dictNext(di)) != NULL)
{
dictEntry *deSnapshot = dictFind(m_spdbSnapshotHOLDER->m_pdict, dictGetKey(de));
if (deSnapshot == nullptr)
if (deSnapshot == nullptr && m_spdbSnapshotHOLDER->m_pdbSnapshot)
{
// The tombstone is for a grand child, propogate it
// The tombstone is for a grand child, propogate it (or possibly in the storage provider - but an extra tombstone won't hurt)
serverAssert(m_spdbSnapshotHOLDER->m_pdbSnapshot->find_cached_threadsafe((const char*)dictGetKey(de)) != nullptr);
dictAdd(m_spdbSnapshotHOLDER->m_pdictTombstone, sdsdupshared((sds)dictGetKey(de)), nullptr);
continue;
}
else if (deSnapshot == nullptr)
{
serverAssert(m_spdbSnapshotHOLDER->m_spstorage != nullptr); // the only case where we can have a tombstone without a snapshot child is if a storage engine is set
continue;
}
const char *key = (const char*)dictGetKey(deSnapshot);
dictDelete(m_spdbSnapshotHOLDER->m_pdict, key);