From 68d751046ee510f3c90eb1ab49d925fba8d6878a Mon Sep 17 00:00:00 2001 From: John Sully Date: Sat, 23 Sep 2023 19:46:35 +0000 Subject: [PATCH] async rehash is preventing rehashing during RDB load after a db flush. Ensure it can't interefere after a flush --- src/db.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/db.cpp b/src/db.cpp index 67e0926e7..75a543f01 100644 --- a/src/db.cpp +++ b/src/db.cpp @@ -2740,6 +2740,13 @@ void redisDbPersistentData::clear(void(callback)(void*)) if (m_spstorage != nullptr) m_spstorage->clear(callback); dictEmpty(m_pdictTombstone,callback); + + // To avoid issues with async rehash we completly free the old dict and create a fresh one + dictRelease(m_pdict); + dictRelease(m_pdictTombstone); + m_pdict = dictCreate(&dbDictType, this); + m_pdictTombstone = dictCreate(&dbTombstoneDictType, this); + m_pdbSnapshot = nullptr; m_numexpires = 0; }