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.
This commit is contained in:
Chen Tianjie 2023-12-28 19:29:27 +08:00 committed by GitHub
parent 2c5b51ad26
commit 9d0158bf89
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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) {