Fix crash when overwriting key stored in FLASH but not in ram during a BGSAVE while clustering is enabled

Former-commit-id: 32967b1d671b151bed976e3d13ce26c7e1496c82
This commit is contained in:
John Sully 2020-06-02 23:59:24 -04:00
parent f0849df48c
commit 589448bdf0

View File

@ -2335,7 +2335,7 @@ void redisDbPersistentData::ensure(const char *sdsKey, dictEntry **pde)
{ {
auto itr = m_pdbSnapshot->find_cached_threadsafe(sdsKey); auto itr = m_pdbSnapshot->find_cached_threadsafe(sdsKey);
if (itr == m_pdbSnapshot->end()) if (itr == m_pdbSnapshot->end())
return; // not found goto LNotFound;
sds keyNew = sdsdupshared(itr.key()); // note: we use the iterator's key because the sdsKey may not be a shared string sds keyNew = sdsdupshared(itr.key()); // note: we use the iterator's key because the sdsKey may not be a shared string
if (itr.val() != nullptr) if (itr.val() != nullptr)
@ -2363,6 +2363,7 @@ void redisDbPersistentData::ensure(const char *sdsKey, dictEntry **pde)
} }
} }
LNotFound:
// If we haven't found it yet check our storage engine // If we haven't found it yet check our storage engine
if (*pde == nullptr && m_spstorage != nullptr) if (*pde == nullptr && m_spstorage != nullptr)
{ {