Skip to content

Commit

Permalink
Fix expire tracking assert failure
Browse files Browse the repository at this point in the history
  • Loading branch information
JohnSully committed Mar 8, 2024
1 parent fe5503a commit c83c55f
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/db.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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);
}

Expand Down Expand Up @@ -3172,6 +3180,7 @@ void redisDbPersistentData::removeAllCachedValues()
} else {
dictEmpty(m_pdict, nullptr);
}
m_numexpires = 0;
}

void redisDbPersistentData::disableKeyCache()
Expand Down

0 comments on commit c83c55f

Please sign in to comment.