Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
e3641c8d
Commit
e3641c8d
authored
Jun 13, 2017
by
antirez
Browse files
Fix PERSIST expired key resuscitation issue #4048.
parent
9ce105ad
Changes
1
Show whitespace changes
Inline
Side-by-side
src/db.c
View file @
e3641c8d
...
@@ -90,7 +90,7 @@ robj *lookupKeyReadWithFlags(redisDb *db, robj *key, int flags) {
...
@@ -90,7 +90,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 sa
v
e
* returns 0 only when the key does not exist at all, so it's sa
f
e
* to return NULL ASAP. */
* to return NULL ASAP. */
if
(
server
.
masterhost
==
NULL
)
return
NULL
;
if
(
server
.
masterhost
==
NULL
)
return
NULL
;
...
@@ -1033,18 +1033,15 @@ void pttlCommand(client *c) {
...
@@ -1033,18 +1033,15 @@ void pttlCommand(client *c) {
}
}
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
);
}
}
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment