From c83c55f1814cd3714d952d981329bfa805c02fa1 Mon Sep 17 00:00:00 2001 From: John Sully Date: Fri, 8 Mar 2024 08:12:22 +0000 Subject: [PATCH] Fix expire tracking assert failure --- src/db.cpp | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/db.cpp b/src/db.cpp index 5a87a4230..bf5b40d68 100644 --- a/src/db.cpp +++ b/src/db.cpp @@ -2884,6 +2884,7 @@ void redisDbPersistentData::ensure(const char *sdsKey, dictEntry **pde) o->SetFExpires(spexpire != nullptr); if (spexpire != nullptr) { o->expire = std::move(*spexpire); + ++m_numexpires; } g_pserver->stat_storage_provider_read_hits++; } else { @@ -3124,8 +3125,15 @@ bool redisDbPersistentData::removeCachedValue(const char *key, dictEntry **ppde) // since we write ASAP the database already has a valid copy so safe to delete if (ppde != nullptr) { + robj *o = (robj*)dictGetVal(*ppde); + if (o->FExpires()) + --m_numexpires; *ppde = dictUnlink(m_pdict, key); } else { + dictEntry *deT = dictFind(m_pdict, key); + robj *o = (robj*)dictGetVal(deT); + if (o->FExpires()) + --m_numexpires; dictDelete(m_pdict, key); } @@ -3172,6 +3180,7 @@ void redisDbPersistentData::removeAllCachedValues() } else { dictEmpty(m_pdict, nullptr); } + m_numexpires = 0; } void redisDbPersistentData::disableKeyCache()