Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
redis
Commits
5d0774d6
Commit
5d0774d6
authored
Jun 03, 2020
by
zhaozhao.zz
Browse files
AOF: append origin SET if no expire option
parent
52e56bf7
Changes
2
Hide whitespace changes
Inline
Side-by-side
src/aof.c
View file @
5d0774d6
...
@@ -611,19 +611,24 @@ void feedAppendOnlyFile(struct redisCommand *cmd, int dictid, robj **argv, int a
...
@@ -611,19 +611,24 @@ void feedAppendOnlyFile(struct redisCommand *cmd, int dictid, robj **argv, int a
}
else
if
(
cmd
->
proc
==
setCommand
&&
argc
>
3
)
{
}
else
if
(
cmd
->
proc
==
setCommand
&&
argc
>
3
)
{
int
i
;
int
i
;
robj
*
exarg
=
NULL
,
*
pxarg
=
NULL
;
robj
*
exarg
=
NULL
,
*
pxarg
=
NULL
;
/* Translate SET [EX seconds][PX milliseconds] to SET and PEXPIREAT */
buf
=
catAppendOnlyGenericCommand
(
buf
,
3
,
argv
);
for
(
i
=
3
;
i
<
argc
;
i
++
)
{
for
(
i
=
3
;
i
<
argc
;
i
++
)
{
if
(
!
strcasecmp
(
argv
[
i
]
->
ptr
,
"ex"
))
exarg
=
argv
[
i
+
1
];
if
(
!
strcasecmp
(
argv
[
i
]
->
ptr
,
"ex"
))
exarg
=
argv
[
i
+
1
];
if
(
!
strcasecmp
(
argv
[
i
]
->
ptr
,
"px"
))
pxarg
=
argv
[
i
+
1
];
if
(
!
strcasecmp
(
argv
[
i
]
->
ptr
,
"px"
))
pxarg
=
argv
[
i
+
1
];
}
}
serverAssert
(
!
(
exarg
&&
pxarg
));
serverAssert
(
!
(
exarg
&&
pxarg
));
if
(
exarg
)
buf
=
catAppendOnlyExpireAtCommand
(
buf
,
server
.
expireCommand
,
argv
[
1
],
if
(
exarg
||
pxarg
)
{
exarg
);
/* Translate SET [EX seconds][PX milliseconds] to SET and PEXPIREAT */
if
(
pxarg
)
buf
=
catAppendOnlyGenericCommand
(
buf
,
3
,
argv
);
buf
=
catAppendOnlyExpireAtCommand
(
buf
,
server
.
pexpireCommand
,
argv
[
1
],
if
(
exarg
)
pxarg
);
buf
=
catAppendOnlyExpireAtCommand
(
buf
,
server
.
expireCommand
,
argv
[
1
],
exarg
);
if
(
pxarg
)
buf
=
catAppendOnlyExpireAtCommand
(
buf
,
server
.
pexpireCommand
,
argv
[
1
],
pxarg
);
}
else
{
buf
=
catAppendOnlyGenericCommand
(
buf
,
argc
,
argv
);
}
}
else
{
}
else
{
/* All the other commands don't need translation or need the
/* All the other commands don't need translation or need the
* same translation already operated in the command vector
* same translation already operated in the command vector
...
...
tests/unit/expire.tcl
View file @
5d0774d6
...
@@ -232,4 +232,14 @@ start_server {tags {"expire"}} {
...
@@ -232,4 +232,14 @@ start_server {tags {"expire"}} {
set ttl
[
r ttl foo
]
set ttl
[
r ttl foo
]
assert
{
$ttl
<= 100 && $ttl > 90
}
assert
{
$ttl
<= 100 && $ttl > 90
}
}
}
test
{
SET - use KEEPTTL option, TTL should not be removed after loadaof
}
{
r config set appendonly yes
r set foo bar EX 100
r set foo bar2 KEEPTTL
after 2000
r debug loadaof
set ttl
[
r ttl foo
]
assert
{
$ttl
<= 98 && $ttl > 90
}
}
}
}
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