summaryrefslogtreecommitdiff
path: root/src/t_string.c
diff options
context:
space:
mode:
authorzhaozhao.zz <zhaozhao.zz@alibaba-inc.com>2019-12-18 15:44:51 +0800
committerzhaozhao.zz <zhaozhao.zz@alibaba-inc.com>2019-12-18 15:44:51 +0800
commit58554396d6d49b2c80fcf61ce5c2ccfdc550c7c2 (patch)
tree459b7f0c657a88fabdbc644f64e42f0a553815a3 /src/t_string.c
parent24044f33560e9c34e73d8ffc493ed7c0b6b95dbc (diff)
downloadredis-58554396d6d49b2c80fcf61ce5c2ccfdc550c7c2.tar.gz
incrbyfloat: fix issue #5256 ttl lost after propagate
Diffstat (limited to 'src/t_string.c')
-rw-r--r--src/t_string.c11
1 files changed, 7 insertions, 4 deletions
diff --git a/src/t_string.c b/src/t_string.c
index a4c4a12cc..4ceb02fe3 100644
--- a/src/t_string.c
+++ b/src/t_string.c
@@ -405,7 +405,7 @@ void decrbyCommand(client *c) {
void incrbyfloatCommand(client *c) {
long double incr, value;
- robj *o, *new, *aux;
+ robj *o, *new, *aux1, *aux2;
o = lookupKeyWrite(c->db,c->argv[1]);
if (o != NULL && checkType(c,o,OBJ_STRING)) return;
@@ -431,10 +431,13 @@ void incrbyfloatCommand(client *c) {
/* Always replicate INCRBYFLOAT as a SET command with the final value
* in order to make sure that differences in float precision or formatting
* will not create differences in replicas or after an AOF restart. */
- aux = createStringObject("SET",3);
- rewriteClientCommandArgument(c,0,aux);
- decrRefCount(aux);
+ aux1 = createStringObject("SET",3);
+ rewriteClientCommandArgument(c,0,aux1);
+ decrRefCount(aux1);
rewriteClientCommandArgument(c,2,new);
+ aux2 = createStringObject("KEEPTTL",7);
+ rewriteClientCommandArgument(c,3,aux2);
+ decrRefCount(aux2);
}
void appendCommand(client *c) {