mirror of
https://github.com/fluencelabs/redis
synced 2025-03-19 09:00:51 +00:00
Fix PERSIST expired key resuscitation issue #4048.
This commit is contained in:
parent
e91b81c612
commit
5877c02c51
2
src/db.c
2
src/db.c
@ -93,7 +93,7 @@ robj *lookupKeyReadWithFlags(redisDb *db, robj *key, int flags) {
|
|||||||
|
|
||||||
if (expireIfNeeded(db,key) == 1) {
|
if (expireIfNeeded(db,key) == 1) {
|
||||||
/* Key expired. If we are in the context of a master, expireIfNeeded()
|
/* Key expired. If we are in the context of a master, expireIfNeeded()
|
||||||
* returns 0 only when the key does not exist at all, so it's save
|
* returns 0 only when the key does not exist at all, so it's safe
|
||||||
* to return NULL ASAP. */
|
* to return NULL ASAP. */
|
||||||
if (server.masterhost == NULL) return NULL;
|
if (server.masterhost == NULL) return NULL;
|
||||||
|
|
||||||
|
@ -477,18 +477,15 @@ void pttlCommand(client *c) {
|
|||||||
|
|
||||||
/* PERSIST key */
|
/* PERSIST key */
|
||||||
void persistCommand(client *c) {
|
void persistCommand(client *c) {
|
||||||
dictEntry *de;
|
if (lookupKeyWrite(c->db,c->argv[1])) {
|
||||||
|
|
||||||
de = dictFind(c->db->dict,c->argv[1]->ptr);
|
|
||||||
if (de == NULL) {
|
|
||||||
addReply(c,shared.czero);
|
|
||||||
} else {
|
|
||||||
if (removeExpire(c->db,c->argv[1])) {
|
if (removeExpire(c->db,c->argv[1])) {
|
||||||
addReply(c,shared.cone);
|
addReply(c,shared.cone);
|
||||||
server.dirty++;
|
server.dirty++;
|
||||||
} else {
|
} else {
|
||||||
addReply(c,shared.czero);
|
addReply(c,shared.czero);
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
addReply(c,shared.czero);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user