Extra expire validation on save
Former-commit-id: 037290cd2ec1b237df5236a86915d63d53fb48ce
This commit is contained in:
parent
0b24112fe2
commit
7cc892284f
@ -1121,6 +1121,7 @@ int saveKey(rio *rdb, const redisDbPersistentDataSnapshot *db, int flags, size_t
|
|||||||
|
|
||||||
initStaticStringObject(key,(char*)keystr);
|
initStaticStringObject(key,(char*)keystr);
|
||||||
const expireEntry *pexpire = db->getExpire(&key);
|
const expireEntry *pexpire = db->getExpire(&key);
|
||||||
|
serverAssert(!o->FExpires() || pexpire != nullptr);
|
||||||
|
|
||||||
if (rdbSaveKeyValuePair(rdb,&key,o,pexpire) == -1)
|
if (rdbSaveKeyValuePair(rdb,&key,o,pexpire) == -1)
|
||||||
return 0;
|
return 0;
|
||||||
@ -1182,8 +1183,11 @@ int rdbSaveRio(rio *rdb, const redisDbPersistentDataSnapshot **rgpdb, int *error
|
|||||||
/* Iterate this DB writing every entry */
|
/* Iterate this DB writing every entry */
|
||||||
size_t ckeysExpired = 0;
|
size_t ckeysExpired = 0;
|
||||||
bool fSavedAll = db->iterate_threadsafe([&](const char *keystr, robj_roptr o)->bool {
|
bool fSavedAll = db->iterate_threadsafe([&](const char *keystr, robj_roptr o)->bool {
|
||||||
if (o->FExpires())
|
if (o->FExpires()) {
|
||||||
++ckeysExpired;
|
++ckeysExpired;
|
||||||
|
} else {
|
||||||
|
serverAssert(db->getExpire(keystr) == nullptr);
|
||||||
|
}
|
||||||
|
|
||||||
if (!saveKey(rdb, db, flags, &processed, keystr, o))
|
if (!saveKey(rdb, db, flags, &processed, keystr, o))
|
||||||
return false;
|
return false;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user