From 650fa335eb59828a87ab1c10b64ff17a5ede55d4 Mon Sep 17 00:00:00 2001 From: John Sully Date: Sun, 14 Mar 2021 03:19:04 +0000 Subject: [PATCH] Remove rarely used bug-prone code paths from tricky snapshot code Former-commit-id: dff84228afb97962d77caefe948154090dd5ce23 --- src/snapshot.cpp | 28 ---------------------------- 1 file changed, 28 deletions(-) diff --git a/src/snapshot.cpp b/src/snapshot.cpp index 5d479fb7f..74099039b 100644 --- a/src/snapshot.cpp +++ b/src/snapshot.cpp @@ -56,34 +56,6 @@ const redisDbPersistentDataSnapshot *redisDbPersistentData::createSnapshot(uint6 } } - if (m_pdbSnapshot != nullptr && m_pdbSnapshot == m_pdbSnapshotASYNC && m_spdbSnapshotHOLDER->m_refCount == 1 && dictSize(m_pdictTombstone) < c_elementsSmallLimit) - { - serverLog(LL_WARNING, "Reusing old snapshot"); - // is there an existing snapshot only owned by us? - - dictIterator *di = dictGetIterator(m_pdictTombstone); - dictEntry *de; - while ((de = dictNext(di)) != nullptr) - { - if (dictDelete(m_pdbSnapshot->m_pdict, dictGetKey(de)) != DICT_OK) - dictAdd(m_spdbSnapshotHOLDER->m_pdictTombstone, sdsdupshared((sds)dictGetKey(de)), nullptr); - } - dictReleaseIterator(di); - - dictForceRehash(m_spdbSnapshotHOLDER->m_pdictTombstone); - dictMerge(m_pdbSnapshot->m_pdict, m_pdict); - dictEmpty(m_pdictTombstone, nullptr); - { - std::unique_lock ul(g_expireLock); - (*m_spdbSnapshotHOLDER->m_setexpire) = *m_setexpire; - } - - m_pdbSnapshotASYNC = nullptr; - serverAssert(m_pdbSnapshot->m_pdict->iterators == 1); - serverAssert(m_spdbSnapshotHOLDER->m_refCount == 1); - return m_pdbSnapshot; - } - // See if we have too many levels and can bail out of this to reduce load if (fOptional && (levels >= 6)) {