From 9d0158bf89265daa96e1711478102147117f6b14 Mon Sep 17 00:00:00 2001 From: Chen Tianjie Date: Thu, 28 Dec 2023 19:29:27 +0800 Subject: [PATCH] Reorder signalModifiedKey in xaddCommand. (#12895) This PR is a supplement to #11144, moving `signalModifiedKey` in `xaddCommand` after the trimming, to ensure the state of key eventual consistency. Currently there is no problem with Redis, but it is better to avoid issues in future development on Redis. --- src/t_stream.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/t_stream.c b/src/t_stream.c index 733ccfc8c..dda3dab2c 100644 --- a/src/t_stream.c +++ b/src/t_stream.c @@ -2052,7 +2052,6 @@ void xaddCommand(client *c) { sds replyid = createStreamIDString(&id); addReplyBulkCBuffer(c, replyid, sdslen(replyid)); - signalModifiedKey(c,c->db,c->argv[1]); notifyKeyspaceEvent(NOTIFY_STREAM,"xadd",c->argv[1],c->db->id); server.dirty++; @@ -2072,6 +2071,8 @@ void xaddCommand(client *c) { } } + signalModifiedKey(c,c->db,c->argv[1]); + /* Let's rewrite the ID argument with the one actually generated for * AOF/replication propagation. */ if (!parsed_args.id_given || !parsed_args.seq_given) {