I find that it is not so easy to fix this bug, so I have 3 suggestions here. We can have a discussion here:

a. Just rewrite the whole INCRBYFLOAT cmd as SETEX key value expiretime and change cmd->proc to SETEX, but I don't think this is an elegent solution; b. Add a new cmd named UPDATE or sth else which just updates the value and DO NOT remove the expire time. Then INCRBYFLOAT can be rewritten as this cmd. As I known, lots of users need a cmd like UPDATE because they just wanna set value and leave the expire time alone; c. Like the privious one, we can also extend SET to SETUX or anything else only to update the value.

Comment From: soloestoy

Nice catch @wormhole1026 .

It's a serious problem which can lead to inconsistency between master/slave and AOF.

I prefer b & c, a new command or option which only update value is a good idea and useful.

Please have a look at it after your vacation @antirez .

Comment From: enjoy-binbin

fixed in #6679